cs4281.c (254263) | cs4281.c (274035) |
---|---|
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 254263 2013-08-12 23:30:01Z scottl $"); | 46SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pci/cs4281.c 274035 2014-11-03 11:11:45Z bapt $"); |
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 --- 708 unchanged lines hidden (view full) --- 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 769 pci_enable_busmaster(dev); 770 | 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 --- 708 unchanged lines hidden (view full) --- 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 769 pci_enable_busmaster(dev); 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); 778 } | 771 if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) { 772 /* Reset the power state. */ 773 device_printf(dev, "chip is in D%d power mode " 774 "-- setting to D0\n", pci_get_powerstate(dev)); 775 776 pci_set_powerstate(dev, PCI_POWERSTATE_D0); 777 } |
779#else 780 data = pci_read_config(dev, CS4281PCI_PMCS_OFFSET, 4); 781 if (data & CS4281PCI_PMCS_PS_MASK) { 782 /* Reset the power state. */ 783 device_printf(dev, "chip is in D%d power mode " 784 "-- setting to D0\n", 785 data & CS4281PCI_PMCS_PS_MASK); 786 pci_write_config(dev, CS4281PCI_PMCS_OFFSET, 787 data & ~CS4281PCI_PMCS_PS_MASK, 4); 788 } 789#endif | |
790 791 sc->regid = PCIR_BAR(0); 792 sc->regtype = SYS_RES_MEMORY; 793 sc->reg = bus_alloc_resource(dev, sc->regtype, &sc->regid, 794 0, ~0, CS4281PCI_BA0_SIZE, RF_ACTIVE); 795 if (!sc->reg) { 796 sc->regtype = SYS_RES_IOPORT; 797 sc->reg = bus_alloc_resource(dev, sc->regtype, &sc->regid, --- 187 unchanged lines hidden --- | 778 779 sc->regid = PCIR_BAR(0); 780 sc->regtype = SYS_RES_MEMORY; 781 sc->reg = bus_alloc_resource(dev, sc->regtype, &sc->regid, 782 0, ~0, CS4281PCI_BA0_SIZE, RF_ACTIVE); 783 if (!sc->reg) { 784 sc->regtype = SYS_RES_IOPORT; 785 sc->reg = bus_alloc_resource(dev, sc->regtype, &sc->regid, --- 187 unchanged lines hidden --- |