Deleted Added
full compact
cs4281.c (193640) cs4281.c (254263)
1/*-
2 * Copyright (c) 2000 Orion Hodson <O.Hodson@cs.ucl.ac.uk>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 29 unchanged lines hidden (view full) ---

38#include <dev/sound/pcm/sound.h>
39#include <dev/sound/pcm/ac97.h>
40
41#include <dev/pci/pcireg.h>
42#include <dev/pci/pcivar.h>
43
44#include <dev/sound/pci/cs4281.h>
45
1/*-
2 * Copyright (c) 2000 Orion Hodson <O.Hodson@cs.ucl.ac.uk>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 29 unchanged lines hidden (view full) ---

38#include <dev/sound/pcm/sound.h>
39#include <dev/sound/pcm/ac97.h>
40
41#include <dev/pci/pcireg.h>
42#include <dev/pci/pcivar.h>
43
44#include <dev/sound/pci/cs4281.h>
45
46SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pci/cs4281.c 193640 2009-06-07 19:12:08Z ariff $");
46SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pci/cs4281.c 254263 2013-08-12 23:30:01Z scottl $");
47
48#define CS4281_DEFAULT_BUFSZ 16384
49
50/* Max fifo size for full duplex is 64 */
51#define CS4281_FIFO_SIZE 15
52
53/* DMA Engine Indices */
54#define CS4281_DMA_PLAY 0

--- 700 unchanged lines hidden (view full) ---

755 return s ? BUS_PROBE_DEFAULT : ENXIO;
756}
757
758static int
759cs4281_pci_attach(device_t dev)
760{
761 struct sc_info *sc;
762 struct ac97_info *codec = NULL;
47
48#define CS4281_DEFAULT_BUFSZ 16384
49
50/* Max fifo size for full duplex is 64 */
51#define CS4281_FIFO_SIZE 15
52
53/* DMA Engine Indices */
54#define CS4281_DMA_PLAY 0

--- 700 unchanged lines hidden (view full) ---

755 return s ? BUS_PROBE_DEFAULT : ENXIO;
756}
757
758static int
759cs4281_pci_attach(device_t dev)
760{
761 struct sc_info *sc;
762 struct ac97_info *codec = NULL;
763 u_int32_t data;
764 char status[SND_STATUSLEN];
765
766 sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
767 sc->dev = dev;
768 sc->type = pci_get_devid(dev);
769
763 char status[SND_STATUSLEN];
764
765 sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
766 sc->dev = dev;
767 sc->type = pci_get_devid(dev);
768
770 data = pci_read_config(dev, PCIR_COMMAND, 2);
771 data |= (PCIM_CMD_PORTEN | PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN);
772 pci_write_config(dev, PCIR_COMMAND, data, 2);
769 pci_enable_busmaster(dev);
773
774#if __FreeBSD_version > 500000
775 if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) {
776 /* Reset the power state. */
777 device_printf(dev, "chip is in D%d power mode "
778 "-- setting to D0\n", pci_get_powerstate(dev));
779
780 pci_set_powerstate(dev, PCI_POWERSTATE_D0);

--- 207 unchanged lines hidden ---
770
771#if __FreeBSD_version > 500000
772 if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) {
773 /* Reset the power state. */
774 device_printf(dev, "chip is in D%d power mode "
775 "-- setting to D0\n", pci_get_powerstate(dev));
776
777 pci_set_powerstate(dev, PCI_POWERSTATE_D0);

--- 207 unchanged lines hidden ---