als4000.c (254263) | als4000.c (274035) |
---|---|
1/*- 2 * Copyright (c) 2001 Orion Hodson <oho@acm.org> 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 --- 32 unchanged lines hidden (view full) --- 41#include <dev/sound/isa/sb.h> 42#include <dev/sound/pci/als4000.h> 43 44#include <dev/pci/pcireg.h> 45#include <dev/pci/pcivar.h> 46 47#include "mixer_if.h" 48 | 1/*- 2 * Copyright (c) 2001 Orion Hodson <oho@acm.org> 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 --- 32 unchanged lines hidden (view full) --- 41#include <dev/sound/isa/sb.h> 42#include <dev/sound/pci/als4000.h> 43 44#include <dev/pci/pcireg.h> 45#include <dev/pci/pcivar.h> 46 47#include "mixer_if.h" 48 |
49SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pci/als4000.c 254263 2013-08-12 23:30:01Z scottl $"); | 49SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pci/als4000.c 274035 2014-11-03 11:11:45Z bapt $"); |
50 51/* Debugging macro's */ 52#undef DEB 53#ifndef DEB 54#define DEB(x) /* x */ 55#endif /* DEB */ 56 57#define ALS_DEFAULT_BUFSZ 16384 --- 755 unchanged lines hidden (view full) --- 813 sc->dev = dev; 814 815 pci_enable_busmaster(dev); 816 /* 817 * By default the power to the various components on the 818 * ALS4000 is entirely controlled by the pci powerstate. We 819 * could attempt finer grained control by setting GCR6.31. 820 */ | 50 51/* Debugging macro's */ 52#undef DEB 53#ifndef DEB 54#define DEB(x) /* x */ 55#endif /* DEB */ 56 57#define ALS_DEFAULT_BUFSZ 16384 --- 755 unchanged lines hidden (view full) --- 813 sc->dev = dev; 814 815 pci_enable_busmaster(dev); 816 /* 817 * By default the power to the various components on the 818 * ALS4000 is entirely controlled by the pci powerstate. We 819 * could attempt finer grained control by setting GCR6.31. 820 */ |
821#if __FreeBSD_version > 500000 | |
822 if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) { 823 /* Reset the power state. */ 824 device_printf(dev, "chip is in D%d power mode " 825 "-- setting to D0\n", pci_get_powerstate(dev)); 826 pci_set_powerstate(dev, PCI_POWERSTATE_D0); 827 } | 821 if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) { 822 /* Reset the power state. */ 823 device_printf(dev, "chip is in D%d power mode " 824 "-- setting to D0\n", pci_get_powerstate(dev)); 825 pci_set_powerstate(dev, PCI_POWERSTATE_D0); 826 } |
828#else 829 data = pci_read_config(dev, ALS_PCI_POWERREG, 2); 830 if ((data & 0x03) != 0) { 831 device_printf(dev, "chip is in D%d power mode " 832 "-- setting to D0\n", data & 0x03); 833 data &= ~0x03; 834 pci_write_config(dev, ALS_PCI_POWERREG, data, 2); 835 } 836#endif | |
837 838 if (als_resource_grab(dev, sc)) { 839 device_printf(dev, "failed to allocate resources\n"); 840 goto bad_attach; 841 } 842 843 if (als_init(sc)) { 844 device_printf(dev, "failed to initialize hardware\n"); --- 107 unchanged lines hidden --- | 827 828 if (als_resource_grab(dev, sc)) { 829 device_printf(dev, "failed to allocate resources\n"); 830 goto bad_attach; 831 } 832 833 if (als_init(sc)) { 834 device_printf(dev, "failed to initialize hardware\n"); --- 107 unchanged lines hidden --- |