aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/Kconfig12
-rw-r--r--sound/pci/Makefile2
-rw-r--r--sound/pci/ac97/ac97_codec.c5
-rw-r--r--sound/pci/ac97/ac97_id.h1
-rw-r--r--sound/pci/ac97/ac97_patch.c24
-rw-r--r--sound/pci/ac97/ak4531_codec.c2
-rw-r--r--sound/pci/ad1889.c1090
-rw-r--r--sound/pci/ad1889.h189
-rw-r--r--sound/pci/ali5451/ali5451.c27
-rw-r--r--sound/pci/als4000.c1
-rw-r--r--sound/pci/atiixp.c4
-rw-r--r--sound/pci/atiixp_modem.c3
-rw-r--r--sound/pci/au88x0/au88x0.c29
-rw-r--r--sound/pci/azt3328.c3
-rw-r--r--sound/pci/bt87x.c13
-rw-r--r--sound/pci/ca0106/ca0106_main.c7
-rw-r--r--sound/pci/ca0106/ca0106_mixer.c18
-rw-r--r--sound/pci/cmipci.c29
-rw-r--r--sound/pci/cs4281.c14
-rw-r--r--sound/pci/cs46xx/cs46xx.c1
-rw-r--r--sound/pci/cs46xx/cs46xx_lib.c28
-rw-r--r--sound/pci/emu10k1/emu10k1.c1
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c7
-rw-r--r--sound/pci/emu10k1/emu10k1x.c7
-rw-r--r--sound/pci/emu10k1/emufx.c20
-rw-r--r--sound/pci/emu10k1/emupcm.c10
-rw-r--r--sound/pci/emu10k1/p16v.c4
-rw-r--r--sound/pci/ens1370.c10
-rw-r--r--sound/pci/es1938.c10
-rw-r--r--sound/pci/es1968.c26
-rw-r--r--sound/pci/fm801.c3
-rw-r--r--sound/pci/hda/hda_codec.c6
-rw-r--r--sound/pci/hda/hda_codec.h1
-rw-r--r--sound/pci/hda/hda_generic.c4
-rw-r--r--sound/pci/hda/hda_intel.c93
-rw-r--r--sound/pci/hda/hda_proc.c2
-rw-r--r--sound/pci/hda/patch_analog.c6
-rw-r--r--sound/pci/hda/patch_cmedia.c2
-rw-r--r--sound/pci/hda/patch_realtek.c8
-rw-r--r--sound/pci/hda/patch_si3054.c3
-rw-r--r--sound/pci/hda/patch_sigmatel.c4
-rw-r--r--sound/pci/ice1712/aureon.c2
-rw-r--r--sound/pci/ice1712/ice1712.c9
-rw-r--r--sound/pci/ice1712/ice1724.c9
-rw-r--r--sound/pci/ice1712/juli.c2
-rw-r--r--sound/pci/ice1712/phase.c4
-rw-r--r--sound/pci/ice1712/pontis.c2
-rw-r--r--sound/pci/intel8x0.c91
-rw-r--r--sound/pci/intel8x0m.c64
-rw-r--r--sound/pci/korg1212/korg1212.c3
-rw-r--r--sound/pci/maestro3.c32
-rw-r--r--sound/pci/mixart/mixart.c5
-rw-r--r--sound/pci/nm256/nm256.c20
-rw-r--r--sound/pci/rme32.c21
-rw-r--r--sound/pci/rme96.c26
-rw-r--r--sound/pci/rme9652/hdsp.c9
-rw-r--r--sound/pci/rme9652/hdspm.c13
-rw-r--r--sound/pci/rme9652/rme9652.c8
-rw-r--r--sound/pci/sonicvibes.c10
-rw-r--r--sound/pci/trident/trident.c1
-rw-r--r--sound/pci/trident/trident_main.c4
-rw-r--r--sound/pci/via82xx.c14
-rw-r--r--sound/pci/via82xx_modem.c3
-rw-r--r--sound/pci/vx222/vx222.c1
-rw-r--r--sound/pci/ymfpci/ymfpci.c1
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c6
66 files changed, 1595 insertions, 494 deletions
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
index 1e458919cce6..a5d593c66f9f 100644
--- a/sound/pci/Kconfig
+++ b/sound/pci/Kconfig
@@ -316,6 +316,18 @@ config SND_YMFPCI
316 To compile this driver as a module, choose M here: the module 316 To compile this driver as a module, choose M here: the module
317 will be called snd-ymfpci. 317 will be called snd-ymfpci.
318 318
319config SND_AD1889
320 tristate "Analog Devices AD1889"
321 depends on SND
322 select SND_AC97_CODEC
323 help
324 Say Y here to include support for the integrated AC97 sound
325 device found in particular on the Hewlett-Packard [BCJ]-xxx0
326 class PA-RISC workstations, using the AD1819 codec.
327
328 To compile this as a module, choose M here: the module
329 will be called snd-ad1889.
330
319config SND_ALS4000 331config SND_ALS4000
320 tristate "Avance Logic ALS4000" 332 tristate "Avance Logic ALS4000"
321 depends on SND && ISA_DMA_API 333 depends on SND && ISA_DMA_API
diff --git a/sound/pci/Makefile b/sound/pci/Makefile
index b40575c3349a..42fabfcfc2a9 100644
--- a/sound/pci/Makefile
+++ b/sound/pci/Makefile
@@ -3,6 +3,7 @@
3# Copyright (c) 2001 by Jaroslav Kysela <perex@suse.cz> 3# Copyright (c) 2001 by Jaroslav Kysela <perex@suse.cz>
4# 4#
5 5
6snd-ad1889-objs := ad1889.o
6snd-als4000-objs := als4000.o 7snd-als4000-objs := als4000.o
7snd-atiixp-objs := atiixp.o 8snd-atiixp-objs := atiixp.o
8snd-atiixp-modem-objs := atiixp_modem.o 9snd-atiixp-modem-objs := atiixp_modem.o
@@ -25,6 +26,7 @@ snd-via82xx-objs := via82xx.o
25snd-via82xx-modem-objs := via82xx_modem.o 26snd-via82xx-modem-objs := via82xx_modem.o
26 27
27# Toplevel Module Dependency 28# Toplevel Module Dependency
29obj-$(CONFIG_SND_AD1889) += snd-ad1889.o
28obj-$(CONFIG_SND_ALS4000) += snd-als4000.o 30obj-$(CONFIG_SND_ALS4000) += snd-als4000.o
29obj-$(CONFIG_SND_ATIIXP) += snd-atiixp.o 31obj-$(CONFIG_SND_ATIIXP) += snd-atiixp.o
30obj-$(CONFIG_SND_ATIIXP_MODEM) += snd-atiixp-modem.o 32obj-$(CONFIG_SND_ATIIXP_MODEM) += snd-atiixp-modem.o
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index 5501f4440c92..e64cb07a39c2 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -112,6 +112,7 @@ static const ac97_codec_id_t snd_ac97_codec_ids[] = {
112{ 0x414c4723, 0xffffffff, "ALC650F", NULL, NULL }, /* already patched */ 112{ 0x414c4723, 0xffffffff, "ALC650F", NULL, NULL }, /* already patched */
113{ 0x414c4720, 0xfffffff0, "ALC650", patch_alc650, NULL }, 113{ 0x414c4720, 0xfffffff0, "ALC650", patch_alc650, NULL },
114{ 0x414c4760, 0xfffffff0, "ALC655", patch_alc655, NULL }, 114{ 0x414c4760, 0xfffffff0, "ALC655", patch_alc655, NULL },
115{ 0x414c4781, 0xffffffff, "ALC658D", NULL, NULL }, /* already patched */
115{ 0x414c4780, 0xfffffff0, "ALC658", patch_alc655, NULL }, 116{ 0x414c4780, 0xfffffff0, "ALC658", patch_alc655, NULL },
116{ 0x414c4790, 0xfffffff0, "ALC850", patch_alc850, NULL }, 117{ 0x414c4790, 0xfffffff0, "ALC850", patch_alc850, NULL },
117{ 0x414c4730, 0xffffffff, "ALC101", NULL, NULL }, 118{ 0x414c4730, 0xffffffff, "ALC101", NULL, NULL },
@@ -1796,7 +1797,7 @@ int snd_ac97_bus(snd_card_t *card, int num, ac97_bus_ops_t *ops,
1796 1797
1797 snd_assert(card != NULL, return -EINVAL); 1798 snd_assert(card != NULL, return -EINVAL);
1798 snd_assert(rbus != NULL, return -EINVAL); 1799 snd_assert(rbus != NULL, return -EINVAL);
1799 bus = kcalloc(1, sizeof(*bus), GFP_KERNEL); 1800 bus = kzalloc(sizeof(*bus), GFP_KERNEL);
1800 if (bus == NULL) 1801 if (bus == NULL)
1801 return -ENOMEM; 1802 return -ENOMEM;
1802 bus->card = card; 1803 bus->card = card;
@@ -1905,7 +1906,7 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97)
1905 } 1906 }
1906 1907
1907 card = bus->card; 1908 card = bus->card;
1908 ac97 = kcalloc(1, sizeof(*ac97), GFP_KERNEL); 1909 ac97 = kzalloc(sizeof(*ac97), GFP_KERNEL);
1909 if (ac97 == NULL) 1910 if (ac97 == NULL)
1910 return -ENOMEM; 1911 return -ENOMEM;
1911 ac97->private_data = template->private_data; 1912 ac97->private_data = template->private_data;
diff --git a/sound/pci/ac97/ac97_id.h b/sound/pci/ac97/ac97_id.h
index dadf387ad0b8..6d73514dc49e 100644
--- a/sound/pci/ac97/ac97_id.h
+++ b/sound/pci/ac97/ac97_id.h
@@ -52,6 +52,7 @@
52#define AC97_ID_ALC650F 0x414c4723 52#define AC97_ID_ALC650F 0x414c4723
53#define AC97_ID_ALC655 0x414c4760 53#define AC97_ID_ALC655 0x414c4760
54#define AC97_ID_ALC658 0x414c4780 54#define AC97_ID_ALC658 0x414c4780
55#define AC97_ID_ALC658D 0x414c4781
55#define AC97_ID_ALC850 0x414c4790 56#define AC97_ID_ALC850 0x414c4790
56#define AC97_ID_YMF753 0x594d4803 57#define AC97_ID_YMF753 0x594d4803
57#define AC97_ID_VT1616 0x49434551 58#define AC97_ID_VT1616 0x49434551
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index b584172c1104..045ddc743edc 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -2134,7 +2134,13 @@ int patch_alc655(ac97_t * ac97)
2134{ 2134{
2135 unsigned int val; 2135 unsigned int val;
2136 2136
2137 ac97->spec.dev_flags = (ac97->id == 0x414c4780); /* ALC658 */ 2137 if (ac97->id == AC97_ID_ALC658) {
2138 ac97->spec.dev_flags = 1; /* ALC658 */
2139 if ((snd_ac97_read(ac97, AC97_ALC650_REVISION) & 0x3f) == 2) {
2140 ac97->id = AC97_ID_ALC658D;
2141 ac97->spec.dev_flags = 2;
2142 }
2143 }
2138 2144
2139 ac97->build_ops = &patch_alc655_ops; 2145 ac97->build_ops = &patch_alc655_ops;
2140 2146
@@ -2143,10 +2149,15 @@ int patch_alc655(ac97_t * ac97)
2143 2149
2144 /* adjust default values */ 2150 /* adjust default values */
2145 val = snd_ac97_read(ac97, 0x7a); /* misc control */ 2151 val = snd_ac97_read(ac97, 0x7a); /* misc control */
2146 if (ac97->id == 0x414c4780) /* ALC658 */ 2152 if (ac97->spec.dev_flags) /* ALC658 */
2147 val &= ~(1 << 1); /* Pin 47 is spdif input pin */ 2153 val &= ~(1 << 1); /* Pin 47 is spdif input pin */
2148 else /* ALC655 */ 2154 else { /* ALC655 */
2149 val |= (1 << 1); /* Pin 47 is spdif input pin */ 2155 if (ac97->subsystem_vendor == 0x1462 &&
2156 ac97->subsystem_device == 0x0131) /* MSI S270 laptop */
2157 val &= ~(1 << 1); /* Pin 47 is EAPD (for internal speaker) */
2158 else
2159 val |= (1 << 1); /* Pin 47 is spdif input pin */
2160 }
2150 val &= ~(1 << 12); /* vref enable */ 2161 val &= ~(1 << 12); /* vref enable */
2151 snd_ac97_write_cache(ac97, 0x7a, val); 2162 snd_ac97_write_cache(ac97, 0x7a, val);
2152 /* set default: spdif-in enabled, 2163 /* set default: spdif-in enabled,
@@ -2159,6 +2170,11 @@ int patch_alc655(ac97_t * ac97)
2159 /* full DAC volume */ 2170 /* full DAC volume */
2160 snd_ac97_write_cache(ac97, AC97_ALC650_SURR_DAC_VOL, 0x0808); 2171 snd_ac97_write_cache(ac97, AC97_ALC650_SURR_DAC_VOL, 0x0808);
2161 snd_ac97_write_cache(ac97, AC97_ALC650_LFE_DAC_VOL, 0x0808); 2172 snd_ac97_write_cache(ac97, AC97_ALC650_LFE_DAC_VOL, 0x0808);
2173
2174 /* update undocumented bit... */
2175 if (ac97->id == AC97_ID_ALC658D)
2176 snd_ac97_update_bits(ac97, 0x74, 0x0800, 0x0800);
2177
2162 return 0; 2178 return 0;
2163} 2179}
2164 2180
diff --git a/sound/pci/ac97/ak4531_codec.c b/sound/pci/ac97/ak4531_codec.c
index f9ce0fd2f52f..4032c5748370 100644
--- a/sound/pci/ac97/ak4531_codec.c
+++ b/sound/pci/ac97/ak4531_codec.c
@@ -357,7 +357,7 @@ int snd_ak4531_mixer(snd_card_t * card, ak4531_t * _ak4531, ak4531_t ** rak4531)
357 snd_assert(rak4531 != NULL, return -EINVAL); 357 snd_assert(rak4531 != NULL, return -EINVAL);
358 *rak4531 = NULL; 358 *rak4531 = NULL;
359 snd_assert(card != NULL && _ak4531 != NULL, return -EINVAL); 359 snd_assert(card != NULL && _ak4531 != NULL, return -EINVAL);
360 ak4531 = kcalloc(1, sizeof(*ak4531), GFP_KERNEL); 360 ak4531 = kzalloc(sizeof(*ak4531), GFP_KERNEL);
361 if (ak4531 == NULL) 361 if (ak4531 == NULL)
362 return -ENOMEM; 362 return -ENOMEM;
363 *ak4531 = *_ak4531; 363 *ak4531 = *_ak4531;
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c
new file mode 100644
index 000000000000..d7d99a25c5e5
--- /dev/null
+++ b/sound/pci/ad1889.c
@@ -0,0 +1,1090 @@
1/* Analog Devices 1889 audio driver
2 *
3 * This is a driver for the AD1889 PCI audio chipset found
4 * on the HP PA-RISC [BCJ]-xxx0 workstations.
5 *
6 * Copyright (C) 2004-2005, Kyle McMartin <kyle@parisc-linux.org>
7 * Copyright (C) 2005, Thibaut Varene <varenet@parisc-linux.org>
8 * Based on the OSS AD1889 driver by Randolph Chung <tausq@debian.org>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License, version 2, as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 *
23 * TODO:
24 * Do we need to take care of CCS register?
25 * Maybe we could use finer grained locking (separate locks for pb/cap)?
26 * Wishlist:
27 * Control Interface (mixer) support
28 * Better AC97 support (VSR...)?
29 * PM support
30 * MIDI support
31 * Game Port support
32 * SG DMA support (this will need *alot* of work)
33 */
34
35#include <linux/init.h>
36#include <linux/pci.h>
37#include <linux/slab.h>
38#include <linux/interrupt.h>
39#include <linux/compiler.h>
40#include <linux/delay.h>
41
42#include <sound/driver.h>
43#include <sound/core.h>
44#include <sound/pcm.h>
45#include <sound/initval.h>
46#include <sound/ac97_codec.h>
47
48#include <asm/io.h>
49
50#include "ad1889.h"
51#include "ac97/ac97_id.h"
52
53#define AD1889_DRVVER "$Revision: 1.3 $"
54
55MODULE_AUTHOR("Kyle McMartin <kyle@parisc-linux.org>, Thibaut Varene <t-bone@parisc-linux.org>");
56MODULE_DESCRIPTION("Analog Devices AD1889 ALSA sound driver");
57MODULE_LICENSE("GPL");
58MODULE_SUPPORTED_DEVICE("{{Analog Devices,AD1889}}");
59
60static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
61module_param_array(index, int, NULL, 0444);
62MODULE_PARM_DESC(index, "Index value for the AD1889 soundcard.");
63
64static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
65module_param_array(id, charp, NULL, 0444);
66MODULE_PARM_DESC(id, "ID string for the AD1889 soundcard.");
67
68static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
69module_param_array(enable, bool, NULL, 0444);
70MODULE_PARM_DESC(enable, "Enable AD1889 soundcard.");
71
72static char *ac97_quirk[SNDRV_CARDS];
73module_param_array(ac97_quirk, charp, NULL, 0444);
74MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware.");
75
76#define DEVNAME "ad1889"
77#define PFX DEVNAME ": "
78
79/* let's use the global sound debug interfaces */
80#define ad1889_debug(fmt, arg...) snd_printd(KERN_DEBUG fmt, ## arg)
81
82/* keep track of some hw registers */
83struct ad1889_register_state {
84 u16 reg; /* reg setup */
85 u32 addr; /* dma base address */
86 unsigned long size; /* DMA buffer size */
87};
88
89struct snd_ad1889 {
90 snd_card_t *card;
91 struct pci_dev *pci;
92
93 int irq;
94 unsigned long bar;
95 void __iomem *iobase;
96
97 ac97_t *ac97;
98 ac97_bus_t *ac97_bus;
99 snd_pcm_t *pcm;
100 snd_info_entry_t *proc;
101
102 snd_pcm_substream_t *psubs;
103 snd_pcm_substream_t *csubs;
104
105 /* playback register state */
106 struct ad1889_register_state wave;
107 struct ad1889_register_state ramc;
108
109 spinlock_t lock;
110};
111
112static inline u16
113ad1889_readw(struct snd_ad1889 *chip, unsigned reg)
114{
115 return readw(chip->iobase + reg);
116}
117
118static inline void
119ad1889_writew(struct snd_ad1889 *chip, unsigned reg, u16 val)
120{
121 writew(val, chip->iobase + reg);
122}
123
124static inline u32
125ad1889_readl(struct snd_ad1889 *chip, unsigned reg)
126{
127 return readl(chip->iobase + reg);
128}
129
130static inline void
131ad1889_writel(struct snd_ad1889 *chip, unsigned reg, u32 val)
132{
133 writel(val, chip->iobase + reg);
134}
135
136static inline void
137ad1889_unmute(struct snd_ad1889 *chip)
138{
139 u16 st;
140 st = ad1889_readw(chip, AD_DS_WADA) &
141 ~(AD_DS_WADA_RWAM | AD_DS_WADA_LWAM);
142 ad1889_writew(chip, AD_DS_WADA, st);
143 ad1889_readw(chip, AD_DS_WADA);
144}
145
146static inline void
147ad1889_mute(struct snd_ad1889 *chip)
148{
149 u16 st;
150 st = ad1889_readw(chip, AD_DS_WADA) | AD_DS_WADA_RWAM | AD_DS_WADA_LWAM;
151 ad1889_writew(chip, AD_DS_WADA, st);
152 ad1889_readw(chip, AD_DS_WADA);
153}
154
155static inline void
156ad1889_load_adc_buffer_address(struct snd_ad1889 *chip, u32 address)
157{
158 ad1889_writel(chip, AD_DMA_ADCBA, address);
159 ad1889_writel(chip, AD_DMA_ADCCA, address);
160}
161
162static inline void
163ad1889_load_adc_buffer_count(struct snd_ad1889 *chip, u32 count)
164{
165 ad1889_writel(chip, AD_DMA_ADCBC, count);
166 ad1889_writel(chip, AD_DMA_ADCCC, count);
167}
168
169static inline void
170ad1889_load_adc_interrupt_count(struct snd_ad1889 *chip, u32 count)
171{
172 ad1889_writel(chip, AD_DMA_ADCIB, count);
173 ad1889_writel(chip, AD_DMA_ADCIC, count);
174}
175
176static inline void
177ad1889_load_wave_buffer_address(struct snd_ad1889 *chip, u32 address)
178{
179 ad1889_writel(chip, AD_DMA_WAVBA, address);
180 ad1889_writel(chip, AD_DMA_WAVCA, address);
181}
182
183static inline void
184ad1889_load_wave_buffer_count(struct snd_ad1889 *chip, u32 count)
185{
186 ad1889_writel(chip, AD_DMA_WAVBC, count);
187 ad1889_writel(chip, AD_DMA_WAVCC, count);
188}
189
190static inline void
191ad1889_load_wave_interrupt_count(struct snd_ad1889 *chip, u32 count)
192{
193 ad1889_writel(chip, AD_DMA_WAVIB, count);
194 ad1889_writel(chip, AD_DMA_WAVIC, count);
195}
196
197static void
198ad1889_channel_reset(struct snd_ad1889 *chip, unsigned int channel)
199{
200 u16 reg;
201
202 if (channel & AD_CHAN_WAV) {
203 /* Disable wave channel */
204 reg = ad1889_readw(chip, AD_DS_WSMC) & ~AD_DS_WSMC_WAEN;
205 ad1889_writew(chip, AD_DS_WSMC, reg);
206 chip->wave.reg = reg;
207
208 /* disable IRQs */
209 reg = ad1889_readw(chip, AD_DMA_WAV);
210 reg &= AD_DMA_IM_DIS;
211 reg &= ~AD_DMA_LOOP;
212 ad1889_writew(chip, AD_DMA_WAV, reg);
213
214 /* clear IRQ and address counters and pointers */
215 ad1889_load_wave_buffer_address(chip, 0x0);
216 ad1889_load_wave_buffer_count(chip, 0x0);
217 ad1889_load_wave_interrupt_count(chip, 0x0);
218
219 /* flush */
220 ad1889_readw(chip, AD_DMA_WAV);
221 }
222
223 if (channel & AD_CHAN_ADC) {
224 /* Disable ADC channel */
225 reg = ad1889_readw(chip, AD_DS_RAMC) & ~AD_DS_RAMC_ADEN;
226 ad1889_writew(chip, AD_DS_RAMC, reg);
227 chip->ramc.reg = reg;
228
229 reg = ad1889_readw(chip, AD_DMA_ADC);
230 reg &= AD_DMA_IM_DIS;
231 reg &= ~AD_DMA_LOOP;
232 ad1889_writew(chip, AD_DMA_ADC, reg);
233
234 ad1889_load_adc_buffer_address(chip, 0x0);
235 ad1889_load_adc_buffer_count(chip, 0x0);
236 ad1889_load_adc_interrupt_count(chip, 0x0);
237
238 /* flush */
239 ad1889_readw(chip, AD_DMA_ADC);
240 }
241}
242
243static inline u16
244snd_ad1889_ac97_read(ac97_t *ac97, unsigned short reg)
245{
246 struct snd_ad1889 *chip = ac97->private_data;
247 return ad1889_readw(chip, AD_AC97_BASE + reg);
248}
249
250static inline void
251snd_ad1889_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val)
252{
253 struct snd_ad1889 *chip = ac97->private_data;
254 ad1889_writew(chip, AD_AC97_BASE + reg, val);
255}
256
257static int
258snd_ad1889_ac97_ready(struct snd_ad1889 *chip)
259{
260 int retry = 400; /* average needs 352 msec */
261
262 while (!(ad1889_readw(chip, AD_AC97_ACIC) & AD_AC97_ACIC_ACRDY)
263 && --retry)
264 mdelay(1);
265 if (!retry) {
266 snd_printk(KERN_ERR PFX "[%s] Link is not ready.\n",
267 __FUNCTION__);
268 return -EIO;
269 }
270 ad1889_debug("[%s] ready after %d ms\n", __FUNCTION__, 400 - retry);
271
272 return 0;
273}
274
275static int
276snd_ad1889_hw_params(snd_pcm_substream_t *substream,
277 snd_pcm_hw_params_t *hw_params)
278{
279 return snd_pcm_lib_malloc_pages(substream,
280 params_buffer_bytes(hw_params));
281}
282
283static int
284snd_ad1889_hw_free(snd_pcm_substream_t *substream)
285{
286 return snd_pcm_lib_free_pages(substream);
287}
288
289static snd_pcm_hardware_t snd_ad1889_playback_hw = {
290 .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
291 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_BLOCK_TRANSFER,
292 .formats = SNDRV_PCM_FMTBIT_S16_LE,
293 .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
294 .rate_min = 8000, /* docs say 7000, but we're lazy */
295 .rate_max = 48000,
296 .channels_min = 1,
297 .channels_max = 2,
298 .buffer_bytes_max = BUFFER_BYTES_MAX,
299 .period_bytes_min = PERIOD_BYTES_MIN,
300 .period_bytes_max = PERIOD_BYTES_MAX,
301 .periods_min = PERIODS_MIN,
302 .periods_max = PERIODS_MAX,
303 /*.fifo_size = 0,*/
304};
305
306static snd_pcm_hardware_t snd_ad1889_capture_hw = {
307 .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
308 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_BLOCK_TRANSFER,
309 .formats = SNDRV_PCM_FMTBIT_S16_LE,
310 .rates = SNDRV_PCM_RATE_48000,
311 .rate_min = 48000, /* docs say we could to VSR, but we're lazy */
312 .rate_max = 48000,
313 .channels_min = 1,
314 .channels_max = 2,
315 .buffer_bytes_max = BUFFER_BYTES_MAX,
316 .period_bytes_min = PERIOD_BYTES_MIN,
317 .period_bytes_max = PERIOD_BYTES_MAX,
318 .periods_min = PERIODS_MIN,
319 .periods_max = PERIODS_MAX,
320 /*.fifo_size = 0,*/
321};
322
323static int
324snd_ad1889_playback_open(snd_pcm_substream_t *ss)
325{
326 struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
327 snd_pcm_runtime_t *rt = ss->runtime;
328
329 chip->psubs = ss;
330 rt->hw = snd_ad1889_playback_hw;
331
332 return 0;
333}
334
335static int
336snd_ad1889_capture_open(snd_pcm_substream_t *ss)
337{
338 struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
339 snd_pcm_runtime_t *rt = ss->runtime;
340
341 chip->csubs = ss;
342 rt->hw = snd_ad1889_capture_hw;
343
344 return 0;
345}
346
347static int
348snd_ad1889_playback_close(snd_pcm_substream_t *ss)
349{
350 struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
351 chip->psubs = NULL;
352 return 0;
353}
354
355static int
356snd_ad1889_capture_close(snd_pcm_substream_t *ss)
357{
358 struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
359 chip->csubs = NULL;
360 return 0;
361}
362
363static int
364snd_ad1889_playback_prepare(snd_pcm_substream_t *ss)
365{
366 struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
367 snd_pcm_runtime_t *rt = ss->runtime;
368 unsigned int size = snd_pcm_lib_buffer_bytes(ss);
369 unsigned int count = snd_pcm_lib_period_bytes(ss);
370 u16 reg;
371
372 ad1889_channel_reset(chip, AD_CHAN_WAV);
373
374 reg = ad1889_readw(chip, AD_DS_WSMC);
375
376 /* Mask out 16-bit / Stereo */
377 reg &= ~(AD_DS_WSMC_WA16 | AD_DS_WSMC_WAST);
378
379 if (snd_pcm_format_width(rt->format) == 16)
380 reg |= AD_DS_WSMC_WA16;
381
382 if (rt->channels > 1)
383 reg |= AD_DS_WSMC_WAST;
384
385 /* let's make sure we don't clobber ourselves */
386 spin_lock_irq(&chip->lock);
387
388 chip->wave.size = size;
389 chip->wave.reg = reg;
390 chip->wave.addr = rt->dma_addr;
391
392 ad1889_writew(chip, AD_DS_WSMC, chip->wave.reg);
393
394 /* Set sample rates on the codec */
395 ad1889_writew(chip, AD_DS_WAS, rt->rate);
396
397 /* Set up DMA */
398 ad1889_load_wave_buffer_address(chip, chip->wave.addr);
399 ad1889_load_wave_buffer_count(chip, size);
400 ad1889_load_wave_interrupt_count(chip, count);
401
402 /* writes flush */
403 ad1889_readw(chip, AD_DS_WSMC);
404
405 spin_unlock_irq(&chip->lock);
406
407 ad1889_debug("prepare playback: addr = 0x%x, count = %u, "
408 "size = %u, reg = 0x%x, rate = %u\n", chip->wave.addr,
409 count, size, reg, rt->rate);
410 return 0;
411}
412
413static int
414snd_ad1889_capture_prepare(snd_pcm_substream_t *ss)
415{
416 struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
417 snd_pcm_runtime_t *rt = ss->runtime;
418 unsigned int size = snd_pcm_lib_buffer_bytes(ss);
419 unsigned int count = snd_pcm_lib_period_bytes(ss);
420 u16 reg;
421
422 ad1889_channel_reset(chip, AD_CHAN_ADC);
423
424 reg = ad1889_readw(chip, AD_DS_RAMC);
425
426 /* Mask out 16-bit / Stereo */
427 reg &= ~(AD_DS_RAMC_AD16 | AD_DS_RAMC_ADST);
428
429 if (snd_pcm_format_width(rt->format) == 16)
430 reg |= AD_DS_RAMC_AD16;
431
432 if (rt->channels > 1)
433 reg |= AD_DS_RAMC_ADST;
434
435 /* let's make sure we don't clobber ourselves */
436 spin_lock_irq(&chip->lock);
437
438 chip->ramc.size = size;
439 chip->ramc.reg = reg;
440 chip->ramc.addr = rt->dma_addr;
441
442 ad1889_writew(chip, AD_DS_RAMC, chip->ramc.reg);
443
444 /* Set up DMA */
445 ad1889_load_adc_buffer_address(chip, chip->ramc.addr);
446 ad1889_load_adc_buffer_count(chip, size);
447 ad1889_load_adc_interrupt_count(chip, count);
448
449 /* writes flush */
450 ad1889_readw(chip, AD_DS_RAMC);
451
452 spin_unlock_irq(&chip->lock);
453
454 ad1889_debug("prepare capture: addr = 0x%x, count = %u, "
455 "size = %u, reg = 0x%x, rate = %u\n", chip->ramc.addr,
456 count, size, reg, rt->rate);
457 return 0;
458}
459
460/* this is called in atomic context with IRQ disabled.
461 Must be as fast as possible and not sleep.
462 DMA should be *triggered* by this call.
463 The WSMC "WAEN" bit triggers DMA Wave On/Off */
464static int
465snd_ad1889_playback_trigger(snd_pcm_substream_t *ss, int cmd)
466{
467 u16 wsmc;
468 struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
469
470 wsmc = ad1889_readw(chip, AD_DS_WSMC);
471
472 switch (cmd) {
473 case SNDRV_PCM_TRIGGER_START:
474 /* enable DMA loop & interrupts */
475 ad1889_writew(chip, AD_DMA_WAV, AD_DMA_LOOP | AD_DMA_IM_CNT);
476 wsmc |= AD_DS_WSMC_WAEN;
477 /* 1 to clear CHSS bit */
478 ad1889_writel(chip, AD_DMA_CHSS, AD_DMA_CHSS_WAVS);
479 ad1889_unmute(chip);
480 break;
481 case SNDRV_PCM_TRIGGER_STOP:
482 ad1889_mute(chip);
483 wsmc &= ~AD_DS_WSMC_WAEN;
484 break;
485 default:
486 snd_BUG();
487 return -EINVAL;
488 }
489
490 chip->wave.reg = wsmc;
491 ad1889_writew(chip, AD_DS_WSMC, wsmc);
492 ad1889_readw(chip, AD_DS_WSMC); /* flush */
493
494 /* reset the chip when STOP - will disable IRQs */
495 if (cmd == SNDRV_PCM_TRIGGER_STOP)
496 ad1889_channel_reset(chip, AD_CHAN_WAV);
497
498 return 0;
499}
500
501/* this is called in atomic context with IRQ disabled.
502 Must be as fast as possible and not sleep.
503 DMA should be *triggered* by this call.
504 The RAMC "ADEN" bit triggers DMA ADC On/Off */
505static int
506snd_ad1889_capture_trigger(snd_pcm_substream_t *ss, int cmd)
507{
508 u16 ramc;
509 struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
510
511 ramc = ad1889_readw(chip, AD_DS_RAMC);
512
513 switch (cmd) {
514 case SNDRV_PCM_TRIGGER_START:
515 /* enable DMA loop & interrupts */
516 ad1889_writew(chip, AD_DMA_ADC, AD_DMA_LOOP | AD_DMA_IM_CNT);
517 ramc |= AD_DS_RAMC_ADEN;
518 /* 1 to clear CHSS bit */
519 ad1889_writel(chip, AD_DMA_CHSS, AD_DMA_CHSS_ADCS);
520 break;
521 case SNDRV_PCM_TRIGGER_STOP:
522 ramc &= ~AD_DS_RAMC_ADEN;
523 break;
524 default:
525 return -EINVAL;
526 }
527
528 chip->ramc.reg = ramc;
529 ad1889_writew(chip, AD_DS_RAMC, ramc);
530 ad1889_readw(chip, AD_DS_RAMC); /* flush */
531
532 /* reset the chip when STOP - will disable IRQs */
533 if (cmd == SNDRV_PCM_TRIGGER_STOP)
534 ad1889_channel_reset(chip, AD_CHAN_ADC);
535
536 return 0;
537}
538
539/* Called in atomic context with IRQ disabled */
540static snd_pcm_uframes_t
541snd_ad1889_playback_pointer(snd_pcm_substream_t *ss)
542{
543 size_t ptr = 0;
544 struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
545
546 if (unlikely(!(chip->wave.reg & AD_DS_WSMC_WAEN)))
547 return 0;
548
549 ptr = ad1889_readl(chip, AD_DMA_WAVCA);
550 ptr -= chip->wave.addr;
551
552 snd_assert((ptr >= 0) && (ptr < chip->wave.size), return 0);
553
554 return bytes_to_frames(ss->runtime, ptr);
555}
556
557/* Called in atomic context with IRQ disabled */
558static snd_pcm_uframes_t
559snd_ad1889_capture_pointer(snd_pcm_substream_t *ss)
560{
561 size_t ptr = 0;
562 struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
563
564 if (unlikely(!(chip->ramc.reg & AD_DS_RAMC_ADEN)))
565 return 0;
566
567 ptr = ad1889_readl(chip, AD_DMA_ADCCA);
568 ptr -= chip->ramc.addr;
569
570 snd_assert((ptr >= 0) && (ptr < chip->ramc.size), return 0);
571
572 return bytes_to_frames(ss->runtime, ptr);
573}
574
575static snd_pcm_ops_t snd_ad1889_playback_ops = {
576 .open = snd_ad1889_playback_open,
577 .close = snd_ad1889_playback_close,
578 .ioctl = snd_pcm_lib_ioctl,
579 .hw_params = snd_ad1889_hw_params,
580 .hw_free = snd_ad1889_hw_free,
581 .prepare = snd_ad1889_playback_prepare,
582 .trigger = snd_ad1889_playback_trigger,
583 .pointer = snd_ad1889_playback_pointer,
584};
585
586static snd_pcm_ops_t snd_ad1889_capture_ops = {
587 .open = snd_ad1889_capture_open,
588 .close = snd_ad1889_capture_close,
589 .ioctl = snd_pcm_lib_ioctl,
590 .hw_params = snd_ad1889_hw_params,
591 .hw_free = snd_ad1889_hw_free,
592 .prepare = snd_ad1889_capture_prepare,
593 .trigger = snd_ad1889_capture_trigger,
594 .pointer = snd_ad1889_capture_pointer,
595};
596
597static irqreturn_t
598snd_ad1889_interrupt(int irq,
599 void *dev_id,
600 struct pt_regs *regs)
601{
602 unsigned long st;
603 struct snd_ad1889 *chip = dev_id;
604
605 st = ad1889_readl(chip, AD_DMA_DISR);
606
607 /* clear ISR */
608 ad1889_writel(chip, AD_DMA_DISR, st);
609
610 st &= AD_INTR_MASK;
611
612 if (unlikely(!st))
613 return IRQ_NONE;
614
615 if (st & (AD_DMA_DISR_PMAI|AD_DMA_DISR_PTAI))
616 ad1889_debug("Unexpected master or target abort interrupt!\n");
617
618 if ((st & AD_DMA_DISR_WAVI) && chip->psubs)
619 snd_pcm_period_elapsed(chip->psubs);
620 if ((st & AD_DMA_DISR_ADCI) && chip->csubs)
621 snd_pcm_period_elapsed(chip->csubs);
622
623 return IRQ_HANDLED;
624}
625
626static void
627snd_ad1889_pcm_free(snd_pcm_t *pcm)
628{
629 struct snd_ad1889 *chip = pcm->private_data;
630 chip->pcm = NULL;
631 snd_pcm_lib_preallocate_free_for_all(pcm);
632}
633
634static int __devinit
635snd_ad1889_pcm_init(struct snd_ad1889 *chip, int device, snd_pcm_t **rpcm)
636{
637 int err;
638 snd_pcm_t *pcm;
639
640 if (rpcm)
641 *rpcm = NULL;
642
643 err = snd_pcm_new(chip->card, chip->card->driver, device, 1, 1, &pcm);
644 if (err < 0)
645 return err;
646
647 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
648 &snd_ad1889_playback_ops);
649 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
650 &snd_ad1889_capture_ops);
651
652 pcm->private_data = chip;
653 pcm->private_free = snd_ad1889_pcm_free;
654 pcm->info_flags = 0;
655 strcpy(pcm->name, chip->card->shortname);
656
657 chip->pcm = pcm;
658 chip->psubs = NULL;
659 chip->csubs = NULL;
660
661 err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
662 snd_dma_pci_data(chip->pci),
663 BUFFER_BYTES_MAX / 2,
664 BUFFER_BYTES_MAX);
665
666 if (err < 0) {
667 snd_printk(KERN_ERR PFX "buffer allocation error: %d\n", err);
668 return err;
669 }
670
671 if (rpcm)
672 *rpcm = pcm;
673
674 return 0;
675}
676
677static void
678snd_ad1889_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
679{
680 struct snd_ad1889 *chip = entry->private_data;
681 u16 reg;
682 int tmp;
683
684 reg = ad1889_readw(chip, AD_DS_WSMC);
685 snd_iprintf(buffer, "Wave output: %s\n",
686 (reg & AD_DS_WSMC_WAEN) ? "enabled" : "disabled");
687 snd_iprintf(buffer, "Wave Channels: %s\n",
688 (reg & AD_DS_WSMC_WAST) ? "stereo" : "mono");
689 snd_iprintf(buffer, "Wave Quality: %d-bit linear\n",
690 (reg & AD_DS_WSMC_WA16) ? 16 : 8);
691
692 /* WARQ is at offset 12 */
693 tmp = (reg & AD_DS_WSMC_WARQ) ?
694 (((reg & AD_DS_WSMC_WARQ >> 12) & 0x01) ? 12 : 18) : 4;
695 tmp /= (reg & AD_DS_WSMC_WAST) ? 2 : 1;
696
697 snd_iprintf(buffer, "Wave FIFO: %d %s words\n\n", tmp,
698 (reg & AD_DS_WSMC_WAST) ? "stereo" : "mono");
699
700
701 snd_iprintf(buffer, "Synthesis output: %s\n",
702 reg & AD_DS_WSMC_SYEN ? "enabled" : "disabled");
703
704 /* SYRQ is at offset 4 */
705 tmp = (reg & AD_DS_WSMC_SYRQ) ?
706 (((reg & AD_DS_WSMC_SYRQ >> 4) & 0x01) ? 12 : 18) : 4;
707 tmp /= (reg & AD_DS_WSMC_WAST) ? 2 : 1;
708
709 snd_iprintf(buffer, "Synthesis FIFO: %d %s words\n\n", tmp,
710 (reg & AD_DS_WSMC_WAST) ? "stereo" : "mono");
711
712 reg = ad1889_readw(chip, AD_DS_RAMC);
713 snd_iprintf(buffer, "ADC input: %s\n",
714 (reg & AD_DS_RAMC_ADEN) ? "enabled" : "disabled");
715 snd_iprintf(buffer, "ADC Channels: %s\n",
716 (reg & AD_DS_RAMC_ADST) ? "stereo" : "mono");
717 snd_iprintf(buffer, "ADC Quality: %d-bit linear\n",
718 (reg & AD_DS_RAMC_AD16) ? 16 : 8);
719
720 /* ACRQ is at offset 4 */
721 tmp = (reg & AD_DS_RAMC_ACRQ) ?
722 (((reg & AD_DS_RAMC_ACRQ >> 4) & 0x01) ? 12 : 18) : 4;
723 tmp /= (reg & AD_DS_RAMC_ADST) ? 2 : 1;
724
725 snd_iprintf(buffer, "ADC FIFO: %d %s words\n\n", tmp,
726 (reg & AD_DS_RAMC_ADST) ? "stereo" : "mono");
727
728 snd_iprintf(buffer, "Resampler input: %s\n",
729 reg & AD_DS_RAMC_REEN ? "enabled" : "disabled");
730
731 /* RERQ is at offset 12 */
732 tmp = (reg & AD_DS_RAMC_RERQ) ?
733 (((reg & AD_DS_RAMC_RERQ >> 12) & 0x01) ? 12 : 18) : 4;
734 tmp /= (reg & AD_DS_RAMC_ADST) ? 2 : 1;
735
736 snd_iprintf(buffer, "Resampler FIFO: %d %s words\n\n", tmp,
737 (reg & AD_DS_WSMC_WAST) ? "stereo" : "mono");
738
739
740 /* doc says LSB represents -1.5dB, but the max value (-94.5dB)
741 suggests that LSB is -3dB, which is more coherent with the logarithmic
742 nature of the dB scale */
743 reg = ad1889_readw(chip, AD_DS_WADA);
744 snd_iprintf(buffer, "Left: %s, -%d dB\n",
745 (reg & AD_DS_WADA_LWAM) ? "mute" : "unmute",
746 ((reg & AD_DS_WADA_LWAA) >> 8) * 3);
747 reg = ad1889_readw(chip, AD_DS_WADA);
748 snd_iprintf(buffer, "Right: %s, -%d dB\n",
749 (reg & AD_DS_WADA_RWAM) ? "mute" : "unmute",
750 ((reg & AD_DS_WADA_RWAA) >> 8) * 3);
751
752 reg = ad1889_readw(chip, AD_DS_WAS);
753 snd_iprintf(buffer, "Wave samplerate: %u Hz\n", reg);
754 reg = ad1889_readw(chip, AD_DS_RES);
755 snd_iprintf(buffer, "Resampler samplerate: %u Hz\n", reg);
756}
757
758static void __devinit
759snd_ad1889_proc_init(struct snd_ad1889 *chip)
760{
761 snd_info_entry_t *entry;
762
763 if (!snd_card_proc_new(chip->card, chip->card->driver, &entry))
764 snd_info_set_text_ops(entry, chip, 1024, snd_ad1889_proc_read);
765}
766
767static struct ac97_quirk ac97_quirks[] = {
768 {
769 .subvendor = 0x11d4, /* AD */
770 .subdevice = 0x1889, /* AD1889 */
771 .codec_id = AC97_ID_AD1819,
772 .name = "AD1889",
773 .type = AC97_TUNE_HP_ONLY
774 },
775 { } /* terminator */
776};
777
778static void __devinit
779snd_ad1889_ac97_xinit(struct snd_ad1889 *chip)
780{
781 u16 reg;
782
783 reg = ad1889_readw(chip, AD_AC97_ACIC);
784 reg |= AD_AC97_ACIC_ACRD; /* Reset Disable */
785 ad1889_writew(chip, AD_AC97_ACIC, reg);
786 ad1889_readw(chip, AD_AC97_ACIC); /* flush posted write */
787 udelay(10);
788 /* Interface Enable */
789 reg |= AD_AC97_ACIC_ACIE;
790 ad1889_writew(chip, AD_AC97_ACIC, reg);
791
792 snd_ad1889_ac97_ready(chip);
793
794 /* Audio Stream Output | Variable Sample Rate Mode */
795 reg = ad1889_readw(chip, AD_AC97_ACIC);
796 reg |= AD_AC97_ACIC_ASOE | AD_AC97_ACIC_VSRM;
797 ad1889_writew(chip, AD_AC97_ACIC, reg);
798 ad1889_readw(chip, AD_AC97_ACIC); /* flush posted write */
799
800}
801
802static void
803snd_ad1889_ac97_bus_free(ac97_bus_t *bus)
804{
805 struct snd_ad1889 *chip = bus->private_data;
806 chip->ac97_bus = NULL;
807}
808
809static void
810snd_ad1889_ac97_free(ac97_t *ac97)
811{
812 struct snd_ad1889 *chip = ac97->private_data;
813 chip->ac97 = NULL;
814}
815
816static int __devinit
817snd_ad1889_ac97_init(struct snd_ad1889 *chip, const char *quirk_override)
818{
819 int err;
820 ac97_template_t ac97;
821 static ac97_bus_ops_t ops = {
822 .write = snd_ad1889_ac97_write,
823 .read = snd_ad1889_ac97_read,
824 };
825
826 /* doing that here, it works. */
827 snd_ad1889_ac97_xinit(chip);
828
829 err = snd_ac97_bus(chip->card, 0, &ops, chip, &chip->ac97_bus);
830 if (err < 0)
831 return err;
832
833 chip->ac97_bus->private_free = snd_ad1889_ac97_bus_free;
834
835 memset(&ac97, 0, sizeof(ac97));
836 ac97.private_data = chip;
837 ac97.private_free = snd_ad1889_ac97_free;
838 ac97.pci = chip->pci;
839
840 err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97);
841 if (err < 0)
842 return err;
843
844 snd_ac97_tune_hardware(chip->ac97, ac97_quirks, quirk_override);
845
846 return 0;
847}
848
849static int
850snd_ad1889_free(struct snd_ad1889 *chip)
851{
852 if (chip->irq < 0)
853 goto skip_hw;
854
855 spin_lock_irq(&chip->lock);
856
857 ad1889_mute(chip);
858
859 /* Turn off interrupt on count and zero DMA registers */
860 ad1889_channel_reset(chip, AD_CHAN_WAV | AD_CHAN_ADC);
861
862 /* clear DISR. If we don't, we'd better jump off the Eiffel Tower */
863 ad1889_writel(chip, AD_DMA_DISR, AD_DMA_DISR_PTAI | AD_DMA_DISR_PMAI);
864 ad1889_readl(chip, AD_DMA_DISR); /* flush, dammit! */
865
866 spin_unlock_irq(&chip->lock);
867
868 synchronize_irq(chip->irq);
869
870 if (chip->irq >= 0)
871 free_irq(chip->irq, (void*)chip);
872
873skip_hw:
874 if (chip->iobase)
875 iounmap(chip->iobase);
876
877 pci_release_regions(chip->pci);
878 pci_disable_device(chip->pci);
879
880 kfree(chip);
881 return 0;
882}
883
884static inline int
885snd_ad1889_dev_free(snd_device_t *device)
886{
887 struct snd_ad1889 *chip = device->device_data;
888 return snd_ad1889_free(chip);
889}
890
891static int __devinit
892snd_ad1889_init(struct snd_ad1889 *chip)
893{
894 ad1889_writew(chip, AD_DS_CCS, AD_DS_CCS_CLKEN); /* turn on clock */
895 ad1889_readw(chip, AD_DS_CCS); /* flush posted write */
896
897 mdelay(10);
898
899 /* enable Master and Target abort interrupts */
900 ad1889_writel(chip, AD_DMA_DISR, AD_DMA_DISR_PMAE | AD_DMA_DISR_PTAE);
901
902 return 0;
903}
904
905static int __devinit
906snd_ad1889_create(snd_card_t *card,
907 struct pci_dev *pci,
908 struct snd_ad1889 **rchip)
909{
910 int err;
911
912 struct snd_ad1889 *chip;
913 static snd_device_ops_t ops = {
914 .dev_free = snd_ad1889_dev_free,
915 };
916
917 *rchip = NULL;
918
919 if ((err = pci_enable_device(pci)) < 0)
920 return err;
921
922 /* check PCI availability (32bit DMA) */
923 if (pci_set_dma_mask(pci, 0xffffffff) < 0 ||
924 pci_set_consistent_dma_mask(pci, 0xffffffff) < 0) {
925 printk(KERN_ERR PFX "error setting 32-bit DMA mask.\n");
926 pci_disable_device(pci);
927 return -ENXIO;
928 }
929
930 /* allocate chip specific data with zero-filled memory */
931 if ((chip = kzalloc(sizeof(*chip), GFP_KERNEL)) == NULL) {
932 pci_disable_device(pci);
933 return -ENOMEM;
934 }
935
936 chip->card = card;
937 card->private_data = chip;
938 chip->pci = pci;
939 chip->irq = -1;
940
941 /* (1) PCI resource allocation */
942 if ((err = pci_request_regions(pci, card->driver)) < 0)
943 goto free_and_ret;
944
945 chip->bar = pci_resource_start(pci, 0);
946 chip->iobase = ioremap_nocache(chip->bar, pci_resource_len(pci, 0));
947 if (chip->iobase == NULL) {
948 printk(KERN_ERR PFX "unable to reserve region.\n");
949 err = -EBUSY;
950 goto free_and_ret;
951 }
952
953 pci_set_master(pci);
954
955 spin_lock_init(&chip->lock); /* only now can we call ad1889_free */
956
957 if (request_irq(pci->irq, snd_ad1889_interrupt,
958 SA_INTERRUPT|SA_SHIRQ, card->driver, (void*)chip)) {
959 printk(KERN_ERR PFX "cannot obtain IRQ %d\n", pci->irq);
960 snd_ad1889_free(chip);
961 return -EBUSY;
962 }
963
964 chip->irq = pci->irq;
965 synchronize_irq(chip->irq);
966
967 /* (2) initialization of the chip hardware */
968 if ((err = snd_ad1889_init(chip)) < 0) {
969 snd_ad1889_free(chip);
970 return err;
971 }
972
973 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
974 snd_ad1889_free(chip);
975 return err;
976 }
977
978 snd_card_set_dev(card, &pci->dev);
979
980 *rchip = chip;
981
982 return 0;
983
984free_and_ret:
985 if (chip)
986 kfree(chip);
987 pci_disable_device(pci);
988
989 return err;
990}
991
992static int __devinit
993snd_ad1889_probe(struct pci_dev *pci,
994 const struct pci_device_id *pci_id)
995{
996 int err;
997 static int devno;
998 snd_card_t *card;
999 struct snd_ad1889 *chip;
1000
1001 /* (1) */
1002 if (devno >= SNDRV_CARDS)
1003 return -ENODEV;
1004 if (!enable[devno]) {
1005 devno++;
1006 return -ENOENT;
1007 }
1008
1009 /* (2) */
1010 card = snd_card_new(index[devno], id[devno], THIS_MODULE, 0);
1011 /* XXX REVISIT: we can probably allocate chip in this call */
1012 if (card == NULL)
1013 return -ENOMEM;
1014
1015 strcpy(card->driver, "AD1889");
1016 strcpy(card->shortname, "Analog Devices AD1889");
1017
1018 /* (3) */
1019 err = snd_ad1889_create(card, pci, &chip);
1020 if (err < 0)
1021 goto free_and_ret;
1022
1023 /* (4) */
1024 sprintf(card->longname, "%s at 0x%lx irq %i",
1025 card->shortname, chip->bar, chip->irq);
1026
1027 /* (5) */
1028 /* register AC97 mixer */
1029 err = snd_ad1889_ac97_init(chip, ac97_quirk[devno]);
1030 if (err < 0)
1031 goto free_and_ret;
1032
1033 err = snd_ad1889_pcm_init(chip, 0, NULL);
1034 if (err < 0)
1035 goto free_and_ret;
1036
1037 /* register proc interface */
1038 snd_ad1889_proc_init(chip);
1039
1040 /* (6) */
1041 err = snd_card_register(card);
1042 if (err < 0)
1043 goto free_and_ret;
1044
1045 /* (7) */
1046 pci_set_drvdata(pci, card);
1047
1048 devno++;
1049 return 0;
1050
1051free_and_ret:
1052 snd_card_free(card);
1053 return err;
1054}
1055
1056static void __devexit
1057snd_ad1889_remove(struct pci_dev *pci)
1058{
1059 snd_card_free(pci_get_drvdata(pci));
1060 pci_set_drvdata(pci, NULL);
1061}
1062
1063static struct pci_device_id snd_ad1889_ids[] = {
1064 { PCI_DEVICE(PCI_VENDOR_ID_ANALOG_DEVICES, PCI_DEVICE_ID_AD1889JS) },
1065 { 0, },
1066};
1067MODULE_DEVICE_TABLE(pci, snd_ad1889_ids);
1068
1069static struct pci_driver ad1889_pci = {
1070 .name = "AD1889 Audio",
1071 .owner = THIS_MODULE,
1072 .id_table = snd_ad1889_ids,
1073 .probe = snd_ad1889_probe,
1074 .remove = __devexit_p(snd_ad1889_remove),
1075};
1076
1077static int __init
1078alsa_ad1889_init(void)
1079{
1080 return pci_register_driver(&ad1889_pci);
1081}
1082
1083static void __exit
1084alsa_ad1889_fini(void)
1085{
1086 pci_unregister_driver(&ad1889_pci);
1087}
1088
1089module_init(alsa_ad1889_init);
1090module_exit(alsa_ad1889_fini);
diff --git a/sound/pci/ad1889.h b/sound/pci/ad1889.h
new file mode 100644
index 000000000000..5e6dad5341a1
--- /dev/null
+++ b/sound/pci/ad1889.h
@@ -0,0 +1,189 @@
1/* Analog Devices 1889 audio driver
2 * Copyright (C) 2004, Kyle McMartin <kyle@parisc-linux.org>
3 */
4
5#ifndef __AD1889_H__
6#define __AD1889_H__
7
8#define AD_DS_WSMC 0x00 /* wave/synthesis channel mixer control */
9#define AD_DS_WSMC_SYEN 0x0004 /* synthesis channel enable */
10#define AD_DS_WSMC_SYRQ 0x0030 /* synth. fifo request point */
11#define AD_DS_WSMC_WA16 0x0100 /* wave channel 16bit select */
12#define AD_DS_WSMC_WAST 0x0200 /* wave channel stereo select */
13#define AD_DS_WSMC_WAEN 0x0400 /* wave channel enable */
14#define AD_DS_WSMC_WARQ 0x3000 /* wave fifo request point */
15
16#define AD_DS_RAMC 0x02 /* resampler/ADC channel mixer control */
17#define AD_DS_RAMC_AD16 0x0001 /* ADC channel 16bit select */
18#define AD_DS_RAMC_ADST 0x0002 /* ADC channel stereo select */
19#define AD_DS_RAMC_ADEN 0x0004 /* ADC channel enable */
20#define AD_DS_RAMC_ACRQ 0x0030 /* ADC fifo request point */
21#define AD_DS_RAMC_REEN 0x0400 /* resampler channel enable */
22#define AD_DS_RAMC_RERQ 0x3000 /* res. fifo request point */
23
24#define AD_DS_WADA 0x04 /* wave channel mix attenuation */
25#define AD_DS_WADA_RWAM 0x0080 /* right wave mute */
26#define AD_DS_WADA_RWAA 0x001f /* right wave attenuation */
27#define AD_DS_WADA_LWAM 0x8000 /* left wave mute */
28#define AD_DS_WADA_LWAA 0x3e00 /* left wave attenuation */
29
30#define AD_DS_SYDA 0x06 /* synthesis channel mix attenuation */
31#define AD_DS_SYDA_RSYM 0x0080 /* right synthesis mute */
32#define AD_DS_SYDA_RSYA 0x001f /* right synthesis attenuation */
33#define AD_DS_SYDA_LSYM 0x8000 /* left synthesis mute */
34#define AD_DS_SYDA_LSYA 0x3e00 /* left synthesis attenuation */
35
36#define AD_DS_WAS 0x08 /* wave channel sample rate */
37#define AD_DS_WAS_WAS 0xffff /* sample rate mask */
38
39#define AD_DS_RES 0x0a /* resampler channel sample rate */
40#define AD_DS_RES_RES 0xffff /* sample rate mask */
41
42#define AD_DS_CCS 0x0c /* chip control/status */
43#define AD_DS_CCS_ADO 0x0001 /* ADC channel overflow */
44#define AD_DS_CCS_REO 0x0002 /* resampler channel overflow */
45#define AD_DS_CCS_SYU 0x0004 /* synthesis channel underflow */
46#define AD_DS_CCS_WAU 0x0008 /* wave channel underflow */
47/* bits 4 -> 7, 9, 11 -> 14 reserved */
48#define AD_DS_CCS_XTD 0x0100 /* xtd delay control (4096 clock cycles) */
49#define AD_DS_CCS_PDALL 0x0400 /* power */
50#define AD_DS_CCS_CLKEN 0x8000 /* clock */
51
52#define AD_DMA_RESBA 0x40 /* RES base address */
53#define AD_DMA_RESCA 0x44 /* RES current address */
54#define AD_DMA_RESBC 0x48 /* RES base count */
55#define AD_DMA_RESCC 0x4c /* RES current count */
56
57#define AD_DMA_ADCBA 0x50 /* ADC base address */
58#define AD_DMA_ADCCA 0x54 /* ADC current address */
59#define AD_DMA_ADCBC 0x58 /* ADC base count */
60#define AD_DMA_ADCCC 0x5c /* ADC current count */
61
62#define AD_DMA_SYNBA 0x60 /* synth base address */
63#define AD_DMA_SYNCA 0x64 /* synth current address */
64#define AD_DMA_SYNBC 0x68 /* synth base count */
65#define AD_DMA_SYNCC 0x6c /* synth current count */
66
67#define AD_DMA_WAVBA 0x70 /* wave base address */
68#define AD_DMA_WAVCA 0x74 /* wave current address */
69#define AD_DMA_WAVBC 0x78 /* wave base count */
70#define AD_DMA_WAVCC 0x7c /* wave current count */
71
72#define AD_DMA_RESIC 0x80 /* RES dma interrupt current byte count */
73#define AD_DMA_RESIB 0x84 /* RES dma interrupt base byte count */
74
75#define AD_DMA_ADCIC 0x88 /* ADC dma interrupt current byte count */
76#define AD_DMA_ADCIB 0x8c /* ADC dma interrupt base byte count */
77
78#define AD_DMA_SYNIC 0x90 /* synth dma interrupt current byte count */
79#define AD_DMA_SYNIB 0x94 /* synth dma interrupt base byte count */
80
81#define AD_DMA_WAVIC 0x98 /* wave dma interrupt current byte count */
82#define AD_DMA_WAVIB 0x9c /* wave dma interrupt base byte count */
83
84#define AD_DMA_ICC 0xffffff /* current byte count mask */
85#define AD_DMA_IBC 0xffffff /* base byte count mask */
86/* bits 24 -> 31 reserved */
87
88/* 4 bytes pad */
89#define AD_DMA_ADC 0xa8 /* ADC dma control and status */
90#define AD_DMA_SYNTH 0xb0 /* Synth dma control and status */
91#define AD_DMA_WAV 0xb8 /* wave dma control and status */
92#define AD_DMA_RES 0xa0 /* Resample dma control and status */
93
94#define AD_DMA_SGDE 0x0001 /* SGD mode enable */
95#define AD_DMA_LOOP 0x0002 /* loop enable */
96#define AD_DMA_IM 0x000c /* interrupt mode mask */
97#define AD_DMA_IM_DIS (~AD_DMA_IM) /* disable */
98#define AD_DMA_IM_CNT 0x0004 /* interrupt on count */
99#define AD_DMA_IM_SGD 0x0008 /* interrupt on SGD flag */
100#define AD_DMA_IM_EOL 0x000c /* interrupt on End of Linked List */
101#define AD_DMA_SGDS 0x0030 /* SGD status */
102#define AD_DMA_SFLG 0x0040 /* SGD flag */
103#define AD_DMA_EOL 0x0080 /* SGD end of list */
104/* bits 8 -> 15 reserved */
105
106#define AD_DMA_DISR 0xc0 /* dma interrupt status */
107#define AD_DMA_DISR_RESI 0x000001 /* resampler channel interrupt */
108#define AD_DMA_DISR_ADCI 0x000002 /* ADC channel interrupt */
109#define AD_DMA_DISR_SYNI 0x000004 /* synthesis channel interrupt */
110#define AD_DMA_DISR_WAVI 0x000008 /* wave channel interrupt */
111/* bits 4, 5 reserved */
112#define AD_DMA_DISR_SEPS 0x000040 /* serial eeprom status */
113/* bits 7 -> 13 reserved */
114#define AD_DMA_DISR_PMAI 0x004000 /* pci master abort interrupt */
115#define AD_DMA_DISR_PTAI 0x008000 /* pci target abort interrupt */
116#define AD_DMA_DISR_PTAE 0x010000 /* pci target abort interrupt enable */
117#define AD_DMA_DISR_PMAE 0x020000 /* pci master abort interrupt enable */
118/* bits 19 -> 31 reserved */
119
120/* interrupt mask */
121#define AD_INTR_MASK (AD_DMA_DISR_RESI|AD_DMA_DISR_ADCI| \
122 AD_DMA_DISR_WAVI|AD_DMA_DISR_SYNI| \
123 AD_DMA_DISR_PMAI|AD_DMA_DISR_PTAI)
124
125#define AD_DMA_CHSS 0xc4 /* dma channel stop status */
126#define AD_DMA_CHSS_RESS 0x000001 /* resampler channel stopped */
127#define AD_DMA_CHSS_ADCS 0x000002 /* ADC channel stopped */
128#define AD_DMA_CHSS_SYNS 0x000004 /* synthesis channel stopped */
129#define AD_DMA_CHSS_WAVS 0x000008 /* wave channel stopped */
130
131#define AD_GPIO_IPC 0xc8 /* gpio port control */
132#define AD_GPIO_OP 0xca /* gpio output port status */
133#define AD_GPIO_IP 0xcc /* gpio input port status */
134
135#define AD_AC97_BASE 0x100 /* ac97 base register */
136
137#define AD_AC97_RESET 0x100 /* reset */
138
139#define AD_AC97_PWR_CTL 0x126 /* == AC97_POWERDOWN */
140#define AD_AC97_PWR_ADC 0x0001 /* ADC ready status */
141#define AD_AC97_PWR_DAC 0x0002 /* DAC ready status */
142#define AD_AC97_PWR_PR0 0x0100 /* PR0 (ADC) powerdown */
143#define AD_AC97_PWR_PR1 0x0200 /* PR1 (DAC) powerdown */
144
145#define AD_MISC_CTL 0x176 /* misc control */
146#define AD_MISC_CTL_DACZ 0x8000 /* set for zero fill, unset for repeat */
147#define AD_MISC_CTL_ARSR 0x0001 /* set for SR1, unset for SR0 */
148#define AD_MISC_CTL_ALSR 0x0100
149#define AD_MISC_CTL_DLSR 0x0400
150#define AD_MISC_CTL_DRSR 0x0004
151
152#define AD_AC97_SR0 0x178 /* sample rate 0, 0xbb80 == 48K */
153#define AD_AC97_SR0_48K 0xbb80 /* 48KHz */
154#define AD_AC97_SR1 0x17a /* sample rate 1 */
155
156#define AD_AC97_ACIC 0x180 /* ac97 codec interface control */
157#define AD_AC97_ACIC_ACIE 0x0001 /* analog codec interface enable */
158#define AD_AC97_ACIC_ACRD 0x0002 /* analog codec reset disable */
159#define AD_AC97_ACIC_ASOE 0x0004 /* audio stream output enable */
160#define AD_AC97_ACIC_VSRM 0x0008 /* variable sample rate mode */
161#define AD_AC97_ACIC_FSDH 0x0100 /* force SDATA_OUT high */
162#define AD_AC97_ACIC_FSYH 0x0200 /* force sync high */
163#define AD_AC97_ACIC_ACRDY 0x8000 /* analog codec ready status */
164/* bits 10 -> 14 reserved */
165
166
167#define AD_DS_MEMSIZE 512
168#define AD_OPL_MEMSIZE 16
169#define AD_MIDI_MEMSIZE 16
170
171#define AD_WAV_STATE 0
172#define AD_ADC_STATE 1
173#define AD_MAX_STATES 2
174
175#define AD_CHAN_WAV 0x0001
176#define AD_CHAN_ADC 0x0002
177#define AD_CHAN_RES 0x0004
178#define AD_CHAN_SYN 0x0008
179
180
181/* The chip would support 4 GB buffers and 16 MB periods,
182 * but let's not overdo it ... */
183#define BUFFER_BYTES_MAX (256 * 1024)
184#define PERIOD_BYTES_MIN 32
185#define PERIOD_BYTES_MAX (BUFFER_BYTES_MAX / 2)
186#define PERIODS_MIN 2
187#define PERIODS_MAX (BUFFER_BYTES_MAX / PERIOD_BYTES_MIN)
188
189#endif /* __AD1889_H__ */
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index 4943299cf137..d683f7736a63 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -78,15 +78,7 @@ MODULE_PARM_DESC(spdif, "Support SPDIF I/O");
78 * Constants definition 78 * Constants definition
79 */ 79 */
80 80
81#ifndef PCI_VENDOR_ID_ALI 81#define DEVICE_ID_ALI5451 ((PCI_VENDOR_ID_AL<<16)|PCI_DEVICE_ID_AL_M5451)
82#define PCI_VENDOR_ID_ALI 0x10b9
83#endif
84
85#ifndef PCI_DEVICE_ID_ALI_5451
86#define PCI_DEVICE_ID_ALI_5451 0x5451
87#endif
88
89#define DEVICE_ID_ALI5451 ((PCI_VENDOR_ID_ALI<<16)|PCI_DEVICE_ID_ALI_5451)
90 82
91 83
92#define ALI_CHANNELS 32 84#define ALI_CHANNELS 32
@@ -326,13 +318,12 @@ static void ali_read_regs(ali_t *codec, int channel)
326static void ali_read_cfg(unsigned int vendor, unsigned deviceid) 318static void ali_read_cfg(unsigned int vendor, unsigned deviceid)
327{ 319{
328 unsigned int dwVal; 320 unsigned int dwVal;
329 struct pci_dev *pci_dev = NULL; 321 struct pci_dev *pci_dev;
330 int i,j; 322 int i,j;
331 323
332 324 pci_dev = pci_get_device(vendor, deviceid, NULL);
333 pci_dev = pci_find_device(vendor, deviceid, pci_dev); 325 if (pci_dev == NULL)
334 if (pci_dev == NULL) 326 return ;
335 return ;
336 327
337 printk("\nM%x PCI CFG\n", deviceid); 328 printk("\nM%x PCI CFG\n", deviceid);
338 printk(" "); 329 printk(" ");
@@ -349,6 +340,7 @@ static void ali_read_cfg(unsigned int vendor, unsigned deviceid)
349 } 340 }
350 printk("\n"); 341 printk("\n");
351 } 342 }
343 pci_dev_put(pci_dev);
352 } 344 }
353static void ali_read_ac97regs(ali_t *codec, int secondary) 345static void ali_read_ac97regs(ali_t *codec, int secondary)
354{ 346{
@@ -2116,6 +2108,8 @@ static int snd_ali_free(ali_t * codec)
2116#ifdef CONFIG_PM 2108#ifdef CONFIG_PM
2117 kfree(codec->image); 2109 kfree(codec->image);
2118#endif 2110#endif
2111 pci_dev_put(codec->pci_m1533);
2112 pci_dev_put(codec->pci_m7101);
2119 kfree(codec); 2113 kfree(codec);
2120 return 0; 2114 return 0;
2121} 2115}
@@ -2305,7 +2299,7 @@ static int __devinit snd_ali_create(snd_card_t * card,
2305 codec->chregs.data.ainten = 0x00; 2299 codec->chregs.data.ainten = 0x00;
2306 2300
2307 /* M1533: southbridge */ 2301 /* M1533: southbridge */
2308 pci_dev = pci_find_device(0x10b9, 0x1533, NULL); 2302 pci_dev = pci_get_device(0x10b9, 0x1533, NULL);
2309 codec->pci_m1533 = pci_dev; 2303 codec->pci_m1533 = pci_dev;
2310 if (! codec->pci_m1533) { 2304 if (! codec->pci_m1533) {
2311 snd_printk(KERN_ERR "ali5451: cannot find ALi 1533 chip.\n"); 2305 snd_printk(KERN_ERR "ali5451: cannot find ALi 1533 chip.\n");
@@ -2313,7 +2307,7 @@ static int __devinit snd_ali_create(snd_card_t * card,
2313 return -ENODEV; 2307 return -ENODEV;
2314 } 2308 }
2315 /* M7101: power management */ 2309 /* M7101: power management */
2316 pci_dev = pci_find_device(0x10b9, 0x7101, NULL); 2310 pci_dev = pci_get_device(0x10b9, 0x7101, NULL);
2317 codec->pci_m7101 = pci_dev; 2311 codec->pci_m7101 = pci_dev;
2318 if (! codec->pci_m7101 && codec->revision == ALI_5451_V02) { 2312 if (! codec->pci_m7101 && codec->revision == ALI_5451_V02) {
2319 snd_printk(KERN_ERR "ali5451: cannot find ALi 7101 chip.\n"); 2313 snd_printk(KERN_ERR "ali5451: cannot find ALi 7101 chip.\n");
@@ -2417,6 +2411,7 @@ static void __devexit snd_ali_remove(struct pci_dev *pci)
2417 2411
2418static struct pci_driver driver = { 2412static struct pci_driver driver = {
2419 .name = "ALI 5451", 2413 .name = "ALI 5451",
2414 .owner = THIS_MODULE,
2420 .id_table = snd_ali_ids, 2415 .id_table = snd_ali_ids,
2421 .probe = snd_ali_probe, 2416 .probe = snd_ali_probe,
2422 .remove = __devexit_p(snd_ali_remove), 2417 .remove = __devexit_p(snd_ali_remove),
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c
index ca28b229c704..196ec1c61bb4 100644
--- a/sound/pci/als4000.c
+++ b/sound/pci/als4000.c
@@ -770,6 +770,7 @@ static void __devexit snd_card_als4000_remove(struct pci_dev *pci)
770 770
771static struct pci_driver driver = { 771static struct pci_driver driver = {
772 .name = "ALS4000", 772 .name = "ALS4000",
773 .owner = THIS_MODULE,
773 .id_table = snd_als4000_ids, 774 .id_table = snd_als4000_ids,
774 .probe = snd_card_als4000_probe, 775 .probe = snd_card_als4000_probe,
775 .remove = __devexit_p(snd_card_als4000_remove), 776 .remove = __devexit_p(snd_card_als4000_remove),
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index 188df085b7ee..241eacf1e652 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -1453,6 +1453,7 @@ static int snd_atiixp_resume(snd_card_t *card)
1453 atiixp_dma_t *dma = &chip->dmas[i]; 1453 atiixp_dma_t *dma = &chip->dmas[i];
1454 if (dma->substream && dma->suspended) { 1454 if (dma->substream && dma->suspended) {
1455 dma->ops->enable_dma(chip, 1); 1455 dma->ops->enable_dma(chip, 1);
1456 dma->substream->ops->prepare(dma->substream);
1456 writel((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN, 1457 writel((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN,
1457 chip->remap_addr + dma->ops->llp_offset); 1458 chip->remap_addr + dma->ops->llp_offset);
1458 writel(dma->saved_curptr, chip->remap_addr + dma->ops->dt_cur); 1459 writel(dma->saved_curptr, chip->remap_addr + dma->ops->dt_cur);
@@ -1530,7 +1531,7 @@ static int __devinit snd_atiixp_create(snd_card_t *card,
1530 if ((err = pci_enable_device(pci)) < 0) 1531 if ((err = pci_enable_device(pci)) < 0)
1531 return err; 1532 return err;
1532 1533
1533 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1534 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1534 if (chip == NULL) { 1535 if (chip == NULL) {
1535 pci_disable_device(pci); 1536 pci_disable_device(pci);
1536 return -ENOMEM; 1537 return -ENOMEM;
@@ -1644,6 +1645,7 @@ static void __devexit snd_atiixp_remove(struct pci_dev *pci)
1644 1645
1645static struct pci_driver driver = { 1646static struct pci_driver driver = {
1646 .name = "ATI IXP AC97 controller", 1647 .name = "ATI IXP AC97 controller",
1648 .owner = THIS_MODULE,
1647 .id_table = snd_atiixp_ids, 1649 .id_table = snd_atiixp_ids,
1648 .probe = snd_atiixp_probe, 1650 .probe = snd_atiixp_probe,
1649 .remove = __devexit_p(snd_atiixp_remove), 1651 .remove = __devexit_p(snd_atiixp_remove),
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index 8d2002951bd7..8a59598167f9 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -1208,7 +1208,7 @@ static int __devinit snd_atiixp_create(snd_card_t *card,
1208 if ((err = pci_enable_device(pci)) < 0) 1208 if ((err = pci_enable_device(pci)) < 0)
1209 return err; 1209 return err;
1210 1210
1211 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1211 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1212 if (chip == NULL) { 1212 if (chip == NULL) {
1213 pci_disable_device(pci); 1213 pci_disable_device(pci);
1214 return -ENOMEM; 1214 return -ENOMEM;
@@ -1318,6 +1318,7 @@ static void __devexit snd_atiixp_remove(struct pci_dev *pci)
1318 1318
1319static struct pci_driver driver = { 1319static struct pci_driver driver = {
1320 .name = "ATI IXP MC97 controller", 1320 .name = "ATI IXP MC97 controller",
1321 .owner = THIS_MODULE,
1321 .id_table = snd_atiixp_ids, 1322 .id_table = snd_atiixp_ids,
1322 .probe = snd_atiixp_probe, 1323 .probe = snd_atiixp_probe,
1323 .remove = __devexit_p(snd_atiixp_remove), 1324 .remove = __devexit_p(snd_atiixp_remove),
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c
index f6236c63aaaa..04b695d6fd48 100644
--- a/sound/pci/au88x0/au88x0.c
+++ b/sound/pci/au88x0/au88x0.c
@@ -79,19 +79,21 @@ static void vortex_fix_agp_bridge(struct pci_dev *via)
79 79
80static void __devinit snd_vortex_workaround(struct pci_dev *vortex, int fix) 80static void __devinit snd_vortex_workaround(struct pci_dev *vortex, int fix)
81{ 81{
82 struct pci_dev *via; 82 struct pci_dev *via = NULL;
83 83
84 /* autodetect if workarounds are required */ 84 /* autodetect if workarounds are required */
85 if (fix == 255) { 85 if (fix == 255) {
86 /* VIA KT133 */ 86 /* VIA KT133 */
87 via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8365_1, NULL); 87 via = pci_get_device(PCI_VENDOR_ID_VIA,
88 PCI_DEVICE_ID_VIA_8365_1, NULL);
88 /* VIA Apollo */ 89 /* VIA Apollo */
89 if (via == NULL) { 90 if (via == NULL) {
90 via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C598_1, NULL); 91 via = pci_get_device(PCI_VENDOR_ID_VIA,
91 } 92 PCI_DEVICE_ID_VIA_82C598_1, NULL);
92 /* AMD Irongate */ 93 /* AMD Irongate */
93 if (via == NULL) { 94 if (via == NULL)
94 via = pci_find_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL); 95 via = pci_get_device(PCI_VENDOR_ID_AMD,
96 PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL);
95 } 97 }
96 if (via) { 98 if (via) {
97 printk(KERN_INFO CARD_NAME ": Activating latency workaround...\n"); 99 printk(KERN_INFO CARD_NAME ": Activating latency workaround...\n");
@@ -101,13 +103,17 @@ static void __devinit snd_vortex_workaround(struct pci_dev *vortex, int fix)
101 } else { 103 } else {
102 if (fix & 0x1) 104 if (fix & 0x1)
103 vortex_fix_latency(vortex); 105 vortex_fix_latency(vortex);
104 if ((fix & 0x2) && (via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8365_1, NULL))) 106 if ((fix & 0x2) && (via = pci_get_device(PCI_VENDOR_ID_VIA,
107 PCI_DEVICE_ID_VIA_8365_1, NULL)))
105 vortex_fix_agp_bridge(via); 108 vortex_fix_agp_bridge(via);
106 if ((fix & 0x4) && (via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C598_1, NULL))) 109 if ((fix & 0x4) && (via = pci_get_device(PCI_VENDOR_ID_VIA,
110 PCI_DEVICE_ID_VIA_82C598_1, NULL)))
107 vortex_fix_agp_bridge(via); 111 vortex_fix_agp_bridge(via);
108 if ((fix & 0x8) && (via = pci_find_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL))) 112 if ((fix & 0x8) && (via = pci_get_device(PCI_VENDOR_ID_AMD,
113 PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL)))
109 vortex_fix_agp_bridge(via); 114 vortex_fix_agp_bridge(via);
110 } 115 }
116 pci_dev_put(via);
111} 117}
112 118
113// component-destructor 119// component-destructor
@@ -150,7 +156,7 @@ snd_vortex_create(snd_card_t * card, struct pci_dev *pci, vortex_t ** rchip)
150 } 156 }
151 pci_set_dma_mask(pci, VORTEX_DMA_MASK); 157 pci_set_dma_mask(pci, VORTEX_DMA_MASK);
152 158
153 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 159 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
154 if (chip == NULL) 160 if (chip == NULL)
155 return -ENOMEM; 161 return -ENOMEM;
156 162
@@ -367,6 +373,7 @@ static void __devexit snd_vortex_remove(struct pci_dev *pci)
367// pci_driver definition 373// pci_driver definition
368static struct pci_driver driver = { 374static struct pci_driver driver = {
369 .name = CARD_NAME_SHORT, 375 .name = CARD_NAME_SHORT,
376 .owner = THIS_MODULE,
370 .id_table = snd_vortex_ids, 377 .id_table = snd_vortex_ids,
371 .probe = snd_vortex_probe, 378 .probe = snd_vortex_probe,
372 .remove = __devexit_p(snd_vortex_remove), 379 .remove = __devexit_p(snd_vortex_remove),
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index 72bba7b2d983..d5261bdec583 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -1345,7 +1345,7 @@ static int __devinit snd_azf3328_create(snd_card_t * card,
1345 if ((err = pci_enable_device(pci)) < 0) 1345 if ((err = pci_enable_device(pci)) < 0)
1346 return err; 1346 return err;
1347 1347
1348 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1348 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1349 if (chip == NULL) { 1349 if (chip == NULL) {
1350 pci_disable_device(pci); 1350 pci_disable_device(pci);
1351 return -ENOMEM; 1351 return -ENOMEM;
@@ -1511,6 +1511,7 @@ static void __devexit snd_azf3328_remove(struct pci_dev *pci)
1511 1511
1512static struct pci_driver driver = { 1512static struct pci_driver driver = {
1513 .name = "AZF3328", 1513 .name = "AZF3328",
1514 .owner = THIS_MODULE,
1514 .id_table = snd_azf3328_ids, 1515 .id_table = snd_azf3328_ids,
1515 .probe = snd_azf3328_probe, 1516 .probe = snd_azf3328_probe,
1516 .remove = __devexit_p(snd_azf3328_remove), 1517 .remove = __devexit_p(snd_azf3328_remove),
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index c5557eaf3e2e..2236c958aec0 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -59,16 +59,6 @@ module_param(load_all, bool, 0444);
59MODULE_PARM_DESC(load_all, "Allow to load the non-whitelisted cards"); 59MODULE_PARM_DESC(load_all, "Allow to load the non-whitelisted cards");
60 60
61 61
62#ifndef PCI_VENDOR_ID_BROOKTREE
63#define PCI_VENDOR_ID_BROOKTREE 0x109e
64#endif
65#ifndef PCI_DEVICE_ID_BROOKTREE_878
66#define PCI_DEVICE_ID_BROOKTREE_878 0x0878
67#endif
68#ifndef PCI_DEVICE_ID_BROOKTREE_879
69#define PCI_DEVICE_ID_BROOKTREE_879 0x0879
70#endif
71
72/* register offsets */ 62/* register offsets */
73#define REG_INT_STAT 0x100 /* interrupt status */ 63#define REG_INT_STAT 0x100 /* interrupt status */
74#define REG_INT_MASK 0x104 /* interrupt mask */ 64#define REG_INT_MASK 0x104 /* interrupt mask */
@@ -720,7 +710,7 @@ static int __devinit snd_bt87x_create(snd_card_t *card,
720 if (err < 0) 710 if (err < 0)
721 return err; 711 return err;
722 712
723 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 713 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
724 if (!chip) { 714 if (!chip) {
725 pci_disable_device(pci); 715 pci_disable_device(pci);
726 return -ENOMEM; 716 return -ENOMEM;
@@ -911,6 +901,7 @@ static struct pci_device_id snd_bt87x_default_ids[] = {
911 901
912static struct pci_driver driver = { 902static struct pci_driver driver = {
913 .name = "Bt87x", 903 .name = "Bt87x",
904 .owner = THIS_MODULE,
914 .id_table = snd_bt87x_ids, 905 .id_table = snd_bt87x_ids,
915 .probe = snd_bt87x_probe, 906 .probe = snd_bt87x_probe,
916 .remove = __devexit_p(snd_bt87x_remove), 907 .remove = __devexit_p(snd_bt87x_remove),
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index 7e27bfc37439..ba07960921d8 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -352,7 +352,7 @@ static int snd_ca0106_pcm_open_playback_channel(snd_pcm_substream_t *substream,
352 snd_pcm_runtime_t *runtime = substream->runtime; 352 snd_pcm_runtime_t *runtime = substream->runtime;
353 int err; 353 int err;
354 354
355 epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); 355 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
356 356
357 if (epcm == NULL) 357 if (epcm == NULL)
358 return -ENOMEM; 358 return -ENOMEM;
@@ -419,7 +419,7 @@ static int snd_ca0106_pcm_open_capture_channel(snd_pcm_substream_t *substream, i
419 snd_pcm_runtime_t *runtime = substream->runtime; 419 snd_pcm_runtime_t *runtime = substream->runtime;
420 int err; 420 int err;
421 421
422 epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); 422 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
423 if (epcm == NULL) { 423 if (epcm == NULL) {
424 snd_printk("open_capture_channel: failed epcm alloc\n"); 424 snd_printk("open_capture_channel: failed epcm alloc\n");
425 return -ENOMEM; 425 return -ENOMEM;
@@ -1144,7 +1144,7 @@ static int __devinit snd_ca0106_create(snd_card_t *card,
1144 return -ENXIO; 1144 return -ENXIO;
1145 } 1145 }
1146 1146
1147 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1147 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1148 if (chip == NULL) { 1148 if (chip == NULL) {
1149 pci_disable_device(pci); 1149 pci_disable_device(pci);
1150 return -ENOMEM; 1150 return -ENOMEM;
@@ -1390,6 +1390,7 @@ MODULE_DEVICE_TABLE(pci, snd_ca0106_ids);
1390// pci_driver definition 1390// pci_driver definition
1391static struct pci_driver driver = { 1391static struct pci_driver driver = {
1392 .name = "CA0106", 1392 .name = "CA0106",
1393 .owner = THIS_MODULE,
1393 .id_table = snd_ca0106_ids, 1394 .id_table = snd_ca0106_ids,
1394 .probe = snd_ca0106_probe, 1395 .probe = snd_ca0106_probe,
1395 .remove = __devexit_p(snd_ca0106_remove), 1396 .remove = __devexit_p(snd_ca0106_remove),
diff --git a/sound/pci/ca0106/ca0106_mixer.c b/sound/pci/ca0106/ca0106_mixer.c
index b6b8882ce704..c10e4a54301b 100644
--- a/sound/pci/ca0106/ca0106_mixer.c
+++ b/sound/pci/ca0106/ca0106_mixer.c
@@ -482,7 +482,7 @@ static int snd_ca0106_volume_put_feedback(snd_kcontrol_t * kcontrol,
482static snd_kcontrol_new_t snd_ca0106_volume_control_analog_front = 482static snd_kcontrol_new_t snd_ca0106_volume_control_analog_front =
483{ 483{
484 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 484 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
485 .name = "Analog Front Volume", 485 .name = "Analog Front Playback Volume",
486 .info = snd_ca0106_volume_info, 486 .info = snd_ca0106_volume_info,
487 .get = snd_ca0106_volume_get_analog_front, 487 .get = snd_ca0106_volume_get_analog_front,
488 .put = snd_ca0106_volume_put_analog_front 488 .put = snd_ca0106_volume_put_analog_front
@@ -490,7 +490,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_analog_front =
490static snd_kcontrol_new_t snd_ca0106_volume_control_analog_center_lfe = 490static snd_kcontrol_new_t snd_ca0106_volume_control_analog_center_lfe =
491{ 491{
492 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 492 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
493 .name = "Analog Center/LFE Volume", 493 .name = "Analog Center/LFE Playback Volume",
494 .info = snd_ca0106_volume_info, 494 .info = snd_ca0106_volume_info,
495 .get = snd_ca0106_volume_get_analog_center_lfe, 495 .get = snd_ca0106_volume_get_analog_center_lfe,
496 .put = snd_ca0106_volume_put_analog_center_lfe 496 .put = snd_ca0106_volume_put_analog_center_lfe
@@ -498,7 +498,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_analog_center_lfe =
498static snd_kcontrol_new_t snd_ca0106_volume_control_analog_unknown = 498static snd_kcontrol_new_t snd_ca0106_volume_control_analog_unknown =
499{ 499{
500 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 500 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
501 .name = "Analog Side Volume", 501 .name = "Analog Side Playback Volume",
502 .info = snd_ca0106_volume_info, 502 .info = snd_ca0106_volume_info,
503 .get = snd_ca0106_volume_get_analog_unknown, 503 .get = snd_ca0106_volume_get_analog_unknown,
504 .put = snd_ca0106_volume_put_analog_unknown 504 .put = snd_ca0106_volume_put_analog_unknown
@@ -506,7 +506,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_analog_unknown =
506static snd_kcontrol_new_t snd_ca0106_volume_control_analog_rear = 506static snd_kcontrol_new_t snd_ca0106_volume_control_analog_rear =
507{ 507{
508 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 508 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
509 .name = "Analog Rear Volume", 509 .name = "Analog Rear Playback Volume",
510 .info = snd_ca0106_volume_info, 510 .info = snd_ca0106_volume_info,
511 .get = snd_ca0106_volume_get_analog_rear, 511 .get = snd_ca0106_volume_get_analog_rear,
512 .put = snd_ca0106_volume_put_analog_rear 512 .put = snd_ca0106_volume_put_analog_rear
@@ -514,7 +514,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_analog_rear =
514static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_front = 514static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_front =
515{ 515{
516 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 516 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
517 .name = "SPDIF Front Volume", 517 .name = "SPDIF Front Playback Volume",
518 .info = snd_ca0106_volume_info, 518 .info = snd_ca0106_volume_info,
519 .get = snd_ca0106_volume_get_spdif_front, 519 .get = snd_ca0106_volume_get_spdif_front,
520 .put = snd_ca0106_volume_put_spdif_front 520 .put = snd_ca0106_volume_put_spdif_front
@@ -522,7 +522,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_front =
522static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_center_lfe = 522static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_center_lfe =
523{ 523{
524 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 524 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
525 .name = "SPDIF Center/LFE Volume", 525 .name = "SPDIF Center/LFE Playback Volume",
526 .info = snd_ca0106_volume_info, 526 .info = snd_ca0106_volume_info,
527 .get = snd_ca0106_volume_get_spdif_center_lfe, 527 .get = snd_ca0106_volume_get_spdif_center_lfe,
528 .put = snd_ca0106_volume_put_spdif_center_lfe 528 .put = snd_ca0106_volume_put_spdif_center_lfe
@@ -530,7 +530,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_center_lfe =
530static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_unknown = 530static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_unknown =
531{ 531{
532 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 532 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
533 .name = "SPDIF Unknown Volume", 533 .name = "SPDIF Unknown Playback Volume",
534 .info = snd_ca0106_volume_info, 534 .info = snd_ca0106_volume_info,
535 .get = snd_ca0106_volume_get_spdif_unknown, 535 .get = snd_ca0106_volume_get_spdif_unknown,
536 .put = snd_ca0106_volume_put_spdif_unknown 536 .put = snd_ca0106_volume_put_spdif_unknown
@@ -538,7 +538,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_unknown =
538static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_rear = 538static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_rear =
539{ 539{
540 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 540 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
541 .name = "SPDIF Rear Volume", 541 .name = "SPDIF Rear Playback Volume",
542 .info = snd_ca0106_volume_info, 542 .info = snd_ca0106_volume_info,
543 .get = snd_ca0106_volume_get_spdif_rear, 543 .get = snd_ca0106_volume_get_spdif_rear,
544 .put = snd_ca0106_volume_put_spdif_rear 544 .put = snd_ca0106_volume_put_spdif_rear
@@ -547,7 +547,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_rear =
547static snd_kcontrol_new_t snd_ca0106_volume_control_feedback = 547static snd_kcontrol_new_t snd_ca0106_volume_control_feedback =
548{ 548{
549 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 549 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
550 .name = "CAPTURE feedback into PLAYBACK", 550 .name = "CAPTURE feedback Playback Volume",
551 .info = snd_ca0106_volume_info, 551 .info = snd_ca0106_volume_info,
552 .get = snd_ca0106_volume_get_feedback, 552 .get = snd_ca0106_volume_get_feedback,
553 .put = snd_ca0106_volume_put_feedback 553 .put = snd_ca0106_volume_put_feedback
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index b098b51099c2..1eb3315d136d 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -79,13 +79,6 @@ module_param_array(joystick_port, int, NULL, 0444);
79MODULE_PARM_DESC(joystick_port, "Joystick port address."); 79MODULE_PARM_DESC(joystick_port, "Joystick port address.");
80#endif 80#endif
81 81
82#ifndef PCI_DEVICE_ID_CMEDIA_CM8738
83#define PCI_DEVICE_ID_CMEDIA_CM8738 0x0111
84#endif
85#ifndef PCI_DEVICE_ID_CMEDIA_CM8738B
86#define PCI_DEVICE_ID_CMEDIA_CM8738B 0x0112
87#endif
88
89/* 82/*
90 * CM8x38 registers definition 83 * CM8x38 registers definition
91 */ 84 */
@@ -348,25 +341,6 @@ MODULE_PARM_DESC(joystick_port, "Joystick port address.");
348 341
349 342
350/* 343/*
351 * pci ids
352 */
353#ifndef PCI_VENDOR_ID_CMEDIA
354#define PCI_VENDOR_ID_CMEDIA 0x13F6
355#endif
356#ifndef PCI_DEVICE_ID_CMEDIA_CM8338A
357#define PCI_DEVICE_ID_CMEDIA_CM8338A 0x0100
358#endif
359#ifndef PCI_DEVICE_ID_CMEDIA_CM8338B
360#define PCI_DEVICE_ID_CMEDIA_CM8338B 0x0101
361#endif
362#ifndef PCI_DEVICE_ID_CMEDIA_CM8738
363#define PCI_DEVICE_ID_CMEDIA_CM8738 0x0111
364#endif
365#ifndef PCI_DEVICE_ID_CMEDIA_CM8738B
366#define PCI_DEVICE_ID_CMEDIA_CM8738B 0x0112
367#endif
368
369/*
370 * channels for playback / capture 344 * channels for playback / capture
371 */ 345 */
372#define CM_CH_PLAY 0 346#define CM_CH_PLAY 0
@@ -2801,7 +2775,7 @@ static int __devinit snd_cmipci_create(snd_card_t *card, struct pci_dev *pci,
2801 if ((err = pci_enable_device(pci)) < 0) 2775 if ((err = pci_enable_device(pci)) < 0)
2802 return err; 2776 return err;
2803 2777
2804 cm = kcalloc(1, sizeof(*cm), GFP_KERNEL); 2778 cm = kzalloc(sizeof(*cm), GFP_KERNEL);
2805 if (cm == NULL) { 2779 if (cm == NULL) {
2806 pci_disable_device(pci); 2780 pci_disable_device(pci);
2807 return -ENOMEM; 2781 return -ENOMEM;
@@ -3063,6 +3037,7 @@ static void __devexit snd_cmipci_remove(struct pci_dev *pci)
3063 3037
3064static struct pci_driver driver = { 3038static struct pci_driver driver = {
3065 .name = "C-Media PCI", 3039 .name = "C-Media PCI",
3040 .owner = THIS_MODULE,
3066 .id_table = snd_cmipci_ids, 3041 .id_table = snd_cmipci_ids,
3067 .probe = snd_cmipci_probe, 3042 .probe = snd_cmipci_probe,
3068 .remove = __devexit_p(snd_cmipci_remove), 3043 .remove = __devexit_p(snd_cmipci_remove),
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c
index c7a370d4f923..dc87e0144b5a 100644
--- a/sound/pci/cs4281.c
+++ b/sound/pci/cs4281.c
@@ -57,17 +57,6 @@ module_param_array(dual_codec, bool, NULL, 0444);
57MODULE_PARM_DESC(dual_codec, "Secondary Codec ID (0 = disabled)."); 57MODULE_PARM_DESC(dual_codec, "Secondary Codec ID (0 = disabled).");
58 58
59/* 59/*
60 *
61 */
62
63#ifndef PCI_VENDOR_ID_CIRRUS
64#define PCI_VENDOR_ID_CIRRUS 0x1013
65#endif
66#ifndef PCI_DEVICE_ID_CIRRUS_4281
67#define PCI_DEVICE_ID_CIRRUS_4281 0x6005
68#endif
69
70/*
71 * Direct registers 60 * Direct registers
72 */ 61 */
73 62
@@ -1394,7 +1383,7 @@ static int __devinit snd_cs4281_create(snd_card_t * card,
1394 *rchip = NULL; 1383 *rchip = NULL;
1395 if ((err = pci_enable_device(pci)) < 0) 1384 if ((err = pci_enable_device(pci)) < 0)
1396 return err; 1385 return err;
1397 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1386 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1398 if (chip == NULL) { 1387 if (chip == NULL) {
1399 pci_disable_device(pci); 1388 pci_disable_device(pci);
1400 return -ENOMEM; 1389 return -ENOMEM;
@@ -2119,6 +2108,7 @@ static int cs4281_resume(snd_card_t *card)
2119 2108
2120static struct pci_driver driver = { 2109static struct pci_driver driver = {
2121 .name = "CS4281", 2110 .name = "CS4281",
2111 .owner = THIS_MODULE,
2122 .id_table = snd_cs4281_ids, 2112 .id_table = snd_cs4281_ids,
2123 .probe = snd_cs4281_probe, 2113 .probe = snd_cs4281_probe,
2124 .remove = __devexit_p(snd_cs4281_remove), 2114 .remove = __devexit_p(snd_cs4281_remove),
diff --git a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c
index b9fff4ee6f9d..32b4f8465cef 100644
--- a/sound/pci/cs46xx/cs46xx.c
+++ b/sound/pci/cs46xx/cs46xx.c
@@ -163,6 +163,7 @@ static void __devexit snd_card_cs46xx_remove(struct pci_dev *pci)
163 163
164static struct pci_driver driver = { 164static struct pci_driver driver = {
165 .name = "Sound Fusion CS46xx", 165 .name = "Sound Fusion CS46xx",
166 .owner = THIS_MODULE,
166 .id_table = snd_cs46xx_ids, 167 .id_table = snd_cs46xx_ids,
167 .probe = snd_card_cs46xx_probe, 168 .probe = snd_card_cs46xx_probe,
168 .remove = __devexit_p(snd_card_cs46xx_remove), 169 .remove = __devexit_p(snd_card_cs46xx_remove),
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index 4b052158ee33..6e3855b8b33d 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -1304,7 +1304,7 @@ static int _cs46xx_playback_open_channel (snd_pcm_substream_t * substream,int pc
1304 cs46xx_pcm_t * cpcm; 1304 cs46xx_pcm_t * cpcm;
1305 snd_pcm_runtime_t *runtime = substream->runtime; 1305 snd_pcm_runtime_t *runtime = substream->runtime;
1306 1306
1307 cpcm = kcalloc(1, sizeof(*cpcm), GFP_KERNEL); 1307 cpcm = kzalloc(sizeof(*cpcm), GFP_KERNEL);
1308 if (cpcm == NULL) 1308 if (cpcm == NULL)
1309 return -ENOMEM; 1309 return -ENOMEM;
1310 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), 1310 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
@@ -3525,17 +3525,6 @@ static void amp_voyetra_4294(cs46xx_t *chip, int change)
3525 3525
3526 3526
3527/* 3527/*
3528 * piix4 pci ids
3529 */
3530#ifndef PCI_VENDOR_ID_INTEL
3531#define PCI_VENDOR_ID_INTEL 0x8086
3532#endif /* PCI_VENDOR_ID_INTEL */
3533
3534#ifndef PCI_DEVICE_ID_INTEL_82371AB_3
3535#define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113
3536#endif /* PCI_DEVICE_ID_INTEL_82371AB_3 */
3537
3538/*
3539 * Handle the CLKRUN on a thinkpad. We must disable CLKRUN support 3528 * Handle the CLKRUN on a thinkpad. We must disable CLKRUN support
3540 * whenever we need to beat on the chip. 3529 * whenever we need to beat on the chip.
3541 * 3530 *
@@ -3548,7 +3537,7 @@ static void clkrun_hack(cs46xx_t *chip, int change)
3548{ 3537{
3549 u16 control, nval; 3538 u16 control, nval;
3550 3539
3551 if (chip->acpi_dev == NULL) 3540 if (!chip->acpi_port)
3552 return; 3541 return;
3553 3542
3554 chip->amplifier += change; 3543 chip->amplifier += change;
@@ -3571,15 +3560,20 @@ static void clkrun_hack(cs46xx_t *chip, int change)
3571 */ 3560 */
3572static void clkrun_init(cs46xx_t *chip) 3561static void clkrun_init(cs46xx_t *chip)
3573{ 3562{
3563 struct pci_dev *pdev;
3574 u8 pp; 3564 u8 pp;
3575 3565
3576 chip->acpi_dev = pci_find_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, NULL); 3566 chip->acpi_port = 0;
3577 if (chip->acpi_dev == NULL) 3567
3568 pdev = pci_get_device(PCI_VENDOR_ID_INTEL,
3569 PCI_DEVICE_ID_INTEL_82371AB_3, NULL);
3570 if (pdev == NULL)
3578 return; /* Not a thinkpad thats for sure */ 3571 return; /* Not a thinkpad thats for sure */
3579 3572
3580 /* Find the control port */ 3573 /* Find the control port */
3581 pci_read_config_byte(chip->acpi_dev, 0x41, &pp); 3574 pci_read_config_byte(pdev, 0x41, &pp);
3582 chip->acpi_port = pp << 8; 3575 chip->acpi_port = pp << 8;
3576 pci_dev_put(pdev);
3583} 3577}
3584 3578
3585 3579
@@ -3780,7 +3774,7 @@ int __devinit snd_cs46xx_create(snd_card_t * card,
3780 if ((err = pci_enable_device(pci)) < 0) 3774 if ((err = pci_enable_device(pci)) < 0)
3781 return err; 3775 return err;
3782 3776
3783 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 3777 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
3784 if (chip == NULL) { 3778 if (chip == NULL) {
3785 pci_disable_device(pci); 3779 pci_disable_device(pci);
3786 return -ENOMEM; 3780 return -ENOMEM;
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c
index fc377c4b666c..b0e00f0a7c2f 100644
--- a/sound/pci/emu10k1/emu10k1.c
+++ b/sound/pci/emu10k1/emu10k1.c
@@ -223,6 +223,7 @@ static void __devexit snd_card_emu10k1_remove(struct pci_dev *pci)
223 223
224static struct pci_driver driver = { 224static struct pci_driver driver = {
225 .name = "EMU10K1_Audigy", 225 .name = "EMU10K1_Audigy",
226 .owner = THIS_MODULE,
226 .id_table = snd_emu10k1_ids, 227 .id_table = snd_emu10k1_ids,
227 .probe = snd_card_emu10k1_probe, 228 .probe = snd_card_emu10k1_probe,
228 .remove = __devexit_p(snd_card_emu10k1_remove), 229 .remove = __devexit_p(snd_card_emu10k1_remove),
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index e69d5b739e80..e87e8427f25f 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -754,12 +754,11 @@ static emu_chip_details_t emu_chip_details[] = {
754 .emu10k1_chip = 1, 754 .emu10k1_chip = 1,
755 .ac97_chip = 1, 755 .ac97_chip = 1,
756 .sblive51 = 1} , 756 .sblive51 = 1} ,
757 /* Tested by alsa bugtrack user "hus" 12th Sept 2005 */ 757 /* Tested by alsa bugtrack user "hus" bug #1297 12th Aug 2005 */
758 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102, 758 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102,
759 .driver = "EMU10K1", .name = "SBLive! Player 5.1 [SB0060]", 759 .driver = "EMU10K1", .name = "SBLive! Platinum 5.1 [SB0060]",
760 .id = "Live", 760 .id = "Live",
761 .emu10k1_chip = 1, 761 .emu10k1_chip = 1,
762 .ac97_chip = 1,
763 .sblive51 = 1} , 762 .sblive51 = 1} ,
764 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80511102, 763 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80511102,
765 .driver = "EMU10K1", .name = "SBLive! Value [CT4850]", 764 .driver = "EMU10K1", .name = "SBLive! Value [CT4850]",
@@ -865,7 +864,7 @@ int __devinit snd_emu10k1_create(snd_card_t * card,
865 if ((err = pci_enable_device(pci)) < 0) 864 if ((err = pci_enable_device(pci)) < 0)
866 return err; 865 return err;
867 866
868 emu = kcalloc(1, sizeof(*emu), GFP_KERNEL); 867 emu = kzalloc(sizeof(*emu), GFP_KERNEL);
869 if (emu == NULL) { 868 if (emu == NULL) {
870 pci_disable_device(pci); 869 pci_disable_device(pci);
871 return -ENOMEM; 870 return -ENOMEM;
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c
index 52c7826df440..ad15755a63c3 100644
--- a/sound/pci/emu10k1/emu10k1x.c
+++ b/sound/pci/emu10k1/emu10k1x.c
@@ -395,7 +395,7 @@ static int snd_emu10k1x_playback_open(snd_pcm_substream_t *substream)
395 if ((err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64)) < 0) 395 if ((err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64)) < 0)
396 return err; 396 return err;
397 397
398 epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); 398 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
399 if (epcm == NULL) 399 if (epcm == NULL)
400 return -ENOMEM; 400 return -ENOMEM;
401 epcm->emu = chip; 401 epcm->emu = chip;
@@ -571,7 +571,7 @@ static int snd_emu10k1x_pcm_open_capture(snd_pcm_substream_t *substream)
571 if ((err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64)) < 0) 571 if ((err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64)) < 0)
572 return err; 572 return err;
573 573
574 epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); 574 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
575 if (epcm == NULL) 575 if (epcm == NULL)
576 return -ENOMEM; 576 return -ENOMEM;
577 577
@@ -920,7 +920,7 @@ static int __devinit snd_emu10k1x_create(snd_card_t *card,
920 return -ENXIO; 920 return -ENXIO;
921 } 921 }
922 922
923 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 923 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
924 if (chip == NULL) { 924 if (chip == NULL) {
925 pci_disable_device(pci); 925 pci_disable_device(pci);
926 return -ENOMEM; 926 return -ENOMEM;
@@ -1615,6 +1615,7 @@ MODULE_DEVICE_TABLE(pci, snd_emu10k1x_ids);
1615// pci_driver definition 1615// pci_driver definition
1616static struct pci_driver driver = { 1616static struct pci_driver driver = {
1617 .name = "EMU10K1X", 1617 .name = "EMU10K1X",
1618 .owner = THIS_MODULE,
1618 .id_table = snd_emu10k1x_ids, 1619 .id_table = snd_emu10k1x_ids,
1619 .probe = snd_emu10k1x_probe, 1620 .probe = snd_emu10k1x_probe,
1620 .remove = __devexit_p(snd_emu10k1x_remove), 1621 .remove = __devexit_p(snd_emu10k1x_remove),
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index 637c555cfdb1..646b5d972e6f 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -470,7 +470,7 @@ static void snd_emu10k1_write_op(emu10k1_fx8010_code_t *icode, unsigned int *ptr
470{ 470{
471 u_int32_t *code; 471 u_int32_t *code;
472 snd_assert(*ptr < 512, return); 472 snd_assert(*ptr < 512, return);
473 code = (u_int32_t *)icode->code + (*ptr) * 2; 473 code = (u_int32_t __force *)icode->code + (*ptr) * 2;
474 set_bit(*ptr, icode->code_valid); 474 set_bit(*ptr, icode->code_valid);
475 code[0] = ((x & 0x3ff) << 10) | (y & 0x3ff); 475 code[0] = ((x & 0x3ff) << 10) | (y & 0x3ff);
476 code[1] = ((op & 0x0f) << 20) | ((r & 0x3ff) << 10) | (a & 0x3ff); 476 code[1] = ((op & 0x0f) << 20) | ((r & 0x3ff) << 10) | (a & 0x3ff);
@@ -485,7 +485,7 @@ static void snd_emu10k1_audigy_write_op(emu10k1_fx8010_code_t *icode, unsigned i
485{ 485{
486 u_int32_t *code; 486 u_int32_t *code;
487 snd_assert(*ptr < 1024, return); 487 snd_assert(*ptr < 1024, return);
488 code = (u_int32_t *)icode->code + (*ptr) * 2; 488 code = (u_int32_t __force *)icode->code + (*ptr) * 2;
489 set_bit(*ptr, icode->code_valid); 489 set_bit(*ptr, icode->code_valid);
490 code[0] = ((x & 0x7ff) << 12) | (y & 0x7ff); 490 code[0] = ((x & 0x7ff) << 12) | (y & 0x7ff);
491 code[1] = ((op & 0x0f) << 24) | ((r & 0x7ff) << 12) | (a & 0x7ff); 491 code[1] = ((op & 0x0f) << 24) | ((r & 0x7ff) << 12) | (a & 0x7ff);
@@ -1036,13 +1036,13 @@ static int __devinit _snd_emu10k1_audigy_init_efx(emu10k1_t *emu)
1036 spin_lock_init(&emu->fx8010.irq_lock); 1036 spin_lock_init(&emu->fx8010.irq_lock);
1037 INIT_LIST_HEAD(&emu->fx8010.gpr_ctl); 1037 INIT_LIST_HEAD(&emu->fx8010.gpr_ctl);
1038 1038
1039 if ((icode = kcalloc(1, sizeof(*icode), GFP_KERNEL)) == NULL || 1039 if ((icode = kzalloc(sizeof(*icode), GFP_KERNEL)) == NULL ||
1040 (icode->gpr_map = (u_int32_t __user *)kcalloc(512 + 256 + 256 + 2 * 1024, sizeof(u_int32_t), GFP_KERNEL)) == NULL || 1040 (icode->gpr_map = (u_int32_t __user *)kcalloc(512 + 256 + 256 + 2 * 1024, sizeof(u_int32_t), GFP_KERNEL)) == NULL ||
1041 (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS, sizeof(*controls), GFP_KERNEL)) == NULL) { 1041 (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS, sizeof(*controls), GFP_KERNEL)) == NULL) {
1042 err = -ENOMEM; 1042 err = -ENOMEM;
1043 goto __err; 1043 goto __err;
1044 } 1044 }
1045 gpr_map = (u32 *)icode->gpr_map; 1045 gpr_map = (u32 __force *)icode->gpr_map;
1046 1046
1047 icode->tram_data_map = icode->gpr_map + 512; 1047 icode->tram_data_map = icode->gpr_map + 512;
1048 icode->tram_addr_map = icode->tram_data_map + 256; 1048 icode->tram_addr_map = icode->tram_data_map + 256;
@@ -1431,7 +1431,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))
1431 __err: 1431 __err:
1432 kfree(controls); 1432 kfree(controls);
1433 if (icode != NULL) { 1433 if (icode != NULL) {
1434 kfree((void *)icode->gpr_map); 1434 kfree((void __force *)icode->gpr_map);
1435 kfree(icode); 1435 kfree(icode);
1436 } 1436 }
1437 return err; 1437 return err;
@@ -1503,15 +1503,15 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu)
1503 spin_lock_init(&emu->fx8010.irq_lock); 1503 spin_lock_init(&emu->fx8010.irq_lock);
1504 INIT_LIST_HEAD(&emu->fx8010.gpr_ctl); 1504 INIT_LIST_HEAD(&emu->fx8010.gpr_ctl);
1505 1505
1506 if ((icode = kcalloc(1, sizeof(*icode), GFP_KERNEL)) == NULL) 1506 if ((icode = kzalloc(sizeof(*icode), GFP_KERNEL)) == NULL)
1507 return -ENOMEM; 1507 return -ENOMEM;
1508 if ((icode->gpr_map = (u_int32_t __user *)kcalloc(256 + 160 + 160 + 2 * 512, sizeof(u_int32_t), GFP_KERNEL)) == NULL || 1508 if ((icode->gpr_map = (u_int32_t __user *)kcalloc(256 + 160 + 160 + 2 * 512, sizeof(u_int32_t), GFP_KERNEL)) == NULL ||
1509 (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS, sizeof(emu10k1_fx8010_control_gpr_t), GFP_KERNEL)) == NULL || 1509 (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS, sizeof(emu10k1_fx8010_control_gpr_t), GFP_KERNEL)) == NULL ||
1510 (ipcm = kcalloc(1, sizeof(*ipcm), GFP_KERNEL)) == NULL) { 1510 (ipcm = kzalloc(sizeof(*ipcm), GFP_KERNEL)) == NULL) {
1511 err = -ENOMEM; 1511 err = -ENOMEM;
1512 goto __err; 1512 goto __err;
1513 } 1513 }
1514 gpr_map = (u32 *)icode->gpr_map; 1514 gpr_map = (u32 __force *)icode->gpr_map;
1515 1515
1516 icode->tram_data_map = icode->gpr_map + 256; 1516 icode->tram_data_map = icode->gpr_map + 256;
1517 icode->tram_addr_map = icode->tram_data_map + 160; 1517 icode->tram_addr_map = icode->tram_data_map + 160;
@@ -2032,7 +2032,7 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu)
2032 kfree(ipcm); 2032 kfree(ipcm);
2033 kfree(controls); 2033 kfree(controls);
2034 if (icode != NULL) { 2034 if (icode != NULL) {
2035 kfree((void *)icode->gpr_map); 2035 kfree((void __force *)icode->gpr_map);
2036 kfree(icode); 2036 kfree(icode);
2037 } 2037 }
2038 return err; 2038 return err;
@@ -2217,7 +2217,7 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne
2217 kfree(ipcm); 2217 kfree(ipcm);
2218 return res; 2218 return res;
2219 case SNDRV_EMU10K1_IOCTL_PCM_PEEK: 2219 case SNDRV_EMU10K1_IOCTL_PCM_PEEK:
2220 ipcm = kcalloc(1, sizeof(*ipcm), GFP_KERNEL); 2220 ipcm = kzalloc(sizeof(*ipcm), GFP_KERNEL);
2221 if (ipcm == NULL) 2221 if (ipcm == NULL)
2222 return -ENOMEM; 2222 return -ENOMEM;
2223 if (copy_from_user(ipcm, argp, sizeof(*ipcm))) { 2223 if (copy_from_user(ipcm, argp, sizeof(*ipcm))) {
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
index 9c35f6dde1b5..66ba27afe962 100644
--- a/sound/pci/emu10k1/emupcm.c
+++ b/sound/pci/emu10k1/emupcm.c
@@ -1016,7 +1016,7 @@ static int snd_emu10k1_efx_playback_open(snd_pcm_substream_t * substream)
1016 snd_pcm_runtime_t *runtime = substream->runtime; 1016 snd_pcm_runtime_t *runtime = substream->runtime;
1017 int i; 1017 int i;
1018 1018
1019 epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); 1019 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
1020 if (epcm == NULL) 1020 if (epcm == NULL)
1021 return -ENOMEM; 1021 return -ENOMEM;
1022 epcm->emu = emu; 1022 epcm->emu = emu;
@@ -1049,7 +1049,7 @@ static int snd_emu10k1_playback_open(snd_pcm_substream_t * substream)
1049 snd_pcm_runtime_t *runtime = substream->runtime; 1049 snd_pcm_runtime_t *runtime = substream->runtime;
1050 int i, err; 1050 int i, err;
1051 1051
1052 epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); 1052 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
1053 if (epcm == NULL) 1053 if (epcm == NULL)
1054 return -ENOMEM; 1054 return -ENOMEM;
1055 epcm->emu = emu; 1055 epcm->emu = emu;
@@ -1094,7 +1094,7 @@ static int snd_emu10k1_capture_open(snd_pcm_substream_t * substream)
1094 snd_pcm_runtime_t *runtime = substream->runtime; 1094 snd_pcm_runtime_t *runtime = substream->runtime;
1095 emu10k1_pcm_t *epcm; 1095 emu10k1_pcm_t *epcm;
1096 1096
1097 epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); 1097 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
1098 if (epcm == NULL) 1098 if (epcm == NULL)
1099 return -ENOMEM; 1099 return -ENOMEM;
1100 epcm->emu = emu; 1100 epcm->emu = emu;
@@ -1130,7 +1130,7 @@ static int snd_emu10k1_capture_mic_open(snd_pcm_substream_t * substream)
1130 emu10k1_pcm_t *epcm; 1130 emu10k1_pcm_t *epcm;
1131 snd_pcm_runtime_t *runtime = substream->runtime; 1131 snd_pcm_runtime_t *runtime = substream->runtime;
1132 1132
1133 epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); 1133 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
1134 if (epcm == NULL) 1134 if (epcm == NULL)
1135 return -ENOMEM; 1135 return -ENOMEM;
1136 epcm->emu = emu; 1136 epcm->emu = emu;
@@ -1170,7 +1170,7 @@ static int snd_emu10k1_capture_efx_open(snd_pcm_substream_t * substream)
1170 int nefx = emu->audigy ? 64 : 32; 1170 int nefx = emu->audigy ? 64 : 32;
1171 int idx; 1171 int idx;
1172 1172
1173 epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); 1173 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
1174 if (epcm == NULL) 1174 if (epcm == NULL)
1175 return -ENOMEM; 1175 return -ENOMEM;
1176 epcm->emu = emu; 1176 epcm->emu = emu;
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c
index a1691330d3b6..d59c7f345ad6 100644
--- a/sound/pci/emu10k1/p16v.c
+++ b/sound/pci/emu10k1/p16v.c
@@ -178,7 +178,7 @@ static int snd_p16v_pcm_open_playback_channel(snd_pcm_substream_t *substream, in
178 snd_pcm_runtime_t *runtime = substream->runtime; 178 snd_pcm_runtime_t *runtime = substream->runtime;
179 int err; 179 int err;
180 180
181 epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); 181 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
182 //snd_printk("epcm kcalloc: %p\n", epcm); 182 //snd_printk("epcm kcalloc: %p\n", epcm);
183 183
184 if (epcm == NULL) 184 if (epcm == NULL)
@@ -214,7 +214,7 @@ static int snd_p16v_pcm_open_capture_channel(snd_pcm_substream_t *substream, int
214 snd_pcm_runtime_t *runtime = substream->runtime; 214 snd_pcm_runtime_t *runtime = substream->runtime;
215 int err; 215 int err;
216 216
217 epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); 217 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
218 //snd_printk("epcm kcalloc: %p\n", epcm); 218 //snd_printk("epcm kcalloc: %p\n", epcm);
219 219
220 if (epcm == NULL) 220 if (epcm == NULL)
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index f06b95f41a1d..bef9a59f46d7 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -100,13 +100,6 @@ MODULE_PARM_DESC(joystick, "Enable joystick.");
100#endif 100#endif
101#endif /* SUPPORT_JOYSTICK */ 101#endif /* SUPPORT_JOYSTICK */
102 102
103#ifndef PCI_DEVICE_ID_ENSONIQ_CT5880
104#define PCI_DEVICE_ID_ENSONIQ_CT5880 0x5880
105#endif
106#ifndef PCI_DEVICE_ID_ENSONIQ_ES1371
107#define PCI_DEVICE_ID_ENSONIQ_ES1371 0x1371
108#endif
109
110/* ES1371 chip ID */ 103/* ES1371 chip ID */
111/* This is a little confusing because all ES1371 compatible chips have the 104/* This is a little confusing because all ES1371 compatible chips have the
112 same DEVICE_ID, the only thing differentiating them is the REV_ID field. 105 same DEVICE_ID, the only thing differentiating them is the REV_ID field.
@@ -1950,7 +1943,7 @@ static int __devinit snd_ensoniq_create(snd_card_t * card,
1950 *rensoniq = NULL; 1943 *rensoniq = NULL;
1951 if ((err = pci_enable_device(pci)) < 0) 1944 if ((err = pci_enable_device(pci)) < 0)
1952 return err; 1945 return err;
1953 ensoniq = kcalloc(1, sizeof(*ensoniq), GFP_KERNEL); 1946 ensoniq = kzalloc(sizeof(*ensoniq), GFP_KERNEL);
1954 if (ensoniq == NULL) { 1947 if (ensoniq == NULL) {
1955 pci_disable_device(pci); 1948 pci_disable_device(pci);
1956 return -ENOMEM; 1949 return -ENOMEM;
@@ -2394,6 +2387,7 @@ static void __devexit snd_audiopci_remove(struct pci_dev *pci)
2394 2387
2395static struct pci_driver driver = { 2388static struct pci_driver driver = {
2396 .name = DRIVER_NAME, 2389 .name = DRIVER_NAME,
2390 .owner = THIS_MODULE,
2397 .id_table = snd_audiopci_ids, 2391 .id_table = snd_audiopci_ids,
2398 .probe = snd_audiopci_probe, 2392 .probe = snd_audiopci_probe,
2399 .remove = __devexit_p(snd_audiopci_remove), 2393 .remove = __devexit_p(snd_audiopci_remove),
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index b492777bc30f..17fa80c23870 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -76,13 +76,6 @@ MODULE_SUPPORTED_DEVICE("{{ESS,ES1938},"
76#define SUPPORT_JOYSTICK 1 76#define SUPPORT_JOYSTICK 1
77#endif 77#endif
78 78
79#ifndef PCI_VENDOR_ID_ESS
80#define PCI_VENDOR_ID_ESS 0x125d
81#endif
82#ifndef PCI_DEVICE_ID_ESS_ES1938
83#define PCI_DEVICE_ID_ESS_ES1938 0x1969
84#endif
85
86static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 79static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
87static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 80static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
88static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 81static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
@@ -1501,7 +1494,7 @@ static int __devinit snd_es1938_create(snd_card_t * card,
1501 return -ENXIO; 1494 return -ENXIO;
1502 } 1495 }
1503 1496
1504 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1497 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1505 if (chip == NULL) { 1498 if (chip == NULL) {
1506 pci_disable_device(pci); 1499 pci_disable_device(pci);
1507 return -ENOMEM; 1500 return -ENOMEM;
@@ -1753,6 +1746,7 @@ static void __devexit snd_es1938_remove(struct pci_dev *pci)
1753 1746
1754static struct pci_driver driver = { 1747static struct pci_driver driver = {
1755 .name = "ESS ES1938 (Solo-1)", 1748 .name = "ESS ES1938 (Solo-1)",
1749 .owner = THIS_MODULE,
1756 .id_table = snd_es1938_ids, 1750 .id_table = snd_es1938_ids,
1757 .probe = snd_es1938_probe, 1751 .probe = snd_es1938_probe,
1758 .remove = __devexit_p(snd_es1938_remove), 1752 .remove = __devexit_p(snd_es1938_remove),
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index 9d7a28783930..ecdcada90ca2 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -160,25 +160,6 @@ MODULE_PARM_DESC(joystick, "Enable joystick.");
160#endif 160#endif
161 161
162 162
163/* PCI Dev ID's */
164
165#ifndef PCI_VENDOR_ID_ESS
166#define PCI_VENDOR_ID_ESS 0x125D
167#endif
168
169#define PCI_VENDOR_ID_ESS_OLD 0x1285 /* Platform Tech, the people the ESS
170 was bought form */
171
172#ifndef PCI_DEVICE_ID_ESS_M2E
173#define PCI_DEVICE_ID_ESS_M2E 0x1978
174#endif
175#ifndef PCI_DEVICE_ID_ESS_M2
176#define PCI_DEVICE_ID_ESS_M2 0x1968
177#endif
178#ifndef PCI_DEVICE_ID_ESS_M1
179#define PCI_DEVICE_ID_ESS_M1 0x0100
180#endif
181
182#define NR_APUS 64 163#define NR_APUS 64
183#define NR_APU_REGS 16 164#define NR_APU_REGS 16
184 165
@@ -1596,7 +1577,7 @@ static int snd_es1968_playback_open(snd_pcm_substream_t *substream)
1596 if (apu1 < 0) 1577 if (apu1 < 0)
1597 return apu1; 1578 return apu1;
1598 1579
1599 es = kcalloc(1, sizeof(*es), GFP_KERNEL); 1580 es = kzalloc(sizeof(*es), GFP_KERNEL);
1600 if (!es) { 1581 if (!es) {
1601 snd_es1968_free_apu_pair(chip, apu1); 1582 snd_es1968_free_apu_pair(chip, apu1);
1602 return -ENOMEM; 1583 return -ENOMEM;
@@ -1641,7 +1622,7 @@ static int snd_es1968_capture_open(snd_pcm_substream_t *substream)
1641 return apu2; 1622 return apu2;
1642 } 1623 }
1643 1624
1644 es = kcalloc(1, sizeof(*es), GFP_KERNEL); 1625 es = kzalloc(sizeof(*es), GFP_KERNEL);
1645 if (!es) { 1626 if (!es) {
1646 snd_es1968_free_apu_pair(chip, apu1); 1627 snd_es1968_free_apu_pair(chip, apu1);
1647 snd_es1968_free_apu_pair(chip, apu2); 1628 snd_es1968_free_apu_pair(chip, apu2);
@@ -2588,7 +2569,7 @@ static int __devinit snd_es1968_create(snd_card_t * card,
2588 return -ENXIO; 2569 return -ENXIO;
2589 } 2570 }
2590 2571
2591 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 2572 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
2592 if (! chip) { 2573 if (! chip) {
2593 pci_disable_device(pci); 2574 pci_disable_device(pci);
2594 return -ENOMEM; 2575 return -ENOMEM;
@@ -2782,6 +2763,7 @@ static void __devexit snd_es1968_remove(struct pci_dev *pci)
2782 2763
2783static struct pci_driver driver = { 2764static struct pci_driver driver = {
2784 .name = "ES1968 (ESS Maestro)", 2765 .name = "ES1968 (ESS Maestro)",
2766 .owner = THIS_MODULE,
2785 .id_table = snd_es1968_ids, 2767 .id_table = snd_es1968_ids,
2786 .probe = snd_es1968_probe, 2768 .probe = snd_es1968_probe,
2787 .remove = __devexit_p(snd_es1968_remove), 2769 .remove = __devexit_p(snd_es1968_remove),
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index 36b2f62e8573..e5cfa2a0c246 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -1263,7 +1263,7 @@ static int __devinit snd_fm801_create(snd_card_t * card,
1263 *rchip = NULL; 1263 *rchip = NULL;
1264 if ((err = pci_enable_device(pci)) < 0) 1264 if ((err = pci_enable_device(pci)) < 0)
1265 return err; 1265 return err;
1266 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1266 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1267 if (chip == NULL) { 1267 if (chip == NULL) {
1268 pci_disable_device(pci); 1268 pci_disable_device(pci);
1269 return -ENOMEM; 1269 return -ENOMEM;
@@ -1462,6 +1462,7 @@ static void __devexit snd_card_fm801_remove(struct pci_dev *pci)
1462 1462
1463static struct pci_driver driver = { 1463static struct pci_driver driver = {
1464 .name = "FM801", 1464 .name = "FM801",
1465 .owner = THIS_MODULE,
1465 .id_table = snd_fm801_ids, 1466 .id_table = snd_fm801_ids,
1466 .probe = snd_card_fm801_probe, 1467 .probe = snd_card_fm801_probe,
1467 .remove = __devexit_p(snd_card_fm801_remove), 1468 .remove = __devexit_p(snd_card_fm801_remove),
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 20f7762f7144..3815403ed095 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -288,7 +288,7 @@ static int init_unsol_queue(struct hda_bus *bus)
288{ 288{
289 struct hda_bus_unsolicited *unsol; 289 struct hda_bus_unsolicited *unsol;
290 290
291 unsol = kcalloc(1, sizeof(*unsol), GFP_KERNEL); 291 unsol = kzalloc(sizeof(*unsol), GFP_KERNEL);
292 if (! unsol) { 292 if (! unsol) {
293 snd_printk(KERN_ERR "hda_codec: can't allocate unsolicited queue\n"); 293 snd_printk(KERN_ERR "hda_codec: can't allocate unsolicited queue\n");
294 return -ENOMEM; 294 return -ENOMEM;
@@ -358,7 +358,7 @@ int snd_hda_bus_new(snd_card_t *card, const struct hda_bus_template *temp,
358 if (busp) 358 if (busp)
359 *busp = NULL; 359 *busp = NULL;
360 360
361 bus = kcalloc(1, sizeof(*bus), GFP_KERNEL); 361 bus = kzalloc(sizeof(*bus), GFP_KERNEL);
362 if (bus == NULL) { 362 if (bus == NULL) {
363 snd_printk(KERN_ERR "can't allocate struct hda_bus\n"); 363 snd_printk(KERN_ERR "can't allocate struct hda_bus\n");
364 return -ENOMEM; 364 return -ENOMEM;
@@ -493,7 +493,7 @@ int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr,
493 return -EBUSY; 493 return -EBUSY;
494 } 494 }
495 495
496 codec = kcalloc(1, sizeof(*codec), GFP_KERNEL); 496 codec = kzalloc(sizeof(*codec), GFP_KERNEL);
497 if (codec == NULL) { 497 if (codec == NULL) {
498 snd_printk(KERN_ERR "can't allocate struct hda_codec\n"); 498 snd_printk(KERN_ERR "can't allocate struct hda_codec\n");
499 return -ENOMEM; 499 return -ENOMEM;
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 63a29a8a2860..bb53bcf76742 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -505,6 +505,7 @@ struct hda_pcm_stream {
505struct hda_pcm { 505struct hda_pcm {
506 char *name; 506 char *name;
507 struct hda_pcm_stream stream[2]; 507 struct hda_pcm_stream stream[2];
508 unsigned int is_modem; /* modem codec? */
508}; 509};
509 510
510/* codec information */ 511/* codec information */
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 1229227af5b5..5b829a1a4c60 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -98,7 +98,7 @@ static int add_new_node(struct hda_codec *codec, struct hda_gspec *spec, hda_nid
98 struct hda_gnode *node; 98 struct hda_gnode *node;
99 int nconns; 99 int nconns;
100 100
101 node = kcalloc(1, sizeof(*node), GFP_KERNEL); 101 node = kzalloc(sizeof(*node), GFP_KERNEL);
102 if (node == NULL) 102 if (node == NULL)
103 return -ENOMEM; 103 return -ENOMEM;
104 node->nid = nid; 104 node->nid = nid;
@@ -886,7 +886,7 @@ int snd_hda_parse_generic_codec(struct hda_codec *codec)
886 return -ENODEV; 886 return -ENODEV;
887 } 887 }
888 888
889 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 889 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
890 if (spec == NULL) { 890 if (spec == NULL) {
891 printk(KERN_ERR "hda_generic: can't allocate spec\n"); 891 printk(KERN_ERR "hda_generic: can't allocate spec\n");
892 return -ENOMEM; 892 return -ENOMEM;
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 15107df1f490..9590ece2099d 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -62,7 +62,7 @@ MODULE_PARM_DESC(enable, "Enable Intel HD audio interface.");
62module_param_array(model, charp, NULL, 0444); 62module_param_array(model, charp, NULL, 0444);
63MODULE_PARM_DESC(model, "Use the given board model."); 63MODULE_PARM_DESC(model, "Use the given board model.");
64module_param_array(position_fix, int, NULL, 0444); 64module_param_array(position_fix, int, NULL, 0444);
65MODULE_PARM_DESC(position_fix, "Fix DMA pointer (0 = FIFO size, 1 = none, 2 = POSBUF)."); 65MODULE_PARM_DESC(position_fix, "Fix DMA pointer (0 = auto, 1 = none, 2 = POSBUF, 3 = FIFO size).");
66 66
67MODULE_LICENSE("GPL"); 67MODULE_LICENSE("GPL");
68MODULE_SUPPORTED_DEVICE("{{Intel, ICH6}," 68MODULE_SUPPORTED_DEVICE("{{Intel, ICH6},"
@@ -164,7 +164,9 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
164/* max buffer size - no h/w limit, you can increase as you like */ 164/* max buffer size - no h/w limit, you can increase as you like */
165#define AZX_MAX_BUF_SIZE (1024*1024*1024) 165#define AZX_MAX_BUF_SIZE (1024*1024*1024)
166/* max number of PCM devics per card */ 166/* max number of PCM devics per card */
167#define AZX_MAX_PCMS 8 167#define AZX_MAX_AUDIO_PCMS 6
168#define AZX_MAX_MODEM_PCMS 2
169#define AZX_MAX_PCMS (AZX_MAX_AUDIO_PCMS + AZX_MAX_MODEM_PCMS)
168 170
169/* RIRB int mask: overrun[2], response[0] */ 171/* RIRB int mask: overrun[2], response[0] */
170#define RIRB_INT_RESPONSE 0x01 172#define RIRB_INT_RESPONSE 0x01
@@ -211,9 +213,10 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
211 213
212/* position fix mode */ 214/* position fix mode */
213enum { 215enum {
214 POS_FIX_FIFO, 216 POS_FIX_AUTO,
215 POS_FIX_NONE, 217 POS_FIX_NONE,
216 POS_FIX_POSBUF 218 POS_FIX_POSBUF,
219 POS_FIX_FIFO,
217}; 220};
218 221
219/* Defines for ATI HD Audio support in SB450 south bridge */ 222/* Defines for ATI HD Audio support in SB450 south bridge */
@@ -243,6 +246,7 @@ struct snd_azx_dev {
243 unsigned int fragsize; /* size of each period in bytes */ 246 unsigned int fragsize; /* size of each period in bytes */
244 unsigned int frags; /* number for period in the play buffer */ 247 unsigned int frags; /* number for period in the play buffer */
245 unsigned int fifo_size; /* FIFO size */ 248 unsigned int fifo_size; /* FIFO size */
249 unsigned int last_pos; /* last updated period position */
246 250
247 void __iomem *sd_addr; /* stream descriptor pointer */ 251 void __iomem *sd_addr; /* stream descriptor pointer */
248 252
@@ -256,6 +260,7 @@ struct snd_azx_dev {
256 260
257 unsigned int opened: 1; 261 unsigned int opened: 1;
258 unsigned int running: 1; 262 unsigned int running: 1;
263 unsigned int period_updating: 1;
259}; 264};
260 265
261/* CORB/RIRB */ 266/* CORB/RIRB */
@@ -724,11 +729,9 @@ static void azx_init_chip(azx_t *chip)
724 /* initialize the codec command I/O */ 729 /* initialize the codec command I/O */
725 azx_init_cmd_io(chip); 730 azx_init_cmd_io(chip);
726 731
727 if (chip->position_fix == POS_FIX_POSBUF) { 732 /* program the position buffer */
728 /* program the position buffer */ 733 azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr);
729 azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr); 734 azx_writel(chip, DPUBASE, upper_32bit(chip->posbuf.addr));
730 azx_writel(chip, DPUBASE, upper_32bit(chip->posbuf.addr));
731 }
732 735
733 /* For ATI SB450 azalia HD audio, we need to enable snoop */ 736 /* For ATI SB450 azalia HD audio, we need to enable snoop */
734 if (chip->driver_type == AZX_DRIVER_ATI) { 737 if (chip->driver_type == AZX_DRIVER_ATI) {
@@ -763,9 +766,11 @@ static irqreturn_t azx_interrupt(int irq, void* dev_id, struct pt_regs *regs)
763 if (status & azx_dev->sd_int_sta_mask) { 766 if (status & azx_dev->sd_int_sta_mask) {
764 azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK); 767 azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK);
765 if (azx_dev->substream && azx_dev->running) { 768 if (azx_dev->substream && azx_dev->running) {
769 azx_dev->period_updating = 1;
766 spin_unlock(&chip->reg_lock); 770 spin_unlock(&chip->reg_lock);
767 snd_pcm_period_elapsed(azx_dev->substream); 771 snd_pcm_period_elapsed(azx_dev->substream);
768 spin_lock(&chip->reg_lock); 772 spin_lock(&chip->reg_lock);
773 azx_dev->period_updating = 0;
769 } 774 }
770 } 775 }
771 } 776 }
@@ -866,11 +871,9 @@ static int azx_setup_controller(azx_t *chip, azx_dev_t *azx_dev)
866 /* upper BDL address */ 871 /* upper BDL address */
867 azx_sd_writel(azx_dev, SD_BDLPU, upper_32bit(azx_dev->bdl_addr)); 872 azx_sd_writel(azx_dev, SD_BDLPU, upper_32bit(azx_dev->bdl_addr));
868 873
869 if (chip->position_fix == POS_FIX_POSBUF) { 874 /* enable the position buffer */
870 /* enable the position buffer */ 875 if (! (azx_readl(chip, DPLBASE) & ICH6_DPLBASE_ENABLE))
871 if (! (azx_readl(chip, DPLBASE) & ICH6_DPLBASE_ENABLE)) 876 azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr | ICH6_DPLBASE_ENABLE);
872 azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr | ICH6_DPLBASE_ENABLE);
873 }
874 877
875 /* set the interrupt enable bits in the descriptor control register */ 878 /* set the interrupt enable bits in the descriptor control register */
876 azx_sd_writel(azx_dev, SD_CTL, azx_sd_readl(azx_dev, SD_CTL) | SD_INT_MASK); 879 azx_sd_writel(azx_dev, SD_CTL, azx_sd_readl(azx_dev, SD_CTL) | SD_INT_MASK);
@@ -1078,6 +1081,7 @@ static int azx_pcm_prepare(snd_pcm_substream_t *substream)
1078 azx_dev->fifo_size = azx_sd_readw(azx_dev, SD_FIFOSIZE) + 1; 1081 azx_dev->fifo_size = azx_sd_readw(azx_dev, SD_FIFOSIZE) + 1;
1079 else 1082 else
1080 azx_dev->fifo_size = 0; 1083 azx_dev->fifo_size = 0;
1084 azx_dev->last_pos = 0;
1081 1085
1082 return hinfo->ops.prepare(hinfo, apcm->codec, azx_dev->stream_tag, 1086 return hinfo->ops.prepare(hinfo, apcm->codec, azx_dev->stream_tag,
1083 azx_dev->format_val, substream); 1087 azx_dev->format_val, substream);
@@ -1133,6 +1137,26 @@ static snd_pcm_uframes_t azx_pcm_pointer(snd_pcm_substream_t *substream)
1133 pos = azx_sd_readl(azx_dev, SD_LPIB); 1137 pos = azx_sd_readl(azx_dev, SD_LPIB);
1134 if (chip->position_fix == POS_FIX_FIFO) 1138 if (chip->position_fix == POS_FIX_FIFO)
1135 pos += azx_dev->fifo_size; 1139 pos += azx_dev->fifo_size;
1140 else if (chip->position_fix == POS_FIX_AUTO && azx_dev->period_updating) {
1141 /* check the validity of DMA position */
1142 unsigned int diff = 0;
1143 azx_dev->last_pos += azx_dev->fragsize;
1144 if (azx_dev->last_pos > pos)
1145 diff = azx_dev->last_pos - pos;
1146 if (azx_dev->last_pos >= azx_dev->bufsize) {
1147 if (pos < azx_dev->fragsize)
1148 diff = 0;
1149 azx_dev->last_pos = 0;
1150 }
1151 if (diff > 0 && diff <= azx_dev->fifo_size)
1152 pos += azx_dev->fifo_size;
1153 else {
1154 snd_printdd(KERN_INFO "hda_intel: DMA position fix %d, switching to posbuf\n", diff);
1155 chip->position_fix = POS_FIX_POSBUF;
1156 pos = *azx_dev->posbuf;
1157 }
1158 azx_dev->period_updating = 0;
1159 }
1136 } 1160 }
1137 if (pos >= azx_dev->bufsize) 1161 if (pos >= azx_dev->bufsize)
1138 pos = 0; 1162 pos = 0;
@@ -1203,12 +1227,33 @@ static int __devinit azx_pcm_create(azx_t *chip)
1203 if ((err = snd_hda_build_pcms(chip->bus)) < 0) 1227 if ((err = snd_hda_build_pcms(chip->bus)) < 0)
1204 return err; 1228 return err;
1205 1229
1230 /* create audio PCMs */
1206 pcm_dev = 0; 1231 pcm_dev = 0;
1207 list_for_each(p, &chip->bus->codec_list) { 1232 list_for_each(p, &chip->bus->codec_list) {
1208 codec = list_entry(p, struct hda_codec, list); 1233 codec = list_entry(p, struct hda_codec, list);
1209 for (c = 0; c < codec->num_pcms; c++) { 1234 for (c = 0; c < codec->num_pcms; c++) {
1235 if (codec->pcm_info[c].is_modem)
1236 continue; /* create later */
1237 if (pcm_dev >= AZX_MAX_AUDIO_PCMS) {
1238 snd_printk(KERN_ERR SFX "Too many audio PCMs\n");
1239 return -EINVAL;
1240 }
1241 err = create_codec_pcm(chip, codec, &codec->pcm_info[c], pcm_dev);
1242 if (err < 0)
1243 return err;
1244 pcm_dev++;
1245 }
1246 }
1247
1248 /* create modem PCMs */
1249 pcm_dev = AZX_MAX_AUDIO_PCMS;
1250 list_for_each(p, &chip->bus->codec_list) {
1251 codec = list_entry(p, struct hda_codec, list);
1252 for (c = 0; c < codec->num_pcms; c++) {
1253 if (! codec->pcm_info[c].is_modem)
1254 continue; /* already created */
1210 if (pcm_dev >= AZX_MAX_PCMS) { 1255 if (pcm_dev >= AZX_MAX_PCMS) {
1211 snd_printk(KERN_ERR SFX "Too many PCMs\n"); 1256 snd_printk(KERN_ERR SFX "Too many modem PCMs\n");
1212 return -EINVAL; 1257 return -EINVAL;
1213 } 1258 }
1214 err = create_codec_pcm(chip, codec, &codec->pcm_info[c], pcm_dev); 1259 err = create_codec_pcm(chip, codec, &codec->pcm_info[c], pcm_dev);
@@ -1244,8 +1289,7 @@ static int __devinit azx_init_stream(azx_t *chip)
1244 azx_dev_t *azx_dev = &chip->azx_dev[i]; 1289 azx_dev_t *azx_dev = &chip->azx_dev[i];
1245 azx_dev->bdl = (u32 *)(chip->bdl.area + off); 1290 azx_dev->bdl = (u32 *)(chip->bdl.area + off);
1246 azx_dev->bdl_addr = chip->bdl.addr + off; 1291 azx_dev->bdl_addr = chip->bdl.addr + off;
1247 if (chip->position_fix == POS_FIX_POSBUF) 1292 azx_dev->posbuf = (volatile u32 *)(chip->posbuf.area + i * 8);
1248 azx_dev->posbuf = (volatile u32 *)(chip->posbuf.area + i * 8);
1249 /* offset: SDI0=0x80, SDI1=0xa0, ... SDO3=0x160 */ 1293 /* offset: SDI0=0x80, SDI1=0xa0, ... SDO3=0x160 */
1250 azx_dev->sd_addr = chip->remap_addr + (0x20 * i + 0x80); 1294 azx_dev->sd_addr = chip->remap_addr + (0x20 * i + 0x80);
1251 /* int mask: SDI0=0x01, SDI1=0x02, ... SDO3=0x80 */ 1295 /* int mask: SDI0=0x01, SDI1=0x02, ... SDO3=0x80 */
@@ -1358,7 +1402,7 @@ static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci,
1358 if ((err = pci_enable_device(pci)) < 0) 1402 if ((err = pci_enable_device(pci)) < 0)
1359 return err; 1403 return err;
1360 1404
1361 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1405 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1362 1406
1363 if (NULL == chip) { 1407 if (NULL == chip) {
1364 snd_printk(KERN_ERR SFX "cannot allocate chip\n"); 1408 snd_printk(KERN_ERR SFX "cannot allocate chip\n");
@@ -1437,13 +1481,11 @@ static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci,
1437 snd_printk(KERN_ERR SFX "cannot allocate BDL\n"); 1481 snd_printk(KERN_ERR SFX "cannot allocate BDL\n");
1438 goto errout; 1482 goto errout;
1439 } 1483 }
1440 if (chip->position_fix == POS_FIX_POSBUF) { 1484 /* allocate memory for the position buffer */
1441 /* allocate memory for the position buffer */ 1485 if ((err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
1442 if ((err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), 1486 chip->num_streams * 8, &chip->posbuf)) < 0) {
1443 chip->num_streams * 8, &chip->posbuf)) < 0) { 1487 snd_printk(KERN_ERR SFX "cannot allocate posbuf\n");
1444 snd_printk(KERN_ERR SFX "cannot allocate posbuf\n"); 1488 goto errout;
1445 goto errout;
1446 }
1447 } 1489 }
1448 /* allocate CORB/RIRB */ 1490 /* allocate CORB/RIRB */
1449 if ((err = azx_alloc_cmd_io(chip)) < 0) 1491 if ((err = azx_alloc_cmd_io(chip)) < 0)
@@ -1561,6 +1603,7 @@ MODULE_DEVICE_TABLE(pci, azx_ids);
1561/* pci_driver definition */ 1603/* pci_driver definition */
1562static struct pci_driver driver = { 1604static struct pci_driver driver = {
1563 .name = "HDA Intel", 1605 .name = "HDA Intel",
1606 .owner = THIS_MODULE,
1564 .id_table = azx_ids, 1607 .id_table = azx_ids,
1565 .probe = azx_probe, 1608 .probe = azx_probe,
1566 .remove = __devexit_p(azx_remove), 1609 .remove = __devexit_p(azx_remove),
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index de1217bd8e68..08f6a6efc5e6 100644
--- a/sound/pci/hda/hda_proc.c
+++ b/sound/pci/hda/hda_proc.c
@@ -207,6 +207,8 @@ static void print_codec_info(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
207 snd_iprintf(buffer, "Vendor Id: 0x%x\n", codec->vendor_id); 207 snd_iprintf(buffer, "Vendor Id: 0x%x\n", codec->vendor_id);
208 snd_iprintf(buffer, "Subsystem Id: 0x%x\n", codec->subsystem_id); 208 snd_iprintf(buffer, "Subsystem Id: 0x%x\n", codec->subsystem_id);
209 snd_iprintf(buffer, "Revision Id: 0x%x\n", codec->revision_id); 209 snd_iprintf(buffer, "Revision Id: 0x%x\n", codec->revision_id);
210 if (! codec->afg)
211 return;
210 snd_iprintf(buffer, "Default PCM: "); 212 snd_iprintf(buffer, "Default PCM: ");
211 print_pcm_caps(buffer, codec, codec->afg); 213 print_pcm_caps(buffer, codec, codec->afg);
212 snd_iprintf(buffer, "Default Amp-In caps: "); 214 snd_iprintf(buffer, "Default Amp-In caps: ");
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index bceb83a42a38..da6874d3988c 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -465,7 +465,7 @@ static int patch_ad1986a(struct hda_codec *codec)
465{ 465{
466 struct ad198x_spec *spec; 466 struct ad198x_spec *spec;
467 467
468 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 468 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
469 if (spec == NULL) 469 if (spec == NULL)
470 return -ENOMEM; 470 return -ENOMEM;
471 471
@@ -623,7 +623,7 @@ static int patch_ad1983(struct hda_codec *codec)
623{ 623{
624 struct ad198x_spec *spec; 624 struct ad198x_spec *spec;
625 625
626 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 626 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
627 if (spec == NULL) 627 if (spec == NULL)
628 return -ENOMEM; 628 return -ENOMEM;
629 629
@@ -764,7 +764,7 @@ static int patch_ad1981(struct hda_codec *codec)
764{ 764{
765 struct ad198x_spec *spec; 765 struct ad198x_spec *spec;
766 766
767 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 767 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
768 if (spec == NULL) 768 if (spec == NULL)
769 return -ENOMEM; 769 return -ENOMEM;
770 770
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c
index 07fb4f5a54b3..523c362ec44d 100644
--- a/sound/pci/hda/patch_cmedia.c
+++ b/sound/pci/hda/patch_cmedia.c
@@ -667,7 +667,7 @@ static int patch_cmi9880(struct hda_codec *codec)
667{ 667{
668 struct cmi_spec *spec; 668 struct cmi_spec *spec;
669 669
670 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 670 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
671 if (spec == NULL) 671 if (spec == NULL)
672 return -ENOMEM; 672 return -ENOMEM;
673 673
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index eeb900ab79af..849b5b50c921 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1526,6 +1526,7 @@ static struct hda_board_config alc880_cfg_tbl[] = {
1526 /* Back 3 jack, front 2 jack (Internal add Aux-In) */ 1526 /* Back 3 jack, front 2 jack (Internal add Aux-In) */
1527 { .pci_subvendor = 0x1025, .pci_subdevice = 0xe310, .config = ALC880_3ST }, 1527 { .pci_subvendor = 0x1025, .pci_subdevice = 0xe310, .config = ALC880_3ST },
1528 { .pci_subvendor = 0x104d, .pci_subdevice = 0x81d6, .config = ALC880_3ST }, 1528 { .pci_subvendor = 0x104d, .pci_subdevice = 0x81d6, .config = ALC880_3ST },
1529 { .pci_subvendor = 0x104d, .pci_subdevice = 0x81a0, .config = ALC880_3ST },
1529 1530
1530 /* Back 3 jack plus 1 SPDIF out jack, front 2 jack */ 1531 /* Back 3 jack plus 1 SPDIF out jack, front 2 jack */
1531 { .modelname = "3stack-digout", .config = ALC880_3ST_DIG }, 1532 { .modelname = "3stack-digout", .config = ALC880_3ST_DIG },
@@ -1581,6 +1582,7 @@ static struct hda_board_config alc880_cfg_tbl[] = {
1581 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1973, .config = ALC880_ASUS_DIG }, 1582 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1973, .config = ALC880_ASUS_DIG },
1582 { .pci_subvendor = 0x1043, .pci_subdevice = 0x19b3, .config = ALC880_ASUS_DIG }, 1583 { .pci_subvendor = 0x1043, .pci_subdevice = 0x19b3, .config = ALC880_ASUS_DIG },
1583 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1113, .config = ALC880_ASUS_DIG }, 1584 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1113, .config = ALC880_ASUS_DIG },
1585 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1173, .config = ALC880_ASUS_DIG },
1584 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1993, .config = ALC880_ASUS }, 1586 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1993, .config = ALC880_ASUS },
1585 { .pci_subvendor = 0x1043, .pci_subdevice = 0x10c3, .config = ALC880_ASUS_DIG }, 1587 { .pci_subvendor = 0x1043, .pci_subdevice = 0x10c3, .config = ALC880_ASUS_DIG },
1586 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1133, .config = ALC880_ASUS }, 1588 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1133, .config = ALC880_ASUS },
@@ -2093,7 +2095,7 @@ static int patch_alc880(struct hda_codec *codec)
2093 int board_config; 2095 int board_config;
2094 int i, err; 2096 int i, err;
2095 2097
2096 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 2098 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
2097 if (spec == NULL) 2099 if (spec == NULL)
2098 return -ENOMEM; 2100 return -ENOMEM;
2099 2101
@@ -2365,7 +2367,7 @@ static int patch_alc260(struct hda_codec *codec)
2365 struct alc_spec *spec; 2367 struct alc_spec *spec;
2366 int board_config; 2368 int board_config;
2367 2369
2368 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 2370 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
2369 if (spec == NULL) 2371 if (spec == NULL)
2370 return -ENOMEM; 2372 return -ENOMEM;
2371 2373
@@ -2615,7 +2617,7 @@ static int patch_alc882(struct hda_codec *codec)
2615{ 2617{
2616 struct alc_spec *spec; 2618 struct alc_spec *spec;
2617 2619
2618 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 2620 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
2619 if (spec == NULL) 2621 if (spec == NULL)
2620 return -ENOMEM; 2622 return -ENOMEM;
2621 2623
diff --git a/sound/pci/hda/patch_si3054.c b/sound/pci/hda/patch_si3054.c
index b0270d1b64ce..d014b7bb70df 100644
--- a/sound/pci/hda/patch_si3054.c
+++ b/sound/pci/hda/patch_si3054.c
@@ -214,6 +214,7 @@ static int si3054_build_pcms(struct hda_codec *codec)
214 info->name = "Si3054 Modem"; 214 info->name = "Si3054 Modem";
215 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = si3054_pcm; 215 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = si3054_pcm;
216 info->stream[SNDRV_PCM_STREAM_CAPTURE] = si3054_pcm; 216 info->stream[SNDRV_PCM_STREAM_CAPTURE] = si3054_pcm;
217 info->is_modem = 1;
217 return 0; 218 return 0;
218} 219}
219 220
@@ -282,7 +283,7 @@ static struct hda_codec_ops si3054_patch_ops = {
282 283
283static int patch_si3054(struct hda_codec *codec) 284static int patch_si3054(struct hda_codec *codec)
284{ 285{
285 struct si3054_spec *spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 286 struct si3054_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
286 if (spec == NULL) 287 if (spec == NULL)
287 return -ENOMEM; 288 return -ENOMEM;
288 codec->spec = spec; 289 codec->spec = spec;
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 9d503da7320d..33a8adaea768 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -919,7 +919,7 @@ static int patch_stac9200(struct hda_codec *codec)
919 struct sigmatel_spec *spec; 919 struct sigmatel_spec *spec;
920 int err; 920 int err;
921 921
922 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 922 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
923 if (spec == NULL) 923 if (spec == NULL)
924 return -ENOMEM; 924 return -ENOMEM;
925 925
@@ -957,7 +957,7 @@ static int patch_stac922x(struct hda_codec *codec)
957 struct sigmatel_spec *spec; 957 struct sigmatel_spec *spec;
958 int err; 958 int err;
959 959
960 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 960 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
961 if (spec == NULL) 961 if (spec == NULL)
962 return -ENOMEM; 962 return -ENOMEM;
963 963
diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c
index 4405d96cbedf..2e0a31613ee6 100644
--- a/sound/pci/ice1712/aureon.c
+++ b/sound/pci/ice1712/aureon.c
@@ -1796,7 +1796,7 @@ static int __devinit aureon_init(ice1712_t *ice)
1796 } 1796 }
1797 1797
1798 /* to remeber the register values of CS8415 */ 1798 /* to remeber the register values of CS8415 */
1799 ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL); 1799 ice->akm = kzalloc(sizeof(akm4xxx_t), GFP_KERNEL);
1800 if (! ice->akm) 1800 if (! ice->akm)
1801 return -ENOMEM; 1801 return -ENOMEM;
1802 ice->akm_codecs = 1; 1802 ice->akm_codecs = 1;
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index b97f50d10ba3..a6d98013c331 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -100,12 +100,6 @@ MODULE_PARM_DESC(cs8427_timeout, "Define reset timeout for cs8427 chip in msec r
100module_param_array(model, charp, NULL, 0444); 100module_param_array(model, charp, NULL, 0444);
101MODULE_PARM_DESC(model, "Use the given board model."); 101MODULE_PARM_DESC(model, "Use the given board model.");
102 102
103#ifndef PCI_VENDOR_ID_ICE
104#define PCI_VENDOR_ID_ICE 0x1412
105#endif
106#ifndef PCI_DEVICE_ID_ICE_1712
107#define PCI_DEVICE_ID_ICE_1712 0x1712
108#endif
109 103
110static struct pci_device_id snd_ice1712_ids[] = { 104static struct pci_device_id snd_ice1712_ids[] = {
111 { PCI_VENDOR_ID_ICE, PCI_DEVICE_ID_ICE_1712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ICE1712 */ 105 { PCI_VENDOR_ID_ICE, PCI_DEVICE_ID_ICE_1712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ICE1712 */
@@ -2535,7 +2529,7 @@ static int __devinit snd_ice1712_create(snd_card_t * card,
2535 return -ENXIO; 2529 return -ENXIO;
2536 } 2530 }
2537 2531
2538 ice = kcalloc(1, sizeof(*ice), GFP_KERNEL); 2532 ice = kzalloc(sizeof(*ice), GFP_KERNEL);
2539 if (ice == NULL) { 2533 if (ice == NULL) {
2540 pci_disable_device(pci); 2534 pci_disable_device(pci);
2541 return -ENOMEM; 2535 return -ENOMEM;
@@ -2741,6 +2735,7 @@ static void __devexit snd_ice1712_remove(struct pci_dev *pci)
2741 2735
2742static struct pci_driver driver = { 2736static struct pci_driver driver = {
2743 .name = "ICE1712", 2737 .name = "ICE1712",
2738 .owner = THIS_MODULE,
2744 .id_table = snd_ice1712_ids, 2739 .id_table = snd_ice1712_ids,
2745 .probe = snd_ice1712_probe, 2740 .probe = snd_ice1712_probe,
2746 .remove = __devexit_p(snd_ice1712_remove), 2741 .remove = __devexit_p(snd_ice1712_remove),
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index c7af5e5fee13..c3ce8f93740b 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -83,12 +83,6 @@ MODULE_PARM_DESC(enable, "Enable ICE1724 soundcard.");
83module_param_array(model, charp, NULL, 0444); 83module_param_array(model, charp, NULL, 0444);
84MODULE_PARM_DESC(model, "Use the given board model."); 84MODULE_PARM_DESC(model, "Use the given board model.");
85 85
86#ifndef PCI_VENDOR_ID_ICE
87#define PCI_VENDOR_ID_ICE 0x1412
88#endif
89#ifndef PCI_DEVICE_ID_VT1724
90#define PCI_DEVICE_ID_VT1724 0x1724
91#endif
92 86
93/* Both VT1720 and VT1724 have the same PCI IDs */ 87/* Both VT1720 and VT1724 have the same PCI IDs */
94static struct pci_device_id snd_vt1724_ids[] = { 88static struct pci_device_id snd_vt1724_ids[] = {
@@ -2130,7 +2124,7 @@ static int __devinit snd_vt1724_create(snd_card_t * card,
2130 if ((err = pci_enable_device(pci)) < 0) 2124 if ((err = pci_enable_device(pci)) < 0)
2131 return err; 2125 return err;
2132 2126
2133 ice = kcalloc(1, sizeof(*ice), GFP_KERNEL); 2127 ice = kzalloc(sizeof(*ice), GFP_KERNEL);
2134 if (ice == NULL) { 2128 if (ice == NULL) {
2135 pci_disable_device(pci); 2129 pci_disable_device(pci);
2136 return -ENOMEM; 2130 return -ENOMEM;
@@ -2321,6 +2315,7 @@ static void __devexit snd_vt1724_remove(struct pci_dev *pci)
2321 2315
2322static struct pci_driver driver = { 2316static struct pci_driver driver = {
2323 .name = "ICE1724", 2317 .name = "ICE1724",
2318 .owner = THIS_MODULE,
2324 .id_table = snd_vt1724_ids, 2319 .id_table = snd_vt1724_ids,
2325 .probe = snd_vt1724_probe, 2320 .probe = snd_vt1724_probe,
2326 .remove = __devexit_p(snd_vt1724_remove), 2321 .remove = __devexit_p(snd_vt1724_remove),
diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c
index 3fb297b969cd..2437876a44e4 100644
--- a/sound/pci/ice1712/juli.c
+++ b/sound/pci/ice1712/juli.c
@@ -182,7 +182,7 @@ static int __devinit juli_init(ice1712_t *ice)
182 ice->num_total_dacs = 2; 182 ice->num_total_dacs = 2;
183 ice->num_total_adcs = 2; 183 ice->num_total_adcs = 2;
184 184
185 ak = ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL); 185 ak = ice->akm = kzalloc(sizeof(akm4xxx_t), GFP_KERNEL);
186 if (! ak) 186 if (! ak)
187 return -ENOMEM; 187 return -ENOMEM;
188 ice->akm_codecs = 1; 188 ice->akm_codecs = 1;
diff --git a/sound/pci/ice1712/phase.c b/sound/pci/ice1712/phase.c
index 5bf734b04fa0..dcf1e8ca3f66 100644
--- a/sound/pci/ice1712/phase.c
+++ b/sound/pci/ice1712/phase.c
@@ -122,7 +122,7 @@ static int __devinit phase22_init(ice1712_t *ice)
122 } 122 }
123 123
124 // Initialize analog chips 124 // Initialize analog chips
125 ak = ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL); 125 ak = ice->akm = kzalloc(sizeof(akm4xxx_t), GFP_KERNEL);
126 if (! ak) 126 if (! ak)
127 return -ENOMEM; 127 return -ENOMEM;
128 ice->akm_codecs = 1; 128 ice->akm_codecs = 1;
@@ -386,7 +386,7 @@ static int __devinit phase28_init(ice1712_t *ice)
386 ice->num_total_adcs = 2; 386 ice->num_total_adcs = 2;
387 387
388 // Initialize analog chips 388 // Initialize analog chips
389 ak = ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL); 389 ak = ice->akm = kzalloc(sizeof(akm4xxx_t), GFP_KERNEL);
390 if (!ak) 390 if (!ak)
391 return -ENOMEM; 391 return -ENOMEM;
392 ice->akm_codecs = 1; 392 ice->akm_codecs = 1;
diff --git a/sound/pci/ice1712/pontis.c b/sound/pci/ice1712/pontis.c
index 25f827d8fbd9..a5f852b1f575 100644
--- a/sound/pci/ice1712/pontis.c
+++ b/sound/pci/ice1712/pontis.c
@@ -781,7 +781,7 @@ static int __devinit pontis_init(ice1712_t *ice)
781 ice->num_total_adcs = 2; 781 ice->num_total_adcs = 2;
782 782
783 /* to remeber the register values */ 783 /* to remeber the register values */
784 ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL); 784 ice->akm = kzalloc(sizeof(akm4xxx_t), GFP_KERNEL);
785 if (! ice->akm) 785 if (! ice->akm)
786 return -ENOMEM; 786 return -ENOMEM;
787 ice->akm_codecs = 1; 787 ice->akm_codecs = 1;
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 7b548416dcef..1a96198a17ae 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -69,6 +69,7 @@ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
69static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 69static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
70static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; 70static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
71static char *ac97_quirk[SNDRV_CARDS]; 71static char *ac97_quirk[SNDRV_CARDS];
72static int buggy_semaphore[SNDRV_CARDS];
72static int buggy_irq[SNDRV_CARDS]; 73static int buggy_irq[SNDRV_CARDS];
73static int xbox[SNDRV_CARDS]; 74static int xbox[SNDRV_CARDS];
74 75
@@ -86,6 +87,8 @@ module_param_array(ac97_clock, int, NULL, 0444);
86MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect)."); 87MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect).");
87module_param_array(ac97_quirk, charp, NULL, 0444); 88module_param_array(ac97_quirk, charp, NULL, 0444);
88MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware."); 89MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware.");
90module_param_array(buggy_semaphore, bool, NULL, 0444);
91MODULE_PARM_DESC(buggy_semaphore, "Enable workaround for hardwares with problematic codec semaphores.");
89module_param_array(buggy_irq, bool, NULL, 0444); 92module_param_array(buggy_irq, bool, NULL, 0444);
90MODULE_PARM_DESC(buggy_irq, "Enable workaround for buggy interrupts on some motherboards."); 93MODULE_PARM_DESC(buggy_irq, "Enable workaround for buggy interrupts on some motherboards.");
91module_param_array(xbox, bool, NULL, 0444); 94module_param_array(xbox, bool, NULL, 0444);
@@ -94,62 +97,6 @@ MODULE_PARM_DESC(xbox, "Set to 1 for Xbox, if you have problems with the AC'97 c
94/* 97/*
95 * Direct registers 98 * Direct registers
96 */ 99 */
97
98#ifndef PCI_DEVICE_ID_INTEL_82801
99#define PCI_DEVICE_ID_INTEL_82801 0x2415
100#endif
101#ifndef PCI_DEVICE_ID_INTEL_82901
102#define PCI_DEVICE_ID_INTEL_82901 0x2425
103#endif
104#ifndef PCI_DEVICE_ID_INTEL_82801BA
105#define PCI_DEVICE_ID_INTEL_82801BA 0x2445
106#endif
107#ifndef PCI_DEVICE_ID_INTEL_440MX
108#define PCI_DEVICE_ID_INTEL_440MX 0x7195
109#endif
110#ifndef PCI_DEVICE_ID_INTEL_ICH3
111#define PCI_DEVICE_ID_INTEL_ICH3 0x2485
112#endif
113#ifndef PCI_DEVICE_ID_INTEL_ICH4
114#define PCI_DEVICE_ID_INTEL_ICH4 0x24c5
115#endif
116#ifndef PCI_DEVICE_ID_INTEL_ICH5
117#define PCI_DEVICE_ID_INTEL_ICH5 0x24d5
118#endif
119#ifndef PCI_DEVICE_ID_INTEL_ESB_5
120#define PCI_DEVICE_ID_INTEL_ESB_5 0x25a6
121#endif
122#ifndef PCI_DEVICE_ID_INTEL_ICH6_18
123#define PCI_DEVICE_ID_INTEL_ICH6_18 0x266e
124#endif
125#ifndef PCI_DEVICE_ID_INTEL_ICH7_20
126#define PCI_DEVICE_ID_INTEL_ICH7_20 0x27de
127#endif
128#ifndef PCI_DEVICE_ID_INTEL_ESB2_14
129#define PCI_DEVICE_ID_INTEL_ESB2_14 0x2698
130#endif
131#ifndef PCI_DEVICE_ID_SI_7012
132#define PCI_DEVICE_ID_SI_7012 0x7012
133#endif
134#ifndef PCI_DEVICE_ID_NVIDIA_MCP_AUDIO
135#define PCI_DEVICE_ID_NVIDIA_MCP_AUDIO 0x01b1
136#endif
137#ifndef PCI_DEVICE_ID_NVIDIA_CK804_AUDIO
138#define PCI_DEVICE_ID_NVIDIA_CK804_AUDIO 0x0059
139#endif
140#ifndef PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO
141#define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO 0x006a
142#endif
143#ifndef PCI_DEVICE_ID_NVIDIA_CK8_AUDIO
144#define PCI_DEVICE_ID_NVIDIA_CK8_AUDIO 0x008a
145#endif
146#ifndef PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO
147#define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO 0x00da
148#endif
149#ifndef PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO
150#define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO 0x00ea
151#endif
152
153enum { DEVICE_INTEL, DEVICE_INTEL_ICH4, DEVICE_SIS, DEVICE_ALI, DEVICE_NFORCE }; 100enum { DEVICE_INTEL, DEVICE_INTEL_ICH4, DEVICE_SIS, DEVICE_ALI, DEVICE_NFORCE };
154 101
155#define ICHREG(x) ICH_REG_##x 102#define ICHREG(x) ICH_REG_##x
@@ -423,6 +370,7 @@ struct _snd_intel8x0 {
423 unsigned fix_nocache: 1; /* workaround for 440MX */ 370 unsigned fix_nocache: 1; /* workaround for 440MX */
424 unsigned buggy_irq: 1; /* workaround for buggy mobos */ 371 unsigned buggy_irq: 1; /* workaround for buggy mobos */
425 unsigned xbox: 1; /* workaround for Xbox AC'97 detection */ 372 unsigned xbox: 1; /* workaround for Xbox AC'97 detection */
373 unsigned buggy_semaphore: 1; /* workaround for buggy codec semaphore */
426 374
427 int spdif_idx; /* SPDIF BAR index; *_SPBAR or -1 if use PCMOUT */ 375 int spdif_idx; /* SPDIF BAR index; *_SPBAR or -1 if use PCMOUT */
428 unsigned int sdm_saved; /* SDM reg value */ 376 unsigned int sdm_saved; /* SDM reg value */
@@ -577,6 +525,9 @@ static int snd_intel8x0_codec_semaphore(intel8x0_t *chip, unsigned int codec)
577 if ((igetdword(chip, ICHREG(GLOB_STA)) & codec) == 0) 525 if ((igetdword(chip, ICHREG(GLOB_STA)) & codec) == 0)
578 return -EIO; 526 return -EIO;
579 527
528 if (chip->buggy_semaphore)
529 return 0; /* just ignore ... */
530
580 /* Anyone holding a semaphore for 1 msec should be shot... */ 531 /* Anyone holding a semaphore for 1 msec should be shot... */
581 time = 100; 532 time = 100;
582 do { 533 do {
@@ -1759,6 +1710,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = {
1759 .type = AC97_TUNE_ALC_JACK 1710 .type = AC97_TUNE_ALC_JACK
1760 }, 1711 },
1761 { 1712 {
1713 .subvendor = 0x1014,
1714 .subdevice = 0x0267,
1715 .name = "IBM NetVista A30p", /* AD1981B */
1716 .type = AC97_TUNE_HP_ONLY
1717 },
1718 {
1762 .subvendor = 0x1028, 1719 .subvendor = 0x1028,
1763 .subdevice = 0x00d8, 1720 .subdevice = 0x00d8,
1764 .name = "Dell Precision 530", /* AD1885 */ 1721 .name = "Dell Precision 530", /* AD1885 */
@@ -2599,6 +2556,7 @@ struct ich_reg_info {
2599static int __devinit snd_intel8x0_create(snd_card_t * card, 2556static int __devinit snd_intel8x0_create(snd_card_t * card,
2600 struct pci_dev *pci, 2557 struct pci_dev *pci,
2601 unsigned long device_type, 2558 unsigned long device_type,
2559 int buggy_sem,
2602 intel8x0_t ** r_intel8x0) 2560 intel8x0_t ** r_intel8x0)
2603{ 2561{
2604 intel8x0_t *chip; 2562 intel8x0_t *chip;
@@ -2646,7 +2604,7 @@ static int __devinit snd_intel8x0_create(snd_card_t * card,
2646 if ((err = pci_enable_device(pci)) < 0) 2604 if ((err = pci_enable_device(pci)) < 0)
2647 return err; 2605 return err;
2648 2606
2649 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 2607 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
2650 if (chip == NULL) { 2608 if (chip == NULL) {
2651 pci_disable_device(pci); 2609 pci_disable_device(pci);
2652 return -ENOMEM; 2610 return -ENOMEM;
@@ -2656,6 +2614,7 @@ static int __devinit snd_intel8x0_create(snd_card_t * card,
2656 chip->card = card; 2614 chip->card = card;
2657 chip->pci = pci; 2615 chip->pci = pci;
2658 chip->irq = -1; 2616 chip->irq = -1;
2617 chip->buggy_semaphore = buggy_sem;
2659 2618
2660 if (pci->vendor == PCI_VENDOR_ID_INTEL && 2619 if (pci->vendor == PCI_VENDOR_ID_INTEL &&
2661 pci->device == PCI_DEVICE_ID_INTEL_440MX) 2620 pci->device == PCI_DEVICE_ID_INTEL_440MX)
@@ -2795,19 +2754,19 @@ static struct shortname_table {
2795 unsigned int id; 2754 unsigned int id;
2796 const char *s; 2755 const char *s;
2797} shortnames[] __devinitdata = { 2756} shortnames[] __devinitdata = {
2798 { PCI_DEVICE_ID_INTEL_82801, "Intel 82801AA-ICH" }, 2757 { PCI_DEVICE_ID_INTEL_82801AA_5, "Intel 82801AA-ICH" },
2799 { PCI_DEVICE_ID_INTEL_82901, "Intel 82901AB-ICH0" }, 2758 { PCI_DEVICE_ID_INTEL_82801AB_5, "Intel 82901AB-ICH0" },
2800 { PCI_DEVICE_ID_INTEL_82801BA, "Intel 82801BA-ICH2" }, 2759 { PCI_DEVICE_ID_INTEL_82801BA_4, "Intel 82801BA-ICH2" },
2801 { PCI_DEVICE_ID_INTEL_440MX, "Intel 440MX" }, 2760 { PCI_DEVICE_ID_INTEL_440MX, "Intel 440MX" },
2802 { PCI_DEVICE_ID_INTEL_ICH3, "Intel 82801CA-ICH3" }, 2761 { PCI_DEVICE_ID_INTEL_82801CA_5, "Intel 82801CA-ICH3" },
2803 { PCI_DEVICE_ID_INTEL_ICH4, "Intel 82801DB-ICH4" }, 2762 { PCI_DEVICE_ID_INTEL_82801DB_5, "Intel 82801DB-ICH4" },
2804 { PCI_DEVICE_ID_INTEL_ICH5, "Intel ICH5" }, 2763 { PCI_DEVICE_ID_INTEL_82801EB_5, "Intel ICH5" },
2805 { PCI_DEVICE_ID_INTEL_ESB_5, "Intel 6300ESB" }, 2764 { PCI_DEVICE_ID_INTEL_ESB_5, "Intel 6300ESB" },
2806 { PCI_DEVICE_ID_INTEL_ICH6_18, "Intel ICH6" }, 2765 { PCI_DEVICE_ID_INTEL_ICH6_18, "Intel ICH6" },
2807 { PCI_DEVICE_ID_INTEL_ICH7_20, "Intel ICH7" }, 2766 { PCI_DEVICE_ID_INTEL_ICH7_20, "Intel ICH7" },
2808 { PCI_DEVICE_ID_INTEL_ESB2_14, "Intel ESB2" }, 2767 { PCI_DEVICE_ID_INTEL_ESB2_14, "Intel ESB2" },
2809 { PCI_DEVICE_ID_SI_7012, "SiS SI7012" }, 2768 { PCI_DEVICE_ID_SI_7012, "SiS SI7012" },
2810 { PCI_DEVICE_ID_NVIDIA_MCP_AUDIO, "NVidia nForce" }, 2769 { PCI_DEVICE_ID_NVIDIA_MCP1_AUDIO, "NVidia nForce" },
2811 { PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO, "NVidia nForce2" }, 2770 { PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO, "NVidia nForce2" },
2812 { PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO, "NVidia nForce3" }, 2771 { PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO, "NVidia nForce3" },
2813 { PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO, "NVidia CK8S" }, 2772 { PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO, "NVidia CK8S" },
@@ -2860,7 +2819,8 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci,
2860 } 2819 }
2861 } 2820 }
2862 2821
2863 if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data, &chip)) < 0) { 2822 if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data,
2823 buggy_semaphore[dev], &chip)) < 0) {
2864 snd_card_free(card); 2824 snd_card_free(card);
2865 return err; 2825 return err;
2866 } 2826 }
@@ -2904,6 +2864,7 @@ static void __devexit snd_intel8x0_remove(struct pci_dev *pci)
2904 2864
2905static struct pci_driver driver = { 2865static struct pci_driver driver = {
2906 .name = "Intel ICH", 2866 .name = "Intel ICH",
2867 .owner = THIS_MODULE,
2907 .id_table = snd_intel8x0_ids, 2868 .id_table = snd_intel8x0_ids,
2908 .probe = snd_intel8x0_probe, 2869 .probe = snd_intel8x0_probe,
2909 .remove = __devexit_p(snd_intel8x0_remove), 2870 .remove = __devexit_p(snd_intel8x0_remove),
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
index bb758c77d211..9e2060d56c24 100644
--- a/sound/pci/intel8x0m.c
+++ b/sound/pci/intel8x0m.c
@@ -73,51 +73,6 @@ MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect).");
73/* 73/*
74 * Direct registers 74 * Direct registers
75 */ 75 */
76
77#ifndef PCI_DEVICE_ID_INTEL_82801_6
78#define PCI_DEVICE_ID_INTEL_82801_6 0x2416
79#endif
80#ifndef PCI_DEVICE_ID_INTEL_82901_6
81#define PCI_DEVICE_ID_INTEL_82901_6 0x2426
82#endif
83#ifndef PCI_DEVICE_ID_INTEL_82801BA_6
84#define PCI_DEVICE_ID_INTEL_82801BA_6 0x2446
85#endif
86#ifndef PCI_DEVICE_ID_INTEL_440MX_6
87#define PCI_DEVICE_ID_INTEL_440MX_6 0x7196
88#endif
89#ifndef PCI_DEVICE_ID_INTEL_ICH3_6
90#define PCI_DEVICE_ID_INTEL_ICH3_6 0x2486
91#endif
92#ifndef PCI_DEVICE_ID_INTEL_ICH4_6
93#define PCI_DEVICE_ID_INTEL_ICH4_6 0x24c6
94#endif
95#ifndef PCI_DEVICE_ID_INTEL_ICH5_6
96#define PCI_DEVICE_ID_INTEL_ICH5_6 0x24d6
97#endif
98#ifndef PCI_DEVICE_ID_INTEL_ICH6_6
99#define PCI_DEVICE_ID_INTEL_ICH6_6 0x266d
100#endif
101#ifndef PCI_DEVICE_ID_INTEL_ICH7_6
102#define PCI_DEVICE_ID_INTEL_ICH7_6 0x27dd
103#endif
104#ifndef PCI_DEVICE_ID_SI_7013
105#define PCI_DEVICE_ID_SI_7013 0x7013
106#endif
107#ifndef PCI_DEVICE_ID_NVIDIA_MCP_MODEM
108#define PCI_DEVICE_ID_NVIDIA_MCP_MODEM 0x01c1
109#endif
110#ifndef PCI_DEVICE_ID_NVIDIA_MCP2_MODEM
111#define PCI_DEVICE_ID_NVIDIA_MCP2_MODEM 0x0069
112#endif
113#ifndef PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM
114#define PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM 0x0089
115#endif
116#ifndef PCI_DEVICE_ID_NVIDIA_MCP3_MODEM
117#define PCI_DEVICE_ID_NVIDIA_MCP3_MODEM 0x00d9
118#endif
119
120
121enum { DEVICE_INTEL, DEVICE_SIS, DEVICE_ALI, DEVICE_NFORCE }; 76enum { DEVICE_INTEL, DEVICE_SIS, DEVICE_ALI, DEVICE_NFORCE };
122 77
123#define ICHREG(x) ICH_REG_##x 78#define ICHREG(x) ICH_REG_##x
@@ -1158,7 +1113,7 @@ static int __devinit snd_intel8x0m_create(snd_card_t * card,
1158 if ((err = pci_enable_device(pci)) < 0) 1113 if ((err = pci_enable_device(pci)) < 0)
1159 return err; 1114 return err;
1160 1115
1161 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1116 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1162 if (chip == NULL) { 1117 if (chip == NULL) {
1163 pci_disable_device(pci); 1118 pci_disable_device(pci);
1164 return -ENOMEM; 1119 return -ENOMEM;
@@ -1283,18 +1238,18 @@ static struct shortname_table {
1283 unsigned int id; 1238 unsigned int id;
1284 const char *s; 1239 const char *s;
1285} shortnames[] __devinitdata = { 1240} shortnames[] __devinitdata = {
1286 { PCI_DEVICE_ID_INTEL_82801_6, "Intel 82801AA-ICH" }, 1241 { PCI_DEVICE_ID_INTEL_82801AA_6, "Intel 82801AA-ICH" },
1287 { PCI_DEVICE_ID_INTEL_82901_6, "Intel 82901AB-ICH0" }, 1242 { PCI_DEVICE_ID_INTEL_82801AB_6, "Intel 82901AB-ICH0" },
1288 { PCI_DEVICE_ID_INTEL_82801BA_6, "Intel 82801BA-ICH2" }, 1243 { PCI_DEVICE_ID_INTEL_82801BA_6, "Intel 82801BA-ICH2" },
1289 { PCI_DEVICE_ID_INTEL_440MX_6, "Intel 440MX" }, 1244 { PCI_DEVICE_ID_INTEL_440MX_6, "Intel 440MX" },
1290 { PCI_DEVICE_ID_INTEL_ICH3_6, "Intel 82801CA-ICH3" }, 1245 { PCI_DEVICE_ID_INTEL_82801CA_6, "Intel 82801CA-ICH3" },
1291 { PCI_DEVICE_ID_INTEL_ICH4_6, "Intel 82801DB-ICH4" }, 1246 { PCI_DEVICE_ID_INTEL_82801DB_6, "Intel 82801DB-ICH4" },
1292 { PCI_DEVICE_ID_INTEL_ICH5_6, "Intel ICH5" }, 1247 { PCI_DEVICE_ID_INTEL_82801EB_6, "Intel ICH5" },
1293 { PCI_DEVICE_ID_INTEL_ICH6_6, "Intel ICH6" }, 1248 { PCI_DEVICE_ID_INTEL_ICH6_17, "Intel ICH6" },
1294 { PCI_DEVICE_ID_INTEL_ICH7_6, "Intel ICH7" }, 1249 { PCI_DEVICE_ID_INTEL_ICH7_19, "Intel ICH7" },
1295 { 0x7446, "AMD AMD768" }, 1250 { 0x7446, "AMD AMD768" },
1296 { PCI_DEVICE_ID_SI_7013, "SiS SI7013" }, 1251 { PCI_DEVICE_ID_SI_7013, "SiS SI7013" },
1297 { PCI_DEVICE_ID_NVIDIA_MCP_MODEM, "NVidia nForce" }, 1252 { PCI_DEVICE_ID_NVIDIA_MCP1_MODEM, "NVidia nForce" },
1298 { PCI_DEVICE_ID_NVIDIA_MCP2_MODEM, "NVidia nForce2" }, 1253 { PCI_DEVICE_ID_NVIDIA_MCP2_MODEM, "NVidia nForce2" },
1299 { PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM, "NVidia nForce2s" }, 1254 { PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM, "NVidia nForce2s" },
1300 { PCI_DEVICE_ID_NVIDIA_MCP3_MODEM, "NVidia nForce3" }, 1255 { PCI_DEVICE_ID_NVIDIA_MCP3_MODEM, "NVidia nForce3" },
@@ -1371,6 +1326,7 @@ static void __devexit snd_intel8x0m_remove(struct pci_dev *pci)
1371 1326
1372static struct pci_driver driver = { 1327static struct pci_driver driver = {
1373 .name = "Intel ICH Modem", 1328 .name = "Intel ICH Modem",
1329 .owner = THIS_MODULE,
1374 .id_table = snd_intel8x0m_ids, 1330 .id_table = snd_intel8x0m_ids,
1375 .probe = snd_intel8x0m_probe, 1331 .probe = snd_intel8x0m_probe,
1376 .remove = __devexit_p(snd_intel8x0m_remove), 1332 .remove = __devexit_p(snd_intel8x0m_remove),
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c
index d2aa9c82d41e..09f9cbe116a3 100644
--- a/sound/pci/korg1212/korg1212.c
+++ b/sound/pci/korg1212/korg1212.c
@@ -2220,7 +2220,7 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci,
2220 if ((err = pci_enable_device(pci)) < 0) 2220 if ((err = pci_enable_device(pci)) < 0)
2221 return err; 2221 return err;
2222 2222
2223 korg1212 = kcalloc(1, sizeof(*korg1212), GFP_KERNEL); 2223 korg1212 = kzalloc(sizeof(*korg1212), GFP_KERNEL);
2224 if (korg1212 == NULL) { 2224 if (korg1212 == NULL) {
2225 pci_disable_device(pci); 2225 pci_disable_device(pci);
2226 return -ENOMEM; 2226 return -ENOMEM;
@@ -2534,6 +2534,7 @@ static void __devexit snd_korg1212_remove(struct pci_dev *pci)
2534 2534
2535static struct pci_driver driver = { 2535static struct pci_driver driver = {
2536 .name = "korg1212", 2536 .name = "korg1212",
2537 .owner = THIS_MODULE,
2537 .id_table = snd_korg1212_ids, 2538 .id_table = snd_korg1212_ids,
2538 .probe = snd_korg1212_probe, 2539 .probe = snd_korg1212_probe,
2539 .remove = __devexit_p(snd_korg1212_remove), 2540 .remove = __devexit_p(snd_korg1212_remove),
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index 39b5e7db1543..2693b6f731f3 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -872,35 +872,6 @@ struct snd_m3 {
872/* 872/*
873 * pci ids 873 * pci ids
874 */ 874 */
875
876#ifndef PCI_VENDOR_ID_ESS
877#define PCI_VENDOR_ID_ESS 0x125D
878#endif
879#ifndef PCI_DEVICE_ID_ESS_ALLEGRO_1
880#define PCI_DEVICE_ID_ESS_ALLEGRO_1 0x1988
881#endif
882#ifndef PCI_DEVICE_ID_ESS_ALLEGRO
883#define PCI_DEVICE_ID_ESS_ALLEGRO 0x1989
884#endif
885#ifndef PCI_DEVICE_ID_ESS_CANYON3D_2LE
886#define PCI_DEVICE_ID_ESS_CANYON3D_2LE 0x1990
887#endif
888#ifndef PCI_DEVICE_ID_ESS_CANYON3D_2
889#define PCI_DEVICE_ID_ESS_CANYON3D_2 0x1992
890#endif
891#ifndef PCI_DEVICE_ID_ESS_MAESTRO3
892#define PCI_DEVICE_ID_ESS_MAESTRO3 0x1998
893#endif
894#ifndef PCI_DEVICE_ID_ESS_MAESTRO3_1
895#define PCI_DEVICE_ID_ESS_MAESTRO3_1 0x1999
896#endif
897#ifndef PCI_DEVICE_ID_ESS_MAESTRO3_HW
898#define PCI_DEVICE_ID_ESS_MAESTRO3_HW 0x199a
899#endif
900#ifndef PCI_DEVICE_ID_ESS_MAESTRO3_2
901#define PCI_DEVICE_ID_ESS_MAESTRO3_2 0x199b
902#endif
903
904static struct pci_device_id snd_m3_ids[] = { 875static struct pci_device_id snd_m3_ids[] = {
905 {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_ALLEGRO_1, PCI_ANY_ID, PCI_ANY_ID, 876 {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_ALLEGRO_1, PCI_ANY_ID, PCI_ANY_ID,
906 PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0}, 877 PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0},
@@ -2689,7 +2660,7 @@ snd_m3_create(snd_card_t *card, struct pci_dev *pci,
2689 return -ENXIO; 2660 return -ENXIO;
2690 } 2661 }
2691 2662
2692 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 2663 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
2693 if (chip == NULL) { 2664 if (chip == NULL) {
2694 pci_disable_device(pci); 2665 pci_disable_device(pci);
2695 return -ENOMEM; 2666 return -ENOMEM;
@@ -2890,6 +2861,7 @@ static void __devexit snd_m3_remove(struct pci_dev *pci)
2890 2861
2891static struct pci_driver driver = { 2862static struct pci_driver driver = {
2892 .name = "Maestro3", 2863 .name = "Maestro3",
2864 .owner = THIS_MODULE,
2893 .id_table = snd_m3_ids, 2865 .id_table = snd_m3_ids,
2894 .probe = snd_m3_probe, 2866 .probe = snd_m3_probe,
2895 .remove = __devexit_p(snd_m3_remove), 2867 .remove = __devexit_p(snd_m3_remove),
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index 6c868d913634..1a62c7f6c52b 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -1004,7 +1004,7 @@ static int __devinit snd_mixart_create(mixart_mgr_t *mgr, snd_card_t *card, int
1004 .dev_free = snd_mixart_chip_dev_free, 1004 .dev_free = snd_mixart_chip_dev_free,
1005 }; 1005 };
1006 1006
1007 mgr->chip[idx] = chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1007 mgr->chip[idx] = chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1008 if (! chip) { 1008 if (! chip) {
1009 snd_printk(KERN_ERR "cannot allocate chip\n"); 1009 snd_printk(KERN_ERR "cannot allocate chip\n");
1010 return -ENOMEM; 1010 return -ENOMEM;
@@ -1292,7 +1292,7 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci,
1292 1292
1293 /* 1293 /*
1294 */ 1294 */
1295 mgr = kcalloc(1, sizeof(*mgr), GFP_KERNEL); 1295 mgr = kzalloc(sizeof(*mgr), GFP_KERNEL);
1296 if (! mgr) { 1296 if (! mgr) {
1297 pci_disable_device(pci); 1297 pci_disable_device(pci);
1298 return -ENOMEM; 1298 return -ENOMEM;
@@ -1424,6 +1424,7 @@ static void __devexit snd_mixart_remove(struct pci_dev *pci)
1424 1424
1425static struct pci_driver driver = { 1425static struct pci_driver driver = {
1426 .name = "Digigram miXart", 1426 .name = "Digigram miXart",
1427 .owner = THIS_MODULE,
1427 .id_table = snd_mixart_ids, 1428 .id_table = snd_mixart_ids,
1428 .probe = snd_mixart_probe, 1429 .probe = snd_mixart_probe,
1429 .remove = __devexit_p(snd_mixart_remove), 1430 .remove = __devexit_p(snd_mixart_remove),
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index 2bbeb10ff7c4..5c55a3b1d121 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -259,21 +259,6 @@ struct snd_nm256 {
259/* 259/*
260 * PCI ids 260 * PCI ids
261 */ 261 */
262
263#ifndef PCI_VENDOR_ID_NEOMAGIC
264#define PCI_VENDOR_ID_NEOMEGIC 0x10c8
265#endif
266#ifndef PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO
267#define PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO 0x8005
268#endif
269#ifndef PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO
270#define PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO 0x8006
271#endif
272#ifndef PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO
273#define PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO 0x8016
274#endif
275
276
277static struct pci_device_id snd_nm256_ids[] = { 262static struct pci_device_id snd_nm256_ids[] = {
278 {PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 263 {PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
279 {PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 264 {PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
@@ -840,7 +825,7 @@ static void snd_nm256_setup_stream(nm256_t *chip, nm256_stream_t *s,
840 runtime->hw = *hw_ptr; 825 runtime->hw = *hw_ptr;
841 runtime->hw.buffer_bytes_max = s->bufsize; 826 runtime->hw.buffer_bytes_max = s->bufsize;
842 runtime->hw.period_bytes_max = s->bufsize / 2; 827 runtime->hw.period_bytes_max = s->bufsize / 2;
843 runtime->dma_area = (void*) s->bufptr; 828 runtime->dma_area = (void __force *) s->bufptr;
844 runtime->dma_addr = s->bufptr_addr; 829 runtime->dma_addr = s->bufptr_addr;
845 runtime->dma_bytes = s->bufsize; 830 runtime->dma_bytes = s->bufsize;
846 runtime->private_data = s; 831 runtime->private_data = s;
@@ -1404,7 +1389,7 @@ snd_nm256_create(snd_card_t *card, struct pci_dev *pci,
1404 if ((err = pci_enable_device(pci)) < 0) 1389 if ((err = pci_enable_device(pci)) < 0)
1405 return err; 1390 return err;
1406 1391
1407 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1392 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1408 if (chip == NULL) { 1393 if (chip == NULL) {
1409 pci_disable_device(pci); 1394 pci_disable_device(pci);
1410 return -ENOMEM; 1395 return -ENOMEM;
@@ -1683,6 +1668,7 @@ static void __devexit snd_nm256_remove(struct pci_dev *pci)
1683 1668
1684static struct pci_driver driver = { 1669static struct pci_driver driver = {
1685 .name = "NeoMagic 256", 1670 .name = "NeoMagic 256",
1671 .owner = THIS_MODULE,
1686 .id_table = snd_nm256_ids, 1672 .id_table = snd_nm256_ids,
1687 .probe = snd_nm256_probe, 1673 .probe = snd_nm256_probe,
1688 .remove = __devexit_p(snd_nm256_remove), 1674 .remove = __devexit_p(snd_nm256_remove),
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c
index 456be39e8e4a..3daeecb9eb0e 100644
--- a/sound/pci/rme32.c
+++ b/sound/pci/rme32.c
@@ -192,20 +192,6 @@ MODULE_SUPPORTED_DEVICE("{{RME,Digi32}," "{RME,Digi32/8}," "{RME,Digi32 PRO}}");
192#define RME32_PRO_REVISION_WITH_8414 150 192#define RME32_PRO_REVISION_WITH_8414 150
193 193
194 194
195/* PCI vendor/device ID's */
196#ifndef PCI_VENDOR_ID_XILINX_RME
197# define PCI_VENDOR_ID_XILINX_RME 0xea60
198#endif
199#ifndef PCI_DEVICE_ID_DIGI32
200# define PCI_DEVICE_ID_DIGI32 0x9896
201#endif
202#ifndef PCI_DEVICE_ID_DIGI32_PRO
203# define PCI_DEVICE_ID_DIGI32_PRO 0x9897
204#endif
205#ifndef PCI_DEVICE_ID_DIGI32_8
206# define PCI_DEVICE_ID_DIGI32_8 0x9898
207#endif
208
209typedef struct snd_rme32 { 195typedef struct snd_rme32 {
210 spinlock_t lock; 196 spinlock_t lock;
211 int irq; 197 int irq;
@@ -692,7 +678,8 @@ snd_rme32_playback_hw_params(snd_pcm_substream_t * substream,
692 if (err < 0) 678 if (err < 0)
693 return err; 679 return err;
694 } else { 680 } else {
695 runtime->dma_area = (void *)(rme32->iobase + RME32_IO_DATA_BUFFER); 681 runtime->dma_area = (void __force *)(rme32->iobase +
682 RME32_IO_DATA_BUFFER);
696 runtime->dma_addr = rme32->port + RME32_IO_DATA_BUFFER; 683 runtime->dma_addr = rme32->port + RME32_IO_DATA_BUFFER;
697 runtime->dma_bytes = RME32_BUFFER_SIZE; 684 runtime->dma_bytes = RME32_BUFFER_SIZE;
698 } 685 }
@@ -746,7 +733,8 @@ snd_rme32_capture_hw_params(snd_pcm_substream_t * substream,
746 if (err < 0) 733 if (err < 0)
747 return err; 734 return err;
748 } else { 735 } else {
749 runtime->dma_area = (void *)rme32->iobase + RME32_IO_DATA_BUFFER; 736 runtime->dma_area = (void __force *)rme32->iobase +
737 RME32_IO_DATA_BUFFER;
750 runtime->dma_addr = rme32->port + RME32_IO_DATA_BUFFER; 738 runtime->dma_addr = rme32->port + RME32_IO_DATA_BUFFER;
751 runtime->dma_bytes = RME32_BUFFER_SIZE; 739 runtime->dma_bytes = RME32_BUFFER_SIZE;
752 } 740 }
@@ -2024,6 +2012,7 @@ static void __devexit snd_rme32_remove(struct pci_dev *pci)
2024 2012
2025static struct pci_driver driver = { 2013static struct pci_driver driver = {
2026 .name = "RME Digi32", 2014 .name = "RME Digi32",
2015 .owner = THIS_MODULE,
2027 .id_table = snd_rme32_ids, 2016 .id_table = snd_rme32_ids,
2028 .probe = snd_rme32_probe, 2017 .probe = snd_rme32_probe,
2029 .remove = __devexit_p(snd_rme32_remove), 2018 .remove = __devexit_p(snd_rme32_remove),
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index 9645e9004a48..9983b66dc564 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -200,25 +200,6 @@ MODULE_PARM_DESC(enable, "Enable RME Digi96 soundcard.");
200#define RME96_AD1852_VOL_BITS 14 200#define RME96_AD1852_VOL_BITS 14
201#define RME96_AD1855_VOL_BITS 10 201#define RME96_AD1855_VOL_BITS 10
202 202
203/*
204 * PCI vendor/device ids, could in the future be defined in <linux/pci.h>,
205 * therefore #ifndef is used.
206 */
207#ifndef PCI_VENDOR_ID_XILINX
208#define PCI_VENDOR_ID_XILINX 0x10ee
209#endif
210#ifndef PCI_DEVICE_ID_DIGI96
211#define PCI_DEVICE_ID_DIGI96 0x3fc0
212#endif
213#ifndef PCI_DEVICE_ID_DIGI96_8
214#define PCI_DEVICE_ID_DIGI96_8 0x3fc1
215#endif
216#ifndef PCI_DEVICE_ID_DIGI96_8_PRO
217#define PCI_DEVICE_ID_DIGI96_8_PRO 0x3fc2
218#endif
219#ifndef PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST
220#define PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST 0x3fc3
221#endif
222 203
223typedef struct snd_rme96 { 204typedef struct snd_rme96 {
224 spinlock_t lock; 205 spinlock_t lock;
@@ -985,7 +966,8 @@ snd_rme96_playback_hw_params(snd_pcm_substream_t *substream,
985 snd_pcm_runtime_t *runtime = substream->runtime; 966 snd_pcm_runtime_t *runtime = substream->runtime;
986 int err, rate, dummy; 967 int err, rate, dummy;
987 968
988 runtime->dma_area = (void *)(rme96->iobase + RME96_IO_PLAY_BUFFER); 969 runtime->dma_area = (void __force *)(rme96->iobase +
970 RME96_IO_PLAY_BUFFER);
989 runtime->dma_addr = rme96->port + RME96_IO_PLAY_BUFFER; 971 runtime->dma_addr = rme96->port + RME96_IO_PLAY_BUFFER;
990 runtime->dma_bytes = RME96_BUFFER_SIZE; 972 runtime->dma_bytes = RME96_BUFFER_SIZE;
991 973
@@ -1037,7 +1019,8 @@ snd_rme96_capture_hw_params(snd_pcm_substream_t *substream,
1037 snd_pcm_runtime_t *runtime = substream->runtime; 1019 snd_pcm_runtime_t *runtime = substream->runtime;
1038 int err, isadat, rate; 1020 int err, isadat, rate;
1039 1021
1040 runtime->dma_area = (void *)(rme96->iobase + RME96_IO_REC_BUFFER); 1022 runtime->dma_area = (void __force *)(rme96->iobase +
1023 RME96_IO_REC_BUFFER);
1041 runtime->dma_addr = rme96->port + RME96_IO_REC_BUFFER; 1024 runtime->dma_addr = rme96->port + RME96_IO_REC_BUFFER;
1042 runtime->dma_bytes = RME96_BUFFER_SIZE; 1025 runtime->dma_bytes = RME96_BUFFER_SIZE;
1043 1026
@@ -2430,6 +2413,7 @@ static void __devexit snd_rme96_remove(struct pci_dev *pci)
2430 2413
2431static struct pci_driver driver = { 2414static struct pci_driver driver = {
2432 .name = "RME Digi96", 2415 .name = "RME Digi96",
2416 .owner = THIS_MODULE,
2433 .id_table = snd_rme96_ids, 2417 .id_table = snd_rme96_ids,
2434 .probe = snd_rme96_probe, 2418 .probe = snd_rme96_probe,
2435 .remove = __devexit_p(snd_rme96_remove), 2419 .remove = __devexit_p(snd_rme96_remove),
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index 6694866089b5..52525eb198c7 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -370,13 +370,6 @@ MODULE_SUPPORTED_DEVICE("{{RME Hammerfall-DSP},"
370#define UNITY_GAIN 32768 370#define UNITY_GAIN 32768
371#define MINUS_INFINITY_GAIN 0 371#define MINUS_INFINITY_GAIN 0
372 372
373#ifndef PCI_VENDOR_ID_XILINX
374#define PCI_VENDOR_ID_XILINX 0x10ee
375#endif
376#ifndef PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP
377#define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP 0x3fc5
378#endif
379
380/* the size of a substream (1 mono data stream) */ 373/* the size of a substream (1 mono data stream) */
381 374
382#define HDSP_CHANNEL_BUFFER_SAMPLES (16*1024) 375#define HDSP_CHANNEL_BUFFER_SAMPLES (16*1024)
@@ -4899,6 +4892,7 @@ static int snd_hdsp_create_alsa_devices(snd_card_t *card, hdsp_t *hdsp)
4899 } 4892 }
4900 4893
4901 if (!(hdsp->state & HDSP_InitializationComplete)) { 4894 if (!(hdsp->state & HDSP_InitializationComplete)) {
4895 strcpy(card->shortname, "Hammerfall DSP");
4902 sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name, 4896 sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name,
4903 hdsp->port, hdsp->irq); 4897 hdsp->port, hdsp->irq);
4904 4898
@@ -5222,6 +5216,7 @@ static void __devexit snd_hdsp_remove(struct pci_dev *pci)
5222 5216
5223static struct pci_driver driver = { 5217static struct pci_driver driver = {
5224 .name = "RME Hammerfall DSP", 5218 .name = "RME Hammerfall DSP",
5219 .owner = THIS_MODULE,
5225 .id_table = snd_hdsp_ids, 5220 .id_table = snd_hdsp_ids,
5226 .probe = snd_hdsp_probe, 5221 .probe = snd_hdsp_probe,
5227 .remove = __devexit_p(snd_hdsp_remove), 5222 .remove = __devexit_p(snd_hdsp_remove),
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 5d786d113b25..fc3f3283ff37 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -301,18 +301,6 @@ MODULE_SUPPORTED_DEVICE("{{RME HDSPM-MADI}}");
301#define UNITY_GAIN 32768 /* = 65536/2 */ 301#define UNITY_GAIN 32768 /* = 65536/2 */
302#define MINUS_INFINITY_GAIN 0 302#define MINUS_INFINITY_GAIN 0
303 303
304/* PCI info */
305#ifndef PCI_VENDOR_ID_XILINX
306#define PCI_VENDOR_ID_XILINX 0x10ee
307#endif
308#ifndef PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP
309#define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP 0x3fc5
310#endif
311#ifndef PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP_MADI
312#define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP_MADI 0x3fc6
313#endif
314
315
316/* Number of channels for different Speed Modes */ 304/* Number of channels for different Speed Modes */
317#define MADI_SS_CHANNELS 64 305#define MADI_SS_CHANNELS 64
318#define MADI_DS_CHANNELS 32 306#define MADI_DS_CHANNELS 32
@@ -3652,6 +3640,7 @@ static void __devexit snd_hdspm_remove(struct pci_dev *pci)
3652 3640
3653static struct pci_driver driver = { 3641static struct pci_driver driver = {
3654 .name = "RME Hammerfall DSP MADI", 3642 .name = "RME Hammerfall DSP MADI",
3643 .owner = THIS_MODULE,
3655 .id_table = snd_hdspm_ids, 3644 .id_table = snd_hdspm_ids,
3656 .probe = snd_hdspm_probe, 3645 .probe = snd_hdspm_probe,
3657 .remove = __devexit_p(snd_hdspm_remove), 3646 .remove = __devexit_p(snd_hdspm_remove),
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c
index 8ee4d6fd6ea7..b600f45e1834 100644
--- a/sound/pci/rme9652/rme9652.c
+++ b/sound/pci/rme9652/rme9652.c
@@ -120,13 +120,6 @@ MODULE_SUPPORTED_DEVICE("{{RME,Hammerfall},"
120 120
121#define RME9652_REV15_buf_pos(x) ((((x)&0xE0000000)>>26)|((x)&RME9652_buf_pos)) 121#define RME9652_REV15_buf_pos(x) ((((x)&0xE0000000)>>26)|((x)&RME9652_buf_pos))
122 122
123#ifndef PCI_VENDOR_ID_XILINX
124#define PCI_VENDOR_ID_XILINX 0x10ee
125#endif
126#ifndef PCI_DEVICE_ID_XILINX_HAMMERFALL
127#define PCI_DEVICE_ID_XILINX_HAMMERFALL 0x3fc4
128#endif
129
130/* amount of io space we remap for register access. i'm not sure we 123/* amount of io space we remap for register access. i'm not sure we
131 even need this much, but 1K is nice round number :) 124 even need this much, but 1K is nice round number :)
132*/ 125*/
@@ -2661,6 +2654,7 @@ static void __devexit snd_rme9652_remove(struct pci_dev *pci)
2661 2654
2662static struct pci_driver driver = { 2655static struct pci_driver driver = {
2663 .name = "RME Digi9652 (Hammerfall)", 2656 .name = "RME Digi9652 (Hammerfall)",
2657 .owner = THIS_MODULE,
2664 .id_table = snd_rme9652_ids, 2658 .id_table = snd_rme9652_ids,
2665 .probe = snd_rme9652_probe, 2659 .probe = snd_rme9652_probe,
2666 .remove = __devexit_p(snd_rme9652_remove), 2660 .remove = __devexit_p(snd_rme9652_remove),
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
index 60ecb2bdb65e..1f6c2bfd43fd 100644
--- a/sound/pci/sonicvibes.c
+++ b/sound/pci/sonicvibes.c
@@ -50,13 +50,6 @@ MODULE_SUPPORTED_DEVICE("{{S3,SonicVibes PCI}}");
50#define SUPPORT_JOYSTICK 1 50#define SUPPORT_JOYSTICK 1
51#endif 51#endif
52 52
53#ifndef PCI_VENDOR_ID_S3
54#define PCI_VENDOR_ID_S3 0x5333
55#endif
56#ifndef PCI_DEVICE_ID_S3_SONICVIBES
57#define PCI_DEVICE_ID_S3_SONICVIBES 0xca00
58#endif
59
60static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 53static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
61static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 54static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
62static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 55static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
@@ -1257,7 +1250,7 @@ static int __devinit snd_sonicvibes_create(snd_card_t * card,
1257 return -ENXIO; 1250 return -ENXIO;
1258 } 1251 }
1259 1252
1260 sonic = kcalloc(1, sizeof(*sonic), GFP_KERNEL); 1253 sonic = kzalloc(sizeof(*sonic), GFP_KERNEL);
1261 if (sonic == NULL) { 1254 if (sonic == NULL) {
1262 pci_disable_device(pci); 1255 pci_disable_device(pci);
1263 return -ENOMEM; 1256 return -ENOMEM;
@@ -1515,6 +1508,7 @@ static void __devexit snd_sonic_remove(struct pci_dev *pci)
1515 1508
1516static struct pci_driver driver = { 1509static struct pci_driver driver = {
1517 .name = "S3 SonicVibes", 1510 .name = "S3 SonicVibes",
1511 .owner = THIS_MODULE,
1518 .id_table = snd_sonic_ids, 1512 .id_table = snd_sonic_ids,
1519 .probe = snd_sonic_probe, 1513 .probe = snd_sonic_probe,
1520 .remove = __devexit_p(snd_sonic_remove), 1514 .remove = __devexit_p(snd_sonic_remove),
diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c
index 940d531575c0..a8ca8e17853f 100644
--- a/sound/pci/trident/trident.c
+++ b/sound/pci/trident/trident.c
@@ -177,6 +177,7 @@ static void __devexit snd_trident_remove(struct pci_dev *pci)
177 177
178static struct pci_driver driver = { 178static struct pci_driver driver = {
179 .name = "Trident4DWaveAudio", 179 .name = "Trident4DWaveAudio",
180 .owner = THIS_MODULE,
180 .id_table = snd_trident_ids, 181 .id_table = snd_trident_ids,
181 .probe = snd_trident_probe, 182 .probe = snd_trident_probe,
182 .remove = __devexit_p(snd_trident_remove), 183 .remove = __devexit_p(snd_trident_remove),
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index f30d9d947862..777da9a7298b 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -2960,7 +2960,7 @@ static int __devinit snd_trident_mixer(trident_t * trident, int pcm_spdif_device
2960 .read = snd_trident_codec_read, 2960 .read = snd_trident_codec_read,
2961 }; 2961 };
2962 2962
2963 uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); 2963 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
2964 if (!uctl) 2964 if (!uctl)
2965 return -ENOMEM; 2965 return -ENOMEM;
2966 2966
@@ -3546,7 +3546,7 @@ int __devinit snd_trident_create(snd_card_t * card,
3546 return -ENXIO; 3546 return -ENXIO;
3547 } 3547 }
3548 3548
3549 trident = kcalloc(1, sizeof(*trident), GFP_KERNEL); 3549 trident = kzalloc(sizeof(*trident), GFP_KERNEL);
3550 if (trident == NULL) { 3550 if (trident == NULL) {
3551 pci_disable_device(pci); 3551 pci_disable_device(pci);
3552 return -ENOMEM; 3552 return -ENOMEM;
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index 56c6e52d7264..6db7de6b9719 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -104,14 +104,6 @@ module_param_array(dxs_support, int, NULL, 0444);
104MODULE_PARM_DESC(dxs_support, "Support for DXS channels (0 = auto, 1 = enable, 2 = disable, 3 = 48k only, 4 = no VRA, 5 = enable any sample rate)"); 104MODULE_PARM_DESC(dxs_support, "Support for DXS channels (0 = auto, 1 = enable, 2 = disable, 3 = 48k only, 4 = no VRA, 5 = enable any sample rate)");
105 105
106 106
107/* pci ids */
108#ifndef PCI_DEVICE_ID_VIA_82C686_5
109#define PCI_DEVICE_ID_VIA_82C686_5 0x3058
110#endif
111#ifndef PCI_DEVICE_ID_VIA_8233_5
112#define PCI_DEVICE_ID_VIA_8233_5 0x3059
113#endif
114
115/* revision numbers for via686 */ 107/* revision numbers for via686 */
116#define VIA_REV_686_A 0x10 108#define VIA_REV_686_A 0x10
117#define VIA_REV_686_B 0x11 109#define VIA_REV_686_B 0x11
@@ -1935,11 +1927,12 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
1935 * DXS channels don't work properly with VRA if MC97 is disabled. 1927 * DXS channels don't work properly with VRA if MC97 is disabled.
1936 */ 1928 */
1937 struct pci_dev *pci; 1929 struct pci_dev *pci;
1938 pci = pci_find_device(0x1106, 0x3068, NULL); /* MC97 */ 1930 pci = pci_get_device(0x1106, 0x3068, NULL); /* MC97 */
1939 if (pci) { 1931 if (pci) {
1940 unsigned char data; 1932 unsigned char data;
1941 pci_read_config_byte(pci, 0x44, &data); 1933 pci_read_config_byte(pci, 0x44, &data);
1942 pci_write_config_byte(pci, 0x44, data | 0x40); 1934 pci_write_config_byte(pci, 0x44, data | 0x40);
1935 pci_dev_put(pci);
1943 } 1936 }
1944 } 1937 }
1945 1938
@@ -2065,7 +2058,7 @@ static int __devinit snd_via82xx_create(snd_card_t * card,
2065 if ((err = pci_enable_device(pci)) < 0) 2058 if ((err = pci_enable_device(pci)) < 0)
2066 return err; 2059 return err;
2067 2060
2068 if ((chip = kcalloc(1, sizeof(*chip), GFP_KERNEL)) == NULL) { 2061 if ((chip = kzalloc(sizeof(*chip), GFP_KERNEL)) == NULL) {
2069 pci_disable_device(pci); 2062 pci_disable_device(pci);
2070 return -ENOMEM; 2063 return -ENOMEM;
2071 } 2064 }
@@ -2350,6 +2343,7 @@ static void __devexit snd_via82xx_remove(struct pci_dev *pci)
2350 2343
2351static struct pci_driver driver = { 2344static struct pci_driver driver = {
2352 .name = "VIA 82xx Audio", 2345 .name = "VIA 82xx Audio",
2346 .owner = THIS_MODULE,
2353 .id_table = snd_via82xx_ids, 2347 .id_table = snd_via82xx_ids,
2354 .probe = snd_via82xx_probe, 2348 .probe = snd_via82xx_probe,
2355 .remove = __devexit_p(snd_via82xx_remove), 2349 .remove = __devexit_p(snd_via82xx_remove),
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index 5872d438a04a..7eac6f6ac737 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -1083,7 +1083,7 @@ static int __devinit snd_via82xx_create(snd_card_t * card,
1083 if ((err = pci_enable_device(pci)) < 0) 1083 if ((err = pci_enable_device(pci)) < 0)
1084 return err; 1084 return err;
1085 1085
1086 if ((chip = kcalloc(1, sizeof(*chip), GFP_KERNEL)) == NULL) { 1086 if ((chip = kzalloc(sizeof(*chip), GFP_KERNEL)) == NULL) {
1087 pci_disable_device(pci); 1087 pci_disable_device(pci);
1088 return -ENOMEM; 1088 return -ENOMEM;
1089 } 1089 }
@@ -1207,6 +1207,7 @@ static void __devexit snd_via82xx_remove(struct pci_dev *pci)
1207 1207
1208static struct pci_driver driver = { 1208static struct pci_driver driver = {
1209 .name = "VIA 82xx Modem", 1209 .name = "VIA 82xx Modem",
1210 .owner = THIS_MODULE,
1210 .id_table = snd_via82xx_modem_ids, 1211 .id_table = snd_via82xx_modem_ids,
1211 .probe = snd_via82xx_probe, 1212 .probe = snd_via82xx_probe,
1212 .remove = __devexit_p(snd_via82xx_remove), 1213 .remove = __devexit_p(snd_via82xx_remove),
diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c
index dca6bd2c7580..2a7ad9dec021 100644
--- a/sound/pci/vx222/vx222.c
+++ b/sound/pci/vx222/vx222.c
@@ -252,6 +252,7 @@ static void __devexit snd_vx222_remove(struct pci_dev *pci)
252 252
253static struct pci_driver driver = { 253static struct pci_driver driver = {
254 .name = "Digigram VX222", 254 .name = "Digigram VX222",
255 .owner = THIS_MODULE,
255 .id_table = snd_vx222_ids, 256 .id_table = snd_vx222_ids,
256 .probe = snd_vx222_probe, 257 .probe = snd_vx222_probe,
257 .remove = __devexit_p(snd_vx222_remove), 258 .remove = __devexit_p(snd_vx222_remove),
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c
index 5b5b624b47d0..2e69abe51aa9 100644
--- a/sound/pci/ymfpci/ymfpci.c
+++ b/sound/pci/ymfpci/ymfpci.c
@@ -352,6 +352,7 @@ static void __devexit snd_card_ymfpci_remove(struct pci_dev *pci)
352 352
353static struct pci_driver driver = { 353static struct pci_driver driver = {
354 .name = "Yamaha DS-XG PCI", 354 .name = "Yamaha DS-XG PCI",
355 .owner = THIS_MODULE,
355 .id_table = snd_ymfpci_ids, 356 .id_table = snd_ymfpci_ids,
356 .probe = snd_card_ymfpci_probe, 357 .probe = snd_card_ymfpci_probe,
357 .remove = __devexit_p(snd_card_ymfpci_remove), 358 .remove = __devexit_p(snd_card_ymfpci_remove),
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index 054836412dc4..27fa523639ae 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -839,7 +839,7 @@ static int snd_ymfpci_playback_open_1(snd_pcm_substream_t * substream)
839 snd_pcm_runtime_t *runtime = substream->runtime; 839 snd_pcm_runtime_t *runtime = substream->runtime;
840 ymfpci_pcm_t *ypcm; 840 ymfpci_pcm_t *ypcm;
841 841
842 ypcm = kcalloc(1, sizeof(*ypcm), GFP_KERNEL); 842 ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL);
843 if (ypcm == NULL) 843 if (ypcm == NULL)
844 return -ENOMEM; 844 return -ENOMEM;
845 ypcm->chip = chip; 845 ypcm->chip = chip;
@@ -957,7 +957,7 @@ static int snd_ymfpci_capture_open(snd_pcm_substream_t * substream,
957 snd_pcm_runtime_t *runtime = substream->runtime; 957 snd_pcm_runtime_t *runtime = substream->runtime;
958 ymfpci_pcm_t *ypcm; 958 ymfpci_pcm_t *ypcm;
959 959
960 ypcm = kcalloc(1, sizeof(*ypcm), GFP_KERNEL); 960 ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL);
961 if (ypcm == NULL) 961 if (ypcm == NULL)
962 return -ENOMEM; 962 return -ENOMEM;
963 ypcm->chip = chip; 963 ypcm->chip = chip;
@@ -2270,7 +2270,7 @@ int __devinit snd_ymfpci_create(snd_card_t * card,
2270 if ((err = pci_enable_device(pci)) < 0) 2270 if ((err = pci_enable_device(pci)) < 0)
2271 return err; 2271 return err;
2272 2272
2273 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 2273 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
2274 if (chip == NULL) { 2274 if (chip == NULL) {
2275 pci_disable_device(pci); 2275 pci_disable_device(pci);
2276 return -ENOMEM; 2276 return -ENOMEM;