diff options
Diffstat (limited to 'sound/pci')
58 files changed, 1205 insertions, 1028 deletions
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index 748f6b7d90b7..fb5ee3cc3968 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig | |||
@@ -135,11 +135,11 @@ config SND_AW2 | |||
135 | 135 | ||
136 | 136 | ||
137 | config SND_AZT3328 | 137 | config SND_AZT3328 |
138 | tristate "Aztech AZF3328 / PCI168 (EXPERIMENTAL)" | 138 | tristate "Aztech AZF3328 / PCI168" |
139 | depends on EXPERIMENTAL | ||
140 | select SND_OPL3_LIB | 139 | select SND_OPL3_LIB |
141 | select SND_MPU401_UART | 140 | select SND_MPU401_UART |
142 | select SND_PCM | 141 | select SND_PCM |
142 | select SND_RAWMIDI | ||
143 | help | 143 | help |
144 | Say Y here to include support for Aztech AZF3328 (PCI168) | 144 | Say Y here to include support for Aztech AZF3328 (PCI168) |
145 | soundcards. | 145 | soundcards. |
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index c551006e2920..b458d208720b 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c | |||
@@ -310,12 +310,16 @@ static int snd_ali_codec_ready(struct snd_ali *codec, | |||
310 | unsigned int res; | 310 | unsigned int res; |
311 | 311 | ||
312 | end_time = jiffies + msecs_to_jiffies(250); | 312 | end_time = jiffies + msecs_to_jiffies(250); |
313 | do { | 313 | |
314 | for (;;) { | ||
314 | res = snd_ali_5451_peek(codec,port); | 315 | res = snd_ali_5451_peek(codec,port); |
315 | if (!(res & 0x8000)) | 316 | if (!(res & 0x8000)) |
316 | return 0; | 317 | return 0; |
318 | if (!time_after_eq(end_time, jiffies)) | ||
319 | break; | ||
317 | schedule_timeout_uninterruptible(1); | 320 | schedule_timeout_uninterruptible(1); |
318 | } while (time_after_eq(end_time, jiffies)); | 321 | } |
322 | |||
319 | snd_ali_5451_poke(codec, port, res & ~0x8000); | 323 | snd_ali_5451_poke(codec, port, res & ~0x8000); |
320 | snd_printdd("ali_codec_ready: codec is not ready.\n "); | 324 | snd_printdd("ali_codec_ready: codec is not ready.\n "); |
321 | return -EIO; | 325 | return -EIO; |
@@ -327,15 +331,17 @@ static int snd_ali_stimer_ready(struct snd_ali *codec) | |||
327 | unsigned long dwChk1,dwChk2; | 331 | unsigned long dwChk1,dwChk2; |
328 | 332 | ||
329 | dwChk1 = snd_ali_5451_peek(codec, ALI_STIMER); | 333 | dwChk1 = snd_ali_5451_peek(codec, ALI_STIMER); |
330 | dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER); | ||
331 | |||
332 | end_time = jiffies + msecs_to_jiffies(250); | 334 | end_time = jiffies + msecs_to_jiffies(250); |
333 | do { | 335 | |
336 | for (;;) { | ||
334 | dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER); | 337 | dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER); |
335 | if (dwChk2 != dwChk1) | 338 | if (dwChk2 != dwChk1) |
336 | return 0; | 339 | return 0; |
340 | if (!time_after_eq(end_time, jiffies)) | ||
341 | break; | ||
337 | schedule_timeout_uninterruptible(1); | 342 | schedule_timeout_uninterruptible(1); |
338 | } while (time_after_eq(end_time, jiffies)); | 343 | } |
344 | |||
339 | snd_printk(KERN_ERR "ali_stimer_read: stimer is not ready.\n"); | 345 | snd_printk(KERN_ERR "ali_stimer_read: stimer is not ready.\n"); |
340 | return -EIO; | 346 | return -EIO; |
341 | } | 347 | } |
@@ -472,45 +478,6 @@ static int snd_ali_reset_5451(struct snd_ali *codec) | |||
472 | return 0; | 478 | return 0; |
473 | } | 479 | } |
474 | 480 | ||
475 | #ifdef CODEC_RESET | ||
476 | |||
477 | static int snd_ali_reset_codec(struct snd_ali *codec) | ||
478 | { | ||
479 | struct pci_dev *pci_dev; | ||
480 | unsigned char bVal; | ||
481 | unsigned int dwVal; | ||
482 | unsigned short wCount, wReg; | ||
483 | |||
484 | pci_dev = codec->pci_m1533; | ||
485 | |||
486 | pci_read_config_dword(pci_dev, 0x7c, &dwVal); | ||
487 | pci_write_config_dword(pci_dev, 0x7c, dwVal | 0x08000000); | ||
488 | udelay(5000); | ||
489 | pci_read_config_dword(pci_dev, 0x7c, &dwVal); | ||
490 | pci_write_config_dword(pci_dev, 0x7c, dwVal & 0xf7ffffff); | ||
491 | udelay(5000); | ||
492 | |||
493 | bVal = inb(ALI_REG(codec,ALI_SCTRL)); | ||
494 | bVal |= 0x02; | ||
495 | outb(ALI_REG(codec,ALI_SCTRL),bVal); | ||
496 | udelay(5000); | ||
497 | bVal = inb(ALI_REG(codec,ALI_SCTRL)); | ||
498 | bVal &= 0xfd; | ||
499 | outb(ALI_REG(codec,ALI_SCTRL),bVal); | ||
500 | udelay(15000); | ||
501 | |||
502 | wCount = 200; | ||
503 | while (wCount--) { | ||
504 | wReg = snd_ali_codec_read(codec->ac97, AC97_POWERDOWN); | ||
505 | if ((wReg & 0x000f) == 0x000f) | ||
506 | return 0; | ||
507 | udelay(5000); | ||
508 | } | ||
509 | return -1; | ||
510 | } | ||
511 | |||
512 | #endif | ||
513 | |||
514 | /* | 481 | /* |
515 | * ALI 5451 Controller | 482 | * ALI 5451 Controller |
516 | */ | 483 | */ |
@@ -555,22 +522,6 @@ static void snd_ali_disable_address_interrupt(struct snd_ali *codec) | |||
555 | outl(gc, ALI_REG(codec, ALI_GC_CIR)); | 522 | outl(gc, ALI_REG(codec, ALI_GC_CIR)); |
556 | } | 523 | } |
557 | 524 | ||
558 | #if 0 /* not used */ | ||
559 | static void snd_ali_enable_voice_irq(struct snd_ali *codec, | ||
560 | unsigned int channel) | ||
561 | { | ||
562 | unsigned int mask; | ||
563 | struct snd_ali_channel_control *pchregs = &(codec->chregs); | ||
564 | |||
565 | snd_ali_printk("enable_voice_irq channel=%d\n",channel); | ||
566 | |||
567 | mask = 1 << (channel & 0x1f); | ||
568 | pchregs->data.ainten = inl(ALI_REG(codec, pchregs->regs.ainten)); | ||
569 | pchregs->data.ainten |= mask; | ||
570 | outl(pchregs->data.ainten, ALI_REG(codec, pchregs->regs.ainten)); | ||
571 | } | ||
572 | #endif | ||
573 | |||
574 | static void snd_ali_disable_voice_irq(struct snd_ali *codec, | 525 | static void snd_ali_disable_voice_irq(struct snd_ali *codec, |
575 | unsigned int channel) | 526 | unsigned int channel) |
576 | { | 527 | { |
@@ -671,16 +622,6 @@ static void snd_ali_free_channel_pcm(struct snd_ali *codec, int channel) | |||
671 | } | 622 | } |
672 | } | 623 | } |
673 | 624 | ||
674 | #if 0 /* not used */ | ||
675 | static void snd_ali_start_voice(struct snd_ali *codec, unsigned int channel) | ||
676 | { | ||
677 | unsigned int mask = 1 << (channel & 0x1f); | ||
678 | |||
679 | snd_ali_printk("start_voice: channel=%d\n",channel); | ||
680 | outl(mask, ALI_REG(codec,codec->chregs.regs.start)); | ||
681 | } | ||
682 | #endif | ||
683 | |||
684 | static void snd_ali_stop_voice(struct snd_ali *codec, unsigned int channel) | 625 | static void snd_ali_stop_voice(struct snd_ali *codec, unsigned int channel) |
685 | { | 626 | { |
686 | unsigned int mask = 1 << (channel & 0x1f); | 627 | unsigned int mask = 1 << (channel & 0x1f); |
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index 71515ddb4593..d6752dff2a44 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c | |||
@@ -287,10 +287,10 @@ struct atiixp { | |||
287 | /* | 287 | /* |
288 | */ | 288 | */ |
289 | static struct pci_device_id snd_atiixp_ids[] = { | 289 | static struct pci_device_id snd_atiixp_ids[] = { |
290 | { 0x1002, 0x4341, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* SB200 */ | 290 | { PCI_VDEVICE(ATI, 0x4341), 0 }, /* SB200 */ |
291 | { 0x1002, 0x4361, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* SB300 */ | 291 | { PCI_VDEVICE(ATI, 0x4361), 0 }, /* SB300 */ |
292 | { 0x1002, 0x4370, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* SB400 */ | 292 | { PCI_VDEVICE(ATI, 0x4370), 0 }, /* SB400 */ |
293 | { 0x1002, 0x4382, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* SB600 */ | 293 | { PCI_VDEVICE(ATI, 0x4382), 0 }, /* SB600 */ |
294 | { 0, } | 294 | { 0, } |
295 | }; | 295 | }; |
296 | 296 | ||
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c index c3136cccc559..e7e147bf8eb2 100644 --- a/sound/pci/atiixp_modem.c +++ b/sound/pci/atiixp_modem.c | |||
@@ -262,8 +262,8 @@ struct atiixp_modem { | |||
262 | /* | 262 | /* |
263 | */ | 263 | */ |
264 | static struct pci_device_id snd_atiixp_ids[] = { | 264 | static struct pci_device_id snd_atiixp_ids[] = { |
265 | { 0x1002, 0x434d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* SB200 */ | 265 | { PCI_VDEVICE(ATI, 0x434d), 0 }, /* SB200 */ |
266 | { 0x1002, 0x4378, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* SB400 */ | 266 | { PCI_VDEVICE(ATI, 0x4378), 0 }, /* SB400 */ |
267 | { 0, } | 267 | { 0, } |
268 | }; | 268 | }; |
269 | 269 | ||
diff --git a/sound/pci/au88x0/au8810.c b/sound/pci/au88x0/au8810.c index fce22c7af0ea..c0e8c6b295cb 100644 --- a/sound/pci/au88x0/au8810.c +++ b/sound/pci/au88x0/au8810.c | |||
@@ -1,8 +1,7 @@ | |||
1 | #include "au8810.h" | 1 | #include "au8810.h" |
2 | #include "au88x0.h" | 2 | #include "au88x0.h" |
3 | static struct pci_device_id snd_vortex_ids[] = { | 3 | static struct pci_device_id snd_vortex_ids[] = { |
4 | {PCI_VENDOR_ID_AUREAL, PCI_DEVICE_ID_AUREAL_ADVANTAGE, | 4 | {PCI_VDEVICE(AUREAL, PCI_DEVICE_ID_AUREAL_ADVANTAGE), 1,}, |
5 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1,}, | ||
6 | {0,} | 5 | {0,} |
7 | }; | 6 | }; |
8 | 7 | ||
diff --git a/sound/pci/au88x0/au8820.c b/sound/pci/au88x0/au8820.c index d1fbcce07257..a6527330df58 100644 --- a/sound/pci/au88x0/au8820.c +++ b/sound/pci/au88x0/au8820.c | |||
@@ -1,8 +1,7 @@ | |||
1 | #include "au8820.h" | 1 | #include "au8820.h" |
2 | #include "au88x0.h" | 2 | #include "au88x0.h" |
3 | static struct pci_device_id snd_vortex_ids[] = { | 3 | static struct pci_device_id snd_vortex_ids[] = { |
4 | {PCI_VENDOR_ID_AUREAL, PCI_DEVICE_ID_AUREAL_VORTEX_1, | 4 | {PCI_VDEVICE(AUREAL, PCI_DEVICE_ID_AUREAL_VORTEX_1), 0,}, |
5 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0,}, | ||
6 | {0,} | 5 | {0,} |
7 | }; | 6 | }; |
8 | 7 | ||
diff --git a/sound/pci/au88x0/au8830.c b/sound/pci/au88x0/au8830.c index d4f2717c14fb..6c702ad4352a 100644 --- a/sound/pci/au88x0/au8830.c +++ b/sound/pci/au88x0/au8830.c | |||
@@ -1,8 +1,7 @@ | |||
1 | #include "au8830.h" | 1 | #include "au8830.h" |
2 | #include "au88x0.h" | 2 | #include "au88x0.h" |
3 | static struct pci_device_id snd_vortex_ids[] = { | 3 | static struct pci_device_id snd_vortex_ids[] = { |
4 | {PCI_VENDOR_ID_AUREAL, PCI_DEVICE_ID_AUREAL_VORTEX_2, | 4 | {PCI_VDEVICE(AUREAL, PCI_DEVICE_ID_AUREAL_VORTEX_2), 0,}, |
5 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0,}, | ||
6 | {0,} | 5 | {0,} |
7 | }; | 6 | }; |
8 | 7 | ||
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index f290bc56178f..8451a0169f32 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * azt3328.c - driver for Aztech AZF3328 based soundcards (e.g. PCI168). | 2 | * azt3328.c - driver for Aztech AZF3328 based soundcards (e.g. PCI168). |
3 | * Copyright (C) 2002, 2005 - 2008 by Andreas Mohr <andi AT lisas.de> | 3 | * Copyright (C) 2002, 2005 - 2009 by Andreas Mohr <andi AT lisas.de> |
4 | * | 4 | * |
5 | * Framework borrowed from Bart Hartgers's als4000.c. | 5 | * Framework borrowed from Bart Hartgers's als4000.c. |
6 | * Driver developed on PCI168 AP(W) version (PCI rev. 10, subsystem ID 1801), | 6 | * Driver developed on PCI168 AP(W) version (PCI rev. 10, subsystem ID 1801), |
@@ -10,6 +10,13 @@ | |||
10 | * PCI168 A/AP, sub ID 8000 | 10 | * PCI168 A/AP, sub ID 8000 |
11 | * Please give me feedback in case you try my driver with one of these!! | 11 | * Please give me feedback in case you try my driver with one of these!! |
12 | * | 12 | * |
13 | * Keywords: Windows XP Vista 168nt4-125.zip 168win95-125.zip PCI 168 download | ||
14 | * (XP/Vista do not support this card at all but every Linux distribution | ||
15 | * has very good support out of the box; | ||
16 | * just to make sure that the right people hit this and get to know that, | ||
17 | * despite the high level of Internet ignorance - as usual :-P - | ||
18 | * about very good support for this card - on Linux!) | ||
19 | * | ||
13 | * GPL LICENSE | 20 | * GPL LICENSE |
14 | * This program is free software; you can redistribute it and/or modify | 21 | * This program is free software; you can redistribute it and/or modify |
15 | * it under the terms of the GNU General Public License as published by | 22 | * it under the terms of the GNU General Public License as published by |
@@ -71,10 +78,11 @@ | |||
71 | * - built-in General DirectX timer having a 20 bits counter | 78 | * - built-in General DirectX timer having a 20 bits counter |
72 | * with 1us resolution (see below!) | 79 | * with 1us resolution (see below!) |
73 | * - I2S serial output port for external DAC | 80 | * - I2S serial output port for external DAC |
81 | * [FIXME: 3.3V or 5V level? maximum rate is 66.2kHz right?] | ||
74 | * - supports 33MHz PCI spec 2.1, PCI power management 1.0, compliant with ACPI | 82 | * - supports 33MHz PCI spec 2.1, PCI power management 1.0, compliant with ACPI |
75 | * - supports hardware volume control | 83 | * - supports hardware volume control |
76 | * - single chip low cost solution (128 pin QFP) | 84 | * - single chip low cost solution (128 pin QFP) |
77 | * - supports programmable Sub-vendor and Sub-system ID | 85 | * - supports programmable Sub-vendor and Sub-system ID [24C02 SEEPROM chip] |
78 | * required for Microsoft's logo compliance (FIXME: where?) | 86 | * required for Microsoft's logo compliance (FIXME: where?) |
79 | * At least the Trident 4D Wave DX has one bit somewhere | 87 | * At least the Trident 4D Wave DX has one bit somewhere |
80 | * to enable writes to PCI subsystem VID registers, that should be it. | 88 | * to enable writes to PCI subsystem VID registers, that should be it. |
@@ -82,6 +90,7 @@ | |||
82 | * some custom data starting at 0x80. What kind of config settings | 90 | * some custom data starting at 0x80. What kind of config settings |
83 | * are located in our extended PCI space anyway?? | 91 | * are located in our extended PCI space anyway?? |
84 | * - PCI168 AP(W) card: power amplifier with 4 Watts/channel at 4 Ohms | 92 | * - PCI168 AP(W) card: power amplifier with 4 Watts/channel at 4 Ohms |
93 | * [TDA1517P chip] | ||
85 | * | 94 | * |
86 | * Note that this driver now is actually *better* than the Windows driver, | 95 | * Note that this driver now is actually *better* than the Windows driver, |
87 | * since it additionally supports the card's 1MHz DirectX timer - just try | 96 | * since it additionally supports the card's 1MHz DirectX timer - just try |
@@ -146,10 +155,15 @@ | |||
146 | * to read the Digital Enhanced Game Port. Not sure whether it is fixable. | 155 | * to read the Digital Enhanced Game Port. Not sure whether it is fixable. |
147 | * | 156 | * |
148 | * TODO | 157 | * TODO |
158 | * - use PCI_VDEVICE | ||
159 | * - verify driver status on x86_64 | ||
160 | * - test multi-card driver operation | ||
161 | * - (ab)use 1MHz DirectX timer as kernel clocksource | ||
149 | * - test MPU401 MIDI playback etc. | 162 | * - test MPU401 MIDI playback etc. |
150 | * - add more power micro-management (disable various units of the card | 163 | * - add more power micro-management (disable various units of the card |
151 | * as long as they're unused). However this requires more I/O ports which I | 164 | * as long as they're unused, to improve audio quality and save power). |
152 | * haven't figured out yet and which thus might not even exist... | 165 | * However this requires more I/O ports which I haven't figured out yet |
166 | * and which thus might not even exist... | ||
153 | * The standard suspend/resume functionality could probably make use of | 167 | * The standard suspend/resume functionality could probably make use of |
154 | * some improvement, too... | 168 | * some improvement, too... |
155 | * - figure out what all unknown port bits are responsible for | 169 | * - figure out what all unknown port bits are responsible for |
@@ -185,25 +199,46 @@ MODULE_SUPPORTED_DEVICE("{{Aztech,AZF3328}}"); | |||
185 | #define SUPPORT_GAMEPORT 1 | 199 | #define SUPPORT_GAMEPORT 1 |
186 | #endif | 200 | #endif |
187 | 201 | ||
202 | /* === Debug settings === | ||
203 | Further diagnostic functionality than the settings below | ||
204 | does not need to be provided, since one can easily write a bash script | ||
205 | to dump the card's I/O ports (those listed in lspci -v -v): | ||
206 | function dump() | ||
207 | { | ||
208 | local descr=$1; local addr=$2; local count=$3 | ||
209 | |||
210 | echo "${descr}: ${count} @ ${addr}:" | ||
211 | dd if=/dev/port skip=$[${addr}] count=${count} bs=1 2>/dev/null| hexdump -C | ||
212 | } | ||
213 | and then use something like | ||
214 | "dump joy200 0x200 8", "dump mpu388 0x388 4", "dump joy 0xb400 8", | ||
215 | "dump codec00 0xa800 32", "dump mixer 0xb800 64", "dump synth 0xbc00 8", | ||
216 | possibly within a "while true; do ... sleep 1; done" loop. | ||
217 | Tweaking ports could be done using | ||
218 | VALSTRING="`printf "%02x" $value`" | ||
219 | printf "\x""$VALSTRING"|dd of=/dev/port seek=$[${addr}] bs=1 2>/dev/null | ||
220 | */ | ||
221 | |||
188 | #define DEBUG_MISC 0 | 222 | #define DEBUG_MISC 0 |
189 | #define DEBUG_CALLS 0 | 223 | #define DEBUG_CALLS 0 |
190 | #define DEBUG_MIXER 0 | 224 | #define DEBUG_MIXER 0 |
191 | #define DEBUG_PLAY_REC 0 | 225 | #define DEBUG_CODEC 0 |
192 | #define DEBUG_IO 0 | 226 | #define DEBUG_IO 0 |
193 | #define DEBUG_TIMER 0 | 227 | #define DEBUG_TIMER 0 |
194 | #define DEBUG_GAME 0 | 228 | #define DEBUG_GAME 0 |
229 | #define DEBUG_PM 0 | ||
195 | #define MIXER_TESTING 0 | 230 | #define MIXER_TESTING 0 |
196 | 231 | ||
197 | #if DEBUG_MISC | 232 | #if DEBUG_MISC |
198 | #define snd_azf3328_dbgmisc(format, args...) printk(KERN_ERR format, ##args) | 233 | #define snd_azf3328_dbgmisc(format, args...) printk(KERN_DEBUG format, ##args) |
199 | #else | 234 | #else |
200 | #define snd_azf3328_dbgmisc(format, args...) | 235 | #define snd_azf3328_dbgmisc(format, args...) |
201 | #endif | 236 | #endif |
202 | 237 | ||
203 | #if DEBUG_CALLS | 238 | #if DEBUG_CALLS |
204 | #define snd_azf3328_dbgcalls(format, args...) printk(format, ##args) | 239 | #define snd_azf3328_dbgcalls(format, args...) printk(format, ##args) |
205 | #define snd_azf3328_dbgcallenter() printk(KERN_ERR "--> %s\n", __func__) | 240 | #define snd_azf3328_dbgcallenter() printk(KERN_DEBUG "--> %s\n", __func__) |
206 | #define snd_azf3328_dbgcallleave() printk(KERN_ERR "<-- %s\n", __func__) | 241 | #define snd_azf3328_dbgcallleave() printk(KERN_DEBUG "<-- %s\n", __func__) |
207 | #else | 242 | #else |
208 | #define snd_azf3328_dbgcalls(format, args...) | 243 | #define snd_azf3328_dbgcalls(format, args...) |
209 | #define snd_azf3328_dbgcallenter() | 244 | #define snd_azf3328_dbgcallenter() |
@@ -216,10 +251,10 @@ MODULE_SUPPORTED_DEVICE("{{Aztech,AZF3328}}"); | |||
216 | #define snd_azf3328_dbgmixer(format, args...) | 251 | #define snd_azf3328_dbgmixer(format, args...) |
217 | #endif | 252 | #endif |
218 | 253 | ||
219 | #if DEBUG_PLAY_REC | 254 | #if DEBUG_CODEC |
220 | #define snd_azf3328_dbgplay(format, args...) printk(KERN_DEBUG format, ##args) | 255 | #define snd_azf3328_dbgcodec(format, args...) printk(KERN_DEBUG format, ##args) |
221 | #else | 256 | #else |
222 | #define snd_azf3328_dbgplay(format, args...) | 257 | #define snd_azf3328_dbgcodec(format, args...) |
223 | #endif | 258 | #endif |
224 | 259 | ||
225 | #if DEBUG_MISC | 260 | #if DEBUG_MISC |
@@ -234,6 +269,12 @@ MODULE_SUPPORTED_DEVICE("{{Aztech,AZF3328}}"); | |||
234 | #define snd_azf3328_dbggame(format, args...) | 269 | #define snd_azf3328_dbggame(format, args...) |
235 | #endif | 270 | #endif |
236 | 271 | ||
272 | #if DEBUG_PM | ||
273 | #define snd_azf3328_dbgpm(format, args...) printk(KERN_DEBUG format, ##args) | ||
274 | #else | ||
275 | #define snd_azf3328_dbgpm(format, args...) | ||
276 | #endif | ||
277 | |||
237 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 278 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
238 | module_param_array(index, int, NULL, 0444); | 279 | module_param_array(index, int, NULL, 0444); |
239 | MODULE_PARM_DESC(index, "Index value for AZF3328 soundcard."); | 280 | MODULE_PARM_DESC(index, "Index value for AZF3328 soundcard."); |
@@ -250,22 +291,23 @@ static int seqtimer_scaling = 128; | |||
250 | module_param(seqtimer_scaling, int, 0444); | 291 | module_param(seqtimer_scaling, int, 0444); |
251 | MODULE_PARM_DESC(seqtimer_scaling, "Set 1024000Hz sequencer timer scale factor (lockup danger!). Default 128."); | 292 | MODULE_PARM_DESC(seqtimer_scaling, "Set 1024000Hz sequencer timer scale factor (lockup danger!). Default 128."); |
252 | 293 | ||
253 | struct snd_azf3328_audio_stream { | 294 | struct snd_azf3328_codec_data { |
295 | unsigned long io_base; | ||
254 | struct snd_pcm_substream *substream; | 296 | struct snd_pcm_substream *substream; |
255 | int enabled; | 297 | bool running; |
256 | int running; | 298 | const char *name; |
257 | unsigned long portbase; | ||
258 | }; | 299 | }; |
259 | 300 | ||
260 | enum snd_azf3328_stream_index { | 301 | enum snd_azf3328_codec_type { |
261 | AZF_PLAYBACK = 0, | 302 | AZF_CODEC_PLAYBACK = 0, |
262 | AZF_CAPTURE = 1, | 303 | AZF_CODEC_CAPTURE = 1, |
304 | AZF_CODEC_I2S_OUT = 2, | ||
263 | }; | 305 | }; |
264 | 306 | ||
265 | struct snd_azf3328 { | 307 | struct snd_azf3328 { |
266 | /* often-used fields towards beginning, then grouped */ | 308 | /* often-used fields towards beginning, then grouped */ |
267 | 309 | ||
268 | unsigned long codec_io; /* usually 0xb000, size 128 */ | 310 | unsigned long ctrl_io; /* usually 0xb000, size 128 */ |
269 | unsigned long game_io; /* usually 0xb400, size 8 */ | 311 | unsigned long game_io; /* usually 0xb400, size 8 */ |
270 | unsigned long mpu_io; /* usually 0xb800, size 4 */ | 312 | unsigned long mpu_io; /* usually 0xb800, size 4 */ |
271 | unsigned long opl3_io; /* usually 0xbc00, size 8 */ | 313 | unsigned long opl3_io; /* usually 0xbc00, size 8 */ |
@@ -275,15 +317,17 @@ struct snd_azf3328 { | |||
275 | 317 | ||
276 | struct snd_timer *timer; | 318 | struct snd_timer *timer; |
277 | 319 | ||
278 | struct snd_pcm *pcm; | 320 | struct snd_pcm *pcm[3]; |
279 | struct snd_azf3328_audio_stream audio_stream[2]; | 321 | |
322 | /* playback, recording and I2S out codecs */ | ||
323 | struct snd_azf3328_codec_data codecs[3]; | ||
280 | 324 | ||
281 | struct snd_card *card; | 325 | struct snd_card *card; |
282 | struct snd_rawmidi *rmidi; | 326 | struct snd_rawmidi *rmidi; |
283 | 327 | ||
284 | #ifdef SUPPORT_GAMEPORT | 328 | #ifdef SUPPORT_GAMEPORT |
285 | struct gameport *gameport; | 329 | struct gameport *gameport; |
286 | int axes[4]; | 330 | u16 axes[4]; |
287 | #endif | 331 | #endif |
288 | 332 | ||
289 | struct pci_dev *pci; | 333 | struct pci_dev *pci; |
@@ -293,16 +337,16 @@ struct snd_azf3328 { | |||
293 | * If we need to add more registers here, then we might try to fold this | 337 | * If we need to add more registers here, then we might try to fold this |
294 | * into some transparent combined shadow register handling with | 338 | * into some transparent combined shadow register handling with |
295 | * CONFIG_PM register storage below, but that's slightly difficult. */ | 339 | * CONFIG_PM register storage below, but that's slightly difficult. */ |
296 | u16 shadow_reg_codec_6AH; | 340 | u16 shadow_reg_ctrl_6AH; |
297 | 341 | ||
298 | #ifdef CONFIG_PM | 342 | #ifdef CONFIG_PM |
299 | /* register value containers for power management | 343 | /* register value containers for power management |
300 | * Note: not always full I/O range preserved (just like Win driver!) */ | 344 | * Note: not always full I/O range preserved (similar to Win driver!) */ |
301 | u16 saved_regs_codec[AZF_IO_SIZE_CODEC_PM / 2]; | 345 | u32 saved_regs_ctrl[AZF_ALIGN(AZF_IO_SIZE_CTRL_PM) / 4]; |
302 | u16 saved_regs_game [AZF_IO_SIZE_GAME_PM / 2]; | 346 | u32 saved_regs_game[AZF_ALIGN(AZF_IO_SIZE_GAME_PM) / 4]; |
303 | u16 saved_regs_mpu [AZF_IO_SIZE_MPU_PM / 2]; | 347 | u32 saved_regs_mpu[AZF_ALIGN(AZF_IO_SIZE_MPU_PM) / 4]; |
304 | u16 saved_regs_opl3 [AZF_IO_SIZE_OPL3_PM / 2]; | 348 | u32 saved_regs_opl3[AZF_ALIGN(AZF_IO_SIZE_OPL3_PM) / 4]; |
305 | u16 saved_regs_mixer[AZF_IO_SIZE_MIXER_PM / 2]; | 349 | u32 saved_regs_mixer[AZF_ALIGN(AZF_IO_SIZE_MIXER_PM) / 4]; |
306 | #endif | 350 | #endif |
307 | }; | 351 | }; |
308 | 352 | ||
@@ -316,7 +360,7 @@ MODULE_DEVICE_TABLE(pci, snd_azf3328_ids); | |||
316 | 360 | ||
317 | 361 | ||
318 | static int | 362 | static int |
319 | snd_azf3328_io_reg_setb(unsigned reg, u8 mask, int do_set) | 363 | snd_azf3328_io_reg_setb(unsigned reg, u8 mask, bool do_set) |
320 | { | 364 | { |
321 | u8 prev = inb(reg), new; | 365 | u8 prev = inb(reg), new; |
322 | 366 | ||
@@ -331,39 +375,72 @@ snd_azf3328_io_reg_setb(unsigned reg, u8 mask, int do_set) | |||
331 | } | 375 | } |
332 | 376 | ||
333 | static inline void | 377 | static inline void |
334 | snd_azf3328_codec_outb(const struct snd_azf3328 *chip, unsigned reg, u8 value) | 378 | snd_azf3328_codec_outb(const struct snd_azf3328_codec_data *codec, |
379 | unsigned reg, | ||
380 | u8 value | ||
381 | ) | ||
335 | { | 382 | { |
336 | outb(value, chip->codec_io + reg); | 383 | outb(value, codec->io_base + reg); |
337 | } | 384 | } |
338 | 385 | ||
339 | static inline u8 | 386 | static inline u8 |
340 | snd_azf3328_codec_inb(const struct snd_azf3328 *chip, unsigned reg) | 387 | snd_azf3328_codec_inb(const struct snd_azf3328_codec_data *codec, unsigned reg) |
341 | { | 388 | { |
342 | return inb(chip->codec_io + reg); | 389 | return inb(codec->io_base + reg); |
343 | } | 390 | } |
344 | 391 | ||
345 | static inline void | 392 | static inline void |
346 | snd_azf3328_codec_outw(const struct snd_azf3328 *chip, unsigned reg, u16 value) | 393 | snd_azf3328_codec_outw(const struct snd_azf3328_codec_data *codec, |
394 | unsigned reg, | ||
395 | u16 value | ||
396 | ) | ||
347 | { | 397 | { |
348 | outw(value, chip->codec_io + reg); | 398 | outw(value, codec->io_base + reg); |
349 | } | 399 | } |
350 | 400 | ||
351 | static inline u16 | 401 | static inline u16 |
352 | snd_azf3328_codec_inw(const struct snd_azf3328 *chip, unsigned reg) | 402 | snd_azf3328_codec_inw(const struct snd_azf3328_codec_data *codec, unsigned reg) |
353 | { | 403 | { |
354 | return inw(chip->codec_io + reg); | 404 | return inw(codec->io_base + reg); |
355 | } | 405 | } |
356 | 406 | ||
357 | static inline void | 407 | static inline void |
358 | snd_azf3328_codec_outl(const struct snd_azf3328 *chip, unsigned reg, u32 value) | 408 | snd_azf3328_codec_outl(const struct snd_azf3328_codec_data *codec, |
409 | unsigned reg, | ||
410 | u32 value | ||
411 | ) | ||
359 | { | 412 | { |
360 | outl(value, chip->codec_io + reg); | 413 | outl(value, codec->io_base + reg); |
361 | } | 414 | } |
362 | 415 | ||
363 | static inline u32 | 416 | static inline u32 |
364 | snd_azf3328_codec_inl(const struct snd_azf3328 *chip, unsigned reg) | 417 | snd_azf3328_codec_inl(const struct snd_azf3328_codec_data *codec, unsigned reg) |
418 | { | ||
419 | return inl(codec->io_base + reg); | ||
420 | } | ||
421 | |||
422 | static inline void | ||
423 | snd_azf3328_ctrl_outb(const struct snd_azf3328 *chip, unsigned reg, u8 value) | ||
424 | { | ||
425 | outb(value, chip->ctrl_io + reg); | ||
426 | } | ||
427 | |||
428 | static inline u8 | ||
429 | snd_azf3328_ctrl_inb(const struct snd_azf3328 *chip, unsigned reg) | ||
430 | { | ||
431 | return inb(chip->ctrl_io + reg); | ||
432 | } | ||
433 | |||
434 | static inline void | ||
435 | snd_azf3328_ctrl_outw(const struct snd_azf3328 *chip, unsigned reg, u16 value) | ||
436 | { | ||
437 | outw(value, chip->ctrl_io + reg); | ||
438 | } | ||
439 | |||
440 | static inline void | ||
441 | snd_azf3328_ctrl_outl(const struct snd_azf3328 *chip, unsigned reg, u32 value) | ||
365 | { | 442 | { |
366 | return inl(chip->codec_io + reg); | 443 | outl(value, chip->ctrl_io + reg); |
367 | } | 444 | } |
368 | 445 | ||
369 | static inline void | 446 | static inline void |
@@ -404,13 +481,13 @@ snd_azf3328_mixer_inw(const struct snd_azf3328 *chip, unsigned reg) | |||
404 | 481 | ||
405 | #define AZF_MUTE_BIT 0x80 | 482 | #define AZF_MUTE_BIT 0x80 |
406 | 483 | ||
407 | static int | 484 | static bool |
408 | snd_azf3328_mixer_set_mute(const struct snd_azf3328 *chip, | 485 | snd_azf3328_mixer_set_mute(const struct snd_azf3328 *chip, |
409 | unsigned reg, int do_mute | 486 | unsigned reg, bool do_mute |
410 | ) | 487 | ) |
411 | { | 488 | { |
412 | unsigned long portbase = chip->mixer_io + reg + 1; | 489 | unsigned long portbase = chip->mixer_io + reg + 1; |
413 | int updated; | 490 | bool updated; |
414 | 491 | ||
415 | /* the mute bit is on the *second* (i.e. right) register of a | 492 | /* the mute bit is on the *second* (i.e. right) register of a |
416 | * left/right channel setting */ | 493 | * left/right channel setting */ |
@@ -569,7 +646,7 @@ snd_azf3328_get_mixer(struct snd_kcontrol *kcontrol, | |||
569 | { | 646 | { |
570 | struct snd_azf3328 *chip = snd_kcontrol_chip(kcontrol); | 647 | struct snd_azf3328 *chip = snd_kcontrol_chip(kcontrol); |
571 | struct azf3328_mixer_reg reg; | 648 | struct azf3328_mixer_reg reg; |
572 | unsigned int oreg, val; | 649 | u16 oreg, val; |
573 | 650 | ||
574 | snd_azf3328_dbgcallenter(); | 651 | snd_azf3328_dbgcallenter(); |
575 | snd_azf3328_mixer_reg_decode(®, kcontrol->private_value); | 652 | snd_azf3328_mixer_reg_decode(®, kcontrol->private_value); |
@@ -600,7 +677,7 @@ snd_azf3328_put_mixer(struct snd_kcontrol *kcontrol, | |||
600 | { | 677 | { |
601 | struct snd_azf3328 *chip = snd_kcontrol_chip(kcontrol); | 678 | struct snd_azf3328 *chip = snd_kcontrol_chip(kcontrol); |
602 | struct azf3328_mixer_reg reg; | 679 | struct azf3328_mixer_reg reg; |
603 | unsigned int oreg, nreg, val; | 680 | u16 oreg, nreg, val; |
604 | 681 | ||
605 | snd_azf3328_dbgcallenter(); | 682 | snd_azf3328_dbgcallenter(); |
606 | snd_azf3328_mixer_reg_decode(®, kcontrol->private_value); | 683 | snd_azf3328_mixer_reg_decode(®, kcontrol->private_value); |
@@ -709,7 +786,7 @@ snd_azf3328_put_mixer_enum(struct snd_kcontrol *kcontrol, | |||
709 | { | 786 | { |
710 | struct snd_azf3328 *chip = snd_kcontrol_chip(kcontrol); | 787 | struct snd_azf3328 *chip = snd_kcontrol_chip(kcontrol); |
711 | struct azf3328_mixer_reg reg; | 788 | struct azf3328_mixer_reg reg; |
712 | unsigned int oreg, nreg, val; | 789 | u16 oreg, nreg, val; |
713 | 790 | ||
714 | snd_azf3328_mixer_reg_decode(®, kcontrol->private_value); | 791 | snd_azf3328_mixer_reg_decode(®, kcontrol->private_value); |
715 | oreg = snd_azf3328_mixer_inw(chip, reg.reg); | 792 | oreg = snd_azf3328_mixer_inw(chip, reg.reg); |
@@ -867,14 +944,15 @@ snd_azf3328_hw_free(struct snd_pcm_substream *substream) | |||
867 | 944 | ||
868 | static void | 945 | static void |
869 | snd_azf3328_codec_setfmt(struct snd_azf3328 *chip, | 946 | snd_azf3328_codec_setfmt(struct snd_azf3328 *chip, |
870 | unsigned reg, | 947 | enum snd_azf3328_codec_type codec_type, |
871 | enum azf_freq_t bitrate, | 948 | enum azf_freq_t bitrate, |
872 | unsigned int format_width, | 949 | unsigned int format_width, |
873 | unsigned int channels | 950 | unsigned int channels |
874 | ) | 951 | ) |
875 | { | 952 | { |
876 | u16 val = 0xff00; | ||
877 | unsigned long flags; | 953 | unsigned long flags; |
954 | const struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type]; | ||
955 | u16 val = 0xff00; | ||
878 | 956 | ||
879 | snd_azf3328_dbgcallenter(); | 957 | snd_azf3328_dbgcallenter(); |
880 | switch (bitrate) { | 958 | switch (bitrate) { |
@@ -917,7 +995,7 @@ snd_azf3328_codec_setfmt(struct snd_azf3328 *chip, | |||
917 | spin_lock_irqsave(&chip->reg_lock, flags); | 995 | spin_lock_irqsave(&chip->reg_lock, flags); |
918 | 996 | ||
919 | /* set bitrate/format */ | 997 | /* set bitrate/format */ |
920 | snd_azf3328_codec_outw(chip, reg, val); | 998 | snd_azf3328_codec_outw(codec, IDX_IO_CODEC_SOUNDFORMAT, val); |
921 | 999 | ||
922 | /* changing the bitrate/format settings switches off the | 1000 | /* changing the bitrate/format settings switches off the |
923 | * audio output with an annoying click in case of 8/16bit format change | 1001 | * audio output with an annoying click in case of 8/16bit format change |
@@ -926,11 +1004,11 @@ snd_azf3328_codec_setfmt(struct snd_azf3328 *chip, | |||
926 | * (FIXME: yes, it works, but what exactly am I doing here?? :) | 1004 | * (FIXME: yes, it works, but what exactly am I doing here?? :) |
927 | * FIXME: does this have some side effects for full-duplex | 1005 | * FIXME: does this have some side effects for full-duplex |
928 | * or other dramatic side effects? */ | 1006 | * or other dramatic side effects? */ |
929 | if (reg == IDX_IO_PLAY_SOUNDFORMAT) /* only do it for playback */ | 1007 | if (codec_type == AZF_CODEC_PLAYBACK) /* only do it for playback */ |
930 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, | 1008 | snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, |
931 | snd_azf3328_codec_inw(chip, IDX_IO_PLAY_FLAGS) | | 1009 | snd_azf3328_codec_inw(codec, IDX_IO_CODEC_DMA_FLAGS) | |
932 | DMA_PLAY_SOMETHING1 | | 1010 | DMA_RUN_SOMETHING1 | |
933 | DMA_PLAY_SOMETHING2 | | 1011 | DMA_RUN_SOMETHING2 | |
934 | SOMETHING_ALMOST_ALWAYS_SET | | 1012 | SOMETHING_ALMOST_ALWAYS_SET | |
935 | DMA_EPILOGUE_SOMETHING | | 1013 | DMA_EPILOGUE_SOMETHING | |
936 | DMA_SOMETHING_ELSE | 1014 | DMA_SOMETHING_ELSE |
@@ -942,112 +1020,134 @@ snd_azf3328_codec_setfmt(struct snd_azf3328 *chip, | |||
942 | 1020 | ||
943 | static inline void | 1021 | static inline void |
944 | snd_azf3328_codec_setfmt_lowpower(struct snd_azf3328 *chip, | 1022 | snd_azf3328_codec_setfmt_lowpower(struct snd_azf3328 *chip, |
945 | unsigned reg | 1023 | enum snd_azf3328_codec_type codec_type |
946 | ) | 1024 | ) |
947 | { | 1025 | { |
948 | /* choose lowest frequency for low power consumption. | 1026 | /* choose lowest frequency for low power consumption. |
949 | * While this will cause louder noise due to rather coarse frequency, | 1027 | * While this will cause louder noise due to rather coarse frequency, |
950 | * it should never matter since output should always | 1028 | * it should never matter since output should always |
951 | * get disabled properly when idle anyway. */ | 1029 | * get disabled properly when idle anyway. */ |
952 | snd_azf3328_codec_setfmt(chip, reg, AZF_FREQ_4000, 8, 1); | 1030 | snd_azf3328_codec_setfmt(chip, codec_type, AZF_FREQ_4000, 8, 1); |
953 | } | 1031 | } |
954 | 1032 | ||
955 | static void | 1033 | static void |
956 | snd_azf3328_codec_reg_6AH_update(struct snd_azf3328 *chip, | 1034 | snd_azf3328_ctrl_reg_6AH_update(struct snd_azf3328 *chip, |
957 | unsigned bitmask, | 1035 | unsigned bitmask, |
958 | int enable | 1036 | bool enable |
959 | ) | 1037 | ) |
960 | { | 1038 | { |
961 | if (enable) | 1039 | bool do_mask = !enable; |
962 | chip->shadow_reg_codec_6AH &= ~bitmask; | 1040 | if (do_mask) |
1041 | chip->shadow_reg_ctrl_6AH |= bitmask; | ||
963 | else | 1042 | else |
964 | chip->shadow_reg_codec_6AH |= bitmask; | 1043 | chip->shadow_reg_ctrl_6AH &= ~bitmask; |
965 | snd_azf3328_dbgplay("6AH_update mask 0x%04x enable %d: val 0x%04x\n", | 1044 | snd_azf3328_dbgcodec("6AH_update mask 0x%04x do_mask %d: val 0x%04x\n", |
966 | bitmask, enable, chip->shadow_reg_codec_6AH); | 1045 | bitmask, do_mask, chip->shadow_reg_ctrl_6AH); |
967 | snd_azf3328_codec_outw(chip, IDX_IO_6AH, chip->shadow_reg_codec_6AH); | 1046 | snd_azf3328_ctrl_outw(chip, IDX_IO_6AH, chip->shadow_reg_ctrl_6AH); |
968 | } | 1047 | } |
969 | 1048 | ||
970 | static inline void | 1049 | static inline void |
971 | snd_azf3328_codec_enable(struct snd_azf3328 *chip, int enable) | 1050 | snd_azf3328_ctrl_enable_codecs(struct snd_azf3328 *chip, bool enable) |
972 | { | 1051 | { |
973 | snd_azf3328_dbgplay("codec_enable %d\n", enable); | 1052 | snd_azf3328_dbgcodec("codec_enable %d\n", enable); |
974 | /* no idea what exactly is being done here, but I strongly assume it's | 1053 | /* no idea what exactly is being done here, but I strongly assume it's |
975 | * PM related */ | 1054 | * PM related */ |
976 | snd_azf3328_codec_reg_6AH_update( | 1055 | snd_azf3328_ctrl_reg_6AH_update( |
977 | chip, IO_6A_PAUSE_PLAYBACK_BIT8, enable | 1056 | chip, IO_6A_PAUSE_PLAYBACK_BIT8, enable |
978 | ); | 1057 | ); |
979 | } | 1058 | } |
980 | 1059 | ||
981 | static void | 1060 | static void |
982 | snd_azf3328_codec_activity(struct snd_azf3328 *chip, | 1061 | snd_azf3328_ctrl_codec_activity(struct snd_azf3328 *chip, |
983 | enum snd_azf3328_stream_index stream_type, | 1062 | enum snd_azf3328_codec_type codec_type, |
984 | int enable | 1063 | bool enable |
985 | ) | 1064 | ) |
986 | { | 1065 | { |
987 | int need_change = (chip->audio_stream[stream_type].running != enable); | 1066 | struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type]; |
1067 | bool need_change = (codec->running != enable); | ||
988 | 1068 | ||
989 | snd_azf3328_dbgplay( | 1069 | snd_azf3328_dbgcodec( |
990 | "codec_activity: type %d, enable %d, need_change %d\n", | 1070 | "codec_activity: %s codec, enable %d, need_change %d\n", |
991 | stream_type, enable, need_change | 1071 | codec->name, enable, need_change |
992 | ); | 1072 | ); |
993 | if (need_change) { | 1073 | if (need_change) { |
994 | enum snd_azf3328_stream_index other = | 1074 | static const struct { |
995 | (stream_type == AZF_PLAYBACK) ? | 1075 | enum snd_azf3328_codec_type other1; |
996 | AZF_CAPTURE : AZF_PLAYBACK; | 1076 | enum snd_azf3328_codec_type other2; |
997 | /* small check to prevent shutting down the other party | 1077 | } peer_codecs[3] = |
998 | * in case it's active */ | 1078 | { { AZF_CODEC_CAPTURE, AZF_CODEC_I2S_OUT }, |
999 | if ((enable) || !(chip->audio_stream[other].running)) | 1079 | { AZF_CODEC_PLAYBACK, AZF_CODEC_I2S_OUT }, |
1000 | snd_azf3328_codec_enable(chip, enable); | 1080 | { AZF_CODEC_PLAYBACK, AZF_CODEC_CAPTURE } }; |
1081 | bool call_function; | ||
1082 | |||
1083 | if (enable) | ||
1084 | /* if enable codec, call enable_codecs func | ||
1085 | to enable codec supply... */ | ||
1086 | call_function = 1; | ||
1087 | else { | ||
1088 | /* ...otherwise call enable_codecs func | ||
1089 | (which globally shuts down operation of codecs) | ||
1090 | only in case the other codecs are currently | ||
1091 | not active either! */ | ||
1092 | call_function = | ||
1093 | ((!chip->codecs[peer_codecs[codec_type].other1] | ||
1094 | .running) | ||
1095 | && (!chip->codecs[peer_codecs[codec_type].other2] | ||
1096 | .running)); | ||
1097 | } | ||
1098 | if (call_function) | ||
1099 | snd_azf3328_ctrl_enable_codecs(chip, enable); | ||
1001 | 1100 | ||
1002 | /* ...and adjust clock, too | 1101 | /* ...and adjust clock, too |
1003 | * (reduce noise and power consumption) */ | 1102 | * (reduce noise and power consumption) */ |
1004 | if (!enable) | 1103 | if (!enable) |
1005 | snd_azf3328_codec_setfmt_lowpower( | 1104 | snd_azf3328_codec_setfmt_lowpower( |
1006 | chip, | 1105 | chip, |
1007 | chip->audio_stream[stream_type].portbase | 1106 | codec_type |
1008 | + IDX_IO_PLAY_SOUNDFORMAT | ||
1009 | ); | 1107 | ); |
1108 | codec->running = enable; | ||
1010 | } | 1109 | } |
1011 | chip->audio_stream[stream_type].running = enable; | ||
1012 | } | 1110 | } |
1013 | 1111 | ||
1014 | static void | 1112 | static void |
1015 | snd_azf3328_setdmaa(struct snd_azf3328 *chip, | 1113 | snd_azf3328_codec_setdmaa(struct snd_azf3328 *chip, |
1016 | long unsigned int addr, | 1114 | enum snd_azf3328_codec_type codec_type, |
1017 | unsigned int count, | 1115 | unsigned long addr, |
1018 | unsigned int size, | 1116 | unsigned int count, |
1019 | enum snd_azf3328_stream_index stream_type | 1117 | unsigned int size |
1020 | ) | 1118 | ) |
1021 | { | 1119 | { |
1120 | const struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type]; | ||
1022 | snd_azf3328_dbgcallenter(); | 1121 | snd_azf3328_dbgcallenter(); |
1023 | if (!chip->audio_stream[stream_type].running) { | 1122 | if (!codec->running) { |
1024 | /* AZF3328 uses a two buffer pointer DMA playback approach */ | 1123 | /* AZF3328 uses a two buffer pointer DMA transfer approach */ |
1025 | 1124 | ||
1026 | unsigned long flags, portbase, addr_area2; | 1125 | unsigned long flags, addr_area2; |
1027 | 1126 | ||
1028 | /* width 32bit (prevent overflow): */ | 1127 | /* width 32bit (prevent overflow): */ |
1029 | unsigned long count_areas, count_tmp; | 1128 | u32 count_areas, lengths; |
1030 | 1129 | ||
1031 | portbase = chip->audio_stream[stream_type].portbase; | ||
1032 | count_areas = size/2; | 1130 | count_areas = size/2; |
1033 | addr_area2 = addr+count_areas; | 1131 | addr_area2 = addr+count_areas; |
1034 | count_areas--; /* max. index */ | 1132 | count_areas--; /* max. index */ |
1035 | snd_azf3328_dbgplay("set DMA: buf1 %08lx[%lu], buf2 %08lx[%lu]\n", addr, count_areas, addr_area2, count_areas); | 1133 | snd_azf3328_dbgcodec("setdma: buffers %08lx[%u] / %08lx[%u]\n", |
1134 | addr, count_areas, addr_area2, count_areas); | ||
1036 | 1135 | ||
1037 | /* build combined I/O buffer length word */ | 1136 | /* build combined I/O buffer length word */ |
1038 | count_tmp = count_areas; | 1137 | lengths = (count_areas << 16) | (count_areas); |
1039 | count_areas |= (count_tmp << 16); | ||
1040 | spin_lock_irqsave(&chip->reg_lock, flags); | 1138 | spin_lock_irqsave(&chip->reg_lock, flags); |
1041 | outl(addr, portbase + IDX_IO_PLAY_DMA_START_1); | 1139 | snd_azf3328_codec_outl(codec, IDX_IO_CODEC_DMA_START_1, addr); |
1042 | outl(addr_area2, portbase + IDX_IO_PLAY_DMA_START_2); | 1140 | snd_azf3328_codec_outl(codec, IDX_IO_CODEC_DMA_START_2, |
1043 | outl(count_areas, portbase + IDX_IO_PLAY_DMA_LEN_1); | 1141 | addr_area2); |
1142 | snd_azf3328_codec_outl(codec, IDX_IO_CODEC_DMA_LENGTHS, | ||
1143 | lengths); | ||
1044 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1144 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1045 | } | 1145 | } |
1046 | snd_azf3328_dbgcallleave(); | 1146 | snd_azf3328_dbgcallleave(); |
1047 | } | 1147 | } |
1048 | 1148 | ||
1049 | static int | 1149 | static int |
1050 | snd_azf3328_playback_prepare(struct snd_pcm_substream *substream) | 1150 | snd_azf3328_codec_prepare(struct snd_pcm_substream *substream) |
1051 | { | 1151 | { |
1052 | #if 0 | 1152 | #if 0 |
1053 | struct snd_azf3328 *chip = snd_pcm_substream_chip(substream); | 1153 | struct snd_azf3328 *chip = snd_pcm_substream_chip(substream); |
@@ -1058,157 +1158,161 @@ snd_azf3328_playback_prepare(struct snd_pcm_substream *substream) | |||
1058 | 1158 | ||
1059 | snd_azf3328_dbgcallenter(); | 1159 | snd_azf3328_dbgcallenter(); |
1060 | #if 0 | 1160 | #if 0 |
1061 | snd_azf3328_codec_setfmt(chip, IDX_IO_PLAY_SOUNDFORMAT, | 1161 | snd_azf3328_codec_setfmt(chip, AZF_CODEC_..., |
1062 | runtime->rate, | 1162 | runtime->rate, |
1063 | snd_pcm_format_width(runtime->format), | 1163 | snd_pcm_format_width(runtime->format), |
1064 | runtime->channels); | 1164 | runtime->channels); |
1065 | snd_azf3328_setdmaa(chip, runtime->dma_addr, count, size, AZF_PLAYBACK); | 1165 | snd_azf3328_codec_setdmaa(chip, AZF_CODEC_..., |
1166 | runtime->dma_addr, count, size); | ||
1066 | #endif | 1167 | #endif |
1067 | snd_azf3328_dbgcallleave(); | 1168 | snd_azf3328_dbgcallleave(); |
1068 | return 0; | 1169 | return 0; |
1069 | } | 1170 | } |
1070 | 1171 | ||
1071 | static int | 1172 | static int |
1072 | snd_azf3328_capture_prepare(struct snd_pcm_substream *substream) | 1173 | snd_azf3328_codec_trigger(enum snd_azf3328_codec_type codec_type, |
1073 | { | 1174 | struct snd_pcm_substream *substream, int cmd) |
1074 | #if 0 | ||
1075 | struct snd_azf3328 *chip = snd_pcm_substream_chip(substream); | ||
1076 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
1077 | unsigned int size = snd_pcm_lib_buffer_bytes(substream); | ||
1078 | unsigned int count = snd_pcm_lib_period_bytes(substream); | ||
1079 | #endif | ||
1080 | |||
1081 | snd_azf3328_dbgcallenter(); | ||
1082 | #if 0 | ||
1083 | snd_azf3328_codec_setfmt(chip, IDX_IO_REC_SOUNDFORMAT, | ||
1084 | runtime->rate, | ||
1085 | snd_pcm_format_width(runtime->format), | ||
1086 | runtime->channels); | ||
1087 | snd_azf3328_setdmaa(chip, runtime->dma_addr, count, size, AZF_CAPTURE); | ||
1088 | #endif | ||
1089 | snd_azf3328_dbgcallleave(); | ||
1090 | return 0; | ||
1091 | } | ||
1092 | |||
1093 | static int | ||
1094 | snd_azf3328_playback_trigger(struct snd_pcm_substream *substream, int cmd) | ||
1095 | { | 1175 | { |
1096 | struct snd_azf3328 *chip = snd_pcm_substream_chip(substream); | 1176 | struct snd_azf3328 *chip = snd_pcm_substream_chip(substream); |
1177 | const struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type]; | ||
1097 | struct snd_pcm_runtime *runtime = substream->runtime; | 1178 | struct snd_pcm_runtime *runtime = substream->runtime; |
1098 | int result = 0; | 1179 | int result = 0; |
1099 | unsigned int status1; | 1180 | u16 flags1; |
1100 | int previously_muted; | 1181 | bool previously_muted = 0; |
1182 | bool is_playback_codec = (AZF_CODEC_PLAYBACK == codec_type); | ||
1101 | 1183 | ||
1102 | snd_azf3328_dbgcalls("snd_azf3328_playback_trigger cmd %d\n", cmd); | 1184 | snd_azf3328_dbgcalls("snd_azf3328_codec_trigger cmd %d\n", cmd); |
1103 | 1185 | ||
1104 | switch (cmd) { | 1186 | switch (cmd) { |
1105 | case SNDRV_PCM_TRIGGER_START: | 1187 | case SNDRV_PCM_TRIGGER_START: |
1106 | snd_azf3328_dbgplay("START PLAYBACK\n"); | 1188 | snd_azf3328_dbgcodec("START %s\n", codec->name); |
1107 | 1189 | ||
1108 | /* mute WaveOut (avoid clicking during setup) */ | 1190 | if (is_playback_codec) { |
1109 | previously_muted = | 1191 | /* mute WaveOut (avoid clicking during setup) */ |
1110 | snd_azf3328_mixer_set_mute(chip, IDX_MIXER_WAVEOUT, 1); | 1192 | previously_muted = |
1193 | snd_azf3328_mixer_set_mute( | ||
1194 | chip, IDX_MIXER_WAVEOUT, 1 | ||
1195 | ); | ||
1196 | } | ||
1111 | 1197 | ||
1112 | snd_azf3328_codec_setfmt(chip, IDX_IO_PLAY_SOUNDFORMAT, | 1198 | snd_azf3328_codec_setfmt(chip, codec_type, |
1113 | runtime->rate, | 1199 | runtime->rate, |
1114 | snd_pcm_format_width(runtime->format), | 1200 | snd_pcm_format_width(runtime->format), |
1115 | runtime->channels); | 1201 | runtime->channels); |
1116 | 1202 | ||
1117 | spin_lock(&chip->reg_lock); | 1203 | spin_lock(&chip->reg_lock); |
1118 | /* first, remember current value: */ | 1204 | /* first, remember current value: */ |
1119 | status1 = snd_azf3328_codec_inw(chip, IDX_IO_PLAY_FLAGS); | 1205 | flags1 = snd_azf3328_codec_inw(codec, IDX_IO_CODEC_DMA_FLAGS); |
1120 | 1206 | ||
1121 | /* stop playback */ | 1207 | /* stop transfer */ |
1122 | status1 &= ~DMA_RESUME; | 1208 | flags1 &= ~DMA_RESUME; |
1123 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, status1); | 1209 | snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, flags1); |
1124 | 1210 | ||
1125 | /* FIXME: clear interrupts or what??? */ | 1211 | /* FIXME: clear interrupts or what??? */ |
1126 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_IRQTYPE, 0xffff); | 1212 | snd_azf3328_codec_outw(codec, IDX_IO_CODEC_IRQTYPE, 0xffff); |
1127 | spin_unlock(&chip->reg_lock); | 1213 | spin_unlock(&chip->reg_lock); |
1128 | 1214 | ||
1129 | snd_azf3328_setdmaa(chip, runtime->dma_addr, | 1215 | snd_azf3328_codec_setdmaa(chip, codec_type, runtime->dma_addr, |
1130 | snd_pcm_lib_period_bytes(substream), | 1216 | snd_pcm_lib_period_bytes(substream), |
1131 | snd_pcm_lib_buffer_bytes(substream), | 1217 | snd_pcm_lib_buffer_bytes(substream) |
1132 | AZF_PLAYBACK); | 1218 | ); |
1133 | 1219 | ||
1134 | spin_lock(&chip->reg_lock); | 1220 | spin_lock(&chip->reg_lock); |
1135 | #ifdef WIN9X | 1221 | #ifdef WIN9X |
1136 | /* FIXME: enable playback/recording??? */ | 1222 | /* FIXME: enable playback/recording??? */ |
1137 | status1 |= DMA_PLAY_SOMETHING1 | DMA_PLAY_SOMETHING2; | 1223 | flags1 |= DMA_RUN_SOMETHING1 | DMA_RUN_SOMETHING2; |
1138 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, status1); | 1224 | snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, flags1); |
1139 | 1225 | ||
1140 | /* start playback again */ | 1226 | /* start transfer again */ |
1141 | /* FIXME: what is this value (0x0010)??? */ | 1227 | /* FIXME: what is this value (0x0010)??? */ |
1142 | status1 |= DMA_RESUME | DMA_EPILOGUE_SOMETHING; | 1228 | flags1 |= DMA_RESUME | DMA_EPILOGUE_SOMETHING; |
1143 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, status1); | 1229 | snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, flags1); |
1144 | #else /* NT4 */ | 1230 | #else /* NT4 */ |
1145 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, | 1231 | snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, |
1146 | 0x0000); | 1232 | 0x0000); |
1147 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, | 1233 | snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, |
1148 | DMA_PLAY_SOMETHING1); | 1234 | DMA_RUN_SOMETHING1); |
1149 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, | 1235 | snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, |
1150 | DMA_PLAY_SOMETHING1 | | 1236 | DMA_RUN_SOMETHING1 | |
1151 | DMA_PLAY_SOMETHING2); | 1237 | DMA_RUN_SOMETHING2); |
1152 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, | 1238 | snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, |
1153 | DMA_RESUME | | 1239 | DMA_RESUME | |
1154 | SOMETHING_ALMOST_ALWAYS_SET | | 1240 | SOMETHING_ALMOST_ALWAYS_SET | |
1155 | DMA_EPILOGUE_SOMETHING | | 1241 | DMA_EPILOGUE_SOMETHING | |
1156 | DMA_SOMETHING_ELSE); | 1242 | DMA_SOMETHING_ELSE); |
1157 | #endif | 1243 | #endif |
1158 | spin_unlock(&chip->reg_lock); | 1244 | spin_unlock(&chip->reg_lock); |
1159 | snd_azf3328_codec_activity(chip, AZF_PLAYBACK, 1); | 1245 | snd_azf3328_ctrl_codec_activity(chip, codec_type, 1); |
1160 | 1246 | ||
1161 | /* now unmute WaveOut */ | 1247 | if (is_playback_codec) { |
1162 | if (!previously_muted) | 1248 | /* now unmute WaveOut */ |
1163 | snd_azf3328_mixer_set_mute(chip, IDX_MIXER_WAVEOUT, 0); | 1249 | if (!previously_muted) |
1250 | snd_azf3328_mixer_set_mute( | ||
1251 | chip, IDX_MIXER_WAVEOUT, 0 | ||
1252 | ); | ||
1253 | } | ||
1164 | 1254 | ||
1165 | snd_azf3328_dbgplay("STARTED PLAYBACK\n"); | 1255 | snd_azf3328_dbgcodec("STARTED %s\n", codec->name); |
1166 | break; | 1256 | break; |
1167 | case SNDRV_PCM_TRIGGER_RESUME: | 1257 | case SNDRV_PCM_TRIGGER_RESUME: |
1168 | snd_azf3328_dbgplay("RESUME PLAYBACK\n"); | 1258 | snd_azf3328_dbgcodec("RESUME %s\n", codec->name); |
1169 | /* resume playback if we were active */ | 1259 | /* resume codec if we were active */ |
1170 | spin_lock(&chip->reg_lock); | 1260 | spin_lock(&chip->reg_lock); |
1171 | if (chip->audio_stream[AZF_PLAYBACK].running) | 1261 | if (codec->running) |
1172 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, | 1262 | snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, |
1173 | snd_azf3328_codec_inw(chip, IDX_IO_PLAY_FLAGS) | DMA_RESUME); | 1263 | snd_azf3328_codec_inw( |
1264 | codec, IDX_IO_CODEC_DMA_FLAGS | ||
1265 | ) | DMA_RESUME | ||
1266 | ); | ||
1174 | spin_unlock(&chip->reg_lock); | 1267 | spin_unlock(&chip->reg_lock); |
1175 | break; | 1268 | break; |
1176 | case SNDRV_PCM_TRIGGER_STOP: | 1269 | case SNDRV_PCM_TRIGGER_STOP: |
1177 | snd_azf3328_dbgplay("STOP PLAYBACK\n"); | 1270 | snd_azf3328_dbgcodec("STOP %s\n", codec->name); |
1178 | 1271 | ||
1179 | /* mute WaveOut (avoid clicking during setup) */ | 1272 | if (is_playback_codec) { |
1180 | previously_muted = | 1273 | /* mute WaveOut (avoid clicking during setup) */ |
1181 | snd_azf3328_mixer_set_mute(chip, IDX_MIXER_WAVEOUT, 1); | 1274 | previously_muted = |
1275 | snd_azf3328_mixer_set_mute( | ||
1276 | chip, IDX_MIXER_WAVEOUT, 1 | ||
1277 | ); | ||
1278 | } | ||
1182 | 1279 | ||
1183 | spin_lock(&chip->reg_lock); | 1280 | spin_lock(&chip->reg_lock); |
1184 | /* first, remember current value: */ | 1281 | /* first, remember current value: */ |
1185 | status1 = snd_azf3328_codec_inw(chip, IDX_IO_PLAY_FLAGS); | 1282 | flags1 = snd_azf3328_codec_inw(codec, IDX_IO_CODEC_DMA_FLAGS); |
1186 | 1283 | ||
1187 | /* stop playback */ | 1284 | /* stop transfer */ |
1188 | status1 &= ~DMA_RESUME; | 1285 | flags1 &= ~DMA_RESUME; |
1189 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, status1); | 1286 | snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, flags1); |
1190 | 1287 | ||
1191 | /* hmm, is this really required? we're resetting the same bit | 1288 | /* hmm, is this really required? we're resetting the same bit |
1192 | * immediately thereafter... */ | 1289 | * immediately thereafter... */ |
1193 | status1 |= DMA_PLAY_SOMETHING1; | 1290 | flags1 |= DMA_RUN_SOMETHING1; |
1194 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, status1); | 1291 | snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, flags1); |
1195 | 1292 | ||
1196 | status1 &= ~DMA_PLAY_SOMETHING1; | 1293 | flags1 &= ~DMA_RUN_SOMETHING1; |
1197 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, status1); | 1294 | snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, flags1); |
1198 | spin_unlock(&chip->reg_lock); | 1295 | spin_unlock(&chip->reg_lock); |
1199 | snd_azf3328_codec_activity(chip, AZF_PLAYBACK, 0); | 1296 | snd_azf3328_ctrl_codec_activity(chip, codec_type, 0); |
1200 | 1297 | ||
1201 | /* now unmute WaveOut */ | 1298 | if (is_playback_codec) { |
1202 | if (!previously_muted) | 1299 | /* now unmute WaveOut */ |
1203 | snd_azf3328_mixer_set_mute(chip, IDX_MIXER_WAVEOUT, 0); | 1300 | if (!previously_muted) |
1301 | snd_azf3328_mixer_set_mute( | ||
1302 | chip, IDX_MIXER_WAVEOUT, 0 | ||
1303 | ); | ||
1304 | } | ||
1204 | 1305 | ||
1205 | snd_azf3328_dbgplay("STOPPED PLAYBACK\n"); | 1306 | snd_azf3328_dbgcodec("STOPPED %s\n", codec->name); |
1206 | break; | 1307 | break; |
1207 | case SNDRV_PCM_TRIGGER_SUSPEND: | 1308 | case SNDRV_PCM_TRIGGER_SUSPEND: |
1208 | snd_azf3328_dbgplay("SUSPEND PLAYBACK\n"); | 1309 | snd_azf3328_dbgcodec("SUSPEND %s\n", codec->name); |
1209 | /* make sure playback is stopped */ | 1310 | /* make sure codec is stopped */ |
1210 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, | 1311 | snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, |
1211 | snd_azf3328_codec_inw(chip, IDX_IO_PLAY_FLAGS) & ~DMA_RESUME); | 1312 | snd_azf3328_codec_inw( |
1313 | codec, IDX_IO_CODEC_DMA_FLAGS | ||
1314 | ) & ~DMA_RESUME | ||
1315 | ); | ||
1212 | break; | 1316 | break; |
1213 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 1317 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
1214 | snd_printk(KERN_ERR "FIXME: SNDRV_PCM_TRIGGER_PAUSE_PUSH NIY!\n"); | 1318 | snd_printk(KERN_ERR "FIXME: SNDRV_PCM_TRIGGER_PAUSE_PUSH NIY!\n"); |
@@ -1217,7 +1321,7 @@ snd_azf3328_playback_trigger(struct snd_pcm_substream *substream, int cmd) | |||
1217 | snd_printk(KERN_ERR "FIXME: SNDRV_PCM_TRIGGER_PAUSE_RELEASE NIY!\n"); | 1321 | snd_printk(KERN_ERR "FIXME: SNDRV_PCM_TRIGGER_PAUSE_RELEASE NIY!\n"); |
1218 | break; | 1322 | break; |
1219 | default: | 1323 | default: |
1220 | printk(KERN_ERR "FIXME: unknown trigger mode!\n"); | 1324 | snd_printk(KERN_ERR "FIXME: unknown trigger mode!\n"); |
1221 | return -EINVAL; | 1325 | return -EINVAL; |
1222 | } | 1326 | } |
1223 | 1327 | ||
@@ -1225,172 +1329,74 @@ snd_azf3328_playback_trigger(struct snd_pcm_substream *substream, int cmd) | |||
1225 | return result; | 1329 | return result; |
1226 | } | 1330 | } |
1227 | 1331 | ||
1228 | /* this is just analogous to playback; I'm not quite sure whether recording | ||
1229 | * should actually be triggered like that */ | ||
1230 | static int | 1332 | static int |
1231 | snd_azf3328_capture_trigger(struct snd_pcm_substream *substream, int cmd) | 1333 | snd_azf3328_codec_playback_trigger(struct snd_pcm_substream *substream, int cmd) |
1232 | { | 1334 | { |
1233 | struct snd_azf3328 *chip = snd_pcm_substream_chip(substream); | 1335 | return snd_azf3328_codec_trigger(AZF_CODEC_PLAYBACK, substream, cmd); |
1234 | struct snd_pcm_runtime *runtime = substream->runtime; | 1336 | } |
1235 | int result = 0; | ||
1236 | unsigned int status1; | ||
1237 | |||
1238 | snd_azf3328_dbgcalls("snd_azf3328_capture_trigger cmd %d\n", cmd); | ||
1239 | |||
1240 | switch (cmd) { | ||
1241 | case SNDRV_PCM_TRIGGER_START: | ||
1242 | |||
1243 | snd_azf3328_dbgplay("START CAPTURE\n"); | ||
1244 | |||
1245 | snd_azf3328_codec_setfmt(chip, IDX_IO_REC_SOUNDFORMAT, | ||
1246 | runtime->rate, | ||
1247 | snd_pcm_format_width(runtime->format), | ||
1248 | runtime->channels); | ||
1249 | |||
1250 | spin_lock(&chip->reg_lock); | ||
1251 | /* first, remember current value: */ | ||
1252 | status1 = snd_azf3328_codec_inw(chip, IDX_IO_REC_FLAGS); | ||
1253 | |||
1254 | /* stop recording */ | ||
1255 | status1 &= ~DMA_RESUME; | ||
1256 | snd_azf3328_codec_outw(chip, IDX_IO_REC_FLAGS, status1); | ||
1257 | |||
1258 | /* FIXME: clear interrupts or what??? */ | ||
1259 | snd_azf3328_codec_outw(chip, IDX_IO_REC_IRQTYPE, 0xffff); | ||
1260 | spin_unlock(&chip->reg_lock); | ||
1261 | |||
1262 | snd_azf3328_setdmaa(chip, runtime->dma_addr, | ||
1263 | snd_pcm_lib_period_bytes(substream), | ||
1264 | snd_pcm_lib_buffer_bytes(substream), | ||
1265 | AZF_CAPTURE); | ||
1266 | |||
1267 | spin_lock(&chip->reg_lock); | ||
1268 | #ifdef WIN9X | ||
1269 | /* FIXME: enable playback/recording??? */ | ||
1270 | status1 |= DMA_PLAY_SOMETHING1 | DMA_PLAY_SOMETHING2; | ||
1271 | snd_azf3328_codec_outw(chip, IDX_IO_REC_FLAGS, status1); | ||
1272 | |||
1273 | /* start capture again */ | ||
1274 | /* FIXME: what is this value (0x0010)??? */ | ||
1275 | status1 |= DMA_RESUME | DMA_EPILOGUE_SOMETHING; | ||
1276 | snd_azf3328_codec_outw(chip, IDX_IO_REC_FLAGS, status1); | ||
1277 | #else | ||
1278 | snd_azf3328_codec_outw(chip, IDX_IO_REC_FLAGS, | ||
1279 | 0x0000); | ||
1280 | snd_azf3328_codec_outw(chip, IDX_IO_REC_FLAGS, | ||
1281 | DMA_PLAY_SOMETHING1); | ||
1282 | snd_azf3328_codec_outw(chip, IDX_IO_REC_FLAGS, | ||
1283 | DMA_PLAY_SOMETHING1 | | ||
1284 | DMA_PLAY_SOMETHING2); | ||
1285 | snd_azf3328_codec_outw(chip, IDX_IO_REC_FLAGS, | ||
1286 | DMA_RESUME | | ||
1287 | SOMETHING_ALMOST_ALWAYS_SET | | ||
1288 | DMA_EPILOGUE_SOMETHING | | ||
1289 | DMA_SOMETHING_ELSE); | ||
1290 | #endif | ||
1291 | spin_unlock(&chip->reg_lock); | ||
1292 | snd_azf3328_codec_activity(chip, AZF_CAPTURE, 1); | ||
1293 | |||
1294 | snd_azf3328_dbgplay("STARTED CAPTURE\n"); | ||
1295 | break; | ||
1296 | case SNDRV_PCM_TRIGGER_RESUME: | ||
1297 | snd_azf3328_dbgplay("RESUME CAPTURE\n"); | ||
1298 | /* resume recording if we were active */ | ||
1299 | spin_lock(&chip->reg_lock); | ||
1300 | if (chip->audio_stream[AZF_CAPTURE].running) | ||
1301 | snd_azf3328_codec_outw(chip, IDX_IO_REC_FLAGS, | ||
1302 | snd_azf3328_codec_inw(chip, IDX_IO_REC_FLAGS) | DMA_RESUME); | ||
1303 | spin_unlock(&chip->reg_lock); | ||
1304 | break; | ||
1305 | case SNDRV_PCM_TRIGGER_STOP: | ||
1306 | snd_azf3328_dbgplay("STOP CAPTURE\n"); | ||
1307 | |||
1308 | spin_lock(&chip->reg_lock); | ||
1309 | /* first, remember current value: */ | ||
1310 | status1 = snd_azf3328_codec_inw(chip, IDX_IO_REC_FLAGS); | ||
1311 | |||
1312 | /* stop recording */ | ||
1313 | status1 &= ~DMA_RESUME; | ||
1314 | snd_azf3328_codec_outw(chip, IDX_IO_REC_FLAGS, status1); | ||
1315 | |||
1316 | status1 |= DMA_PLAY_SOMETHING1; | ||
1317 | snd_azf3328_codec_outw(chip, IDX_IO_REC_FLAGS, status1); | ||
1318 | |||
1319 | status1 &= ~DMA_PLAY_SOMETHING1; | ||
1320 | snd_azf3328_codec_outw(chip, IDX_IO_REC_FLAGS, status1); | ||
1321 | spin_unlock(&chip->reg_lock); | ||
1322 | snd_azf3328_codec_activity(chip, AZF_CAPTURE, 0); | ||
1323 | 1337 | ||
1324 | snd_azf3328_dbgplay("STOPPED CAPTURE\n"); | 1338 | static int |
1325 | break; | 1339 | snd_azf3328_codec_capture_trigger(struct snd_pcm_substream *substream, int cmd) |
1326 | case SNDRV_PCM_TRIGGER_SUSPEND: | 1340 | { |
1327 | snd_azf3328_dbgplay("SUSPEND CAPTURE\n"); | 1341 | return snd_azf3328_codec_trigger(AZF_CODEC_CAPTURE, substream, cmd); |
1328 | /* make sure recording is stopped */ | 1342 | } |
1329 | snd_azf3328_codec_outw(chip, IDX_IO_REC_FLAGS, | ||
1330 | snd_azf3328_codec_inw(chip, IDX_IO_REC_FLAGS) & ~DMA_RESUME); | ||
1331 | break; | ||
1332 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | ||
1333 | snd_printk(KERN_ERR "FIXME: SNDRV_PCM_TRIGGER_PAUSE_PUSH NIY!\n"); | ||
1334 | break; | ||
1335 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | ||
1336 | snd_printk(KERN_ERR "FIXME: SNDRV_PCM_TRIGGER_PAUSE_RELEASE NIY!\n"); | ||
1337 | break; | ||
1338 | default: | ||
1339 | printk(KERN_ERR "FIXME: unknown trigger mode!\n"); | ||
1340 | return -EINVAL; | ||
1341 | } | ||
1342 | 1343 | ||
1343 | snd_azf3328_dbgcallleave(); | 1344 | static int |
1344 | return result; | 1345 | snd_azf3328_codec_i2s_out_trigger(struct snd_pcm_substream *substream, int cmd) |
1346 | { | ||
1347 | return snd_azf3328_codec_trigger(AZF_CODEC_I2S_OUT, substream, cmd); | ||
1345 | } | 1348 | } |
1346 | 1349 | ||
1347 | static snd_pcm_uframes_t | 1350 | static snd_pcm_uframes_t |
1348 | snd_azf3328_playback_pointer(struct snd_pcm_substream *substream) | 1351 | snd_azf3328_codec_pointer(struct snd_pcm_substream *substream, |
1352 | enum snd_azf3328_codec_type codec_type | ||
1353 | ) | ||
1349 | { | 1354 | { |
1350 | struct snd_azf3328 *chip = snd_pcm_substream_chip(substream); | 1355 | const struct snd_azf3328 *chip = snd_pcm_substream_chip(substream); |
1356 | const struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type]; | ||
1351 | unsigned long bufptr, result; | 1357 | unsigned long bufptr, result; |
1352 | snd_pcm_uframes_t frmres; | 1358 | snd_pcm_uframes_t frmres; |
1353 | 1359 | ||
1354 | #ifdef QUERY_HARDWARE | 1360 | #ifdef QUERY_HARDWARE |
1355 | bufptr = snd_azf3328_codec_inl(chip, IDX_IO_PLAY_DMA_START_1); | 1361 | bufptr = snd_azf3328_codec_inl(codec, IDX_IO_CODEC_DMA_START_1); |
1356 | #else | 1362 | #else |
1357 | bufptr = substream->runtime->dma_addr; | 1363 | bufptr = substream->runtime->dma_addr; |
1358 | #endif | 1364 | #endif |
1359 | result = snd_azf3328_codec_inl(chip, IDX_IO_PLAY_DMA_CURRPOS); | 1365 | result = snd_azf3328_codec_inl(codec, IDX_IO_CODEC_DMA_CURRPOS); |
1360 | 1366 | ||
1361 | /* calculate offset */ | 1367 | /* calculate offset */ |
1362 | result -= bufptr; | 1368 | result -= bufptr; |
1363 | frmres = bytes_to_frames( substream->runtime, result); | 1369 | frmres = bytes_to_frames( substream->runtime, result); |
1364 | snd_azf3328_dbgplay("PLAY @ 0x%8lx, frames %8ld\n", result, frmres); | 1370 | snd_azf3328_dbgcodec("%s @ 0x%8lx, frames %8ld\n", |
1371 | codec->name, result, frmres); | ||
1365 | return frmres; | 1372 | return frmres; |
1366 | } | 1373 | } |
1367 | 1374 | ||
1368 | static snd_pcm_uframes_t | 1375 | static snd_pcm_uframes_t |
1369 | snd_azf3328_capture_pointer(struct snd_pcm_substream *substream) | 1376 | snd_azf3328_codec_playback_pointer(struct snd_pcm_substream *substream) |
1370 | { | 1377 | { |
1371 | struct snd_azf3328 *chip = snd_pcm_substream_chip(substream); | 1378 | return snd_azf3328_codec_pointer(substream, AZF_CODEC_PLAYBACK); |
1372 | unsigned long bufptr, result; | 1379 | } |
1373 | snd_pcm_uframes_t frmres; | ||
1374 | 1380 | ||
1375 | #ifdef QUERY_HARDWARE | 1381 | static snd_pcm_uframes_t |
1376 | bufptr = snd_azf3328_codec_inl(chip, IDX_IO_REC_DMA_START_1); | 1382 | snd_azf3328_codec_capture_pointer(struct snd_pcm_substream *substream) |
1377 | #else | 1383 | { |
1378 | bufptr = substream->runtime->dma_addr; | 1384 | return snd_azf3328_codec_pointer(substream, AZF_CODEC_CAPTURE); |
1379 | #endif | 1385 | } |
1380 | result = snd_azf3328_codec_inl(chip, IDX_IO_REC_DMA_CURRPOS); | ||
1381 | 1386 | ||
1382 | /* calculate offset */ | 1387 | static snd_pcm_uframes_t |
1383 | result -= bufptr; | 1388 | snd_azf3328_codec_i2s_out_pointer(struct snd_pcm_substream *substream) |
1384 | frmres = bytes_to_frames( substream->runtime, result); | 1389 | { |
1385 | snd_azf3328_dbgplay("REC @ 0x%8lx, frames %8ld\n", result, frmres); | 1390 | return snd_azf3328_codec_pointer(substream, AZF_CODEC_I2S_OUT); |
1386 | return frmres; | ||
1387 | } | 1391 | } |
1388 | 1392 | ||
1389 | /******************************************************************/ | 1393 | /******************************************************************/ |
1390 | 1394 | ||
1391 | #ifdef SUPPORT_GAMEPORT | 1395 | #ifdef SUPPORT_GAMEPORT |
1392 | static inline void | 1396 | static inline void |
1393 | snd_azf3328_gameport_irq_enable(struct snd_azf3328 *chip, int enable) | 1397 | snd_azf3328_gameport_irq_enable(struct snd_azf3328 *chip, |
1398 | bool enable | ||
1399 | ) | ||
1394 | { | 1400 | { |
1395 | snd_azf3328_io_reg_setb( | 1401 | snd_azf3328_io_reg_setb( |
1396 | chip->game_io+IDX_GAME_HWCONFIG, | 1402 | chip->game_io+IDX_GAME_HWCONFIG, |
@@ -1400,7 +1406,9 @@ snd_azf3328_gameport_irq_enable(struct snd_azf3328 *chip, int enable) | |||
1400 | } | 1406 | } |
1401 | 1407 | ||
1402 | static inline void | 1408 | static inline void |
1403 | snd_azf3328_gameport_legacy_address_enable(struct snd_azf3328 *chip, int enable) | 1409 | snd_azf3328_gameport_legacy_address_enable(struct snd_azf3328 *chip, |
1410 | bool enable | ||
1411 | ) | ||
1404 | { | 1412 | { |
1405 | snd_azf3328_io_reg_setb( | 1413 | snd_azf3328_io_reg_setb( |
1406 | chip->game_io+IDX_GAME_HWCONFIG, | 1414 | chip->game_io+IDX_GAME_HWCONFIG, |
@@ -1409,10 +1417,27 @@ snd_azf3328_gameport_legacy_address_enable(struct snd_azf3328 *chip, int enable) | |||
1409 | ); | 1417 | ); |
1410 | } | 1418 | } |
1411 | 1419 | ||
1420 | static void | ||
1421 | snd_azf3328_gameport_set_counter_frequency(struct snd_azf3328 *chip, | ||
1422 | unsigned int freq_cfg | ||
1423 | ) | ||
1424 | { | ||
1425 | snd_azf3328_io_reg_setb( | ||
1426 | chip->game_io+IDX_GAME_HWCONFIG, | ||
1427 | 0x02, | ||
1428 | (freq_cfg & 1) != 0 | ||
1429 | ); | ||
1430 | snd_azf3328_io_reg_setb( | ||
1431 | chip->game_io+IDX_GAME_HWCONFIG, | ||
1432 | 0x04, | ||
1433 | (freq_cfg & 2) != 0 | ||
1434 | ); | ||
1435 | } | ||
1436 | |||
1412 | static inline void | 1437 | static inline void |
1413 | snd_azf3328_gameport_axis_circuit_enable(struct snd_azf3328 *chip, int enable) | 1438 | snd_azf3328_gameport_axis_circuit_enable(struct snd_azf3328 *chip, bool enable) |
1414 | { | 1439 | { |
1415 | snd_azf3328_codec_reg_6AH_update( | 1440 | snd_azf3328_ctrl_reg_6AH_update( |
1416 | chip, IO_6A_SOMETHING2_GAMEPORT, enable | 1441 | chip, IO_6A_SOMETHING2_GAMEPORT, enable |
1417 | ); | 1442 | ); |
1418 | } | 1443 | } |
@@ -1447,6 +1472,8 @@ snd_azf3328_gameport_open(struct gameport *gameport, int mode) | |||
1447 | break; | 1472 | break; |
1448 | } | 1473 | } |
1449 | 1474 | ||
1475 | snd_azf3328_gameport_set_counter_frequency(chip, | ||
1476 | GAME_HWCFG_ADC_COUNTER_FREQ_STD); | ||
1450 | snd_azf3328_gameport_axis_circuit_enable(chip, (res == 0)); | 1477 | snd_azf3328_gameport_axis_circuit_enable(chip, (res == 0)); |
1451 | 1478 | ||
1452 | return res; | 1479 | return res; |
@@ -1458,6 +1485,8 @@ snd_azf3328_gameport_close(struct gameport *gameport) | |||
1458 | struct snd_azf3328 *chip = gameport_get_port_data(gameport); | 1485 | struct snd_azf3328 *chip = gameport_get_port_data(gameport); |
1459 | 1486 | ||
1460 | snd_azf3328_dbggame("gameport_close\n"); | 1487 | snd_azf3328_dbggame("gameport_close\n"); |
1488 | snd_azf3328_gameport_set_counter_frequency(chip, | ||
1489 | GAME_HWCFG_ADC_COUNTER_FREQ_1_200); | ||
1461 | snd_azf3328_gameport_axis_circuit_enable(chip, 0); | 1490 | snd_azf3328_gameport_axis_circuit_enable(chip, 0); |
1462 | } | 1491 | } |
1463 | 1492 | ||
@@ -1491,7 +1520,7 @@ snd_azf3328_gameport_cooked_read(struct gameport *gameport, | |||
1491 | 1520 | ||
1492 | val = snd_azf3328_game_inb(chip, IDX_GAME_AXES_CONFIG); | 1521 | val = snd_azf3328_game_inb(chip, IDX_GAME_AXES_CONFIG); |
1493 | if (val & GAME_AXES_SAMPLING_READY) { | 1522 | if (val & GAME_AXES_SAMPLING_READY) { |
1494 | for (i = 0; i < 4; ++i) { | 1523 | for (i = 0; i < ARRAY_SIZE(chip->axes); ++i) { |
1495 | /* configure the axis to read */ | 1524 | /* configure the axis to read */ |
1496 | val = (i << 4) | 0x0f; | 1525 | val = (i << 4) | 0x0f; |
1497 | snd_azf3328_game_outb(chip, IDX_GAME_AXES_CONFIG, val); | 1526 | snd_azf3328_game_outb(chip, IDX_GAME_AXES_CONFIG, val); |
@@ -1514,7 +1543,7 @@ snd_azf3328_gameport_cooked_read(struct gameport *gameport, | |||
1514 | snd_azf3328_game_outw(chip, IDX_GAME_AXIS_VALUE, 0xffff); | 1543 | snd_azf3328_game_outw(chip, IDX_GAME_AXIS_VALUE, 0xffff); |
1515 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1544 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1516 | 1545 | ||
1517 | for (i = 0; i < 4; i++) { | 1546 | for (i = 0; i < ARRAY_SIZE(chip->axes); i++) { |
1518 | axes[i] = chip->axes[i]; | 1547 | axes[i] = chip->axes[i]; |
1519 | if (axes[i] == 0xffff) | 1548 | if (axes[i] == 0xffff) |
1520 | axes[i] = -1; | 1549 | axes[i] = -1; |
@@ -1552,6 +1581,8 @@ snd_azf3328_gameport(struct snd_azf3328 *chip, int dev) | |||
1552 | /* DISABLE legacy address: we don't need it! */ | 1581 | /* DISABLE legacy address: we don't need it! */ |
1553 | snd_azf3328_gameport_legacy_address_enable(chip, 0); | 1582 | snd_azf3328_gameport_legacy_address_enable(chip, 0); |
1554 | 1583 | ||
1584 | snd_azf3328_gameport_set_counter_frequency(chip, | ||
1585 | GAME_HWCFG_ADC_COUNTER_FREQ_1_200); | ||
1555 | snd_azf3328_gameport_axis_circuit_enable(chip, 0); | 1586 | snd_azf3328_gameport_axis_circuit_enable(chip, 0); |
1556 | 1587 | ||
1557 | gameport_register_port(chip->gameport); | 1588 | gameport_register_port(chip->gameport); |
@@ -1585,40 +1616,77 @@ snd_azf3328_gameport_interrupt(struct snd_azf3328 *chip) | |||
1585 | static inline void | 1616 | static inline void |
1586 | snd_azf3328_irq_log_unknown_type(u8 which) | 1617 | snd_azf3328_irq_log_unknown_type(u8 which) |
1587 | { | 1618 | { |
1588 | snd_azf3328_dbgplay( | 1619 | snd_azf3328_dbgcodec( |
1589 | "azt3328: unknown IRQ type (%x) occurred, please report!\n", | 1620 | "azt3328: unknown IRQ type (%x) occurred, please report!\n", |
1590 | which | 1621 | which |
1591 | ); | 1622 | ); |
1592 | } | 1623 | } |
1593 | 1624 | ||
1625 | static inline void | ||
1626 | snd_azf3328_codec_interrupt(struct snd_azf3328 *chip, u8 status) | ||
1627 | { | ||
1628 | u8 which; | ||
1629 | enum snd_azf3328_codec_type codec_type; | ||
1630 | const struct snd_azf3328_codec_data *codec; | ||
1631 | |||
1632 | for (codec_type = AZF_CODEC_PLAYBACK; | ||
1633 | codec_type <= AZF_CODEC_I2S_OUT; | ||
1634 | ++codec_type) { | ||
1635 | |||
1636 | /* skip codec if there's no interrupt for it */ | ||
1637 | if (!(status & (1 << codec_type))) | ||
1638 | continue; | ||
1639 | |||
1640 | codec = &chip->codecs[codec_type]; | ||
1641 | |||
1642 | spin_lock(&chip->reg_lock); | ||
1643 | which = snd_azf3328_codec_inb(codec, IDX_IO_CODEC_IRQTYPE); | ||
1644 | /* ack all IRQ types immediately */ | ||
1645 | snd_azf3328_codec_outb(codec, IDX_IO_CODEC_IRQTYPE, which); | ||
1646 | spin_unlock(&chip->reg_lock); | ||
1647 | |||
1648 | if ((chip->pcm[codec_type]) && (codec->substream)) { | ||
1649 | snd_pcm_period_elapsed(codec->substream); | ||
1650 | snd_azf3328_dbgcodec("%s period done (#%x), @ %x\n", | ||
1651 | codec->name, | ||
1652 | which, | ||
1653 | snd_azf3328_codec_inl( | ||
1654 | codec, IDX_IO_CODEC_DMA_CURRPOS | ||
1655 | ) | ||
1656 | ); | ||
1657 | } else | ||
1658 | printk(KERN_WARNING "azt3328: irq handler problem!\n"); | ||
1659 | if (which & IRQ_SOMETHING) | ||
1660 | snd_azf3328_irq_log_unknown_type(which); | ||
1661 | } | ||
1662 | } | ||
1663 | |||
1594 | static irqreturn_t | 1664 | static irqreturn_t |
1595 | snd_azf3328_interrupt(int irq, void *dev_id) | 1665 | snd_azf3328_interrupt(int irq, void *dev_id) |
1596 | { | 1666 | { |
1597 | struct snd_azf3328 *chip = dev_id; | 1667 | struct snd_azf3328 *chip = dev_id; |
1598 | u8 status, which; | 1668 | u8 status; |
1599 | #if DEBUG_PLAY_REC | 1669 | #if DEBUG_CODEC |
1600 | static unsigned long irq_count; | 1670 | static unsigned long irq_count; |
1601 | #endif | 1671 | #endif |
1602 | 1672 | ||
1603 | status = snd_azf3328_codec_inb(chip, IDX_IO_IRQSTATUS); | 1673 | status = snd_azf3328_ctrl_inb(chip, IDX_IO_IRQSTATUS); |
1604 | 1674 | ||
1605 | /* fast path out, to ease interrupt sharing */ | 1675 | /* fast path out, to ease interrupt sharing */ |
1606 | if (!(status & | 1676 | if (!(status & |
1607 | (IRQ_PLAYBACK|IRQ_RECORDING|IRQ_GAMEPORT|IRQ_MPU401|IRQ_TIMER) | 1677 | (IRQ_PLAYBACK|IRQ_RECORDING|IRQ_I2S_OUT |
1678 | |IRQ_GAMEPORT|IRQ_MPU401|IRQ_TIMER) | ||
1608 | )) | 1679 | )) |
1609 | return IRQ_NONE; /* must be interrupt for another device */ | 1680 | return IRQ_NONE; /* must be interrupt for another device */ |
1610 | 1681 | ||
1611 | snd_azf3328_dbgplay( | 1682 | snd_azf3328_dbgcodec( |
1612 | "irq_count %ld! IDX_IO_PLAY_FLAGS %04x, " | 1683 | "irq_count %ld! IDX_IO_IRQSTATUS %04x\n", |
1613 | "IDX_IO_PLAY_IRQTYPE %04x, IDX_IO_IRQSTATUS %04x\n", | ||
1614 | irq_count++ /* debug-only */, | 1684 | irq_count++ /* debug-only */, |
1615 | snd_azf3328_codec_inw(chip, IDX_IO_PLAY_FLAGS), | ||
1616 | snd_azf3328_codec_inw(chip, IDX_IO_PLAY_IRQTYPE), | ||
1617 | status | 1685 | status |
1618 | ); | 1686 | ); |
1619 | 1687 | ||
1620 | if (status & IRQ_TIMER) { | 1688 | if (status & IRQ_TIMER) { |
1621 | /* snd_azf3328_dbgplay("timer %ld\n", | 1689 | /* snd_azf3328_dbgcodec("timer %ld\n", |
1622 | snd_azf3328_codec_inl(chip, IDX_IO_TIMER_VALUE) | 1690 | snd_azf3328_codec_inl(chip, IDX_IO_TIMER_VALUE) |
1623 | & TIMER_VALUE_MASK | 1691 | & TIMER_VALUE_MASK |
1624 | ); */ | 1692 | ); */ |
@@ -1626,71 +1694,36 @@ snd_azf3328_interrupt(int irq, void *dev_id) | |||
1626 | snd_timer_interrupt(chip->timer, chip->timer->sticks); | 1694 | snd_timer_interrupt(chip->timer, chip->timer->sticks); |
1627 | /* ACK timer */ | 1695 | /* ACK timer */ |
1628 | spin_lock(&chip->reg_lock); | 1696 | spin_lock(&chip->reg_lock); |
1629 | snd_azf3328_codec_outb(chip, IDX_IO_TIMER_VALUE + 3, 0x07); | 1697 | snd_azf3328_ctrl_outb(chip, IDX_IO_TIMER_VALUE + 3, 0x07); |
1630 | spin_unlock(&chip->reg_lock); | 1698 | spin_unlock(&chip->reg_lock); |
1631 | snd_azf3328_dbgplay("azt3328: timer IRQ\n"); | 1699 | snd_azf3328_dbgcodec("azt3328: timer IRQ\n"); |
1632 | } | 1700 | } |
1633 | if (status & IRQ_PLAYBACK) { | ||
1634 | spin_lock(&chip->reg_lock); | ||
1635 | which = snd_azf3328_codec_inb(chip, IDX_IO_PLAY_IRQTYPE); | ||
1636 | /* ack all IRQ types immediately */ | ||
1637 | snd_azf3328_codec_outb(chip, IDX_IO_PLAY_IRQTYPE, which); | ||
1638 | spin_unlock(&chip->reg_lock); | ||
1639 | 1701 | ||
1640 | if (chip->pcm && chip->audio_stream[AZF_PLAYBACK].substream) { | 1702 | if (status & (IRQ_PLAYBACK|IRQ_RECORDING|IRQ_I2S_OUT)) |
1641 | snd_pcm_period_elapsed( | 1703 | snd_azf3328_codec_interrupt(chip, status); |
1642 | chip->audio_stream[AZF_PLAYBACK].substream | ||
1643 | ); | ||
1644 | snd_azf3328_dbgplay("PLAY period done (#%x), @ %x\n", | ||
1645 | which, | ||
1646 | snd_azf3328_codec_inl( | ||
1647 | chip, IDX_IO_PLAY_DMA_CURRPOS | ||
1648 | ) | ||
1649 | ); | ||
1650 | } else | ||
1651 | printk(KERN_WARNING "azt3328: irq handler problem!\n"); | ||
1652 | if (which & IRQ_PLAY_SOMETHING) | ||
1653 | snd_azf3328_irq_log_unknown_type(which); | ||
1654 | } | ||
1655 | if (status & IRQ_RECORDING) { | ||
1656 | spin_lock(&chip->reg_lock); | ||
1657 | which = snd_azf3328_codec_inb(chip, IDX_IO_REC_IRQTYPE); | ||
1658 | /* ack all IRQ types immediately */ | ||
1659 | snd_azf3328_codec_outb(chip, IDX_IO_REC_IRQTYPE, which); | ||
1660 | spin_unlock(&chip->reg_lock); | ||
1661 | 1704 | ||
1662 | if (chip->pcm && chip->audio_stream[AZF_CAPTURE].substream) { | ||
1663 | snd_pcm_period_elapsed( | ||
1664 | chip->audio_stream[AZF_CAPTURE].substream | ||
1665 | ); | ||
1666 | snd_azf3328_dbgplay("REC period done (#%x), @ %x\n", | ||
1667 | which, | ||
1668 | snd_azf3328_codec_inl( | ||
1669 | chip, IDX_IO_REC_DMA_CURRPOS | ||
1670 | ) | ||
1671 | ); | ||
1672 | } else | ||
1673 | printk(KERN_WARNING "azt3328: irq handler problem!\n"); | ||
1674 | if (which & IRQ_REC_SOMETHING) | ||
1675 | snd_azf3328_irq_log_unknown_type(which); | ||
1676 | } | ||
1677 | if (status & IRQ_GAMEPORT) | 1705 | if (status & IRQ_GAMEPORT) |
1678 | snd_azf3328_gameport_interrupt(chip); | 1706 | snd_azf3328_gameport_interrupt(chip); |
1707 | |||
1679 | /* MPU401 has less critical IRQ requirements | 1708 | /* MPU401 has less critical IRQ requirements |
1680 | * than timer and playback/recording, right? */ | 1709 | * than timer and playback/recording, right? */ |
1681 | if (status & IRQ_MPU401) { | 1710 | if (status & IRQ_MPU401) { |
1682 | snd_mpu401_uart_interrupt(irq, chip->rmidi->private_data); | 1711 | snd_mpu401_uart_interrupt(irq, chip->rmidi->private_data); |
1683 | 1712 | ||
1684 | /* hmm, do we have to ack the IRQ here somehow? | 1713 | /* hmm, do we have to ack the IRQ here somehow? |
1685 | * If so, then I don't know how... */ | 1714 | * If so, then I don't know how yet... */ |
1686 | snd_azf3328_dbgplay("azt3328: MPU401 IRQ\n"); | 1715 | snd_azf3328_dbgcodec("azt3328: MPU401 IRQ\n"); |
1687 | } | 1716 | } |
1688 | return IRQ_HANDLED; | 1717 | return IRQ_HANDLED; |
1689 | } | 1718 | } |
1690 | 1719 | ||
1691 | /*****************************************************************/ | 1720 | /*****************************************************************/ |
1692 | 1721 | ||
1693 | static const struct snd_pcm_hardware snd_azf3328_playback = | 1722 | /* as long as we think we have identical snd_pcm_hardware parameters |
1723 | for playback, capture and i2s out, we can use the same physical struct | ||
1724 | since the struct is simply being copied into a member. | ||
1725 | */ | ||
1726 | static const struct snd_pcm_hardware snd_azf3328_hardware = | ||
1694 | { | 1727 | { |
1695 | /* FIXME!! Correct? */ | 1728 | /* FIXME!! Correct? */ |
1696 | .info = SNDRV_PCM_INFO_MMAP | | 1729 | .info = SNDRV_PCM_INFO_MMAP | |
@@ -1718,31 +1751,6 @@ static const struct snd_pcm_hardware snd_azf3328_playback = | |||
1718 | .fifo_size = 0, | 1751 | .fifo_size = 0, |
1719 | }; | 1752 | }; |
1720 | 1753 | ||
1721 | static const struct snd_pcm_hardware snd_azf3328_capture = | ||
1722 | { | ||
1723 | /* FIXME */ | ||
1724 | .info = SNDRV_PCM_INFO_MMAP | | ||
1725 | SNDRV_PCM_INFO_INTERLEAVED | | ||
1726 | SNDRV_PCM_INFO_MMAP_VALID, | ||
1727 | .formats = SNDRV_PCM_FMTBIT_S8 | | ||
1728 | SNDRV_PCM_FMTBIT_U8 | | ||
1729 | SNDRV_PCM_FMTBIT_S16_LE | | ||
1730 | SNDRV_PCM_FMTBIT_U16_LE, | ||
1731 | .rates = SNDRV_PCM_RATE_5512 | | ||
1732 | SNDRV_PCM_RATE_8000_48000 | | ||
1733 | SNDRV_PCM_RATE_KNOT, | ||
1734 | .rate_min = AZF_FREQ_4000, | ||
1735 | .rate_max = AZF_FREQ_66200, | ||
1736 | .channels_min = 1, | ||
1737 | .channels_max = 2, | ||
1738 | .buffer_bytes_max = 65536, | ||
1739 | .period_bytes_min = 64, | ||
1740 | .period_bytes_max = 65536, | ||
1741 | .periods_min = 1, | ||
1742 | .periods_max = 1024, | ||
1743 | .fifo_size = 0, | ||
1744 | }; | ||
1745 | |||
1746 | 1754 | ||
1747 | static unsigned int snd_azf3328_fixed_rates[] = { | 1755 | static unsigned int snd_azf3328_fixed_rates[] = { |
1748 | AZF_FREQ_4000, | 1756 | AZF_FREQ_4000, |
@@ -1770,14 +1778,19 @@ static struct snd_pcm_hw_constraint_list snd_azf3328_hw_constraints_rates = { | |||
1770 | /*****************************************************************/ | 1778 | /*****************************************************************/ |
1771 | 1779 | ||
1772 | static int | 1780 | static int |
1773 | snd_azf3328_playback_open(struct snd_pcm_substream *substream) | 1781 | snd_azf3328_pcm_open(struct snd_pcm_substream *substream, |
1782 | enum snd_azf3328_codec_type codec_type | ||
1783 | ) | ||
1774 | { | 1784 | { |
1775 | struct snd_azf3328 *chip = snd_pcm_substream_chip(substream); | 1785 | struct snd_azf3328 *chip = snd_pcm_substream_chip(substream); |
1776 | struct snd_pcm_runtime *runtime = substream->runtime; | 1786 | struct snd_pcm_runtime *runtime = substream->runtime; |
1777 | 1787 | ||
1778 | snd_azf3328_dbgcallenter(); | 1788 | snd_azf3328_dbgcallenter(); |
1779 | chip->audio_stream[AZF_PLAYBACK].substream = substream; | 1789 | chip->codecs[codec_type].substream = substream; |
1780 | runtime->hw = snd_azf3328_playback; | 1790 | |
1791 | /* same parameters for all our codecs - at least we think so... */ | ||
1792 | runtime->hw = snd_azf3328_hardware; | ||
1793 | |||
1781 | snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, | 1794 | snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, |
1782 | &snd_azf3328_hw_constraints_rates); | 1795 | &snd_azf3328_hw_constraints_rates); |
1783 | snd_azf3328_dbgcallleave(); | 1796 | snd_azf3328_dbgcallleave(); |
@@ -1785,40 +1798,52 @@ snd_azf3328_playback_open(struct snd_pcm_substream *substream) | |||
1785 | } | 1798 | } |
1786 | 1799 | ||
1787 | static int | 1800 | static int |
1801 | snd_azf3328_playback_open(struct snd_pcm_substream *substream) | ||
1802 | { | ||
1803 | return snd_azf3328_pcm_open(substream, AZF_CODEC_PLAYBACK); | ||
1804 | } | ||
1805 | |||
1806 | static int | ||
1788 | snd_azf3328_capture_open(struct snd_pcm_substream *substream) | 1807 | snd_azf3328_capture_open(struct snd_pcm_substream *substream) |
1789 | { | 1808 | { |
1790 | struct snd_azf3328 *chip = snd_pcm_substream_chip(substream); | 1809 | return snd_azf3328_pcm_open(substream, AZF_CODEC_CAPTURE); |
1791 | struct snd_pcm_runtime *runtime = substream->runtime; | 1810 | } |
1792 | 1811 | ||
1793 | snd_azf3328_dbgcallenter(); | 1812 | static int |
1794 | chip->audio_stream[AZF_CAPTURE].substream = substream; | 1813 | snd_azf3328_i2s_out_open(struct snd_pcm_substream *substream) |
1795 | runtime->hw = snd_azf3328_capture; | 1814 | { |
1796 | snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, | 1815 | return snd_azf3328_pcm_open(substream, AZF_CODEC_I2S_OUT); |
1797 | &snd_azf3328_hw_constraints_rates); | ||
1798 | snd_azf3328_dbgcallleave(); | ||
1799 | return 0; | ||
1800 | } | 1816 | } |
1801 | 1817 | ||
1802 | static int | 1818 | static int |
1803 | snd_azf3328_playback_close(struct snd_pcm_substream *substream) | 1819 | snd_azf3328_pcm_close(struct snd_pcm_substream *substream, |
1820 | enum snd_azf3328_codec_type codec_type | ||
1821 | ) | ||
1804 | { | 1822 | { |
1805 | struct snd_azf3328 *chip = snd_pcm_substream_chip(substream); | 1823 | struct snd_azf3328 *chip = snd_pcm_substream_chip(substream); |
1806 | 1824 | ||
1807 | snd_azf3328_dbgcallenter(); | 1825 | snd_azf3328_dbgcallenter(); |
1808 | chip->audio_stream[AZF_PLAYBACK].substream = NULL; | 1826 | chip->codecs[codec_type].substream = NULL; |
1809 | snd_azf3328_dbgcallleave(); | 1827 | snd_azf3328_dbgcallleave(); |
1810 | return 0; | 1828 | return 0; |
1811 | } | 1829 | } |
1812 | 1830 | ||
1813 | static int | 1831 | static int |
1832 | snd_azf3328_playback_close(struct snd_pcm_substream *substream) | ||
1833 | { | ||
1834 | return snd_azf3328_pcm_close(substream, AZF_CODEC_PLAYBACK); | ||
1835 | } | ||
1836 | |||
1837 | static int | ||
1814 | snd_azf3328_capture_close(struct snd_pcm_substream *substream) | 1838 | snd_azf3328_capture_close(struct snd_pcm_substream *substream) |
1815 | { | 1839 | { |
1816 | struct snd_azf3328 *chip = snd_pcm_substream_chip(substream); | 1840 | return snd_azf3328_pcm_close(substream, AZF_CODEC_CAPTURE); |
1841 | } | ||
1817 | 1842 | ||
1818 | snd_azf3328_dbgcallenter(); | 1843 | static int |
1819 | chip->audio_stream[AZF_CAPTURE].substream = NULL; | 1844 | snd_azf3328_i2s_out_close(struct snd_pcm_substream *substream) |
1820 | snd_azf3328_dbgcallleave(); | 1845 | { |
1821 | return 0; | 1846 | return snd_azf3328_pcm_close(substream, AZF_CODEC_I2S_OUT); |
1822 | } | 1847 | } |
1823 | 1848 | ||
1824 | /******************************************************************/ | 1849 | /******************************************************************/ |
@@ -1829,9 +1854,9 @@ static struct snd_pcm_ops snd_azf3328_playback_ops = { | |||
1829 | .ioctl = snd_pcm_lib_ioctl, | 1854 | .ioctl = snd_pcm_lib_ioctl, |
1830 | .hw_params = snd_azf3328_hw_params, | 1855 | .hw_params = snd_azf3328_hw_params, |
1831 | .hw_free = snd_azf3328_hw_free, | 1856 | .hw_free = snd_azf3328_hw_free, |
1832 | .prepare = snd_azf3328_playback_prepare, | 1857 | .prepare = snd_azf3328_codec_prepare, |
1833 | .trigger = snd_azf3328_playback_trigger, | 1858 | .trigger = snd_azf3328_codec_playback_trigger, |
1834 | .pointer = snd_azf3328_playback_pointer | 1859 | .pointer = snd_azf3328_codec_playback_pointer |
1835 | }; | 1860 | }; |
1836 | 1861 | ||
1837 | static struct snd_pcm_ops snd_azf3328_capture_ops = { | 1862 | static struct snd_pcm_ops snd_azf3328_capture_ops = { |
@@ -1840,30 +1865,67 @@ static struct snd_pcm_ops snd_azf3328_capture_ops = { | |||
1840 | .ioctl = snd_pcm_lib_ioctl, | 1865 | .ioctl = snd_pcm_lib_ioctl, |
1841 | .hw_params = snd_azf3328_hw_params, | 1866 | .hw_params = snd_azf3328_hw_params, |
1842 | .hw_free = snd_azf3328_hw_free, | 1867 | .hw_free = snd_azf3328_hw_free, |
1843 | .prepare = snd_azf3328_capture_prepare, | 1868 | .prepare = snd_azf3328_codec_prepare, |
1844 | .trigger = snd_azf3328_capture_trigger, | 1869 | .trigger = snd_azf3328_codec_capture_trigger, |
1845 | .pointer = snd_azf3328_capture_pointer | 1870 | .pointer = snd_azf3328_codec_capture_pointer |
1871 | }; | ||
1872 | |||
1873 | static struct snd_pcm_ops snd_azf3328_i2s_out_ops = { | ||
1874 | .open = snd_azf3328_i2s_out_open, | ||
1875 | .close = snd_azf3328_i2s_out_close, | ||
1876 | .ioctl = snd_pcm_lib_ioctl, | ||
1877 | .hw_params = snd_azf3328_hw_params, | ||
1878 | .hw_free = snd_azf3328_hw_free, | ||
1879 | .prepare = snd_azf3328_codec_prepare, | ||
1880 | .trigger = snd_azf3328_codec_i2s_out_trigger, | ||
1881 | .pointer = snd_azf3328_codec_i2s_out_pointer | ||
1846 | }; | 1882 | }; |
1847 | 1883 | ||
1848 | static int __devinit | 1884 | static int __devinit |
1849 | snd_azf3328_pcm(struct snd_azf3328 *chip, int device) | 1885 | snd_azf3328_pcm(struct snd_azf3328 *chip) |
1850 | { | 1886 | { |
1887 | enum { AZF_PCMDEV_STD, AZF_PCMDEV_I2S_OUT, NUM_AZF_PCMDEVS }; /* pcm devices */ | ||
1888 | |||
1851 | struct snd_pcm *pcm; | 1889 | struct snd_pcm *pcm; |
1852 | int err; | 1890 | int err; |
1853 | 1891 | ||
1854 | snd_azf3328_dbgcallenter(); | 1892 | snd_azf3328_dbgcallenter(); |
1855 | if ((err = snd_pcm_new(chip->card, "AZF3328 DSP", device, 1, 1, &pcm)) < 0) | 1893 | |
1894 | err = snd_pcm_new(chip->card, "AZF3328 DSP", AZF_PCMDEV_STD, | ||
1895 | 1, 1, &pcm); | ||
1896 | if (err < 0) | ||
1856 | return err; | 1897 | return err; |
1857 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_azf3328_playback_ops); | 1898 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, |
1858 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_azf3328_capture_ops); | 1899 | &snd_azf3328_playback_ops); |
1900 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, | ||
1901 | &snd_azf3328_capture_ops); | ||
1859 | 1902 | ||
1860 | pcm->private_data = chip; | 1903 | pcm->private_data = chip; |
1861 | pcm->info_flags = 0; | 1904 | pcm->info_flags = 0; |
1862 | strcpy(pcm->name, chip->card->shortname); | 1905 | strcpy(pcm->name, chip->card->shortname); |
1863 | chip->pcm = pcm; | 1906 | /* same pcm object for playback/capture (see snd_pcm_new() above) */ |
1907 | chip->pcm[AZF_CODEC_PLAYBACK] = pcm; | ||
1908 | chip->pcm[AZF_CODEC_CAPTURE] = pcm; | ||
1864 | 1909 | ||
1865 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1910 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1866 | snd_dma_pci_data(chip->pci), 64*1024, 64*1024); | 1911 | snd_dma_pci_data(chip->pci), |
1912 | 64*1024, 64*1024); | ||
1913 | |||
1914 | err = snd_pcm_new(chip->card, "AZF3328 I2S OUT", AZF_PCMDEV_I2S_OUT, | ||
1915 | 1, 0, &pcm); | ||
1916 | if (err < 0) | ||
1917 | return err; | ||
1918 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
1919 | &snd_azf3328_i2s_out_ops); | ||
1920 | |||
1921 | pcm->private_data = chip; | ||
1922 | pcm->info_flags = 0; | ||
1923 | strcpy(pcm->name, chip->card->shortname); | ||
1924 | chip->pcm[AZF_CODEC_I2S_OUT] = pcm; | ||
1925 | |||
1926 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | ||
1927 | snd_dma_pci_data(chip->pci), | ||
1928 | 64*1024, 64*1024); | ||
1867 | 1929 | ||
1868 | snd_azf3328_dbgcallleave(); | 1930 | snd_azf3328_dbgcallleave(); |
1869 | return 0; | 1931 | return 0; |
@@ -1902,7 +1964,7 @@ snd_azf3328_timer_start(struct snd_timer *timer) | |||
1902 | snd_azf3328_dbgtimer("setting timer countdown value %d, add COUNTDOWN|IRQ\n", delay); | 1964 | snd_azf3328_dbgtimer("setting timer countdown value %d, add COUNTDOWN|IRQ\n", delay); |
1903 | delay |= TIMER_COUNTDOWN_ENABLE | TIMER_IRQ_ENABLE; | 1965 | delay |= TIMER_COUNTDOWN_ENABLE | TIMER_IRQ_ENABLE; |
1904 | spin_lock_irqsave(&chip->reg_lock, flags); | 1966 | spin_lock_irqsave(&chip->reg_lock, flags); |
1905 | snd_azf3328_codec_outl(chip, IDX_IO_TIMER_VALUE, delay); | 1967 | snd_azf3328_ctrl_outl(chip, IDX_IO_TIMER_VALUE, delay); |
1906 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1968 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1907 | snd_azf3328_dbgcallleave(); | 1969 | snd_azf3328_dbgcallleave(); |
1908 | return 0; | 1970 | return 0; |
@@ -1919,7 +1981,7 @@ snd_azf3328_timer_stop(struct snd_timer *timer) | |||
1919 | spin_lock_irqsave(&chip->reg_lock, flags); | 1981 | spin_lock_irqsave(&chip->reg_lock, flags); |
1920 | /* disable timer countdown and interrupt */ | 1982 | /* disable timer countdown and interrupt */ |
1921 | /* FIXME: should we write TIMER_IRQ_ACK here? */ | 1983 | /* FIXME: should we write TIMER_IRQ_ACK here? */ |
1922 | snd_azf3328_codec_outb(chip, IDX_IO_TIMER_VALUE + 3, 0); | 1984 | snd_azf3328_ctrl_outb(chip, IDX_IO_TIMER_VALUE + 3, 0); |
1923 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1985 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1924 | snd_azf3328_dbgcallleave(); | 1986 | snd_azf3328_dbgcallleave(); |
1925 | return 0; | 1987 | return 0; |
@@ -2035,7 +2097,7 @@ snd_azf3328_test_bit(unsigned unsigned reg, int bit) | |||
2035 | 2097 | ||
2036 | outb(val, reg); | 2098 | outb(val, reg); |
2037 | 2099 | ||
2038 | printk(KERN_ERR "reg %04x bit %d: %02x %02x %02x\n", | 2100 | printk(KERN_DEBUG "reg %04x bit %d: %02x %02x %02x\n", |
2039 | reg, bit, val, valoff, valon | 2101 | reg, bit, val, valoff, valon |
2040 | ); | 2102 | ); |
2041 | } | 2103 | } |
@@ -2048,9 +2110,9 @@ snd_azf3328_debug_show_ports(const struct snd_azf3328 *chip) | |||
2048 | u16 tmp; | 2110 | u16 tmp; |
2049 | 2111 | ||
2050 | snd_azf3328_dbgmisc( | 2112 | snd_azf3328_dbgmisc( |
2051 | "codec_io 0x%lx, game_io 0x%lx, mpu_io 0x%lx, " | 2113 | "ctrl_io 0x%lx, game_io 0x%lx, mpu_io 0x%lx, " |
2052 | "opl3_io 0x%lx, mixer_io 0x%lx, irq %d\n", | 2114 | "opl3_io 0x%lx, mixer_io 0x%lx, irq %d\n", |
2053 | chip->codec_io, chip->game_io, chip->mpu_io, | 2115 | chip->ctrl_io, chip->game_io, chip->mpu_io, |
2054 | chip->opl3_io, chip->mixer_io, chip->irq | 2116 | chip->opl3_io, chip->mixer_io, chip->irq |
2055 | ); | 2117 | ); |
2056 | 2118 | ||
@@ -2083,9 +2145,9 @@ snd_azf3328_debug_show_ports(const struct snd_azf3328 *chip) | |||
2083 | inb(0x38c + tmp) | 2145 | inb(0x38c + tmp) |
2084 | ); | 2146 | ); |
2085 | 2147 | ||
2086 | for (tmp = 0; tmp < AZF_IO_SIZE_CODEC; tmp += 2) | 2148 | for (tmp = 0; tmp < AZF_IO_SIZE_CTRL; tmp += 2) |
2087 | snd_azf3328_dbgmisc("codec 0x%02x: 0x%04x\n", | 2149 | snd_azf3328_dbgmisc("ctrl 0x%02x: 0x%04x\n", |
2088 | tmp, snd_azf3328_codec_inw(chip, tmp) | 2150 | tmp, snd_azf3328_ctrl_inw(chip, tmp) |
2089 | ); | 2151 | ); |
2090 | 2152 | ||
2091 | for (tmp = 0; tmp < AZF_IO_SIZE_MIXER; tmp += 2) | 2153 | for (tmp = 0; tmp < AZF_IO_SIZE_MIXER; tmp += 2) |
@@ -2106,7 +2168,8 @@ snd_azf3328_create(struct snd_card *card, | |||
2106 | static struct snd_device_ops ops = { | 2168 | static struct snd_device_ops ops = { |
2107 | .dev_free = snd_azf3328_dev_free, | 2169 | .dev_free = snd_azf3328_dev_free, |
2108 | }; | 2170 | }; |
2109 | u16 tmp; | 2171 | u8 dma_init; |
2172 | enum snd_azf3328_codec_type codec_type; | ||
2110 | 2173 | ||
2111 | *rchip = NULL; | 2174 | *rchip = NULL; |
2112 | 2175 | ||
@@ -2138,14 +2201,21 @@ snd_azf3328_create(struct snd_card *card, | |||
2138 | if (err < 0) | 2201 | if (err < 0) |
2139 | goto out_err; | 2202 | goto out_err; |
2140 | 2203 | ||
2141 | chip->codec_io = pci_resource_start(pci, 0); | 2204 | chip->ctrl_io = pci_resource_start(pci, 0); |
2142 | chip->game_io = pci_resource_start(pci, 1); | 2205 | chip->game_io = pci_resource_start(pci, 1); |
2143 | chip->mpu_io = pci_resource_start(pci, 2); | 2206 | chip->mpu_io = pci_resource_start(pci, 2); |
2144 | chip->opl3_io = pci_resource_start(pci, 3); | 2207 | chip->opl3_io = pci_resource_start(pci, 3); |
2145 | chip->mixer_io = pci_resource_start(pci, 4); | 2208 | chip->mixer_io = pci_resource_start(pci, 4); |
2146 | 2209 | ||
2147 | chip->audio_stream[AZF_PLAYBACK].portbase = chip->codec_io + 0x00; | 2210 | chip->codecs[AZF_CODEC_PLAYBACK].io_base = |
2148 | chip->audio_stream[AZF_CAPTURE].portbase = chip->codec_io + 0x20; | 2211 | chip->ctrl_io + AZF_IO_OFFS_CODEC_PLAYBACK; |
2212 | chip->codecs[AZF_CODEC_PLAYBACK].name = "PLAYBACK"; | ||
2213 | chip->codecs[AZF_CODEC_CAPTURE].io_base = | ||
2214 | chip->ctrl_io + AZF_IO_OFFS_CODEC_CAPTURE; | ||
2215 | chip->codecs[AZF_CODEC_CAPTURE].name = "CAPTURE"; | ||
2216 | chip->codecs[AZF_CODEC_I2S_OUT].io_base = | ||
2217 | chip->ctrl_io + AZF_IO_OFFS_CODEC_I2S_OUT; | ||
2218 | chip->codecs[AZF_CODEC_I2S_OUT].name = "I2S_OUT"; | ||
2149 | 2219 | ||
2150 | if (request_irq(pci->irq, snd_azf3328_interrupt, | 2220 | if (request_irq(pci->irq, snd_azf3328_interrupt, |
2151 | IRQF_SHARED, card->shortname, chip)) { | 2221 | IRQF_SHARED, card->shortname, chip)) { |
@@ -2168,20 +2238,25 @@ snd_azf3328_create(struct snd_card *card, | |||
2168 | if (err < 0) | 2238 | if (err < 0) |
2169 | goto out_err; | 2239 | goto out_err; |
2170 | 2240 | ||
2171 | /* shutdown codecs to save power */ | 2241 | /* standard codec init stuff */ |
2172 | /* have snd_azf3328_codec_activity() act properly */ | 2242 | /* default DMA init value */ |
2173 | chip->audio_stream[AZF_PLAYBACK].running = 1; | 2243 | dma_init = DMA_RUN_SOMETHING2|DMA_EPILOGUE_SOMETHING|DMA_SOMETHING_ELSE; |
2174 | snd_azf3328_codec_activity(chip, AZF_PLAYBACK, 0); | ||
2175 | 2244 | ||
2176 | /* standard chip init stuff */ | 2245 | for (codec_type = AZF_CODEC_PLAYBACK; |
2177 | /* default IRQ init value */ | 2246 | codec_type <= AZF_CODEC_I2S_OUT; ++codec_type) { |
2178 | tmp = DMA_PLAY_SOMETHING2|DMA_EPILOGUE_SOMETHING|DMA_SOMETHING_ELSE; | 2247 | struct snd_azf3328_codec_data *codec = |
2248 | &chip->codecs[codec_type]; | ||
2179 | 2249 | ||
2180 | spin_lock_irq(&chip->reg_lock); | 2250 | /* shutdown codecs to save power */ |
2181 | snd_azf3328_codec_outb(chip, IDX_IO_PLAY_FLAGS, tmp); | 2251 | /* have ...ctrl_codec_activity() act properly */ |
2182 | snd_azf3328_codec_outb(chip, IDX_IO_REC_FLAGS, tmp); | 2252 | codec->running = 1; |
2183 | snd_azf3328_codec_outb(chip, IDX_IO_SOMETHING_FLAGS, tmp); | 2253 | snd_azf3328_ctrl_codec_activity(chip, codec_type, 0); |
2184 | spin_unlock_irq(&chip->reg_lock); | 2254 | |
2255 | spin_lock_irq(&chip->reg_lock); | ||
2256 | snd_azf3328_codec_outb(codec, IDX_IO_CODEC_DMA_FLAGS, | ||
2257 | dma_init); | ||
2258 | spin_unlock_irq(&chip->reg_lock); | ||
2259 | } | ||
2185 | 2260 | ||
2186 | snd_card_set_dev(card, &pci->dev); | 2261 | snd_card_set_dev(card, &pci->dev); |
2187 | 2262 | ||
@@ -2229,8 +2304,11 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
2229 | 2304 | ||
2230 | card->private_data = chip; | 2305 | card->private_data = chip; |
2231 | 2306 | ||
2307 | /* chose to use MPU401_HW_AZT2320 ID instead of MPU401_HW_MPU401, | ||
2308 | since our hardware ought to be similar, thus use same ID. */ | ||
2232 | err = snd_mpu401_uart_new( | 2309 | err = snd_mpu401_uart_new( |
2233 | card, 0, MPU401_HW_MPU401, chip->mpu_io, MPU401_INFO_INTEGRATED, | 2310 | card, 0, |
2311 | MPU401_HW_AZT2320, chip->mpu_io, MPU401_INFO_INTEGRATED, | ||
2234 | pci->irq, 0, &chip->rmidi | 2312 | pci->irq, 0, &chip->rmidi |
2235 | ); | 2313 | ); |
2236 | if (err < 0) { | 2314 | if (err < 0) { |
@@ -2244,7 +2322,7 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
2244 | if (err < 0) | 2322 | if (err < 0) |
2245 | goto out_err; | 2323 | goto out_err; |
2246 | 2324 | ||
2247 | err = snd_azf3328_pcm(chip, 0); | 2325 | err = snd_azf3328_pcm(chip); |
2248 | if (err < 0) | 2326 | if (err < 0) |
2249 | goto out_err; | 2327 | goto out_err; |
2250 | 2328 | ||
@@ -2266,14 +2344,14 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
2266 | opl3->private_data = chip; | 2344 | opl3->private_data = chip; |
2267 | 2345 | ||
2268 | sprintf(card->longname, "%s at 0x%lx, irq %i", | 2346 | sprintf(card->longname, "%s at 0x%lx, irq %i", |
2269 | card->shortname, chip->codec_io, chip->irq); | 2347 | card->shortname, chip->ctrl_io, chip->irq); |
2270 | 2348 | ||
2271 | err = snd_card_register(card); | 2349 | err = snd_card_register(card); |
2272 | if (err < 0) | 2350 | if (err < 0) |
2273 | goto out_err; | 2351 | goto out_err; |
2274 | 2352 | ||
2275 | #ifdef MODULE | 2353 | #ifdef MODULE |
2276 | printk( | 2354 | printk(KERN_INFO |
2277 | "azt3328: Sound driver for Aztech AZF3328-based soundcards such as PCI168.\n" | 2355 | "azt3328: Sound driver for Aztech AZF3328-based soundcards such as PCI168.\n" |
2278 | "azt3328: Hardware was completely undocumented, unfortunately.\n" | 2356 | "azt3328: Hardware was completely undocumented, unfortunately.\n" |
2279 | "azt3328: Feel free to contact andi AT lisas.de for bug reports etc.!\n" | 2357 | "azt3328: Feel free to contact andi AT lisas.de for bug reports etc.!\n" |
@@ -2308,36 +2386,52 @@ snd_azf3328_remove(struct pci_dev *pci) | |||
2308 | } | 2386 | } |
2309 | 2387 | ||
2310 | #ifdef CONFIG_PM | 2388 | #ifdef CONFIG_PM |
2389 | static inline void | ||
2390 | snd_azf3328_suspend_regs(unsigned long io_addr, unsigned count, u32 *saved_regs) | ||
2391 | { | ||
2392 | unsigned reg; | ||
2393 | |||
2394 | for (reg = 0; reg < count; ++reg) { | ||
2395 | *saved_regs = inl(io_addr); | ||
2396 | snd_azf3328_dbgpm("suspend: io 0x%04lx: 0x%08x\n", | ||
2397 | io_addr, *saved_regs); | ||
2398 | ++saved_regs; | ||
2399 | io_addr += sizeof(*saved_regs); | ||
2400 | } | ||
2401 | } | ||
2402 | |||
2311 | static int | 2403 | static int |
2312 | snd_azf3328_suspend(struct pci_dev *pci, pm_message_t state) | 2404 | snd_azf3328_suspend(struct pci_dev *pci, pm_message_t state) |
2313 | { | 2405 | { |
2314 | struct snd_card *card = pci_get_drvdata(pci); | 2406 | struct snd_card *card = pci_get_drvdata(pci); |
2315 | struct snd_azf3328 *chip = card->private_data; | 2407 | struct snd_azf3328 *chip = card->private_data; |
2316 | unsigned reg; | 2408 | u16 *saved_regs_ctrl_u16; |
2317 | 2409 | ||
2318 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 2410 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
2319 | 2411 | ||
2320 | snd_pcm_suspend_all(chip->pcm); | 2412 | snd_pcm_suspend_all(chip->pcm[AZF_CODEC_PLAYBACK]); |
2413 | snd_pcm_suspend_all(chip->pcm[AZF_CODEC_I2S_OUT]); | ||
2321 | 2414 | ||
2322 | for (reg = 0; reg < AZF_IO_SIZE_MIXER_PM / 2; ++reg) | 2415 | snd_azf3328_suspend_regs(chip->mixer_io, |
2323 | chip->saved_regs_mixer[reg] = inw(chip->mixer_io + reg * 2); | 2416 | ARRAY_SIZE(chip->saved_regs_mixer), chip->saved_regs_mixer); |
2324 | 2417 | ||
2325 | /* make sure to disable master volume etc. to prevent looping sound */ | 2418 | /* make sure to disable master volume etc. to prevent looping sound */ |
2326 | snd_azf3328_mixer_set_mute(chip, IDX_MIXER_PLAY_MASTER, 1); | 2419 | snd_azf3328_mixer_set_mute(chip, IDX_MIXER_PLAY_MASTER, 1); |
2327 | snd_azf3328_mixer_set_mute(chip, IDX_MIXER_WAVEOUT, 1); | 2420 | snd_azf3328_mixer_set_mute(chip, IDX_MIXER_WAVEOUT, 1); |
2328 | 2421 | ||
2329 | for (reg = 0; reg < AZF_IO_SIZE_CODEC_PM / 2; ++reg) | 2422 | snd_azf3328_suspend_regs(chip->ctrl_io, |
2330 | chip->saved_regs_codec[reg] = inw(chip->codec_io + reg * 2); | 2423 | ARRAY_SIZE(chip->saved_regs_ctrl), chip->saved_regs_ctrl); |
2331 | 2424 | ||
2332 | /* manually store the one currently relevant write-only reg, too */ | 2425 | /* manually store the one currently relevant write-only reg, too */ |
2333 | chip->saved_regs_codec[IDX_IO_6AH / 2] = chip->shadow_reg_codec_6AH; | 2426 | saved_regs_ctrl_u16 = (u16 *)chip->saved_regs_ctrl; |
2427 | saved_regs_ctrl_u16[IDX_IO_6AH / 2] = chip->shadow_reg_ctrl_6AH; | ||
2334 | 2428 | ||
2335 | for (reg = 0; reg < AZF_IO_SIZE_GAME_PM / 2; ++reg) | 2429 | snd_azf3328_suspend_regs(chip->game_io, |
2336 | chip->saved_regs_game[reg] = inw(chip->game_io + reg * 2); | 2430 | ARRAY_SIZE(chip->saved_regs_game), chip->saved_regs_game); |
2337 | for (reg = 0; reg < AZF_IO_SIZE_MPU_PM / 2; ++reg) | 2431 | snd_azf3328_suspend_regs(chip->mpu_io, |
2338 | chip->saved_regs_mpu[reg] = inw(chip->mpu_io + reg * 2); | 2432 | ARRAY_SIZE(chip->saved_regs_mpu), chip->saved_regs_mpu); |
2339 | for (reg = 0; reg < AZF_IO_SIZE_OPL3_PM / 2; ++reg) | 2433 | snd_azf3328_suspend_regs(chip->opl3_io, |
2340 | chip->saved_regs_opl3[reg] = inw(chip->opl3_io + reg * 2); | 2434 | ARRAY_SIZE(chip->saved_regs_opl3), chip->saved_regs_opl3); |
2341 | 2435 | ||
2342 | pci_disable_device(pci); | 2436 | pci_disable_device(pci); |
2343 | pci_save_state(pci); | 2437 | pci_save_state(pci); |
@@ -2345,12 +2439,28 @@ snd_azf3328_suspend(struct pci_dev *pci, pm_message_t state) | |||
2345 | return 0; | 2439 | return 0; |
2346 | } | 2440 | } |
2347 | 2441 | ||
2442 | static inline void | ||
2443 | snd_azf3328_resume_regs(const u32 *saved_regs, | ||
2444 | unsigned long io_addr, | ||
2445 | unsigned count | ||
2446 | ) | ||
2447 | { | ||
2448 | unsigned reg; | ||
2449 | |||
2450 | for (reg = 0; reg < count; ++reg) { | ||
2451 | outl(*saved_regs, io_addr); | ||
2452 | snd_azf3328_dbgpm("resume: io 0x%04lx: 0x%08x --> 0x%08x\n", | ||
2453 | io_addr, *saved_regs, inl(io_addr)); | ||
2454 | ++saved_regs; | ||
2455 | io_addr += sizeof(*saved_regs); | ||
2456 | } | ||
2457 | } | ||
2458 | |||
2348 | static int | 2459 | static int |
2349 | snd_azf3328_resume(struct pci_dev *pci) | 2460 | snd_azf3328_resume(struct pci_dev *pci) |
2350 | { | 2461 | { |
2351 | struct snd_card *card = pci_get_drvdata(pci); | 2462 | struct snd_card *card = pci_get_drvdata(pci); |
2352 | struct snd_azf3328 *chip = card->private_data; | 2463 | const struct snd_azf3328 *chip = card->private_data; |
2353 | unsigned reg; | ||
2354 | 2464 | ||
2355 | pci_set_power_state(pci, PCI_D0); | 2465 | pci_set_power_state(pci, PCI_D0); |
2356 | pci_restore_state(pci); | 2466 | pci_restore_state(pci); |
@@ -2362,16 +2472,24 @@ snd_azf3328_resume(struct pci_dev *pci) | |||
2362 | } | 2472 | } |
2363 | pci_set_master(pci); | 2473 | pci_set_master(pci); |
2364 | 2474 | ||
2365 | for (reg = 0; reg < AZF_IO_SIZE_GAME_PM / 2; ++reg) | 2475 | snd_azf3328_resume_regs(chip->saved_regs_game, chip->game_io, |
2366 | outw(chip->saved_regs_game[reg], chip->game_io + reg * 2); | 2476 | ARRAY_SIZE(chip->saved_regs_game)); |
2367 | for (reg = 0; reg < AZF_IO_SIZE_MPU_PM / 2; ++reg) | 2477 | snd_azf3328_resume_regs(chip->saved_regs_mpu, chip->mpu_io, |
2368 | outw(chip->saved_regs_mpu[reg], chip->mpu_io + reg * 2); | 2478 | ARRAY_SIZE(chip->saved_regs_mpu)); |
2369 | for (reg = 0; reg < AZF_IO_SIZE_OPL3_PM / 2; ++reg) | 2479 | snd_azf3328_resume_regs(chip->saved_regs_opl3, chip->opl3_io, |
2370 | outw(chip->saved_regs_opl3[reg], chip->opl3_io + reg * 2); | 2480 | ARRAY_SIZE(chip->saved_regs_opl3)); |
2371 | for (reg = 0; reg < AZF_IO_SIZE_MIXER_PM / 2; ++reg) | 2481 | |
2372 | outw(chip->saved_regs_mixer[reg], chip->mixer_io + reg * 2); | 2482 | snd_azf3328_resume_regs(chip->saved_regs_mixer, chip->mixer_io, |
2373 | for (reg = 0; reg < AZF_IO_SIZE_CODEC_PM / 2; ++reg) | 2483 | ARRAY_SIZE(chip->saved_regs_mixer)); |
2374 | outw(chip->saved_regs_codec[reg], chip->codec_io + reg * 2); | 2484 | |
2485 | /* unfortunately with 32bit transfers, IDX_MIXER_PLAY_MASTER (0x02) | ||
2486 | and IDX_MIXER_RESET (offset 0x00) get touched at the same time, | ||
2487 | resulting in a mixer reset condition persisting until _after_ | ||
2488 | master vol was restored. Thus master vol needs an extra restore. */ | ||
2489 | outw(((u16 *)chip->saved_regs_mixer)[1], chip->mixer_io + 2); | ||
2490 | |||
2491 | snd_azf3328_resume_regs(chip->saved_regs_ctrl, chip->ctrl_io, | ||
2492 | ARRAY_SIZE(chip->saved_regs_ctrl)); | ||
2375 | 2493 | ||
2376 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | 2494 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); |
2377 | return 0; | 2495 | return 0; |
diff --git a/sound/pci/azt3328.h b/sound/pci/azt3328.h index 974e05122f00..6f46b97650cc 100644 --- a/sound/pci/azt3328.h +++ b/sound/pci/azt3328.h | |||
@@ -6,50 +6,59 @@ | |||
6 | 6 | ||
7 | /*** main I/O area port indices ***/ | 7 | /*** main I/O area port indices ***/ |
8 | /* (only 0x70 of 0x80 bytes saved/restored by Windows driver) */ | 8 | /* (only 0x70 of 0x80 bytes saved/restored by Windows driver) */ |
9 | #define AZF_IO_SIZE_CODEC 0x80 | 9 | #define AZF_IO_SIZE_CTRL 0x80 |
10 | #define AZF_IO_SIZE_CODEC_PM 0x70 | 10 | #define AZF_IO_SIZE_CTRL_PM 0x70 |
11 | 11 | ||
12 | /* the driver initialisation suggests a layout of 4 main areas: | 12 | /* the driver initialisation suggests a layout of 4 areas |
13 | * from 0x00 (playback), from 0x20 (recording) and from 0x40 (maybe MPU401??). | 13 | * within the main card control I/O: |
14 | * from 0x00 (playback codec), from 0x20 (recording codec) | ||
15 | * and from 0x40 (most certainly I2S out codec). | ||
14 | * And another area from 0x60 to 0x6f (DirectX timer, IRQ management, | 16 | * And another area from 0x60 to 0x6f (DirectX timer, IRQ management, |
15 | * power management etc.???). */ | 17 | * power management etc.???). */ |
16 | 18 | ||
17 | /** playback area **/ | 19 | #define AZF_IO_OFFS_CODEC_PLAYBACK 0x00 |
18 | #define IDX_IO_PLAY_FLAGS 0x00 /* PU:0x0000 */ | 20 | #define AZF_IO_OFFS_CODEC_CAPTURE 0x20 |
21 | #define AZF_IO_OFFS_CODEC_I2S_OUT 0x40 | ||
22 | |||
23 | #define IDX_IO_CODEC_DMA_FLAGS 0x00 /* PU:0x0000 */ | ||
19 | /* able to reactivate output after output muting due to 8/16bit | 24 | /* able to reactivate output after output muting due to 8/16bit |
20 | * output change, just like 0x0002. | 25 | * output change, just like 0x0002. |
21 | * 0x0001 is the only bit that's able to start the DMA counter */ | 26 | * 0x0001 is the only bit that's able to start the DMA counter */ |
22 | #define DMA_RESUME 0x0001 /* paused if cleared ? */ | 27 | #define DMA_RESUME 0x0001 /* paused if cleared? */ |
23 | /* 0x0002 *temporarily* set during DMA stopping. hmm | 28 | /* 0x0002 *temporarily* set during DMA stopping. hmm |
24 | * both 0x0002 and 0x0004 set in playback setup. */ | 29 | * both 0x0002 and 0x0004 set in playback setup. */ |
25 | /* able to reactivate output after output muting due to 8/16bit | 30 | /* able to reactivate output after output muting due to 8/16bit |
26 | * output change, just like 0x0001. */ | 31 | * output change, just like 0x0001. */ |
27 | #define DMA_PLAY_SOMETHING1 0x0002 /* \ alternated (toggled) */ | 32 | #define DMA_RUN_SOMETHING1 0x0002 /* \ alternated (toggled) */ |
28 | /* 0x0004: NOT able to reactivate output */ | 33 | /* 0x0004: NOT able to reactivate output */ |
29 | #define DMA_PLAY_SOMETHING2 0x0004 /* / bits */ | 34 | #define DMA_RUN_SOMETHING2 0x0004 /* / bits */ |
30 | #define SOMETHING_ALMOST_ALWAYS_SET 0x0008 /* ???; can be modified */ | 35 | #define SOMETHING_ALMOST_ALWAYS_SET 0x0008 /* ???; can be modified */ |
31 | #define DMA_EPILOGUE_SOMETHING 0x0010 | 36 | #define DMA_EPILOGUE_SOMETHING 0x0010 |
32 | #define DMA_SOMETHING_ELSE 0x0020 /* ??? */ | 37 | #define DMA_SOMETHING_ELSE 0x0020 /* ??? */ |
33 | #define SOMETHING_UNMODIFIABLE 0xffc0 /* unused ? not modifiable */ | 38 | #define SOMETHING_UNMODIFIABLE 0xffc0 /* unused? not modifiable */ |
34 | #define IDX_IO_PLAY_IRQTYPE 0x02 /* PU:0x0001 */ | 39 | #define IDX_IO_CODEC_IRQTYPE 0x02 /* PU:0x0001 */ |
35 | /* write back to flags in case flags are set, in order to ACK IRQ in handler | 40 | /* write back to flags in case flags are set, in order to ACK IRQ in handler |
36 | * (bit 1 of port 0x64 indicates interrupt for one of these three types) | 41 | * (bit 1 of port 0x64 indicates interrupt for one of these three types) |
37 | * sometimes in this case it just writes 0xffff to globally ACK all IRQs | 42 | * sometimes in this case it just writes 0xffff to globally ACK all IRQs |
38 | * settings written are not reflected when reading back, though. | 43 | * settings written are not reflected when reading back, though. |
39 | * seems to be IRQ, too (frequently used: port |= 0x07 !), but who knows ? */ | 44 | * seems to be IRQ, too (frequently used: port |= 0x07 !), but who knows? */ |
40 | #define IRQ_PLAY_SOMETHING 0x0001 /* something & ACK */ | 45 | #define IRQ_SOMETHING 0x0001 /* something & ACK */ |
41 | #define IRQ_FINISHED_PLAYBUF_1 0x0002 /* 1st dmabuf finished & ACK */ | 46 | #define IRQ_FINISHED_DMABUF_1 0x0002 /* 1st dmabuf finished & ACK */ |
42 | #define IRQ_FINISHED_PLAYBUF_2 0x0004 /* 2nd dmabuf finished & ACK */ | 47 | #define IRQ_FINISHED_DMABUF_2 0x0004 /* 2nd dmabuf finished & ACK */ |
43 | #define IRQMASK_SOME_STATUS_1 0x0008 /* \ related bits */ | 48 | #define IRQMASK_SOME_STATUS_1 0x0008 /* \ related bits */ |
44 | #define IRQMASK_SOME_STATUS_2 0x0010 /* / (checked together in loop) */ | 49 | #define IRQMASK_SOME_STATUS_2 0x0010 /* / (checked together in loop) */ |
45 | #define IRQMASK_UNMODIFIABLE 0xffe0 /* unused ? not modifiable */ | 50 | #define IRQMASK_UNMODIFIABLE 0xffe0 /* unused? not modifiable */ |
46 | #define IDX_IO_PLAY_DMA_START_1 0x04 /* start address of 1st DMA play area, PU:0x00000000 */ | 51 | /* start address of 1st DMA transfer area, PU:0x00000000 */ |
47 | #define IDX_IO_PLAY_DMA_START_2 0x08 /* start address of 2nd DMA play area, PU:0x00000000 */ | 52 | #define IDX_IO_CODEC_DMA_START_1 0x04 |
48 | #define IDX_IO_PLAY_DMA_LEN_1 0x0c /* length of 1st DMA play area, PU:0x0000 */ | 53 | /* start address of 2nd DMA transfer area, PU:0x00000000 */ |
49 | #define IDX_IO_PLAY_DMA_LEN_2 0x0e /* length of 2nd DMA play area, PU:0x0000 */ | 54 | #define IDX_IO_CODEC_DMA_START_2 0x08 |
50 | #define IDX_IO_PLAY_DMA_CURRPOS 0x10 /* current DMA position, PU:0x00000000 */ | 55 | /* both lengths of DMA transfer areas, PU:0x00000000 |
51 | #define IDX_IO_PLAY_DMA_CURROFS 0x14 /* offset within current DMA play area, PU:0x0000 */ | 56 | length1: offset 0x0c, length2: offset 0x0e */ |
52 | #define IDX_IO_PLAY_SOUNDFORMAT 0x16 /* PU:0x0010 */ | 57 | #define IDX_IO_CODEC_DMA_LENGTHS 0x0c |
58 | #define IDX_IO_CODEC_DMA_CURRPOS 0x10 /* current DMA position, PU:0x00000000 */ | ||
59 | /* offset within current DMA transfer area, PU:0x0000 */ | ||
60 | #define IDX_IO_CODEC_DMA_CURROFS 0x14 | ||
61 | #define IDX_IO_CODEC_SOUNDFORMAT 0x16 /* PU:0x0010 */ | ||
53 | /* all unspecified bits can't be modified */ | 62 | /* all unspecified bits can't be modified */ |
54 | #define SOUNDFORMAT_FREQUENCY_MASK 0x000f | 63 | #define SOUNDFORMAT_FREQUENCY_MASK 0x000f |
55 | #define SOUNDFORMAT_XTAL1 0x00 | 64 | #define SOUNDFORMAT_XTAL1 0x00 |
@@ -76,6 +85,7 @@ | |||
76 | #define SOUNDFORMAT_FLAG_16BIT 0x0010 | 85 | #define SOUNDFORMAT_FLAG_16BIT 0x0010 |
77 | #define SOUNDFORMAT_FLAG_2CHANNELS 0x0020 | 86 | #define SOUNDFORMAT_FLAG_2CHANNELS 0x0020 |
78 | 87 | ||
88 | |||
79 | /* define frequency helpers, for maximum value safety */ | 89 | /* define frequency helpers, for maximum value safety */ |
80 | enum azf_freq_t { | 90 | enum azf_freq_t { |
81 | #define AZF_FREQ(rate) AZF_FREQ_##rate = rate | 91 | #define AZF_FREQ(rate) AZF_FREQ_##rate = rate |
@@ -96,29 +106,6 @@ enum azf_freq_t { | |||
96 | #undef AZF_FREQ | 106 | #undef AZF_FREQ |
97 | }; | 107 | }; |
98 | 108 | ||
99 | /** recording area (see also: playback bit flag definitions) **/ | ||
100 | #define IDX_IO_REC_FLAGS 0x20 /* ??, PU:0x0000 */ | ||
101 | #define IDX_IO_REC_IRQTYPE 0x22 /* ??, PU:0x0000 */ | ||
102 | #define IRQ_REC_SOMETHING 0x0001 /* something & ACK */ | ||
103 | #define IRQ_FINISHED_RECBUF_1 0x0002 /* 1st dmabuf finished & ACK */ | ||
104 | #define IRQ_FINISHED_RECBUF_2 0x0004 /* 2nd dmabuf finished & ACK */ | ||
105 | /* hmm, maybe these are just the corresponding *recording* flags ? | ||
106 | * but OTOH they are most likely at port 0x22 instead */ | ||
107 | #define IRQMASK_SOME_STATUS_1 0x0008 /* \ related bits */ | ||
108 | #define IRQMASK_SOME_STATUS_2 0x0010 /* / (checked together in loop) */ | ||
109 | #define IDX_IO_REC_DMA_START_1 0x24 /* PU:0x00000000 */ | ||
110 | #define IDX_IO_REC_DMA_START_2 0x28 /* PU:0x00000000 */ | ||
111 | #define IDX_IO_REC_DMA_LEN_1 0x2c /* PU:0x0000 */ | ||
112 | #define IDX_IO_REC_DMA_LEN_2 0x2e /* PU:0x0000 */ | ||
113 | #define IDX_IO_REC_DMA_CURRPOS 0x30 /* PU:0x00000000 */ | ||
114 | #define IDX_IO_REC_DMA_CURROFS 0x34 /* PU:0x00000000 */ | ||
115 | #define IDX_IO_REC_SOUNDFORMAT 0x36 /* PU:0x0000 */ | ||
116 | |||
117 | /** hmm, what is this I/O area for? MPU401?? or external DAC via I2S?? (after playback, recording, ???, timer) **/ | ||
118 | #define IDX_IO_SOMETHING_FLAGS 0x40 /* gets set to 0x34 just like port 0x0 and 0x20 on card init, PU:0x0000 */ | ||
119 | /* general */ | ||
120 | #define IDX_IO_42H 0x42 /* PU:0x0001 */ | ||
121 | |||
122 | /** DirectX timer, main interrupt area (FIXME: and something else?) **/ | 109 | /** DirectX timer, main interrupt area (FIXME: and something else?) **/ |
123 | #define IDX_IO_TIMER_VALUE 0x60 /* found this timer area by pure luck :-) */ | 110 | #define IDX_IO_TIMER_VALUE 0x60 /* found this timer area by pure luck :-) */ |
124 | /* timer countdown value; triggers IRQ when timer is finished */ | 111 | /* timer countdown value; triggers IRQ when timer is finished */ |
@@ -133,17 +120,19 @@ enum azf_freq_t { | |||
133 | #define IDX_IO_IRQSTATUS 0x64 | 120 | #define IDX_IO_IRQSTATUS 0x64 |
134 | /* some IRQ bit in here might also be used to signal a power-management timer | 121 | /* some IRQ bit in here might also be used to signal a power-management timer |
135 | * timeout, to request shutdown of the chip (e.g. AD1815JS has such a thing). | 122 | * timeout, to request shutdown of the chip (e.g. AD1815JS has such a thing). |
136 | * Some OPL3 hardware (e.g. in LM4560) has some special timer hardware which | 123 | * OPL3 hardware contains several timers which confusingly in most cases |
137 | * can trigger an OPL3 timer IRQ, so maybe there's such a thing as well... */ | 124 | * are NOT routed to an IRQ, but some designs (e.g. LM4560) DO support that, |
125 | * so I wouldn't be surprised at all to discover that AZF3328 | ||
126 | * supports that thing as well... */ | ||
138 | 127 | ||
139 | #define IRQ_PLAYBACK 0x0001 | 128 | #define IRQ_PLAYBACK 0x0001 |
140 | #define IRQ_RECORDING 0x0002 | 129 | #define IRQ_RECORDING 0x0002 |
141 | #define IRQ_UNKNOWN1 0x0004 /* most probably I2S port */ | 130 | #define IRQ_I2S_OUT 0x0004 /* this IS I2S, right!? (untested) */ |
142 | #define IRQ_GAMEPORT 0x0008 /* Interrupt of Digital(ly) Enhanced Game Port */ | 131 | #define IRQ_GAMEPORT 0x0008 /* Interrupt of Digital(ly) Enhanced Game Port */ |
143 | #define IRQ_MPU401 0x0010 | 132 | #define IRQ_MPU401 0x0010 |
144 | #define IRQ_TIMER 0x0020 /* DirectX timer */ | 133 | #define IRQ_TIMER 0x0020 /* DirectX timer */ |
145 | #define IRQ_UNKNOWN2 0x0040 /* probably unused, or possibly I2S port? */ | 134 | #define IRQ_UNKNOWN2 0x0040 /* probably unused, or possibly OPL3 timer? */ |
146 | #define IRQ_UNKNOWN3 0x0080 /* probably unused, or possibly I2S port? */ | 135 | #define IRQ_UNKNOWN3 0x0080 /* probably unused, or possibly OPL3 timer? */ |
147 | #define IDX_IO_66H 0x66 /* writing 0xffff returns 0x0000 */ | 136 | #define IDX_IO_66H 0x66 /* writing 0xffff returns 0x0000 */ |
148 | /* this is set to e.g. 0x3ff or 0x300, and writable; | 137 | /* this is set to e.g. 0x3ff or 0x300, and writable; |
149 | * maybe some buffer limit, but I couldn't find out more, PU:0x00ff: */ | 138 | * maybe some buffer limit, but I couldn't find out more, PU:0x00ff: */ |
@@ -206,7 +195,7 @@ enum azf_freq_t { | |||
206 | /*** Gameport area port indices ***/ | 195 | /*** Gameport area port indices ***/ |
207 | /* (only 0x06 of 0x08 bytes saved/restored by Windows driver) */ | 196 | /* (only 0x06 of 0x08 bytes saved/restored by Windows driver) */ |
208 | #define AZF_IO_SIZE_GAME 0x08 | 197 | #define AZF_IO_SIZE_GAME 0x08 |
209 | #define AZF_IO_SIZE_GAME_PM 0x06 | 198 | #define AZF_IO_SIZE_GAME_PM 0x06 |
210 | 199 | ||
211 | enum { | 200 | enum { |
212 | AZF_GAME_LEGACY_IO_PORT = 0x200 | 201 | AZF_GAME_LEGACY_IO_PORT = 0x200 |
@@ -272,6 +261,12 @@ enum { | |||
272 | * 11 --> 1/200: */ | 261 | * 11 --> 1/200: */ |
273 | #define GAME_HWCFG_ADC_COUNTER_FREQ_MASK 0x06 | 262 | #define GAME_HWCFG_ADC_COUNTER_FREQ_MASK 0x06 |
274 | 263 | ||
264 | /* FIXME: these values might be reversed... */ | ||
265 | #define GAME_HWCFG_ADC_COUNTER_FREQ_STD 0 | ||
266 | #define GAME_HWCFG_ADC_COUNTER_FREQ_1_2 1 | ||
267 | #define GAME_HWCFG_ADC_COUNTER_FREQ_1_20 2 | ||
268 | #define GAME_HWCFG_ADC_COUNTER_FREQ_1_200 3 | ||
269 | |||
275 | /* enable gameport legacy I/O address (0x200) | 270 | /* enable gameport legacy I/O address (0x200) |
276 | * I was unable to locate any configurability for a different address: */ | 271 | * I was unable to locate any configurability for a different address: */ |
277 | #define GAME_HWCFG_LEGACY_ADDRESS_ENABLE 0x08 | 272 | #define GAME_HWCFG_LEGACY_ADDRESS_ENABLE 0x08 |
@@ -281,6 +276,7 @@ enum { | |||
281 | #define AZF_IO_SIZE_MPU_PM 0x04 | 276 | #define AZF_IO_SIZE_MPU_PM 0x04 |
282 | 277 | ||
283 | /*** OPL3 synth ***/ | 278 | /*** OPL3 synth ***/ |
279 | /* (only 0x06 of 0x08 bytes saved/restored by Windows driver) */ | ||
284 | #define AZF_IO_SIZE_OPL3 0x08 | 280 | #define AZF_IO_SIZE_OPL3 0x08 |
285 | #define AZF_IO_SIZE_OPL3_PM 0x06 | 281 | #define AZF_IO_SIZE_OPL3_PM 0x06 |
286 | /* hmm, given that a standard OPL3 has 4 registers only, | 282 | /* hmm, given that a standard OPL3 has 4 registers only, |
@@ -340,4 +336,7 @@ enum { | |||
340 | #define SET_CHAN_LEFT 1 | 336 | #define SET_CHAN_LEFT 1 |
341 | #define SET_CHAN_RIGHT 2 | 337 | #define SET_CHAN_RIGHT 2 |
342 | 338 | ||
339 | /* helper macro to align I/O port ranges to 32bit I/O width */ | ||
340 | #define AZF_ALIGN(x) (((x) + 3) & (~3)) | ||
341 | |||
343 | #endif /* __SOUND_AZT3328_H */ | 342 | #endif /* __SOUND_AZT3328_H */ |
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index 57b992a5c057..15e4138bce17 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c | |||
@@ -325,9 +325,9 @@ static struct snd_pcm_hardware snd_ca0106_capture_hw = { | |||
325 | .rate_max = 192000, | 325 | .rate_max = 192000, |
326 | .channels_min = 2, | 326 | .channels_min = 2, |
327 | .channels_max = 2, | 327 | .channels_max = 2, |
328 | .buffer_bytes_max = ((65536 - 64) * 8), | 328 | .buffer_bytes_max = 65536 - 128, |
329 | .period_bytes_min = 64, | 329 | .period_bytes_min = 64, |
330 | .period_bytes_max = (65536 - 64), | 330 | .period_bytes_max = 32768 - 64, |
331 | .periods_min = 2, | 331 | .periods_min = 2, |
332 | .periods_max = 2, | 332 | .periods_max = 2, |
333 | .fifo_size = 0, | 333 | .fifo_size = 0, |
@@ -1876,7 +1876,7 @@ static int snd_ca0106_resume(struct pci_dev *pci) | |||
1876 | 1876 | ||
1877 | // PCI IDs | 1877 | // PCI IDs |
1878 | static struct pci_device_id snd_ca0106_ids[] = { | 1878 | static struct pci_device_id snd_ca0106_ids[] = { |
1879 | { 0x1102, 0x0007, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* Audigy LS or Live 24bit */ | 1879 | { PCI_VDEVICE(CREATIVE, 0x0007), 0 }, /* Audigy LS or Live 24bit */ |
1880 | { 0, } | 1880 | { 0, } |
1881 | }; | 1881 | }; |
1882 | MODULE_DEVICE_TABLE(pci, snd_ca0106_ids); | 1882 | MODULE_DEVICE_TABLE(pci, snd_ca0106_ids); |
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index 449fe02f666e..ddcd4a9fd7e6 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c | |||
@@ -2797,11 +2797,11 @@ static inline void snd_cmipci_proc_init(struct cmipci *cm) {} | |||
2797 | 2797 | ||
2798 | 2798 | ||
2799 | static struct pci_device_id snd_cmipci_ids[] = { | 2799 | static struct pci_device_id snd_cmipci_ids[] = { |
2800 | {PCI_VENDOR_ID_CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8338A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 2800 | {PCI_VDEVICE(CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8338A), 0}, |
2801 | {PCI_VENDOR_ID_CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8338B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 2801 | {PCI_VDEVICE(CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8338B), 0}, |
2802 | {PCI_VENDOR_ID_CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8738, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 2802 | {PCI_VDEVICE(CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8738), 0}, |
2803 | {PCI_VENDOR_ID_CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8738B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 2803 | {PCI_VDEVICE(CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8738B), 0}, |
2804 | {PCI_VENDOR_ID_AL, PCI_DEVICE_ID_CMEDIA_CM8738, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 2804 | {PCI_VDEVICE(AL, PCI_DEVICE_ID_CMEDIA_CM8738), 0}, |
2805 | {0,}, | 2805 | {0,}, |
2806 | }; | 2806 | }; |
2807 | 2807 | ||
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index f6286f84a221..e2e0359bb056 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c | |||
@@ -495,7 +495,7 @@ struct cs4281 { | |||
495 | static irqreturn_t snd_cs4281_interrupt(int irq, void *dev_id); | 495 | static irqreturn_t snd_cs4281_interrupt(int irq, void *dev_id); |
496 | 496 | ||
497 | static struct pci_device_id snd_cs4281_ids[] = { | 497 | static struct pci_device_id snd_cs4281_ids[] = { |
498 | { 0x1013, 0x6005, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* CS4281 */ | 498 | { PCI_VDEVICE(CIRRUS, 0x6005), 0, }, /* CS4281 */ |
499 | { 0, } | 499 | { 0, } |
500 | }; | 500 | }; |
501 | 501 | ||
diff --git a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c index c9b3e3d48cbc..033aec430117 100644 --- a/sound/pci/cs46xx/cs46xx.c +++ b/sound/pci/cs46xx/cs46xx.c | |||
@@ -65,9 +65,9 @@ module_param_array(mmap_valid, bool, NULL, 0444); | |||
65 | MODULE_PARM_DESC(mmap_valid, "Support OSS mmap."); | 65 | MODULE_PARM_DESC(mmap_valid, "Support OSS mmap."); |
66 | 66 | ||
67 | static struct pci_device_id snd_cs46xx_ids[] = { | 67 | static struct pci_device_id snd_cs46xx_ids[] = { |
68 | { 0x1013, 0x6001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* CS4280 */ | 68 | { PCI_VDEVICE(CIRRUS, 0x6001), 0, }, /* CS4280 */ |
69 | { 0x1013, 0x6003, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* CS4612 */ | 69 | { PCI_VDEVICE(CIRRUS, 0x6003), 0, }, /* CS4612 */ |
70 | { 0x1013, 0x6004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* CS4615 */ | 70 | { PCI_VDEVICE(CIRRUS, 0x6004), 0, }, /* CS4615 */ |
71 | { 0, } | 71 | { 0, } |
72 | }; | 72 | }; |
73 | 73 | ||
diff --git a/sound/pci/cs46xx/cs46xx_lib.h b/sound/pci/cs46xx/cs46xx_lib.h index 4eb55aa33612..b5189495d58a 100644 --- a/sound/pci/cs46xx/cs46xx_lib.h +++ b/sound/pci/cs46xx/cs46xx_lib.h | |||
@@ -35,7 +35,7 @@ | |||
35 | 35 | ||
36 | 36 | ||
37 | #ifdef CONFIG_SND_CS46XX_NEW_DSP | 37 | #ifdef CONFIG_SND_CS46XX_NEW_DSP |
38 | #define CS46XX_MIN_PERIOD_SIZE 1 | 38 | #define CS46XX_MIN_PERIOD_SIZE 64 |
39 | #define CS46XX_MAX_PERIOD_SIZE 1024*1024 | 39 | #define CS46XX_MAX_PERIOD_SIZE 1024*1024 |
40 | #else | 40 | #else |
41 | #define CS46XX_MIN_PERIOD_SIZE 2048 | 41 | #define CS46XX_MIN_PERIOD_SIZE 2048 |
diff --git a/sound/pci/ctxfi/ct20k2reg.h b/sound/pci/ctxfi/ct20k2reg.h index 2d07986f57cc..e0394e3996e8 100644 --- a/sound/pci/ctxfi/ct20k2reg.h +++ b/sound/pci/ctxfi/ct20k2reg.h | |||
@@ -11,9 +11,12 @@ | |||
11 | 11 | ||
12 | 12 | ||
13 | /* Timer Registers */ | 13 | /* Timer Registers */ |
14 | #define TIMER_TIMR 0x1B7004 | 14 | #define WC 0x1b7000 |
15 | #define INTERRUPT_GIP 0x1B7010 | 15 | #define TIMR 0x1b7004 |
16 | #define INTERRUPT_GIE 0x1B7014 | 16 | # define TIMR_IE (1<<15) |
17 | # define TIMR_IP (1<<14) | ||
18 | #define GIP 0x1b7010 | ||
19 | #define GIE 0x1b7014 | ||
17 | 20 | ||
18 | /* I2C Registers */ | 21 | /* I2C Registers */ |
19 | #define I2C_IF_ADDRESS 0x1B9000 | 22 | #define I2C_IF_ADDRESS 0x1B9000 |
diff --git a/sound/pci/ctxfi/ctamixer.c b/sound/pci/ctxfi/ctamixer.c index a1db51b3ead8..fee35cfc0c7f 100644 --- a/sound/pci/ctxfi/ctamixer.c +++ b/sound/pci/ctxfi/ctamixer.c | |||
@@ -63,7 +63,7 @@ static int amixer_set_input(struct amixer *amixer, struct rsc *rsc) | |||
63 | hw = amixer->rsc.hw; | 63 | hw = amixer->rsc.hw; |
64 | hw->amixer_set_mode(amixer->rsc.ctrl_blk, AMIXER_Y_IMMEDIATE); | 64 | hw->amixer_set_mode(amixer->rsc.ctrl_blk, AMIXER_Y_IMMEDIATE); |
65 | amixer->input = rsc; | 65 | amixer->input = rsc; |
66 | if (NULL == rsc) | 66 | if (!rsc) |
67 | hw->amixer_set_x(amixer->rsc.ctrl_blk, BLANK_SLOT); | 67 | hw->amixer_set_x(amixer->rsc.ctrl_blk, BLANK_SLOT); |
68 | else | 68 | else |
69 | hw->amixer_set_x(amixer->rsc.ctrl_blk, | 69 | hw->amixer_set_x(amixer->rsc.ctrl_blk, |
@@ -99,7 +99,7 @@ static int amixer_set_sum(struct amixer *amixer, struct sum *sum) | |||
99 | 99 | ||
100 | hw = amixer->rsc.hw; | 100 | hw = amixer->rsc.hw; |
101 | amixer->sum = sum; | 101 | amixer->sum = sum; |
102 | if (NULL == sum) { | 102 | if (!sum) { |
103 | hw->amixer_set_se(amixer->rsc.ctrl_blk, 0); | 103 | hw->amixer_set_se(amixer->rsc.ctrl_blk, 0); |
104 | } else { | 104 | } else { |
105 | hw->amixer_set_se(amixer->rsc.ctrl_blk, 1); | 105 | hw->amixer_set_se(amixer->rsc.ctrl_blk, 1); |
@@ -124,20 +124,20 @@ static int amixer_commit_write(struct amixer *amixer) | |||
124 | 124 | ||
125 | /* Program master and conjugate resources */ | 125 | /* Program master and conjugate resources */ |
126 | amixer->rsc.ops->master(&amixer->rsc); | 126 | amixer->rsc.ops->master(&amixer->rsc); |
127 | if (NULL != input) | 127 | if (input) |
128 | input->ops->master(input); | 128 | input->ops->master(input); |
129 | 129 | ||
130 | if (NULL != sum) | 130 | if (sum) |
131 | sum->rsc.ops->master(&sum->rsc); | 131 | sum->rsc.ops->master(&sum->rsc); |
132 | 132 | ||
133 | for (i = 0; i < amixer->rsc.msr; i++) { | 133 | for (i = 0; i < amixer->rsc.msr; i++) { |
134 | hw->amixer_set_dirty_all(amixer->rsc.ctrl_blk); | 134 | hw->amixer_set_dirty_all(amixer->rsc.ctrl_blk); |
135 | if (NULL != input) { | 135 | if (input) { |
136 | hw->amixer_set_x(amixer->rsc.ctrl_blk, | 136 | hw->amixer_set_x(amixer->rsc.ctrl_blk, |
137 | input->ops->output_slot(input)); | 137 | input->ops->output_slot(input)); |
138 | input->ops->next_conj(input); | 138 | input->ops->next_conj(input); |
139 | } | 139 | } |
140 | if (NULL != sum) { | 140 | if (sum) { |
141 | hw->amixer_set_sadr(amixer->rsc.ctrl_blk, | 141 | hw->amixer_set_sadr(amixer->rsc.ctrl_blk, |
142 | sum->rsc.ops->index(&sum->rsc)); | 142 | sum->rsc.ops->index(&sum->rsc)); |
143 | sum->rsc.ops->next_conj(&sum->rsc); | 143 | sum->rsc.ops->next_conj(&sum->rsc); |
@@ -147,10 +147,10 @@ static int amixer_commit_write(struct amixer *amixer) | |||
147 | amixer->rsc.ops->next_conj(&amixer->rsc); | 147 | amixer->rsc.ops->next_conj(&amixer->rsc); |
148 | } | 148 | } |
149 | amixer->rsc.ops->master(&amixer->rsc); | 149 | amixer->rsc.ops->master(&amixer->rsc); |
150 | if (NULL != input) | 150 | if (input) |
151 | input->ops->master(input); | 151 | input->ops->master(input); |
152 | 152 | ||
153 | if (NULL != sum) | 153 | if (sum) |
154 | sum->rsc.ops->master(&sum->rsc); | 154 | sum->rsc.ops->master(&sum->rsc); |
155 | 155 | ||
156 | return 0; | 156 | return 0; |
@@ -242,13 +242,12 @@ static int get_amixer_rsc(struct amixer_mgr *mgr, | |||
242 | 242 | ||
243 | /* Allocate mem for amixer resource */ | 243 | /* Allocate mem for amixer resource */ |
244 | amixer = kzalloc(sizeof(*amixer), GFP_KERNEL); | 244 | amixer = kzalloc(sizeof(*amixer), GFP_KERNEL); |
245 | if (NULL == amixer) { | 245 | if (!amixer) |
246 | err = -ENOMEM; | 246 | return -ENOMEM; |
247 | return err; | ||
248 | } | ||
249 | 247 | ||
250 | /* Check whether there are sufficient | 248 | /* Check whether there are sufficient |
251 | * amixer resources to meet request. */ | 249 | * amixer resources to meet request. */ |
250 | err = 0; | ||
252 | spin_lock_irqsave(&mgr->mgr_lock, flags); | 251 | spin_lock_irqsave(&mgr->mgr_lock, flags); |
253 | for (i = 0; i < desc->msr; i++) { | 252 | for (i = 0; i < desc->msr; i++) { |
254 | err = mgr_get_resource(&mgr->mgr, 1, &idx); | 253 | err = mgr_get_resource(&mgr->mgr, 1, &idx); |
@@ -304,7 +303,7 @@ int amixer_mgr_create(void *hw, struct amixer_mgr **ramixer_mgr) | |||
304 | 303 | ||
305 | *ramixer_mgr = NULL; | 304 | *ramixer_mgr = NULL; |
306 | amixer_mgr = kzalloc(sizeof(*amixer_mgr), GFP_KERNEL); | 305 | amixer_mgr = kzalloc(sizeof(*amixer_mgr), GFP_KERNEL); |
307 | if (NULL == amixer_mgr) | 306 | if (!amixer_mgr) |
308 | return -ENOMEM; | 307 | return -ENOMEM; |
309 | 308 | ||
310 | err = rsc_mgr_init(&amixer_mgr->mgr, AMIXER, AMIXER_RESOURCE_NUM, hw); | 309 | err = rsc_mgr_init(&amixer_mgr->mgr, AMIXER, AMIXER_RESOURCE_NUM, hw); |
@@ -397,12 +396,11 @@ static int get_sum_rsc(struct sum_mgr *mgr, | |||
397 | 396 | ||
398 | /* Allocate mem for sum resource */ | 397 | /* Allocate mem for sum resource */ |
399 | sum = kzalloc(sizeof(*sum), GFP_KERNEL); | 398 | sum = kzalloc(sizeof(*sum), GFP_KERNEL); |
400 | if (NULL == sum) { | 399 | if (!sum) |
401 | err = -ENOMEM; | 400 | return -ENOMEM; |
402 | return err; | ||
403 | } | ||
404 | 401 | ||
405 | /* Check whether there are sufficient sum resources to meet request. */ | 402 | /* Check whether there are sufficient sum resources to meet request. */ |
403 | err = 0; | ||
406 | spin_lock_irqsave(&mgr->mgr_lock, flags); | 404 | spin_lock_irqsave(&mgr->mgr_lock, flags); |
407 | for (i = 0; i < desc->msr; i++) { | 405 | for (i = 0; i < desc->msr; i++) { |
408 | err = mgr_get_resource(&mgr->mgr, 1, &idx); | 406 | err = mgr_get_resource(&mgr->mgr, 1, &idx); |
@@ -458,7 +456,7 @@ int sum_mgr_create(void *hw, struct sum_mgr **rsum_mgr) | |||
458 | 456 | ||
459 | *rsum_mgr = NULL; | 457 | *rsum_mgr = NULL; |
460 | sum_mgr = kzalloc(sizeof(*sum_mgr), GFP_KERNEL); | 458 | sum_mgr = kzalloc(sizeof(*sum_mgr), GFP_KERNEL); |
461 | if (NULL == sum_mgr) | 459 | if (!sum_mgr) |
462 | return -ENOMEM; | 460 | return -ENOMEM; |
463 | 461 | ||
464 | err = rsc_mgr_init(&sum_mgr->mgr, SUM, SUM_RESOURCE_NUM, hw); | 462 | err = rsc_mgr_init(&sum_mgr->mgr, SUM, SUM_RESOURCE_NUM, hw); |
diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c index a49c76647307..75454648d50c 100644 --- a/sound/pci/ctxfi/ctatc.c +++ b/sound/pci/ctxfi/ctatc.c | |||
@@ -136,7 +136,7 @@ static int ct_map_audio_buffer(struct ct_atc *atc, struct ct_atc_pcm *apcm) | |||
136 | struct snd_pcm_runtime *runtime; | 136 | struct snd_pcm_runtime *runtime; |
137 | struct ct_vm *vm; | 137 | struct ct_vm *vm; |
138 | 138 | ||
139 | if (NULL == apcm->substream) | 139 | if (!apcm->substream) |
140 | return 0; | 140 | return 0; |
141 | 141 | ||
142 | runtime = apcm->substream->runtime; | 142 | runtime = apcm->substream->runtime; |
@@ -144,7 +144,7 @@ static int ct_map_audio_buffer(struct ct_atc *atc, struct ct_atc_pcm *apcm) | |||
144 | 144 | ||
145 | apcm->vm_block = vm->map(vm, apcm->substream, runtime->dma_bytes); | 145 | apcm->vm_block = vm->map(vm, apcm->substream, runtime->dma_bytes); |
146 | 146 | ||
147 | if (NULL == apcm->vm_block) | 147 | if (!apcm->vm_block) |
148 | return -ENOENT; | 148 | return -ENOENT; |
149 | 149 | ||
150 | return 0; | 150 | return 0; |
@@ -154,7 +154,7 @@ static void ct_unmap_audio_buffer(struct ct_atc *atc, struct ct_atc_pcm *apcm) | |||
154 | { | 154 | { |
155 | struct ct_vm *vm; | 155 | struct ct_vm *vm; |
156 | 156 | ||
157 | if (NULL == apcm->vm_block) | 157 | if (!apcm->vm_block) |
158 | return; | 158 | return; |
159 | 159 | ||
160 | vm = atc->vm; | 160 | vm = atc->vm; |
@@ -231,16 +231,16 @@ atc_get_pitch(unsigned int input_rate, unsigned int output_rate) | |||
231 | 231 | ||
232 | static int select_rom(unsigned int pitch) | 232 | static int select_rom(unsigned int pitch) |
233 | { | 233 | { |
234 | if ((pitch > 0x00428f5c) && (pitch < 0x01b851ec)) { | 234 | if (pitch > 0x00428f5c && pitch < 0x01b851ec) { |
235 | /* 0.26 <= pitch <= 1.72 */ | 235 | /* 0.26 <= pitch <= 1.72 */ |
236 | return 1; | 236 | return 1; |
237 | } else if ((0x01d66666 == pitch) || (0x01d66667 == pitch)) { | 237 | } else if (pitch == 0x01d66666 || pitch == 0x01d66667) { |
238 | /* pitch == 1.8375 */ | 238 | /* pitch == 1.8375 */ |
239 | return 2; | 239 | return 2; |
240 | } else if (0x02000000 == pitch) { | 240 | } else if (pitch == 0x02000000) { |
241 | /* pitch == 2 */ | 241 | /* pitch == 2 */ |
242 | return 3; | 242 | return 3; |
243 | } else if ((pitch >= 0x0) && (pitch <= 0x08000000)) { | 243 | } else if (pitch >= 0x0 && pitch <= 0x08000000) { |
244 | /* 0 <= pitch <= 8 */ | 244 | /* 0 <= pitch <= 8 */ |
245 | return 0; | 245 | return 0; |
246 | } else { | 246 | } else { |
@@ -283,7 +283,7 @@ static int atc_pcm_playback_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm) | |||
283 | /* Get AMIXER resource */ | 283 | /* Get AMIXER resource */ |
284 | n_amixer = (n_amixer < 2) ? 2 : n_amixer; | 284 | n_amixer = (n_amixer < 2) ? 2 : n_amixer; |
285 | apcm->amixers = kzalloc(sizeof(void *)*n_amixer, GFP_KERNEL); | 285 | apcm->amixers = kzalloc(sizeof(void *)*n_amixer, GFP_KERNEL); |
286 | if (NULL == apcm->amixers) { | 286 | if (!apcm->amixers) { |
287 | err = -ENOMEM; | 287 | err = -ENOMEM; |
288 | goto error1; | 288 | goto error1; |
289 | } | 289 | } |
@@ -311,7 +311,7 @@ static int atc_pcm_playback_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm) | |||
311 | INIT_VOL, atc->pcm[i+device*2]); | 311 | INIT_VOL, atc->pcm[i+device*2]); |
312 | mutex_unlock(&atc->atc_mutex); | 312 | mutex_unlock(&atc->atc_mutex); |
313 | src = src->ops->next_interleave(src); | 313 | src = src->ops->next_interleave(src); |
314 | if (NULL == src) | 314 | if (!src) |
315 | src = apcm->src; | 315 | src = apcm->src; |
316 | } | 316 | } |
317 | 317 | ||
@@ -334,7 +334,7 @@ atc_pcm_release_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm) | |||
334 | struct srcimp *srcimp; | 334 | struct srcimp *srcimp; |
335 | int i; | 335 | int i; |
336 | 336 | ||
337 | if (NULL != apcm->srcimps) { | 337 | if (apcm->srcimps) { |
338 | for (i = 0; i < apcm->n_srcimp; i++) { | 338 | for (i = 0; i < apcm->n_srcimp; i++) { |
339 | srcimp = apcm->srcimps[i]; | 339 | srcimp = apcm->srcimps[i]; |
340 | srcimp->ops->unmap(srcimp); | 340 | srcimp->ops->unmap(srcimp); |
@@ -345,7 +345,7 @@ atc_pcm_release_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm) | |||
345 | apcm->srcimps = NULL; | 345 | apcm->srcimps = NULL; |
346 | } | 346 | } |
347 | 347 | ||
348 | if (NULL != apcm->srccs) { | 348 | if (apcm->srccs) { |
349 | for (i = 0; i < apcm->n_srcc; i++) { | 349 | for (i = 0; i < apcm->n_srcc; i++) { |
350 | src_mgr->put_src(src_mgr, apcm->srccs[i]); | 350 | src_mgr->put_src(src_mgr, apcm->srccs[i]); |
351 | apcm->srccs[i] = NULL; | 351 | apcm->srccs[i] = NULL; |
@@ -354,7 +354,7 @@ atc_pcm_release_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm) | |||
354 | apcm->srccs = NULL; | 354 | apcm->srccs = NULL; |
355 | } | 355 | } |
356 | 356 | ||
357 | if (NULL != apcm->amixers) { | 357 | if (apcm->amixers) { |
358 | for (i = 0; i < apcm->n_amixer; i++) { | 358 | for (i = 0; i < apcm->n_amixer; i++) { |
359 | amixer_mgr->put_amixer(amixer_mgr, apcm->amixers[i]); | 359 | amixer_mgr->put_amixer(amixer_mgr, apcm->amixers[i]); |
360 | apcm->amixers[i] = NULL; | 360 | apcm->amixers[i] = NULL; |
@@ -363,17 +363,17 @@ atc_pcm_release_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm) | |||
363 | apcm->amixers = NULL; | 363 | apcm->amixers = NULL; |
364 | } | 364 | } |
365 | 365 | ||
366 | if (NULL != apcm->mono) { | 366 | if (apcm->mono) { |
367 | sum_mgr->put_sum(sum_mgr, apcm->mono); | 367 | sum_mgr->put_sum(sum_mgr, apcm->mono); |
368 | apcm->mono = NULL; | 368 | apcm->mono = NULL; |
369 | } | 369 | } |
370 | 370 | ||
371 | if (NULL != apcm->src) { | 371 | if (apcm->src) { |
372 | src_mgr->put_src(src_mgr, apcm->src); | 372 | src_mgr->put_src(src_mgr, apcm->src); |
373 | apcm->src = NULL; | 373 | apcm->src = NULL; |
374 | } | 374 | } |
375 | 375 | ||
376 | if (NULL != apcm->vm_block) { | 376 | if (apcm->vm_block) { |
377 | /* Undo device virtual mem map */ | 377 | /* Undo device virtual mem map */ |
378 | ct_unmap_audio_buffer(atc, apcm); | 378 | ct_unmap_audio_buffer(atc, apcm); |
379 | apcm->vm_block = NULL; | 379 | apcm->vm_block = NULL; |
@@ -419,7 +419,7 @@ static int atc_pcm_stop(struct ct_atc *atc, struct ct_atc_pcm *apcm) | |||
419 | src->ops->set_state(src, SRC_STATE_OFF); | 419 | src->ops->set_state(src, SRC_STATE_OFF); |
420 | src->ops->commit_write(src); | 420 | src->ops->commit_write(src); |
421 | 421 | ||
422 | if (NULL != apcm->srccs) { | 422 | if (apcm->srccs) { |
423 | for (i = 0; i < apcm->n_srcc; i++) { | 423 | for (i = 0; i < apcm->n_srcc; i++) { |
424 | src = apcm->srccs[i]; | 424 | src = apcm->srccs[i]; |
425 | src->ops->set_bm(src, 0); | 425 | src->ops->set_bm(src, 0); |
@@ -544,18 +544,18 @@ atc_pcm_capture_get_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm) | |||
544 | 544 | ||
545 | if (n_srcc) { | 545 | if (n_srcc) { |
546 | apcm->srccs = kzalloc(sizeof(void *)*n_srcc, GFP_KERNEL); | 546 | apcm->srccs = kzalloc(sizeof(void *)*n_srcc, GFP_KERNEL); |
547 | if (NULL == apcm->srccs) | 547 | if (!apcm->srccs) |
548 | return -ENOMEM; | 548 | return -ENOMEM; |
549 | } | 549 | } |
550 | if (n_amixer) { | 550 | if (n_amixer) { |
551 | apcm->amixers = kzalloc(sizeof(void *)*n_amixer, GFP_KERNEL); | 551 | apcm->amixers = kzalloc(sizeof(void *)*n_amixer, GFP_KERNEL); |
552 | if (NULL == apcm->amixers) { | 552 | if (!apcm->amixers) { |
553 | err = -ENOMEM; | 553 | err = -ENOMEM; |
554 | goto error1; | 554 | goto error1; |
555 | } | 555 | } |
556 | } | 556 | } |
557 | apcm->srcimps = kzalloc(sizeof(void *)*n_srcimp, GFP_KERNEL); | 557 | apcm->srcimps = kzalloc(sizeof(void *)*n_srcimp, GFP_KERNEL); |
558 | if (NULL == apcm->srcimps) { | 558 | if (!apcm->srcimps) { |
559 | err = -ENOMEM; | 559 | err = -ENOMEM; |
560 | goto error1; | 560 | goto error1; |
561 | } | 561 | } |
@@ -818,7 +818,7 @@ static int spdif_passthru_playback_get_resources(struct ct_atc *atc, | |||
818 | /* Get AMIXER resource */ | 818 | /* Get AMIXER resource */ |
819 | n_amixer = (n_amixer < 2) ? 2 : n_amixer; | 819 | n_amixer = (n_amixer < 2) ? 2 : n_amixer; |
820 | apcm->amixers = kzalloc(sizeof(void *)*n_amixer, GFP_KERNEL); | 820 | apcm->amixers = kzalloc(sizeof(void *)*n_amixer, GFP_KERNEL); |
821 | if (NULL == apcm->amixers) { | 821 | if (!apcm->amixers) { |
822 | err = -ENOMEM; | 822 | err = -ENOMEM; |
823 | goto error1; | 823 | goto error1; |
824 | } | 824 | } |
@@ -919,7 +919,7 @@ spdif_passthru_playback_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm) | |||
919 | amixer = apcm->amixers[i]; | 919 | amixer = apcm->amixers[i]; |
920 | amixer->ops->setup(amixer, &src->rsc, INIT_VOL, NULL); | 920 | amixer->ops->setup(amixer, &src->rsc, INIT_VOL, NULL); |
921 | src = src->ops->next_interleave(src); | 921 | src = src->ops->next_interleave(src); |
922 | if (NULL == src) | 922 | if (!src) |
923 | src = apcm->src; | 923 | src = apcm->src; |
924 | } | 924 | } |
925 | /* Connect to SPDIFOO */ | 925 | /* Connect to SPDIFOO */ |
@@ -1037,7 +1037,7 @@ static int atc_line_front_unmute(struct ct_atc *atc, unsigned char state) | |||
1037 | 1037 | ||
1038 | static int atc_line_surround_unmute(struct ct_atc *atc, unsigned char state) | 1038 | static int atc_line_surround_unmute(struct ct_atc *atc, unsigned char state) |
1039 | { | 1039 | { |
1040 | return atc_daio_unmute(atc, state, LINEO4); | 1040 | return atc_daio_unmute(atc, state, LINEO2); |
1041 | } | 1041 | } |
1042 | 1042 | ||
1043 | static int atc_line_clfe_unmute(struct ct_atc *atc, unsigned char state) | 1043 | static int atc_line_clfe_unmute(struct ct_atc *atc, unsigned char state) |
@@ -1047,7 +1047,7 @@ static int atc_line_clfe_unmute(struct ct_atc *atc, unsigned char state) | |||
1047 | 1047 | ||
1048 | static int atc_line_rear_unmute(struct ct_atc *atc, unsigned char state) | 1048 | static int atc_line_rear_unmute(struct ct_atc *atc, unsigned char state) |
1049 | { | 1049 | { |
1050 | return atc_daio_unmute(atc, state, LINEO2); | 1050 | return atc_daio_unmute(atc, state, LINEO4); |
1051 | } | 1051 | } |
1052 | 1052 | ||
1053 | static int atc_line_in_unmute(struct ct_atc *atc, unsigned char state) | 1053 | static int atc_line_in_unmute(struct ct_atc *atc, unsigned char state) |
@@ -1121,7 +1121,7 @@ static int atc_release_resources(struct ct_atc *atc) | |||
1121 | struct ct_mixer *mixer = NULL; | 1121 | struct ct_mixer *mixer = NULL; |
1122 | 1122 | ||
1123 | /* disconnect internal mixer objects */ | 1123 | /* disconnect internal mixer objects */ |
1124 | if (NULL != atc->mixer) { | 1124 | if (atc->mixer) { |
1125 | mixer = atc->mixer; | 1125 | mixer = atc->mixer; |
1126 | mixer->set_input_left(mixer, MIX_LINE_IN, NULL); | 1126 | mixer->set_input_left(mixer, MIX_LINE_IN, NULL); |
1127 | mixer->set_input_right(mixer, MIX_LINE_IN, NULL); | 1127 | mixer->set_input_right(mixer, MIX_LINE_IN, NULL); |
@@ -1131,7 +1131,7 @@ static int atc_release_resources(struct ct_atc *atc) | |||
1131 | mixer->set_input_right(mixer, MIX_SPDIF_IN, NULL); | 1131 | mixer->set_input_right(mixer, MIX_SPDIF_IN, NULL); |
1132 | } | 1132 | } |
1133 | 1133 | ||
1134 | if (NULL != atc->daios) { | 1134 | if (atc->daios) { |
1135 | daio_mgr = (struct daio_mgr *)atc->rsc_mgrs[DAIO]; | 1135 | daio_mgr = (struct daio_mgr *)atc->rsc_mgrs[DAIO]; |
1136 | for (i = 0; i < atc->n_daio; i++) { | 1136 | for (i = 0; i < atc->n_daio; i++) { |
1137 | daio = atc->daios[i]; | 1137 | daio = atc->daios[i]; |
@@ -1149,7 +1149,7 @@ static int atc_release_resources(struct ct_atc *atc) | |||
1149 | atc->daios = NULL; | 1149 | atc->daios = NULL; |
1150 | } | 1150 | } |
1151 | 1151 | ||
1152 | if (NULL != atc->pcm) { | 1152 | if (atc->pcm) { |
1153 | sum_mgr = atc->rsc_mgrs[SUM]; | 1153 | sum_mgr = atc->rsc_mgrs[SUM]; |
1154 | for (i = 0; i < atc->n_pcm; i++) | 1154 | for (i = 0; i < atc->n_pcm; i++) |
1155 | sum_mgr->put_sum(sum_mgr, atc->pcm[i]); | 1155 | sum_mgr->put_sum(sum_mgr, atc->pcm[i]); |
@@ -1158,7 +1158,7 @@ static int atc_release_resources(struct ct_atc *atc) | |||
1158 | atc->pcm = NULL; | 1158 | atc->pcm = NULL; |
1159 | } | 1159 | } |
1160 | 1160 | ||
1161 | if (NULL != atc->srcs) { | 1161 | if (atc->srcs) { |
1162 | src_mgr = atc->rsc_mgrs[SRC]; | 1162 | src_mgr = atc->rsc_mgrs[SRC]; |
1163 | for (i = 0; i < atc->n_src; i++) | 1163 | for (i = 0; i < atc->n_src; i++) |
1164 | src_mgr->put_src(src_mgr, atc->srcs[i]); | 1164 | src_mgr->put_src(src_mgr, atc->srcs[i]); |
@@ -1167,7 +1167,7 @@ static int atc_release_resources(struct ct_atc *atc) | |||
1167 | atc->srcs = NULL; | 1167 | atc->srcs = NULL; |
1168 | } | 1168 | } |
1169 | 1169 | ||
1170 | if (NULL != atc->srcimps) { | 1170 | if (atc->srcimps) { |
1171 | srcimp_mgr = atc->rsc_mgrs[SRCIMP]; | 1171 | srcimp_mgr = atc->rsc_mgrs[SRCIMP]; |
1172 | for (i = 0; i < atc->n_srcimp; i++) { | 1172 | for (i = 0; i < atc->n_srcimp; i++) { |
1173 | srcimp = atc->srcimps[i]; | 1173 | srcimp = atc->srcimps[i]; |
@@ -1185,7 +1185,7 @@ static int ct_atc_destroy(struct ct_atc *atc) | |||
1185 | { | 1185 | { |
1186 | int i = 0; | 1186 | int i = 0; |
1187 | 1187 | ||
1188 | if (NULL == atc) | 1188 | if (!atc) |
1189 | return 0; | 1189 | return 0; |
1190 | 1190 | ||
1191 | if (atc->timer) { | 1191 | if (atc->timer) { |
@@ -1196,21 +1196,20 @@ static int ct_atc_destroy(struct ct_atc *atc) | |||
1196 | atc_release_resources(atc); | 1196 | atc_release_resources(atc); |
1197 | 1197 | ||
1198 | /* Destroy internal mixer objects */ | 1198 | /* Destroy internal mixer objects */ |
1199 | if (NULL != atc->mixer) | 1199 | if (atc->mixer) |
1200 | ct_mixer_destroy(atc->mixer); | 1200 | ct_mixer_destroy(atc->mixer); |
1201 | 1201 | ||
1202 | for (i = 0; i < NUM_RSCTYP; i++) { | 1202 | for (i = 0; i < NUM_RSCTYP; i++) { |
1203 | if ((NULL != rsc_mgr_funcs[i].destroy) && | 1203 | if (rsc_mgr_funcs[i].destroy && atc->rsc_mgrs[i]) |
1204 | (NULL != atc->rsc_mgrs[i])) | ||
1205 | rsc_mgr_funcs[i].destroy(atc->rsc_mgrs[i]); | 1204 | rsc_mgr_funcs[i].destroy(atc->rsc_mgrs[i]); |
1206 | 1205 | ||
1207 | } | 1206 | } |
1208 | 1207 | ||
1209 | if (NULL != atc->hw) | 1208 | if (atc->hw) |
1210 | destroy_hw_obj((struct hw *)atc->hw); | 1209 | destroy_hw_obj((struct hw *)atc->hw); |
1211 | 1210 | ||
1212 | /* Destroy device virtual memory manager object */ | 1211 | /* Destroy device virtual memory manager object */ |
1213 | if (NULL != atc->vm) { | 1212 | if (atc->vm) { |
1214 | ct_vm_destroy(atc->vm); | 1213 | ct_vm_destroy(atc->vm); |
1215 | atc->vm = NULL; | 1214 | atc->vm = NULL; |
1216 | } | 1215 | } |
@@ -1275,7 +1274,7 @@ int __devinit ct_atc_create_alsa_devs(struct ct_atc *atc) | |||
1275 | alsa_dev_funcs[MIXER].public_name = atc->chip_name; | 1274 | alsa_dev_funcs[MIXER].public_name = atc->chip_name; |
1276 | 1275 | ||
1277 | for (i = 0; i < NUM_CTALSADEVS; i++) { | 1276 | for (i = 0; i < NUM_CTALSADEVS; i++) { |
1278 | if (NULL == alsa_dev_funcs[i].create) | 1277 | if (!alsa_dev_funcs[i].create) |
1279 | continue; | 1278 | continue; |
1280 | 1279 | ||
1281 | err = alsa_dev_funcs[i].create(atc, i, | 1280 | err = alsa_dev_funcs[i].create(atc, i, |
@@ -1312,7 +1311,7 @@ static int __devinit atc_create_hw_devs(struct ct_atc *atc) | |||
1312 | return err; | 1311 | return err; |
1313 | 1312 | ||
1314 | for (i = 0; i < NUM_RSCTYP; i++) { | 1313 | for (i = 0; i < NUM_RSCTYP; i++) { |
1315 | if (NULL == rsc_mgr_funcs[i].create) | 1314 | if (!rsc_mgr_funcs[i].create) |
1316 | continue; | 1315 | continue; |
1317 | 1316 | ||
1318 | err = rsc_mgr_funcs[i].create(atc->hw, &atc->rsc_mgrs[i]); | 1317 | err = rsc_mgr_funcs[i].create(atc->hw, &atc->rsc_mgrs[i]); |
@@ -1339,19 +1338,19 @@ static int atc_get_resources(struct ct_atc *atc) | |||
1339 | int err, i; | 1338 | int err, i; |
1340 | 1339 | ||
1341 | atc->daios = kzalloc(sizeof(void *)*(DAIONUM), GFP_KERNEL); | 1340 | atc->daios = kzalloc(sizeof(void *)*(DAIONUM), GFP_KERNEL); |
1342 | if (NULL == atc->daios) | 1341 | if (!atc->daios) |
1343 | return -ENOMEM; | 1342 | return -ENOMEM; |
1344 | 1343 | ||
1345 | atc->srcs = kzalloc(sizeof(void *)*(2*2), GFP_KERNEL); | 1344 | atc->srcs = kzalloc(sizeof(void *)*(2*2), GFP_KERNEL); |
1346 | if (NULL == atc->srcs) | 1345 | if (!atc->srcs) |
1347 | return -ENOMEM; | 1346 | return -ENOMEM; |
1348 | 1347 | ||
1349 | atc->srcimps = kzalloc(sizeof(void *)*(2*2), GFP_KERNEL); | 1348 | atc->srcimps = kzalloc(sizeof(void *)*(2*2), GFP_KERNEL); |
1350 | if (NULL == atc->srcimps) | 1349 | if (!atc->srcimps) |
1351 | return -ENOMEM; | 1350 | return -ENOMEM; |
1352 | 1351 | ||
1353 | atc->pcm = kzalloc(sizeof(void *)*(2*4), GFP_KERNEL); | 1352 | atc->pcm = kzalloc(sizeof(void *)*(2*4), GFP_KERNEL); |
1354 | if (NULL == atc->pcm) | 1353 | if (!atc->pcm) |
1355 | return -ENOMEM; | 1354 | return -ENOMEM; |
1356 | 1355 | ||
1357 | daio_mgr = (struct daio_mgr *)atc->rsc_mgrs[DAIO]; | 1356 | daio_mgr = (struct daio_mgr *)atc->rsc_mgrs[DAIO]; |
@@ -1648,7 +1647,7 @@ int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci, | |||
1648 | *ratc = NULL; | 1647 | *ratc = NULL; |
1649 | 1648 | ||
1650 | atc = kzalloc(sizeof(*atc), GFP_KERNEL); | 1649 | atc = kzalloc(sizeof(*atc), GFP_KERNEL); |
1651 | if (NULL == atc) | 1650 | if (!atc) |
1652 | return -ENOMEM; | 1651 | return -ENOMEM; |
1653 | 1652 | ||
1654 | /* Set operations */ | 1653 | /* Set operations */ |
diff --git a/sound/pci/ctxfi/ctdaio.c b/sound/pci/ctxfi/ctdaio.c index 082e35c08c02..af56eb949bde 100644 --- a/sound/pci/ctxfi/ctdaio.c +++ b/sound/pci/ctxfi/ctdaio.c | |||
@@ -57,9 +57,9 @@ struct daio_rsc_idx idx_20k1[NUM_DAIOTYP] = { | |||
57 | 57 | ||
58 | struct daio_rsc_idx idx_20k2[NUM_DAIOTYP] = { | 58 | struct daio_rsc_idx idx_20k2[NUM_DAIOTYP] = { |
59 | [LINEO1] = {.left = 0x40, .right = 0x41}, | 59 | [LINEO1] = {.left = 0x40, .right = 0x41}, |
60 | [LINEO2] = {.left = 0x70, .right = 0x71}, | 60 | [LINEO2] = {.left = 0x60, .right = 0x61}, |
61 | [LINEO3] = {.left = 0x50, .right = 0x51}, | 61 | [LINEO3] = {.left = 0x50, .right = 0x51}, |
62 | [LINEO4] = {.left = 0x60, .right = 0x61}, | 62 | [LINEO4] = {.left = 0x70, .right = 0x71}, |
63 | [LINEIM] = {.left = 0x45, .right = 0xc5}, | 63 | [LINEIM] = {.left = 0x45, .right = 0xc5}, |
64 | [SPDIFOO] = {.left = 0x00, .right = 0x01}, | 64 | [SPDIFOO] = {.left = 0x00, .right = 0x01}, |
65 | [SPDIFIO] = {.left = 0x05, .right = 0x85}, | 65 | [SPDIFIO] = {.left = 0x05, .right = 0x85}, |
@@ -173,7 +173,7 @@ static int dao_set_left_input(struct dao *dao, struct rsc *input) | |||
173 | int i; | 173 | int i; |
174 | 174 | ||
175 | entry = kzalloc((sizeof(*entry) * daio->rscl.msr), GFP_KERNEL); | 175 | entry = kzalloc((sizeof(*entry) * daio->rscl.msr), GFP_KERNEL); |
176 | if (NULL == entry) | 176 | if (!entry) |
177 | return -ENOMEM; | 177 | return -ENOMEM; |
178 | 178 | ||
179 | /* Program master and conjugate resources */ | 179 | /* Program master and conjugate resources */ |
@@ -201,7 +201,7 @@ static int dao_set_right_input(struct dao *dao, struct rsc *input) | |||
201 | int i; | 201 | int i; |
202 | 202 | ||
203 | entry = kzalloc((sizeof(*entry) * daio->rscr.msr), GFP_KERNEL); | 203 | entry = kzalloc((sizeof(*entry) * daio->rscr.msr), GFP_KERNEL); |
204 | if (NULL == entry) | 204 | if (!entry) |
205 | return -ENOMEM; | 205 | return -ENOMEM; |
206 | 206 | ||
207 | /* Program master and conjugate resources */ | 207 | /* Program master and conjugate resources */ |
@@ -228,7 +228,7 @@ static int dao_clear_left_input(struct dao *dao) | |||
228 | struct daio *daio = &dao->daio; | 228 | struct daio *daio = &dao->daio; |
229 | int i; | 229 | int i; |
230 | 230 | ||
231 | if (NULL == dao->imappers[0]) | 231 | if (!dao->imappers[0]) |
232 | return 0; | 232 | return 0; |
233 | 233 | ||
234 | entry = dao->imappers[0]; | 234 | entry = dao->imappers[0]; |
@@ -252,7 +252,7 @@ static int dao_clear_right_input(struct dao *dao) | |||
252 | struct daio *daio = &dao->daio; | 252 | struct daio *daio = &dao->daio; |
253 | int i; | 253 | int i; |
254 | 254 | ||
255 | if (NULL == dao->imappers[daio->rscl.msr]) | 255 | if (!dao->imappers[daio->rscl.msr]) |
256 | return 0; | 256 | return 0; |
257 | 257 | ||
258 | entry = dao->imappers[daio->rscl.msr]; | 258 | entry = dao->imappers[daio->rscl.msr]; |
@@ -408,7 +408,7 @@ static int dao_rsc_init(struct dao *dao, | |||
408 | return err; | 408 | return err; |
409 | 409 | ||
410 | dao->imappers = kzalloc(sizeof(void *)*desc->msr*2, GFP_KERNEL); | 410 | dao->imappers = kzalloc(sizeof(void *)*desc->msr*2, GFP_KERNEL); |
411 | if (NULL == dao->imappers) { | 411 | if (!dao->imappers) { |
412 | err = -ENOMEM; | 412 | err = -ENOMEM; |
413 | goto error1; | 413 | goto error1; |
414 | } | 414 | } |
@@ -442,11 +442,11 @@ error1: | |||
442 | 442 | ||
443 | static int dao_rsc_uninit(struct dao *dao) | 443 | static int dao_rsc_uninit(struct dao *dao) |
444 | { | 444 | { |
445 | if (NULL != dao->imappers) { | 445 | if (dao->imappers) { |
446 | if (NULL != dao->imappers[0]) | 446 | if (dao->imappers[0]) |
447 | dao_clear_left_input(dao); | 447 | dao_clear_left_input(dao); |
448 | 448 | ||
449 | if (NULL != dao->imappers[dao->daio.rscl.msr]) | 449 | if (dao->imappers[dao->daio.rscl.msr]) |
450 | dao_clear_right_input(dao); | 450 | dao_clear_right_input(dao); |
451 | 451 | ||
452 | kfree(dao->imappers); | 452 | kfree(dao->imappers); |
@@ -555,7 +555,7 @@ static int get_daio_rsc(struct daio_mgr *mgr, | |||
555 | /* Allocate mem for daio resource */ | 555 | /* Allocate mem for daio resource */ |
556 | if (desc->type <= DAIO_OUT_MAX) { | 556 | if (desc->type <= DAIO_OUT_MAX) { |
557 | dao = kzalloc(sizeof(*dao), GFP_KERNEL); | 557 | dao = kzalloc(sizeof(*dao), GFP_KERNEL); |
558 | if (NULL == dao) { | 558 | if (!dao) { |
559 | err = -ENOMEM; | 559 | err = -ENOMEM; |
560 | goto error; | 560 | goto error; |
561 | } | 561 | } |
@@ -566,7 +566,7 @@ static int get_daio_rsc(struct daio_mgr *mgr, | |||
566 | *rdaio = &dao->daio; | 566 | *rdaio = &dao->daio; |
567 | } else { | 567 | } else { |
568 | dai = kzalloc(sizeof(*dai), GFP_KERNEL); | 568 | dai = kzalloc(sizeof(*dai), GFP_KERNEL); |
569 | if (NULL == dai) { | 569 | if (!dai) { |
570 | err = -ENOMEM; | 570 | err = -ENOMEM; |
571 | goto error; | 571 | goto error; |
572 | } | 572 | } |
@@ -583,9 +583,9 @@ static int get_daio_rsc(struct daio_mgr *mgr, | |||
583 | return 0; | 583 | return 0; |
584 | 584 | ||
585 | error: | 585 | error: |
586 | if (NULL != dao) | 586 | if (dao) |
587 | kfree(dao); | 587 | kfree(dao); |
588 | else if (NULL != dai) | 588 | else if (dai) |
589 | kfree(dai); | 589 | kfree(dai); |
590 | 590 | ||
591 | spin_lock_irqsave(&mgr->mgr_lock, flags); | 591 | spin_lock_irqsave(&mgr->mgr_lock, flags); |
@@ -663,7 +663,7 @@ static int daio_imap_add(struct daio_mgr *mgr, struct imapper *entry) | |||
663 | int err; | 663 | int err; |
664 | 664 | ||
665 | spin_lock_irqsave(&mgr->imap_lock, flags); | 665 | spin_lock_irqsave(&mgr->imap_lock, flags); |
666 | if ((0 == entry->addr) && (mgr->init_imap_added)) { | 666 | if (!entry->addr && mgr->init_imap_added) { |
667 | input_mapper_delete(&mgr->imappers, mgr->init_imap, | 667 | input_mapper_delete(&mgr->imappers, mgr->init_imap, |
668 | daio_map_op, mgr); | 668 | daio_map_op, mgr); |
669 | mgr->init_imap_added = 0; | 669 | mgr->init_imap_added = 0; |
@@ -707,7 +707,7 @@ int daio_mgr_create(void *hw, struct daio_mgr **rdaio_mgr) | |||
707 | 707 | ||
708 | *rdaio_mgr = NULL; | 708 | *rdaio_mgr = NULL; |
709 | daio_mgr = kzalloc(sizeof(*daio_mgr), GFP_KERNEL); | 709 | daio_mgr = kzalloc(sizeof(*daio_mgr), GFP_KERNEL); |
710 | if (NULL == daio_mgr) | 710 | if (!daio_mgr) |
711 | return -ENOMEM; | 711 | return -ENOMEM; |
712 | 712 | ||
713 | err = rsc_mgr_init(&daio_mgr->mgr, DAIO, DAIO_RESOURCE_NUM, hw); | 713 | err = rsc_mgr_init(&daio_mgr->mgr, DAIO, DAIO_RESOURCE_NUM, hw); |
@@ -718,7 +718,7 @@ int daio_mgr_create(void *hw, struct daio_mgr **rdaio_mgr) | |||
718 | spin_lock_init(&daio_mgr->imap_lock); | 718 | spin_lock_init(&daio_mgr->imap_lock); |
719 | INIT_LIST_HEAD(&daio_mgr->imappers); | 719 | INIT_LIST_HEAD(&daio_mgr->imappers); |
720 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); | 720 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); |
721 | if (NULL == entry) { | 721 | if (!entry) { |
722 | err = -ENOMEM; | 722 | err = -ENOMEM; |
723 | goto error2; | 723 | goto error2; |
724 | } | 724 | } |
diff --git a/sound/pci/ctxfi/cthw20k1.c b/sound/pci/ctxfi/cthw20k1.c index ad3e1d144464..0cf400f879f9 100644 --- a/sound/pci/ctxfi/cthw20k1.c +++ b/sound/pci/ctxfi/cthw20k1.c | |||
@@ -168,7 +168,7 @@ static int src_get_rsc_ctrl_blk(void **rblk) | |||
168 | 168 | ||
169 | *rblk = NULL; | 169 | *rblk = NULL; |
170 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); | 170 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); |
171 | if (NULL == blk) | 171 | if (!blk) |
172 | return -ENOMEM; | 172 | return -ENOMEM; |
173 | 173 | ||
174 | *rblk = blk; | 174 | *rblk = blk; |
@@ -494,7 +494,7 @@ static int src_mgr_get_ctrl_blk(void **rblk) | |||
494 | 494 | ||
495 | *rblk = NULL; | 495 | *rblk = NULL; |
496 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); | 496 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); |
497 | if (NULL == blk) | 497 | if (!blk) |
498 | return -ENOMEM; | 498 | return -ENOMEM; |
499 | 499 | ||
500 | *rblk = blk; | 500 | *rblk = blk; |
@@ -515,7 +515,7 @@ static int srcimp_mgr_get_ctrl_blk(void **rblk) | |||
515 | 515 | ||
516 | *rblk = NULL; | 516 | *rblk = NULL; |
517 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); | 517 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); |
518 | if (NULL == blk) | 518 | if (!blk) |
519 | return -ENOMEM; | 519 | return -ENOMEM; |
520 | 520 | ||
521 | *rblk = blk; | 521 | *rblk = blk; |
@@ -702,7 +702,7 @@ static int amixer_rsc_get_ctrl_blk(void **rblk) | |||
702 | 702 | ||
703 | *rblk = NULL; | 703 | *rblk = NULL; |
704 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); | 704 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); |
705 | if (NULL == blk) | 705 | if (!blk) |
706 | return -ENOMEM; | 706 | return -ENOMEM; |
707 | 707 | ||
708 | *rblk = blk; | 708 | *rblk = blk; |
@@ -723,7 +723,7 @@ static int amixer_mgr_get_ctrl_blk(void **rblk) | |||
723 | 723 | ||
724 | *rblk = NULL; | 724 | *rblk = NULL; |
725 | /*blk = kzalloc(sizeof(*blk), GFP_KERNEL); | 725 | /*blk = kzalloc(sizeof(*blk), GFP_KERNEL); |
726 | if (NULL == blk) | 726 | if (!blk) |
727 | return -ENOMEM; | 727 | return -ENOMEM; |
728 | 728 | ||
729 | *rblk = blk;*/ | 729 | *rblk = blk;*/ |
@@ -909,7 +909,7 @@ static int dai_get_ctrl_blk(void **rblk) | |||
909 | 909 | ||
910 | *rblk = NULL; | 910 | *rblk = NULL; |
911 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); | 911 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); |
912 | if (NULL == blk) | 912 | if (!blk) |
913 | return -ENOMEM; | 913 | return -ENOMEM; |
914 | 914 | ||
915 | *rblk = blk; | 915 | *rblk = blk; |
@@ -958,7 +958,7 @@ static int dao_get_ctrl_blk(void **rblk) | |||
958 | 958 | ||
959 | *rblk = NULL; | 959 | *rblk = NULL; |
960 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); | 960 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); |
961 | if (NULL == blk) | 961 | if (!blk) |
962 | return -ENOMEM; | 962 | return -ENOMEM; |
963 | 963 | ||
964 | *rblk = blk; | 964 | *rblk = blk; |
@@ -1152,7 +1152,7 @@ static int daio_mgr_get_ctrl_blk(struct hw *hw, void **rblk) | |||
1152 | 1152 | ||
1153 | *rblk = NULL; | 1153 | *rblk = NULL; |
1154 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); | 1154 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); |
1155 | if (NULL == blk) | 1155 | if (!blk) |
1156 | return -ENOMEM; | 1156 | return -ENOMEM; |
1157 | 1157 | ||
1158 | blk->i2sctl = hw_read_20kx(hw, I2SCTL); | 1158 | blk->i2sctl = hw_read_20kx(hw, I2SCTL); |
@@ -1808,7 +1808,7 @@ static int uaa_to_xfi(struct pci_dev *pci) | |||
1808 | /* By default, Hendrix card UAA Bar0 should be using memory... */ | 1808 | /* By default, Hendrix card UAA Bar0 should be using memory... */ |
1809 | io_base = pci_resource_start(pci, 0); | 1809 | io_base = pci_resource_start(pci, 0); |
1810 | mem_base = ioremap(io_base, pci_resource_len(pci, 0)); | 1810 | mem_base = ioremap(io_base, pci_resource_len(pci, 0)); |
1811 | if (NULL == mem_base) | 1811 | if (!mem_base) |
1812 | return -ENOENT; | 1812 | return -ENOENT; |
1813 | 1813 | ||
1814 | /* Read current mode from Mode Change Register */ | 1814 | /* Read current mode from Mode Change Register */ |
@@ -1977,7 +1977,7 @@ static int hw_card_shutdown(struct hw *hw) | |||
1977 | 1977 | ||
1978 | hw->irq = -1; | 1978 | hw->irq = -1; |
1979 | 1979 | ||
1980 | if (NULL != ((void *)hw->mem_base)) | 1980 | if (hw->mem_base) |
1981 | iounmap((void *)hw->mem_base); | 1981 | iounmap((void *)hw->mem_base); |
1982 | 1982 | ||
1983 | hw->mem_base = (unsigned long)NULL; | 1983 | hw->mem_base = (unsigned long)NULL; |
@@ -2274,7 +2274,7 @@ int __devinit create_20k1_hw_obj(struct hw **rhw) | |||
2274 | 2274 | ||
2275 | *rhw = NULL; | 2275 | *rhw = NULL; |
2276 | hw20k1 = kzalloc(sizeof(*hw20k1), GFP_KERNEL); | 2276 | hw20k1 = kzalloc(sizeof(*hw20k1), GFP_KERNEL); |
2277 | if (NULL == hw20k1) | 2277 | if (!hw20k1) |
2278 | return -ENOMEM; | 2278 | return -ENOMEM; |
2279 | 2279 | ||
2280 | spin_lock_init(&hw20k1->reg_20k1_lock); | 2280 | spin_lock_init(&hw20k1->reg_20k1_lock); |
diff --git a/sound/pci/ctxfi/cthw20k2.c b/sound/pci/ctxfi/cthw20k2.c index dec46d04b041..b6b11bfe7574 100644 --- a/sound/pci/ctxfi/cthw20k2.c +++ b/sound/pci/ctxfi/cthw20k2.c | |||
@@ -166,7 +166,7 @@ static int src_get_rsc_ctrl_blk(void **rblk) | |||
166 | 166 | ||
167 | *rblk = NULL; | 167 | *rblk = NULL; |
168 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); | 168 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); |
169 | if (NULL == blk) | 169 | if (!blk) |
170 | return -ENOMEM; | 170 | return -ENOMEM; |
171 | 171 | ||
172 | *rblk = blk; | 172 | *rblk = blk; |
@@ -492,7 +492,7 @@ static int src_mgr_get_ctrl_blk(void **rblk) | |||
492 | 492 | ||
493 | *rblk = NULL; | 493 | *rblk = NULL; |
494 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); | 494 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); |
495 | if (NULL == blk) | 495 | if (!blk) |
496 | return -ENOMEM; | 496 | return -ENOMEM; |
497 | 497 | ||
498 | *rblk = blk; | 498 | *rblk = blk; |
@@ -513,7 +513,7 @@ static int srcimp_mgr_get_ctrl_blk(void **rblk) | |||
513 | 513 | ||
514 | *rblk = NULL; | 514 | *rblk = NULL; |
515 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); | 515 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); |
516 | if (NULL == blk) | 516 | if (!blk) |
517 | return -ENOMEM; | 517 | return -ENOMEM; |
518 | 518 | ||
519 | *rblk = blk; | 519 | *rblk = blk; |
@@ -702,7 +702,7 @@ static int amixer_rsc_get_ctrl_blk(void **rblk) | |||
702 | 702 | ||
703 | *rblk = NULL; | 703 | *rblk = NULL; |
704 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); | 704 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); |
705 | if (NULL == blk) | 705 | if (!blk) |
706 | return -ENOMEM; | 706 | return -ENOMEM; |
707 | 707 | ||
708 | *rblk = blk; | 708 | *rblk = blk; |
@@ -891,7 +891,7 @@ static int dai_get_ctrl_blk(void **rblk) | |||
891 | 891 | ||
892 | *rblk = NULL; | 892 | *rblk = NULL; |
893 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); | 893 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); |
894 | if (NULL == blk) | 894 | if (!blk) |
895 | return -ENOMEM; | 895 | return -ENOMEM; |
896 | 896 | ||
897 | *rblk = blk; | 897 | *rblk = blk; |
@@ -941,7 +941,7 @@ static int dao_get_ctrl_blk(void **rblk) | |||
941 | 941 | ||
942 | *rblk = NULL; | 942 | *rblk = NULL; |
943 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); | 943 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); |
944 | if (NULL == blk) | 944 | if (!blk) |
945 | return -ENOMEM; | 945 | return -ENOMEM; |
946 | 946 | ||
947 | *rblk = blk; | 947 | *rblk = blk; |
@@ -1092,7 +1092,7 @@ static int daio_mgr_get_ctrl_blk(struct hw *hw, void **rblk) | |||
1092 | 1092 | ||
1093 | *rblk = NULL; | 1093 | *rblk = NULL; |
1094 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); | 1094 | blk = kzalloc(sizeof(*blk), GFP_KERNEL); |
1095 | if (NULL == blk) | 1095 | if (!blk) |
1096 | return -ENOMEM; | 1096 | return -ENOMEM; |
1097 | 1097 | ||
1098 | for (i = 0; i < 8; i++) { | 1098 | for (i = 0; i < 8; i++) { |
@@ -1112,6 +1112,26 @@ static int daio_mgr_put_ctrl_blk(void *blk) | |||
1112 | return 0; | 1112 | return 0; |
1113 | } | 1113 | } |
1114 | 1114 | ||
1115 | /* Timer interrupt */ | ||
1116 | static int set_timer_irq(struct hw *hw, int enable) | ||
1117 | { | ||
1118 | hw_write_20kx(hw, GIE, enable ? IT_INT : 0); | ||
1119 | return 0; | ||
1120 | } | ||
1121 | |||
1122 | static int set_timer_tick(struct hw *hw, unsigned int ticks) | ||
1123 | { | ||
1124 | if (ticks) | ||
1125 | ticks |= TIMR_IE | TIMR_IP; | ||
1126 | hw_write_20kx(hw, TIMR, ticks); | ||
1127 | return 0; | ||
1128 | } | ||
1129 | |||
1130 | static unsigned int get_wc(struct hw *hw) | ||
1131 | { | ||
1132 | return hw_read_20kx(hw, WC); | ||
1133 | } | ||
1134 | |||
1115 | /* Card hardware initialization block */ | 1135 | /* Card hardware initialization block */ |
1116 | struct dac_conf { | 1136 | struct dac_conf { |
1117 | unsigned int msr; /* master sample rate in rsrs */ | 1137 | unsigned int msr; /* master sample rate in rsrs */ |
@@ -1841,6 +1861,22 @@ static int hw_have_digit_io_switch(struct hw *hw) | |||
1841 | return 0; | 1861 | return 0; |
1842 | } | 1862 | } |
1843 | 1863 | ||
1864 | static irqreturn_t ct_20k2_interrupt(int irq, void *dev_id) | ||
1865 | { | ||
1866 | struct hw *hw = dev_id; | ||
1867 | unsigned int status; | ||
1868 | |||
1869 | status = hw_read_20kx(hw, GIP); | ||
1870 | if (!status) | ||
1871 | return IRQ_NONE; | ||
1872 | |||
1873 | if (hw->irq_callback) | ||
1874 | hw->irq_callback(hw->irq_callback_data, status); | ||
1875 | |||
1876 | hw_write_20kx(hw, GIP, status); | ||
1877 | return IRQ_HANDLED; | ||
1878 | } | ||
1879 | |||
1844 | static int hw_card_start(struct hw *hw) | 1880 | static int hw_card_start(struct hw *hw) |
1845 | { | 1881 | { |
1846 | int err = 0; | 1882 | int err = 0; |
@@ -1868,7 +1904,7 @@ static int hw_card_start(struct hw *hw) | |||
1868 | hw->io_base = pci_resource_start(hw->pci, 2); | 1904 | hw->io_base = pci_resource_start(hw->pci, 2); |
1869 | hw->mem_base = (unsigned long)ioremap(hw->io_base, | 1905 | hw->mem_base = (unsigned long)ioremap(hw->io_base, |
1870 | pci_resource_len(hw->pci, 2)); | 1906 | pci_resource_len(hw->pci, 2)); |
1871 | if (NULL == (void *)hw->mem_base) { | 1907 | if (!hw->mem_base) { |
1872 | err = -ENOENT; | 1908 | err = -ENOENT; |
1873 | goto error2; | 1909 | goto error2; |
1874 | } | 1910 | } |
@@ -1879,12 +1915,15 @@ static int hw_card_start(struct hw *hw) | |||
1879 | set_field(&gctl, GCTL_UAA, 0); | 1915 | set_field(&gctl, GCTL_UAA, 0); |
1880 | hw_write_20kx(hw, GLOBAL_CNTL_GCTL, gctl); | 1916 | hw_write_20kx(hw, GLOBAL_CNTL_GCTL, gctl); |
1881 | 1917 | ||
1882 | /*if ((err = request_irq(pci->irq, ct_atc_interrupt, IRQF_SHARED, | 1918 | if (hw->irq < 0) { |
1883 | atc->chip_details->nm_card, hw))) { | 1919 | err = request_irq(pci->irq, ct_20k2_interrupt, IRQF_SHARED, |
1884 | goto error3; | 1920 | "ctxfi", hw); |
1921 | if (err < 0) { | ||
1922 | printk(KERN_ERR "XFi: Cannot get irq %d\n", pci->irq); | ||
1923 | goto error2; | ||
1924 | } | ||
1925 | hw->irq = pci->irq; | ||
1885 | } | 1926 | } |
1886 | hw->irq = pci->irq; | ||
1887 | */ | ||
1888 | 1927 | ||
1889 | pci_set_master(pci); | 1928 | pci_set_master(pci); |
1890 | 1929 | ||
@@ -1923,7 +1962,7 @@ static int hw_card_shutdown(struct hw *hw) | |||
1923 | 1962 | ||
1924 | hw->irq = -1; | 1963 | hw->irq = -1; |
1925 | 1964 | ||
1926 | if (NULL != ((void *)hw->mem_base)) | 1965 | if (hw->mem_base) |
1927 | iounmap((void *)hw->mem_base); | 1966 | iounmap((void *)hw->mem_base); |
1928 | 1967 | ||
1929 | hw->mem_base = (unsigned long)NULL; | 1968 | hw->mem_base = (unsigned long)NULL; |
@@ -1972,7 +2011,7 @@ static int hw_card_init(struct hw *hw, struct card_conf *info) | |||
1972 | hw_write_20kx(hw, GLOBAL_CNTL_GCTL, gctl); | 2011 | hw_write_20kx(hw, GLOBAL_CNTL_GCTL, gctl); |
1973 | 2012 | ||
1974 | /* Reset all global pending interrupts */ | 2013 | /* Reset all global pending interrupts */ |
1975 | hw_write_20kx(hw, INTERRUPT_GIE, 0); | 2014 | hw_write_20kx(hw, GIE, 0); |
1976 | /* Reset all SRC pending interrupts */ | 2015 | /* Reset all SRC pending interrupts */ |
1977 | hw_write_20kx(hw, SRC_IP, 0); | 2016 | hw_write_20kx(hw, SRC_IP, 0); |
1978 | 2017 | ||
@@ -2149,6 +2188,10 @@ static struct hw ct20k2_preset __devinitdata = { | |||
2149 | .daio_mgr_set_imapnxt = daio_mgr_set_imapnxt, | 2188 | .daio_mgr_set_imapnxt = daio_mgr_set_imapnxt, |
2150 | .daio_mgr_set_imapaddr = daio_mgr_set_imapaddr, | 2189 | .daio_mgr_set_imapaddr = daio_mgr_set_imapaddr, |
2151 | .daio_mgr_commit_write = daio_mgr_commit_write, | 2190 | .daio_mgr_commit_write = daio_mgr_commit_write, |
2191 | |||
2192 | .set_timer_irq = set_timer_irq, | ||
2193 | .set_timer_tick = set_timer_tick, | ||
2194 | .get_wc = get_wc, | ||
2152 | }; | 2195 | }; |
2153 | 2196 | ||
2154 | int __devinit create_20k2_hw_obj(struct hw **rhw) | 2197 | int __devinit create_20k2_hw_obj(struct hw **rhw) |
diff --git a/sound/pci/ctxfi/ctmixer.c b/sound/pci/ctxfi/ctmixer.c index f26d7cd9db9f..15c1e7271ea8 100644 --- a/sound/pci/ctxfi/ctmixer.c +++ b/sound/pci/ctxfi/ctmixer.c | |||
@@ -654,7 +654,7 @@ ct_mixer_kcontrol_new(struct ct_mixer *mixer, struct snd_kcontrol_new *new) | |||
654 | int err; | 654 | int err; |
655 | 655 | ||
656 | kctl = snd_ctl_new1(new, mixer->atc); | 656 | kctl = snd_ctl_new1(new, mixer->atc); |
657 | if (NULL == kctl) | 657 | if (!kctl) |
658 | return -ENOMEM; | 658 | return -ENOMEM; |
659 | 659 | ||
660 | if (SNDRV_CTL_ELEM_IFACE_PCM == kctl->id.iface) | 660 | if (SNDRV_CTL_ELEM_IFACE_PCM == kctl->id.iface) |
@@ -837,17 +837,17 @@ static int ct_mixer_get_mem(struct ct_mixer **rmixer) | |||
837 | *rmixer = NULL; | 837 | *rmixer = NULL; |
838 | /* Allocate mem for mixer obj */ | 838 | /* Allocate mem for mixer obj */ |
839 | mixer = kzalloc(sizeof(*mixer), GFP_KERNEL); | 839 | mixer = kzalloc(sizeof(*mixer), GFP_KERNEL); |
840 | if (NULL == mixer) | 840 | if (!mixer) |
841 | return -ENOMEM; | 841 | return -ENOMEM; |
842 | 842 | ||
843 | mixer->amixers = kzalloc(sizeof(void *)*(NUM_CT_AMIXERS*CHN_NUM), | 843 | mixer->amixers = kzalloc(sizeof(void *)*(NUM_CT_AMIXERS*CHN_NUM), |
844 | GFP_KERNEL); | 844 | GFP_KERNEL); |
845 | if (NULL == mixer->amixers) { | 845 | if (!mixer->amixers) { |
846 | err = -ENOMEM; | 846 | err = -ENOMEM; |
847 | goto error1; | 847 | goto error1; |
848 | } | 848 | } |
849 | mixer->sums = kzalloc(sizeof(void *)*(NUM_CT_SUMS*CHN_NUM), GFP_KERNEL); | 849 | mixer->sums = kzalloc(sizeof(void *)*(NUM_CT_SUMS*CHN_NUM), GFP_KERNEL); |
850 | if (NULL == mixer->sums) { | 850 | if (!mixer->sums) { |
851 | err = -ENOMEM; | 851 | err = -ENOMEM; |
852 | goto error2; | 852 | goto error2; |
853 | } | 853 | } |
diff --git a/sound/pci/ctxfi/ctpcm.c b/sound/pci/ctxfi/ctpcm.c index 60ea23180acb..d0dc227fbdd3 100644 --- a/sound/pci/ctxfi/ctpcm.c +++ b/sound/pci/ctxfi/ctpcm.c | |||
@@ -97,7 +97,7 @@ static void ct_atc_pcm_interrupt(struct ct_atc_pcm *atc_pcm) | |||
97 | { | 97 | { |
98 | struct ct_atc_pcm *apcm = atc_pcm; | 98 | struct ct_atc_pcm *apcm = atc_pcm; |
99 | 99 | ||
100 | if (NULL == apcm->substream) | 100 | if (!apcm->substream) |
101 | return; | 101 | return; |
102 | 102 | ||
103 | snd_pcm_period_elapsed(apcm->substream); | 103 | snd_pcm_period_elapsed(apcm->substream); |
@@ -123,7 +123,7 @@ static int ct_pcm_playback_open(struct snd_pcm_substream *substream) | |||
123 | int err; | 123 | int err; |
124 | 124 | ||
125 | apcm = kzalloc(sizeof(*apcm), GFP_KERNEL); | 125 | apcm = kzalloc(sizeof(*apcm), GFP_KERNEL); |
126 | if (NULL == apcm) | 126 | if (!apcm) |
127 | return -ENOMEM; | 127 | return -ENOMEM; |
128 | 128 | ||
129 | apcm->substream = substream; | 129 | apcm->substream = substream; |
@@ -271,7 +271,7 @@ static int ct_pcm_capture_open(struct snd_pcm_substream *substream) | |||
271 | int err; | 271 | int err; |
272 | 272 | ||
273 | apcm = kzalloc(sizeof(*apcm), GFP_KERNEL); | 273 | apcm = kzalloc(sizeof(*apcm), GFP_KERNEL); |
274 | if (NULL == apcm) | 274 | if (!apcm) |
275 | return -ENOMEM; | 275 | return -ENOMEM; |
276 | 276 | ||
277 | apcm->started = 0; | 277 | apcm->started = 0; |
diff --git a/sound/pci/ctxfi/ctresource.c b/sound/pci/ctxfi/ctresource.c index 889c495bb7d1..7dfaf67344d4 100644 --- a/sound/pci/ctxfi/ctresource.c +++ b/sound/pci/ctxfi/ctresource.c | |||
@@ -144,7 +144,7 @@ int rsc_init(struct rsc *rsc, u32 idx, enum RSCTYP type, u32 msr, void *hw) | |||
144 | rsc->msr = msr; | 144 | rsc->msr = msr; |
145 | rsc->hw = hw; | 145 | rsc->hw = hw; |
146 | rsc->ops = &rsc_generic_ops; | 146 | rsc->ops = &rsc_generic_ops; |
147 | if (NULL == hw) { | 147 | if (!hw) { |
148 | rsc->ctrl_blk = NULL; | 148 | rsc->ctrl_blk = NULL; |
149 | return 0; | 149 | return 0; |
150 | } | 150 | } |
@@ -216,7 +216,7 @@ int rsc_mgr_init(struct rsc_mgr *mgr, enum RSCTYP type, | |||
216 | mgr->type = NUM_RSCTYP; | 216 | mgr->type = NUM_RSCTYP; |
217 | 217 | ||
218 | mgr->rscs = kzalloc(((amount + 8 - 1) / 8), GFP_KERNEL); | 218 | mgr->rscs = kzalloc(((amount + 8 - 1) / 8), GFP_KERNEL); |
219 | if (NULL == mgr->rscs) | 219 | if (!mgr->rscs) |
220 | return -ENOMEM; | 220 | return -ENOMEM; |
221 | 221 | ||
222 | switch (type) { | 222 | switch (type) { |
diff --git a/sound/pci/ctxfi/ctsrc.c b/sound/pci/ctxfi/ctsrc.c index e1c145d8b702..c749fa720889 100644 --- a/sound/pci/ctxfi/ctsrc.c +++ b/sound/pci/ctxfi/ctsrc.c | |||
@@ -441,7 +441,7 @@ get_src_rsc(struct src_mgr *mgr, const struct src_desc *desc, struct src **rsrc) | |||
441 | else | 441 | else |
442 | src = kzalloc(sizeof(*src), GFP_KERNEL); | 442 | src = kzalloc(sizeof(*src), GFP_KERNEL); |
443 | 443 | ||
444 | if (NULL == src) { | 444 | if (!src) { |
445 | err = -ENOMEM; | 445 | err = -ENOMEM; |
446 | goto error1; | 446 | goto error1; |
447 | } | 447 | } |
@@ -550,7 +550,7 @@ int src_mgr_create(void *hw, struct src_mgr **rsrc_mgr) | |||
550 | 550 | ||
551 | *rsrc_mgr = NULL; | 551 | *rsrc_mgr = NULL; |
552 | src_mgr = kzalloc(sizeof(*src_mgr), GFP_KERNEL); | 552 | src_mgr = kzalloc(sizeof(*src_mgr), GFP_KERNEL); |
553 | if (NULL == src_mgr) | 553 | if (!src_mgr) |
554 | return -ENOMEM; | 554 | return -ENOMEM; |
555 | 555 | ||
556 | err = rsc_mgr_init(&src_mgr->mgr, SRC, SRC_RESOURCE_NUM, hw); | 556 | err = rsc_mgr_init(&src_mgr->mgr, SRC, SRC_RESOURCE_NUM, hw); |
@@ -679,7 +679,7 @@ static int srcimp_rsc_init(struct srcimp *srcimp, | |||
679 | /* Reserve memory for imapper nodes */ | 679 | /* Reserve memory for imapper nodes */ |
680 | srcimp->imappers = kzalloc(sizeof(struct imapper)*desc->msr, | 680 | srcimp->imappers = kzalloc(sizeof(struct imapper)*desc->msr, |
681 | GFP_KERNEL); | 681 | GFP_KERNEL); |
682 | if (NULL == srcimp->imappers) { | 682 | if (!srcimp->imappers) { |
683 | err = -ENOMEM; | 683 | err = -ENOMEM; |
684 | goto error1; | 684 | goto error1; |
685 | } | 685 | } |
@@ -724,12 +724,11 @@ static int get_srcimp_rsc(struct srcimp_mgr *mgr, | |||
724 | 724 | ||
725 | /* Allocate mem for SRCIMP resource */ | 725 | /* Allocate mem for SRCIMP resource */ |
726 | srcimp = kzalloc(sizeof(*srcimp), GFP_KERNEL); | 726 | srcimp = kzalloc(sizeof(*srcimp), GFP_KERNEL); |
727 | if (NULL == srcimp) { | 727 | if (!srcimp) |
728 | err = -ENOMEM; | 728 | return -ENOMEM; |
729 | return err; | ||
730 | } | ||
731 | 729 | ||
732 | /* Check whether there are sufficient SRCIMP resources. */ | 730 | /* Check whether there are sufficient SRCIMP resources. */ |
731 | err = 0; | ||
733 | spin_lock_irqsave(&mgr->mgr_lock, flags); | 732 | spin_lock_irqsave(&mgr->mgr_lock, flags); |
734 | for (i = 0; i < desc->msr; i++) { | 733 | for (i = 0; i < desc->msr; i++) { |
735 | err = mgr_get_resource(&mgr->mgr, 1, &idx); | 734 | err = mgr_get_resource(&mgr->mgr, 1, &idx); |
@@ -834,7 +833,7 @@ int srcimp_mgr_create(void *hw, struct srcimp_mgr **rsrcimp_mgr) | |||
834 | 833 | ||
835 | *rsrcimp_mgr = NULL; | 834 | *rsrcimp_mgr = NULL; |
836 | srcimp_mgr = kzalloc(sizeof(*srcimp_mgr), GFP_KERNEL); | 835 | srcimp_mgr = kzalloc(sizeof(*srcimp_mgr), GFP_KERNEL); |
837 | if (NULL == srcimp_mgr) | 836 | if (!srcimp_mgr) |
838 | return -ENOMEM; | 837 | return -ENOMEM; |
839 | 838 | ||
840 | err = rsc_mgr_init(&srcimp_mgr->mgr, SRCIMP, SRCIMP_RESOURCE_NUM, hw); | 839 | err = rsc_mgr_init(&srcimp_mgr->mgr, SRCIMP, SRCIMP_RESOURCE_NUM, hw); |
@@ -845,7 +844,7 @@ int srcimp_mgr_create(void *hw, struct srcimp_mgr **rsrcimp_mgr) | |||
845 | spin_lock_init(&srcimp_mgr->imap_lock); | 844 | spin_lock_init(&srcimp_mgr->imap_lock); |
846 | INIT_LIST_HEAD(&srcimp_mgr->imappers); | 845 | INIT_LIST_HEAD(&srcimp_mgr->imappers); |
847 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); | 846 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); |
848 | if (NULL == entry) { | 847 | if (!entry) { |
849 | err = -ENOMEM; | 848 | err = -ENOMEM; |
850 | goto error2; | 849 | goto error2; |
851 | } | 850 | } |
diff --git a/sound/pci/ctxfi/ctvmem.c b/sound/pci/ctxfi/ctvmem.c index 67665a7e43c6..6b78752e9503 100644 --- a/sound/pci/ctxfi/ctvmem.c +++ b/sound/pci/ctxfi/ctvmem.c | |||
@@ -60,7 +60,7 @@ get_vm_block(struct ct_vm *vm, unsigned int size) | |||
60 | } | 60 | } |
61 | 61 | ||
62 | block = kzalloc(sizeof(*block), GFP_KERNEL); | 62 | block = kzalloc(sizeof(*block), GFP_KERNEL); |
63 | if (NULL == block) | 63 | if (!block) |
64 | goto out; | 64 | goto out; |
65 | 65 | ||
66 | block->addr = entry->addr; | 66 | block->addr = entry->addr; |
@@ -181,7 +181,7 @@ int ct_vm_create(struct ct_vm **rvm) | |||
181 | *rvm = NULL; | 181 | *rvm = NULL; |
182 | 182 | ||
183 | vm = kzalloc(sizeof(*vm), GFP_KERNEL); | 183 | vm = kzalloc(sizeof(*vm), GFP_KERNEL); |
184 | if (NULL == vm) | 184 | if (!vm) |
185 | return -ENOMEM; | 185 | return -ENOMEM; |
186 | 186 | ||
187 | mutex_init(&vm->lock); | 187 | mutex_init(&vm->lock); |
@@ -189,7 +189,7 @@ int ct_vm_create(struct ct_vm **rvm) | |||
189 | /* Allocate page table pages */ | 189 | /* Allocate page table pages */ |
190 | for (i = 0; i < CT_PTP_NUM; i++) { | 190 | for (i = 0; i < CT_PTP_NUM; i++) { |
191 | vm->ptp[i] = kmalloc(PAGE_SIZE, GFP_KERNEL); | 191 | vm->ptp[i] = kmalloc(PAGE_SIZE, GFP_KERNEL); |
192 | if (NULL == vm->ptp[i]) | 192 | if (!vm->ptp[i]) |
193 | break; | 193 | break; |
194 | } | 194 | } |
195 | if (!i) { | 195 | if (!i) { |
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index da2065cd2c0d..1305f7ca02c3 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c | |||
@@ -950,7 +950,7 @@ static int __devinit snd_echo_new_pcm(struct echoaudio *chip) | |||
950 | Control interface | 950 | Control interface |
951 | ******************************************************************************/ | 951 | ******************************************************************************/ |
952 | 952 | ||
953 | #ifndef ECHOCARD_HAS_VMIXER | 953 | #if !defined(ECHOCARD_HAS_VMIXER) || defined(ECHOCARD_HAS_LINE_OUT_GAIN) |
954 | 954 | ||
955 | /******************* PCM output volume *******************/ | 955 | /******************* PCM output volume *******************/ |
956 | static int snd_echo_output_gain_info(struct snd_kcontrol *kcontrol, | 956 | static int snd_echo_output_gain_info(struct snd_kcontrol *kcontrol, |
@@ -1003,6 +1003,19 @@ static int snd_echo_output_gain_put(struct snd_kcontrol *kcontrol, | |||
1003 | return changed; | 1003 | return changed; |
1004 | } | 1004 | } |
1005 | 1005 | ||
1006 | #ifdef ECHOCARD_HAS_LINE_OUT_GAIN | ||
1007 | /* On the Mia this one controls the line-out volume */ | ||
1008 | static struct snd_kcontrol_new snd_echo_line_output_gain __devinitdata = { | ||
1009 | .name = "Line Playback Volume", | ||
1010 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
1011 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | | ||
1012 | SNDRV_CTL_ELEM_ACCESS_TLV_READ, | ||
1013 | .info = snd_echo_output_gain_info, | ||
1014 | .get = snd_echo_output_gain_get, | ||
1015 | .put = snd_echo_output_gain_put, | ||
1016 | .tlv = {.p = db_scale_output_gain}, | ||
1017 | }; | ||
1018 | #else | ||
1006 | static struct snd_kcontrol_new snd_echo_pcm_output_gain __devinitdata = { | 1019 | static struct snd_kcontrol_new snd_echo_pcm_output_gain __devinitdata = { |
1007 | .name = "PCM Playback Volume", | 1020 | .name = "PCM Playback Volume", |
1008 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1021 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
@@ -1012,9 +1025,10 @@ static struct snd_kcontrol_new snd_echo_pcm_output_gain __devinitdata = { | |||
1012 | .put = snd_echo_output_gain_put, | 1025 | .put = snd_echo_output_gain_put, |
1013 | .tlv = {.p = db_scale_output_gain}, | 1026 | .tlv = {.p = db_scale_output_gain}, |
1014 | }; | 1027 | }; |
1015 | |||
1016 | #endif | 1028 | #endif |
1017 | 1029 | ||
1030 | #endif /* !ECHOCARD_HAS_VMIXER || ECHOCARD_HAS_LINE_OUT_GAIN */ | ||
1031 | |||
1018 | 1032 | ||
1019 | 1033 | ||
1020 | #ifdef ECHOCARD_HAS_INPUT_GAIN | 1034 | #ifdef ECHOCARD_HAS_INPUT_GAIN |
@@ -2030,10 +2044,18 @@ static int __devinit snd_echo_probe(struct pci_dev *pci, | |||
2030 | snd_echo_vmixer.count = num_pipes_out(chip) * num_busses_out(chip); | 2044 | snd_echo_vmixer.count = num_pipes_out(chip) * num_busses_out(chip); |
2031 | if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_vmixer, chip))) < 0) | 2045 | if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_vmixer, chip))) < 0) |
2032 | goto ctl_error; | 2046 | goto ctl_error; |
2033 | #else | 2047 | #ifdef ECHOCARD_HAS_LINE_OUT_GAIN |
2034 | if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_pcm_output_gain, chip))) < 0) | 2048 | err = snd_ctl_add(chip->card, |
2049 | snd_ctl_new1(&snd_echo_line_output_gain, chip)); | ||
2050 | if (err < 0) | ||
2035 | goto ctl_error; | 2051 | goto ctl_error; |
2036 | #endif | 2052 | #endif |
2053 | #else /* ECHOCARD_HAS_VMIXER */ | ||
2054 | err = snd_ctl_add(chip->card, | ||
2055 | snd_ctl_new1(&snd_echo_pcm_output_gain, chip)); | ||
2056 | if (err < 0) | ||
2057 | goto ctl_error; | ||
2058 | #endif /* ECHOCARD_HAS_VMIXER */ | ||
2037 | 2059 | ||
2038 | #ifdef ECHOCARD_HAS_INPUT_GAIN | 2060 | #ifdef ECHOCARD_HAS_INPUT_GAIN |
2039 | if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_line_input_gain, chip))) < 0) | 2061 | if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_line_input_gain, chip))) < 0) |
diff --git a/sound/pci/echoaudio/mia.c b/sound/pci/echoaudio/mia.c index f3b9b45c9c1b..f05c8c097aa8 100644 --- a/sound/pci/echoaudio/mia.c +++ b/sound/pci/echoaudio/mia.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #define ECHOCARD_HAS_ADAT FALSE | 29 | #define ECHOCARD_HAS_ADAT FALSE |
30 | #define ECHOCARD_HAS_STEREO_BIG_ENDIAN32 | 30 | #define ECHOCARD_HAS_STEREO_BIG_ENDIAN32 |
31 | #define ECHOCARD_HAS_MIDI | 31 | #define ECHOCARD_HAS_MIDI |
32 | #define ECHOCARD_HAS_LINE_OUT_GAIN | ||
32 | 33 | ||
33 | /* Pipe indexes */ | 34 | /* Pipe indexes */ |
34 | #define PX_ANALOG_OUT 0 /* 8 */ | 35 | #define PX_ANALOG_OUT 0 /* 8 */ |
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c index c7f3b994101c..168af67d938e 100644 --- a/sound/pci/emu10k1/emu10k1.c +++ b/sound/pci/emu10k1/emu10k1.c | |||
@@ -77,9 +77,9 @@ MODULE_PARM_DESC(subsystem, "Force card subsystem model."); | |||
77 | * Class 0401: 1102:0008 (rev 00) Subsystem: 1102:1001 -> Audigy2 Value Model:SB0400 | 77 | * Class 0401: 1102:0008 (rev 00) Subsystem: 1102:1001 -> Audigy2 Value Model:SB0400 |
78 | */ | 78 | */ |
79 | static struct pci_device_id snd_emu10k1_ids[] = { | 79 | static struct pci_device_id snd_emu10k1_ids[] = { |
80 | { 0x1102, 0x0002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* EMU10K1 */ | 80 | { PCI_VDEVICE(CREATIVE, 0x0002), 0 }, /* EMU10K1 */ |
81 | { 0x1102, 0x0004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 }, /* Audigy */ | 81 | { PCI_VDEVICE(CREATIVE, 0x0004), 1 }, /* Audigy */ |
82 | { 0x1102, 0x0008, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 }, /* Audigy 2 Value SB0400 */ | 82 | { PCI_VDEVICE(CREATIVE, 0x0008), 1 }, /* Audigy 2 Value SB0400 */ |
83 | { 0, } | 83 | { 0, } |
84 | }; | 84 | }; |
85 | 85 | ||
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c index 4d3ad793e98f..36e08bd2b3cc 100644 --- a/sound/pci/emu10k1/emu10k1x.c +++ b/sound/pci/emu10k1/emu10k1x.c | |||
@@ -1607,7 +1607,7 @@ static void __devexit snd_emu10k1x_remove(struct pci_dev *pci) | |||
1607 | 1607 | ||
1608 | // PCI IDs | 1608 | // PCI IDs |
1609 | static struct pci_device_id snd_emu10k1x_ids[] = { | 1609 | static struct pci_device_id snd_emu10k1x_ids[] = { |
1610 | { 0x1102, 0x0006, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* Dell OEM version (EMU10K1) */ | 1610 | { PCI_VDEVICE(CREATIVE, 0x0006), 0 }, /* Dell OEM version (EMU10K1) */ |
1611 | { 0, } | 1611 | { 0, } |
1612 | }; | 1612 | }; |
1613 | MODULE_DEVICE_TABLE(pci, snd_emu10k1x_ids); | 1613 | MODULE_DEVICE_TABLE(pci, snd_emu10k1x_ids); |
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c index e617acaf10e3..61b8ab39800f 100644 --- a/sound/pci/emu10k1/p16v.c +++ b/sound/pci/emu10k1/p16v.c | |||
@@ -644,7 +644,7 @@ int __devinit snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm * | |||
644 | int err; | 644 | int err; |
645 | int capture=1; | 645 | int capture=1; |
646 | 646 | ||
647 | /* snd_printk("KERN_DEBUG snd_p16v_pcm called. device=%d\n", device); */ | 647 | /* snd_printk(KERN_DEBUG "snd_p16v_pcm called. device=%d\n", device); */ |
648 | emu->p16v_device_offset = device; | 648 | emu->p16v_device_offset = device; |
649 | if (rpcm) | 649 | if (rpcm) |
650 | *rpcm = NULL; | 650 | *rpcm = NULL; |
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index 18f4d1e98c46..2b82c5c723e1 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c | |||
@@ -445,12 +445,12 @@ static irqreturn_t snd_audiopci_interrupt(int irq, void *dev_id); | |||
445 | 445 | ||
446 | static struct pci_device_id snd_audiopci_ids[] = { | 446 | static struct pci_device_id snd_audiopci_ids[] = { |
447 | #ifdef CHIP1370 | 447 | #ifdef CHIP1370 |
448 | { 0x1274, 0x5000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* ES1370 */ | 448 | { PCI_VDEVICE(ENSONIQ, 0x5000), 0, }, /* ES1370 */ |
449 | #endif | 449 | #endif |
450 | #ifdef CHIP1371 | 450 | #ifdef CHIP1371 |
451 | { 0x1274, 0x1371, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* ES1371 */ | 451 | { PCI_VDEVICE(ENSONIQ, 0x1371), 0, }, /* ES1371 */ |
452 | { 0x1274, 0x5880, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* ES1373 - CT5880 */ | 452 | { PCI_VDEVICE(ENSONIQ, 0x5880), 0, }, /* ES1373 - CT5880 */ |
453 | { 0x1102, 0x8938, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* Ectiva EV1938 */ | 453 | { PCI_VDEVICE(ECTIVA, 0x8938), 0, }, /* Ectiva EV1938 */ |
454 | #endif | 454 | #endif |
455 | { 0, } | 455 | { 0, } |
456 | }; | 456 | }; |
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index fbd2ac09aa34..820318ee62c1 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c | |||
@@ -244,7 +244,7 @@ struct es1938 { | |||
244 | static irqreturn_t snd_es1938_interrupt(int irq, void *dev_id); | 244 | static irqreturn_t snd_es1938_interrupt(int irq, void *dev_id); |
245 | 245 | ||
246 | static struct pci_device_id snd_es1938_ids[] = { | 246 | static struct pci_device_id snd_es1938_ids[] = { |
247 | { 0x125d, 0x1969, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* Solo-1 */ | 247 | { PCI_VDEVICE(ESS, 0x1969), 0, }, /* Solo-1 */ |
248 | { 0, } | 248 | { 0, } |
249 | }; | 249 | }; |
250 | 250 | ||
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index 0d0cdbdb4486..cecf1ffeeaaa 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c | |||
@@ -107,7 +107,7 @@ MODULE_PARM_DESC(dxr_enable, "Enable DXR support for Terratec DMX6FIRE."); | |||
107 | 107 | ||
108 | 108 | ||
109 | static const struct pci_device_id snd_ice1712_ids[] = { | 109 | static const struct pci_device_id snd_ice1712_ids[] = { |
110 | { PCI_VENDOR_ID_ICE, PCI_DEVICE_ID_ICE_1712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ICE1712 */ | 110 | { PCI_VDEVICE(ICE, PCI_DEVICE_ID_ICE_1712), 0 }, /* ICE1712 */ |
111 | { 0, } | 111 | { 0, } |
112 | }; | 112 | }; |
113 | 113 | ||
diff --git a/sound/pci/ice1712/ice1712.h b/sound/pci/ice1712/ice1712.h index adc909ec125c..9da2dae64c5b 100644 --- a/sound/pci/ice1712/ice1712.h +++ b/sound/pci/ice1712/ice1712.h | |||
@@ -379,6 +379,15 @@ struct snd_ice1712 { | |||
379 | unsigned char (*set_mclk)(struct snd_ice1712 *ice, unsigned int rate); | 379 | unsigned char (*set_mclk)(struct snd_ice1712 *ice, unsigned int rate); |
380 | void (*set_spdif_clock)(struct snd_ice1712 *ice); | 380 | void (*set_spdif_clock)(struct snd_ice1712 *ice); |
381 | 381 | ||
382 | #ifdef CONFIG_PM | ||
383 | int (*pm_suspend)(struct snd_ice1712 *); | ||
384 | int (*pm_resume)(struct snd_ice1712 *); | ||
385 | int pm_suspend_enabled:1; | ||
386 | int pm_saved_is_spdif_master:1; | ||
387 | unsigned int pm_saved_spdif_ctrl; | ||
388 | unsigned char pm_saved_spdif_cfg; | ||
389 | unsigned int pm_saved_route; | ||
390 | #endif | ||
382 | }; | 391 | }; |
383 | 392 | ||
384 | 393 | ||
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 36ade77cf371..af6e00148621 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c | |||
@@ -93,7 +93,7 @@ MODULE_PARM_DESC(model, "Use the given board model."); | |||
93 | 93 | ||
94 | /* Both VT1720 and VT1724 have the same PCI IDs */ | 94 | /* Both VT1720 and VT1724 have the same PCI IDs */ |
95 | static const struct pci_device_id snd_vt1724_ids[] = { | 95 | static const struct pci_device_id snd_vt1724_ids[] = { |
96 | { PCI_VENDOR_ID_ICE, PCI_DEVICE_ID_VT1724, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 96 | { PCI_VDEVICE(ICE, PCI_DEVICE_ID_VT1724), 0 }, |
97 | { 0, } | 97 | { 0, } |
98 | }; | 98 | }; |
99 | 99 | ||
@@ -560,6 +560,7 @@ static int snd_vt1724_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
560 | 560 | ||
561 | case SNDRV_PCM_TRIGGER_START: | 561 | case SNDRV_PCM_TRIGGER_START: |
562 | case SNDRV_PCM_TRIGGER_STOP: | 562 | case SNDRV_PCM_TRIGGER_STOP: |
563 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
563 | spin_lock(&ice->reg_lock); | 564 | spin_lock(&ice->reg_lock); |
564 | old = inb(ICEMT1724(ice, DMA_CONTROL)); | 565 | old = inb(ICEMT1724(ice, DMA_CONTROL)); |
565 | if (cmd == SNDRV_PCM_TRIGGER_START) | 566 | if (cmd == SNDRV_PCM_TRIGGER_START) |
@@ -570,6 +571,10 @@ static int snd_vt1724_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
570 | spin_unlock(&ice->reg_lock); | 571 | spin_unlock(&ice->reg_lock); |
571 | break; | 572 | break; |
572 | 573 | ||
574 | case SNDRV_PCM_TRIGGER_RESUME: | ||
575 | /* apps will have to restart stream */ | ||
576 | break; | ||
577 | |||
573 | default: | 578 | default: |
574 | return -EINVAL; | 579 | return -EINVAL; |
575 | } | 580 | } |
@@ -2262,7 +2267,7 @@ static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice, | |||
2262 | 2267 | ||
2263 | 2268 | ||
2264 | 2269 | ||
2265 | static void __devinit snd_vt1724_chip_reset(struct snd_ice1712 *ice) | 2270 | static void snd_vt1724_chip_reset(struct snd_ice1712 *ice) |
2266 | { | 2271 | { |
2267 | outb(VT1724_RESET , ICEREG1724(ice, CONTROL)); | 2272 | outb(VT1724_RESET , ICEREG1724(ice, CONTROL)); |
2268 | inb(ICEREG1724(ice, CONTROL)); /* pci posting flush */ | 2273 | inb(ICEREG1724(ice, CONTROL)); /* pci posting flush */ |
@@ -2272,7 +2277,7 @@ static void __devinit snd_vt1724_chip_reset(struct snd_ice1712 *ice) | |||
2272 | msleep(10); | 2277 | msleep(10); |
2273 | } | 2278 | } |
2274 | 2279 | ||
2275 | static int __devinit snd_vt1724_chip_init(struct snd_ice1712 *ice) | 2280 | static int snd_vt1724_chip_init(struct snd_ice1712 *ice) |
2276 | { | 2281 | { |
2277 | outb(ice->eeprom.data[ICE_EEP2_SYSCONF], ICEREG1724(ice, SYS_CFG)); | 2282 | outb(ice->eeprom.data[ICE_EEP2_SYSCONF], ICEREG1724(ice, SYS_CFG)); |
2278 | outb(ice->eeprom.data[ICE_EEP2_ACLINK], ICEREG1724(ice, AC97_CFG)); | 2283 | outb(ice->eeprom.data[ICE_EEP2_ACLINK], ICEREG1724(ice, AC97_CFG)); |
@@ -2287,6 +2292,14 @@ static int __devinit snd_vt1724_chip_init(struct snd_ice1712 *ice) | |||
2287 | 2292 | ||
2288 | outb(0, ICEREG1724(ice, POWERDOWN)); | 2293 | outb(0, ICEREG1724(ice, POWERDOWN)); |
2289 | 2294 | ||
2295 | /* MPU_RX and TX irq masks are cleared later dynamically */ | ||
2296 | outb(VT1724_IRQ_MPU_RX | VT1724_IRQ_MPU_TX , ICEREG1724(ice, IRQMASK)); | ||
2297 | |||
2298 | /* don't handle FIFO overrun/underruns (just yet), | ||
2299 | * since they cause machine lockups | ||
2300 | */ | ||
2301 | outb(VT1724_MULTI_FIFO_ERR, ICEMT1724(ice, DMA_INT_MASK)); | ||
2302 | |||
2290 | return 0; | 2303 | return 0; |
2291 | } | 2304 | } |
2292 | 2305 | ||
@@ -2431,6 +2444,8 @@ static int __devinit snd_vt1724_create(struct snd_card *card, | |||
2431 | snd_vt1724_proc_init(ice); | 2444 | snd_vt1724_proc_init(ice); |
2432 | synchronize_irq(pci->irq); | 2445 | synchronize_irq(pci->irq); |
2433 | 2446 | ||
2447 | card->private_data = ice; | ||
2448 | |||
2434 | err = pci_request_regions(pci, "ICE1724"); | 2449 | err = pci_request_regions(pci, "ICE1724"); |
2435 | if (err < 0) { | 2450 | if (err < 0) { |
2436 | kfree(ice); | 2451 | kfree(ice); |
@@ -2459,14 +2474,6 @@ static int __devinit snd_vt1724_create(struct snd_card *card, | |||
2459 | return -EIO; | 2474 | return -EIO; |
2460 | } | 2475 | } |
2461 | 2476 | ||
2462 | /* MPU_RX and TX irq masks are cleared later dynamically */ | ||
2463 | outb(VT1724_IRQ_MPU_RX | VT1724_IRQ_MPU_TX , ICEREG1724(ice, IRQMASK)); | ||
2464 | |||
2465 | /* don't handle FIFO overrun/underruns (just yet), | ||
2466 | * since they cause machine lockups | ||
2467 | */ | ||
2468 | outb(VT1724_MULTI_FIFO_ERR, ICEMT1724(ice, DMA_INT_MASK)); | ||
2469 | |||
2470 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ice, &ops); | 2477 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ice, &ops); |
2471 | if (err < 0) { | 2478 | if (err < 0) { |
2472 | snd_vt1724_free(ice); | 2479 | snd_vt1724_free(ice); |
@@ -2650,11 +2657,96 @@ static void __devexit snd_vt1724_remove(struct pci_dev *pci) | |||
2650 | pci_set_drvdata(pci, NULL); | 2657 | pci_set_drvdata(pci, NULL); |
2651 | } | 2658 | } |
2652 | 2659 | ||
2660 | #ifdef CONFIG_PM | ||
2661 | static int snd_vt1724_suspend(struct pci_dev *pci, pm_message_t state) | ||
2662 | { | ||
2663 | struct snd_card *card = pci_get_drvdata(pci); | ||
2664 | struct snd_ice1712 *ice = card->private_data; | ||
2665 | |||
2666 | if (!ice->pm_suspend_enabled) | ||
2667 | return 0; | ||
2668 | |||
2669 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | ||
2670 | |||
2671 | snd_pcm_suspend_all(ice->pcm); | ||
2672 | snd_pcm_suspend_all(ice->pcm_pro); | ||
2673 | snd_pcm_suspend_all(ice->pcm_ds); | ||
2674 | snd_ac97_suspend(ice->ac97); | ||
2675 | |||
2676 | spin_lock_irq(&ice->reg_lock); | ||
2677 | ice->pm_saved_is_spdif_master = ice->is_spdif_master(ice); | ||
2678 | ice->pm_saved_spdif_ctrl = inw(ICEMT1724(ice, SPDIF_CTRL)); | ||
2679 | ice->pm_saved_spdif_cfg = inb(ICEREG1724(ice, SPDIF_CFG)); | ||
2680 | ice->pm_saved_route = inl(ICEMT1724(ice, ROUTE_PLAYBACK)); | ||
2681 | spin_unlock_irq(&ice->reg_lock); | ||
2682 | |||
2683 | if (ice->pm_suspend) | ||
2684 | ice->pm_suspend(ice); | ||
2685 | |||
2686 | pci_disable_device(pci); | ||
2687 | pci_save_state(pci); | ||
2688 | pci_set_power_state(pci, pci_choose_state(pci, state)); | ||
2689 | return 0; | ||
2690 | } | ||
2691 | |||
2692 | static int snd_vt1724_resume(struct pci_dev *pci) | ||
2693 | { | ||
2694 | struct snd_card *card = pci_get_drvdata(pci); | ||
2695 | struct snd_ice1712 *ice = card->private_data; | ||
2696 | |||
2697 | if (!ice->pm_suspend_enabled) | ||
2698 | return 0; | ||
2699 | |||
2700 | pci_set_power_state(pci, PCI_D0); | ||
2701 | pci_restore_state(pci); | ||
2702 | |||
2703 | if (pci_enable_device(pci) < 0) { | ||
2704 | snd_card_disconnect(card); | ||
2705 | return -EIO; | ||
2706 | } | ||
2707 | |||
2708 | pci_set_master(pci); | ||
2709 | |||
2710 | snd_vt1724_chip_reset(ice); | ||
2711 | |||
2712 | if (snd_vt1724_chip_init(ice) < 0) { | ||
2713 | snd_card_disconnect(card); | ||
2714 | return -EIO; | ||
2715 | } | ||
2716 | |||
2717 | if (ice->pm_resume) | ||
2718 | ice->pm_resume(ice); | ||
2719 | |||
2720 | if (ice->pm_saved_is_spdif_master) { | ||
2721 | /* switching to external clock via SPDIF */ | ||
2722 | ice->set_spdif_clock(ice); | ||
2723 | } else { | ||
2724 | /* internal on-card clock */ | ||
2725 | snd_vt1724_set_pro_rate(ice, ice->pro_rate_default, 1); | ||
2726 | } | ||
2727 | |||
2728 | update_spdif_bits(ice, ice->pm_saved_spdif_ctrl); | ||
2729 | |||
2730 | outb(ice->pm_saved_spdif_cfg, ICEREG1724(ice, SPDIF_CFG)); | ||
2731 | outl(ice->pm_saved_route, ICEMT1724(ice, ROUTE_PLAYBACK)); | ||
2732 | |||
2733 | if (ice->ac97) | ||
2734 | snd_ac97_resume(ice->ac97); | ||
2735 | |||
2736 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | ||
2737 | return 0; | ||
2738 | } | ||
2739 | #endif | ||
2740 | |||
2653 | static struct pci_driver driver = { | 2741 | static struct pci_driver driver = { |
2654 | .name = "ICE1724", | 2742 | .name = "ICE1724", |
2655 | .id_table = snd_vt1724_ids, | 2743 | .id_table = snd_vt1724_ids, |
2656 | .probe = snd_vt1724_probe, | 2744 | .probe = snd_vt1724_probe, |
2657 | .remove = __devexit_p(snd_vt1724_remove), | 2745 | .remove = __devexit_p(snd_vt1724_remove), |
2746 | #ifdef CONFIG_PM | ||
2747 | .suspend = snd_vt1724_suspend, | ||
2748 | .resume = snd_vt1724_resume, | ||
2749 | #endif | ||
2658 | }; | 2750 | }; |
2659 | 2751 | ||
2660 | static int __init alsa_card_ice1724_init(void) | 2752 | static int __init alsa_card_ice1724_init(void) |
diff --git a/sound/pci/ice1712/prodigy_hifi.c b/sound/pci/ice1712/prodigy_hifi.c index 043a93879bd5..c75515f5be6f 100644 --- a/sound/pci/ice1712/prodigy_hifi.c +++ b/sound/pci/ice1712/prodigy_hifi.c | |||
@@ -1077,7 +1077,7 @@ static int __devinit prodigy_hifi_init(struct snd_ice1712 *ice) | |||
1077 | /* | 1077 | /* |
1078 | * initialize the chip | 1078 | * initialize the chip |
1079 | */ | 1079 | */ |
1080 | static int __devinit prodigy_hd2_init(struct snd_ice1712 *ice) | 1080 | static void ak4396_init(struct snd_ice1712 *ice) |
1081 | { | 1081 | { |
1082 | static unsigned short ak4396_inits[] = { | 1082 | static unsigned short ak4396_inits[] = { |
1083 | AK4396_CTRL1, 0x87, /* I2S Normal Mode, 24 bit */ | 1083 | AK4396_CTRL1, 0x87, /* I2S Normal Mode, 24 bit */ |
@@ -1087,9 +1087,37 @@ static int __devinit prodigy_hd2_init(struct snd_ice1712 *ice) | |||
1087 | AK4396_RCH_ATT, 0x00, | 1087 | AK4396_RCH_ATT, 0x00, |
1088 | }; | 1088 | }; |
1089 | 1089 | ||
1090 | struct prodigy_hifi_spec *spec; | ||
1091 | unsigned int i; | 1090 | unsigned int i; |
1092 | 1091 | ||
1092 | /* initialize ak4396 codec */ | ||
1093 | /* reset codec */ | ||
1094 | ak4396_write(ice, AK4396_CTRL1, 0x86); | ||
1095 | msleep(100); | ||
1096 | ak4396_write(ice, AK4396_CTRL1, 0x87); | ||
1097 | |||
1098 | for (i = 0; i < ARRAY_SIZE(ak4396_inits); i += 2) | ||
1099 | ak4396_write(ice, ak4396_inits[i], ak4396_inits[i+1]); | ||
1100 | } | ||
1101 | |||
1102 | #ifdef CONFIG_PM | ||
1103 | static int __devinit prodigy_hd2_resume(struct snd_ice1712 *ice) | ||
1104 | { | ||
1105 | /* initialize ak4396 codec and restore previous mixer volumes */ | ||
1106 | struct prodigy_hifi_spec *spec = ice->spec; | ||
1107 | int i; | ||
1108 | mutex_lock(&ice->gpio_mutex); | ||
1109 | ak4396_init(ice); | ||
1110 | for (i = 0; i < 2; i++) | ||
1111 | ak4396_write(ice, AK4396_LCH_ATT + i, spec->vol[i] & 0xff); | ||
1112 | mutex_unlock(&ice->gpio_mutex); | ||
1113 | return 0; | ||
1114 | } | ||
1115 | #endif | ||
1116 | |||
1117 | static int __devinit prodigy_hd2_init(struct snd_ice1712 *ice) | ||
1118 | { | ||
1119 | struct prodigy_hifi_spec *spec; | ||
1120 | |||
1093 | ice->vt1720 = 0; | 1121 | ice->vt1720 = 0; |
1094 | ice->vt1724 = 1; | 1122 | ice->vt1724 = 1; |
1095 | 1123 | ||
@@ -1112,14 +1140,12 @@ static int __devinit prodigy_hd2_init(struct snd_ice1712 *ice) | |||
1112 | return -ENOMEM; | 1140 | return -ENOMEM; |
1113 | ice->spec = spec; | 1141 | ice->spec = spec; |
1114 | 1142 | ||
1115 | /* initialize ak4396 codec */ | 1143 | #ifdef CONFIG_PM |
1116 | /* reset codec */ | 1144 | ice->pm_resume = &prodigy_hd2_resume; |
1117 | ak4396_write(ice, AK4396_CTRL1, 0x86); | 1145 | ice->pm_suspend_enabled = 1; |
1118 | msleep(100); | 1146 | #endif |
1119 | ak4396_write(ice, AK4396_CTRL1, 0x87); | 1147 | |
1120 | 1148 | ak4396_init(ice); | |
1121 | for (i = 0; i < ARRAY_SIZE(ak4396_inits); i += 2) | ||
1122 | ak4396_write(ice, ak4396_inits[i], ak4396_inits[i+1]); | ||
1123 | 1149 | ||
1124 | return 0; | 1150 | return 0; |
1125 | } | 1151 | } |
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 8aa5687f392a..754867ed4785 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
@@ -421,29 +421,29 @@ struct intel8x0 { | |||
421 | }; | 421 | }; |
422 | 422 | ||
423 | static struct pci_device_id snd_intel8x0_ids[] = { | 423 | static struct pci_device_id snd_intel8x0_ids[] = { |
424 | { 0x8086, 0x2415, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 82801AA */ | 424 | { PCI_VDEVICE(INTEL, 0x2415), DEVICE_INTEL }, /* 82801AA */ |
425 | { 0x8086, 0x2425, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 82901AB */ | 425 | { PCI_VDEVICE(INTEL, 0x2425), DEVICE_INTEL }, /* 82901AB */ |
426 | { 0x8086, 0x2445, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 82801BA */ | 426 | { PCI_VDEVICE(INTEL, 0x2445), DEVICE_INTEL }, /* 82801BA */ |
427 | { 0x8086, 0x2485, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* ICH3 */ | 427 | { PCI_VDEVICE(INTEL, 0x2485), DEVICE_INTEL }, /* ICH3 */ |
428 | { 0x8086, 0x24c5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL_ICH4 }, /* ICH4 */ | 428 | { PCI_VDEVICE(INTEL, 0x24c5), DEVICE_INTEL_ICH4 }, /* ICH4 */ |
429 | { 0x8086, 0x24d5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL_ICH4 }, /* ICH5 */ | 429 | { PCI_VDEVICE(INTEL, 0x24d5), DEVICE_INTEL_ICH4 }, /* ICH5 */ |
430 | { 0x8086, 0x25a6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL_ICH4 }, /* ESB */ | 430 | { PCI_VDEVICE(INTEL, 0x25a6), DEVICE_INTEL_ICH4 }, /* ESB */ |
431 | { 0x8086, 0x266e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL_ICH4 }, /* ICH6 */ | 431 | { PCI_VDEVICE(INTEL, 0x266e), DEVICE_INTEL_ICH4 }, /* ICH6 */ |
432 | { 0x8086, 0x27de, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL_ICH4 }, /* ICH7 */ | 432 | { PCI_VDEVICE(INTEL, 0x27de), DEVICE_INTEL_ICH4 }, /* ICH7 */ |
433 | { 0x8086, 0x2698, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL_ICH4 }, /* ESB2 */ | 433 | { PCI_VDEVICE(INTEL, 0x2698), DEVICE_INTEL_ICH4 }, /* ESB2 */ |
434 | { 0x8086, 0x7195, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 440MX */ | 434 | { PCI_VDEVICE(INTEL, 0x7195), DEVICE_INTEL }, /* 440MX */ |
435 | { 0x1039, 0x7012, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_SIS }, /* SI7012 */ | 435 | { PCI_VDEVICE(SI, 0x7012), DEVICE_SIS }, /* SI7012 */ |
436 | { 0x10de, 0x01b1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_NFORCE }, /* NFORCE */ | 436 | { PCI_VDEVICE(NVIDIA, 0x01b1), DEVICE_NFORCE }, /* NFORCE */ |
437 | { 0x10de, 0x003a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_NFORCE }, /* MCP04 */ | 437 | { PCI_VDEVICE(NVIDIA, 0x003a), DEVICE_NFORCE }, /* MCP04 */ |
438 | { 0x10de, 0x006a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_NFORCE }, /* NFORCE2 */ | 438 | { PCI_VDEVICE(NVIDIA, 0x006a), DEVICE_NFORCE }, /* NFORCE2 */ |
439 | { 0x10de, 0x0059, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_NFORCE }, /* CK804 */ | 439 | { PCI_VDEVICE(NVIDIA, 0x0059), DEVICE_NFORCE }, /* CK804 */ |
440 | { 0x10de, 0x008a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_NFORCE }, /* CK8 */ | 440 | { PCI_VDEVICE(NVIDIA, 0x008a), DEVICE_NFORCE }, /* CK8 */ |
441 | { 0x10de, 0x00da, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_NFORCE }, /* NFORCE3 */ | 441 | { PCI_VDEVICE(NVIDIA, 0x00da), DEVICE_NFORCE }, /* NFORCE3 */ |
442 | { 0x10de, 0x00ea, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_NFORCE }, /* CK8S */ | 442 | { PCI_VDEVICE(NVIDIA, 0x00ea), DEVICE_NFORCE }, /* CK8S */ |
443 | { 0x10de, 0x026b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_NFORCE }, /* MCP51 */ | 443 | { PCI_VDEVICE(NVIDIA, 0x026b), DEVICE_NFORCE }, /* MCP51 */ |
444 | { 0x1022, 0x746d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* AMD8111 */ | 444 | { PCI_VDEVICE(AMD, 0x746d), DEVICE_INTEL }, /* AMD8111 */ |
445 | { 0x1022, 0x7445, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* AMD768 */ | 445 | { PCI_VDEVICE(AMD, 0x7445), DEVICE_INTEL }, /* AMD768 */ |
446 | { 0x10b9, 0x5455, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_ALI }, /* Ali5455 */ | 446 | { PCI_VDEVICE(AL, 0x5455), DEVICE_ALI }, /* Ali5455 */ |
447 | { 0, } | 447 | { 0, } |
448 | }; | 448 | }; |
449 | 449 | ||
@@ -1954,6 +1954,18 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { | |||
1954 | .name = "Sony S1XP", | 1954 | .name = "Sony S1XP", |
1955 | .type = AC97_TUNE_INV_EAPD | 1955 | .type = AC97_TUNE_INV_EAPD |
1956 | }, | 1956 | }, |
1957 | { | ||
1958 | .subvendor = 0x104d, | ||
1959 | .subdevice = 0x81c0, | ||
1960 | .name = "Sony VAIO VGN-T350P", /*AD1981B*/ | ||
1961 | .type = AC97_TUNE_INV_EAPD | ||
1962 | }, | ||
1963 | { | ||
1964 | .subvendor = 0x104d, | ||
1965 | .subdevice = 0x81c5, | ||
1966 | .name = "Sony VAIO VGN-B1VP", /*AD1981B*/ | ||
1967 | .type = AC97_TUNE_INV_EAPD | ||
1968 | }, | ||
1957 | { | 1969 | { |
1958 | .subvendor = 0x1043, | 1970 | .subvendor = 0x1043, |
1959 | .subdevice = 0x80f3, | 1971 | .subdevice = 0x80f3, |
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index 6ec0fc50d6be..9e7d12e7673f 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c | |||
@@ -220,24 +220,24 @@ struct intel8x0m { | |||
220 | }; | 220 | }; |
221 | 221 | ||
222 | static struct pci_device_id snd_intel8x0m_ids[] = { | 222 | static struct pci_device_id snd_intel8x0m_ids[] = { |
223 | { 0x8086, 0x2416, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 82801AA */ | 223 | { PCI_VDEVICE(INTEL, 0x2416), DEVICE_INTEL }, /* 82801AA */ |
224 | { 0x8086, 0x2426, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 82901AB */ | 224 | { PCI_VDEVICE(INTEL, 0x2426), DEVICE_INTEL }, /* 82901AB */ |
225 | { 0x8086, 0x2446, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 82801BA */ | 225 | { PCI_VDEVICE(INTEL, 0x2446), DEVICE_INTEL }, /* 82801BA */ |
226 | { 0x8086, 0x2486, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* ICH3 */ | 226 | { PCI_VDEVICE(INTEL, 0x2486), DEVICE_INTEL }, /* ICH3 */ |
227 | { 0x8086, 0x24c6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* ICH4 */ | 227 | { PCI_VDEVICE(INTEL, 0x24c6), DEVICE_INTEL }, /* ICH4 */ |
228 | { 0x8086, 0x24d6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* ICH5 */ | 228 | { PCI_VDEVICE(INTEL, 0x24d6), DEVICE_INTEL }, /* ICH5 */ |
229 | { 0x8086, 0x266d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* ICH6 */ | 229 | { PCI_VDEVICE(INTEL, 0x266d), DEVICE_INTEL }, /* ICH6 */ |
230 | { 0x8086, 0x27dd, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* ICH7 */ | 230 | { PCI_VDEVICE(INTEL, 0x27dd), DEVICE_INTEL }, /* ICH7 */ |
231 | { 0x8086, 0x7196, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 440MX */ | 231 | { PCI_VDEVICE(INTEL, 0x7196), DEVICE_INTEL }, /* 440MX */ |
232 | { 0x1022, 0x7446, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* AMD768 */ | 232 | { PCI_VDEVICE(AMD, 0x7446), DEVICE_INTEL }, /* AMD768 */ |
233 | { 0x1039, 0x7013, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_SIS }, /* SI7013 */ | 233 | { PCI_VDEVICE(SI, 0x7013), DEVICE_SIS }, /* SI7013 */ |
234 | { 0x10de, 0x01c1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_NFORCE }, /* NFORCE */ | 234 | { PCI_VDEVICE(NVIDIA, 0x01c1), DEVICE_NFORCE }, /* NFORCE */ |
235 | { 0x10de, 0x0069, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_NFORCE }, /* NFORCE2 */ | 235 | { PCI_VDEVICE(NVIDIA, 0x0069), DEVICE_NFORCE }, /* NFORCE2 */ |
236 | { 0x10de, 0x0089, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_NFORCE }, /* NFORCE2s */ | 236 | { PCI_VDEVICE(NVIDIA, 0x0089), DEVICE_NFORCE }, /* NFORCE2s */ |
237 | { 0x10de, 0x00d9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_NFORCE }, /* NFORCE3 */ | 237 | { PCI_VDEVICE(NVIDIA, 0x00d9), DEVICE_NFORCE }, /* NFORCE3 */ |
238 | #if 0 | 238 | #if 0 |
239 | { 0x1022, 0x746d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* AMD8111 */ | 239 | { PCI_VDEVICE(AMD, 0x746d), DEVICE_INTEL }, /* AMD8111 */ |
240 | { 0x10b9, 0x5455, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_ALI }, /* Ali5455 */ | 240 | { PCI_VDEVICE(AL, 0x5455), DEVICE_ALI }, /* Ali5455 */ |
241 | #endif | 241 | #endif |
242 | { 0, } | 242 | { 0, } |
243 | }; | 243 | }; |
diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c index 18da2ef04d09..11b8c6514b3d 100644 --- a/sound/pci/lx6464es/lx6464es.c +++ b/sound/pci/lx6464es/lx6464es.c | |||
@@ -654,13 +654,12 @@ static int __devinit lx_init_ethersound_config(struct lx6464es *chip) | |||
654 | int i; | 654 | int i; |
655 | u32 orig_conf_es = lx_dsp_reg_read(chip, eReg_CONFES); | 655 | u32 orig_conf_es = lx_dsp_reg_read(chip, eReg_CONFES); |
656 | 656 | ||
657 | u32 default_conf_es = (64 << IOCR_OUTPUTS_OFFSET) | | 657 | /* configure 64 io channels */ |
658 | u32 conf_es = (orig_conf_es & CONFES_READ_PART_MASK) | | ||
658 | (64 << IOCR_INPUTS_OFFSET) | | 659 | (64 << IOCR_INPUTS_OFFSET) | |
660 | (64 << IOCR_OUTPUTS_OFFSET) | | ||
659 | (FREQ_RATIO_SINGLE_MODE << FREQ_RATIO_OFFSET); | 661 | (FREQ_RATIO_SINGLE_MODE << FREQ_RATIO_OFFSET); |
660 | 662 | ||
661 | u32 conf_es = (orig_conf_es & CONFES_READ_PART_MASK) | ||
662 | | (default_conf_es & CONFES_WRITE_PART_MASK); | ||
663 | |||
664 | snd_printdd("->lx_init_ethersound\n"); | 663 | snd_printdd("->lx_init_ethersound\n"); |
665 | 664 | ||
666 | chip->freq_ratio = FREQ_RATIO_SINGLE_MODE; | 665 | chip->freq_ratio = FREQ_RATIO_SINGLE_MODE; |
diff --git a/sound/pci/lx6464es/lx6464es.h b/sound/pci/lx6464es/lx6464es.h index 012c010c8c89..51afc048961d 100644 --- a/sound/pci/lx6464es/lx6464es.h +++ b/sound/pci/lx6464es/lx6464es.h | |||
@@ -86,7 +86,6 @@ struct lx6464es { | |||
86 | 86 | ||
87 | /* messaging */ | 87 | /* messaging */ |
88 | spinlock_t msg_lock; /* message spinlock */ | 88 | spinlock_t msg_lock; /* message spinlock */ |
89 | atomic_t send_message_locked; | ||
90 | struct lx_rmh rmh; | 89 | struct lx_rmh rmh; |
91 | 90 | ||
92 | /* configuration */ | 91 | /* configuration */ |
@@ -95,7 +94,6 @@ struct lx6464es { | |||
95 | uint hardware_running[2]; | 94 | uint hardware_running[2]; |
96 | u32 board_sample_rate; /* sample rate read from | 95 | u32 board_sample_rate; /* sample rate read from |
97 | * board */ | 96 | * board */ |
98 | u32 sample_rate; /* our sample rate */ | ||
99 | u16 pcm_granularity; /* board blocksize */ | 97 | u16 pcm_granularity; /* board blocksize */ |
100 | 98 | ||
101 | /* dma */ | 99 | /* dma */ |
diff --git a/sound/pci/lx6464es/lx_core.c b/sound/pci/lx6464es/lx_core.c index 5812780d6e89..3086b751da4a 100644 --- a/sound/pci/lx6464es/lx_core.c +++ b/sound/pci/lx6464es/lx_core.c | |||
@@ -314,98 +314,6 @@ static inline void lx_message_dump(struct lx_rmh *rmh) | |||
314 | #define XILINX_POLL_NO_SLEEP 100 | 314 | #define XILINX_POLL_NO_SLEEP 100 |
315 | #define XILINX_POLL_ITERATIONS 150 | 315 | #define XILINX_POLL_ITERATIONS 150 |
316 | 316 | ||
317 | #if 0 /* not used now */ | ||
318 | static int lx_message_send(struct lx6464es *chip, struct lx_rmh *rmh) | ||
319 | { | ||
320 | u32 reg = ED_DSP_TIMED_OUT; | ||
321 | int dwloop; | ||
322 | int answer_received; | ||
323 | |||
324 | if (lx_dsp_reg_read(chip, eReg_CSM) & (Reg_CSM_MC | Reg_CSM_MR)) { | ||
325 | snd_printk(KERN_ERR LXP "PIOSendMessage eReg_CSM %x\n", reg); | ||
326 | return -EBUSY; | ||
327 | } | ||
328 | |||
329 | /* write command */ | ||
330 | lx_dsp_reg_writebuf(chip, eReg_CRM1, rmh->cmd, rmh->cmd_len); | ||
331 | |||
332 | snd_BUG_ON(atomic_read(&chip->send_message_locked) != 0); | ||
333 | atomic_set(&chip->send_message_locked, 1); | ||
334 | |||
335 | /* MicoBlaze gogogo */ | ||
336 | lx_dsp_reg_write(chip, eReg_CSM, Reg_CSM_MC); | ||
337 | |||
338 | /* wait for interrupt to answer */ | ||
339 | for (dwloop = 0; dwloop != XILINX_TIMEOUT_MS; ++dwloop) { | ||
340 | answer_received = atomic_read(&chip->send_message_locked); | ||
341 | if (answer_received == 0) | ||
342 | break; | ||
343 | msleep(1); | ||
344 | } | ||
345 | |||
346 | if (answer_received == 0) { | ||
347 | /* in Debug mode verify Reg_CSM_MR */ | ||
348 | snd_BUG_ON(!(lx_dsp_reg_read(chip, eReg_CSM) & Reg_CSM_MR)); | ||
349 | |||
350 | /* command finished, read status */ | ||
351 | if (rmh->dsp_stat == 0) | ||
352 | reg = lx_dsp_reg_read(chip, eReg_CRM1); | ||
353 | else | ||
354 | reg = 0; | ||
355 | } else { | ||
356 | int i; | ||
357 | snd_printk(KERN_WARNING LXP "TIMEOUT lx_message_send! " | ||
358 | "Interrupts disabled?\n"); | ||
359 | |||
360 | /* attente bit Reg_CSM_MR */ | ||
361 | for (i = 0; i != XILINX_POLL_ITERATIONS; i++) { | ||
362 | if ((lx_dsp_reg_read(chip, eReg_CSM) & Reg_CSM_MR)) { | ||
363 | if (rmh->dsp_stat == 0) | ||
364 | reg = lx_dsp_reg_read(chip, eReg_CRM1); | ||
365 | else | ||
366 | reg = 0; | ||
367 | goto polling_successful; | ||
368 | } | ||
369 | |||
370 | if (i > XILINX_POLL_NO_SLEEP) | ||
371 | msleep(1); | ||
372 | } | ||
373 | snd_printk(KERN_WARNING LXP "TIMEOUT lx_message_send! " | ||
374 | "polling failed\n"); | ||
375 | |||
376 | polling_successful: | ||
377 | atomic_set(&chip->send_message_locked, 0); | ||
378 | } | ||
379 | |||
380 | if ((reg & ERROR_VALUE) == 0) { | ||
381 | /* read response */ | ||
382 | if (rmh->stat_len) { | ||
383 | snd_BUG_ON(rmh->stat_len >= (REG_CRM_NUMBER-1)); | ||
384 | |||
385 | lx_dsp_reg_readbuf(chip, eReg_CRM2, rmh->stat, | ||
386 | rmh->stat_len); | ||
387 | } | ||
388 | } else | ||
389 | snd_printk(KERN_WARNING LXP "lx_message_send: error_value %x\n", | ||
390 | reg); | ||
391 | |||
392 | /* clear Reg_CSM_MR */ | ||
393 | lx_dsp_reg_write(chip, eReg_CSM, 0); | ||
394 | |||
395 | switch (reg) { | ||
396 | case ED_DSP_TIMED_OUT: | ||
397 | snd_printk(KERN_WARNING LXP "lx_message_send: dsp timeout\n"); | ||
398 | return -ETIMEDOUT; | ||
399 | |||
400 | case ED_DSP_CRASHED: | ||
401 | snd_printk(KERN_WARNING LXP "lx_message_send: dsp crashed\n"); | ||
402 | return -EAGAIN; | ||
403 | } | ||
404 | |||
405 | lx_message_dump(rmh); | ||
406 | return 0; | ||
407 | } | ||
408 | #endif /* not used now */ | ||
409 | 317 | ||
410 | static int lx_message_send_atomic(struct lx6464es *chip, struct lx_rmh *rmh) | 318 | static int lx_message_send_atomic(struct lx6464es *chip, struct lx_rmh *rmh) |
411 | { | 319 | { |
@@ -423,7 +331,7 @@ static int lx_message_send_atomic(struct lx6464es *chip, struct lx_rmh *rmh) | |||
423 | /* MicoBlaze gogogo */ | 331 | /* MicoBlaze gogogo */ |
424 | lx_dsp_reg_write(chip, eReg_CSM, Reg_CSM_MC); | 332 | lx_dsp_reg_write(chip, eReg_CSM, Reg_CSM_MC); |
425 | 333 | ||
426 | /* wait for interrupt to answer */ | 334 | /* wait for device to answer */ |
427 | for (dwloop = 0; dwloop != XILINX_TIMEOUT_MS * 1000; ++dwloop) { | 335 | for (dwloop = 0; dwloop != XILINX_TIMEOUT_MS * 1000; ++dwloop) { |
428 | if (lx_dsp_reg_read(chip, eReg_CSM) & Reg_CSM_MR) { | 336 | if (lx_dsp_reg_read(chip, eReg_CSM) & Reg_CSM_MR) { |
429 | if (rmh->dsp_stat == 0) | 337 | if (rmh->dsp_stat == 0) |
@@ -1175,10 +1083,6 @@ static int lx_interrupt_ack(struct lx6464es *chip, u32 *r_irqsrc, | |||
1175 | *r_async_escmd = 1; | 1083 | *r_async_escmd = 1; |
1176 | } | 1084 | } |
1177 | 1085 | ||
1178 | if (irqsrc & MASK_SYS_STATUS_CMD_DONE) | ||
1179 | /* xilinx command notification */ | ||
1180 | atomic_set(&chip->send_message_locked, 0); | ||
1181 | |||
1182 | if (irq_async) { | 1086 | if (irq_async) { |
1183 | /* snd_printd("interrupt: async event pending\n"); */ | 1087 | /* snd_printd("interrupt: async event pending\n"); */ |
1184 | *r_async_pending = 1; | 1088 | *r_async_pending = 1; |
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index 82bc5b9e7629..a83d1968a845 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c | |||
@@ -61,7 +61,7 @@ MODULE_PARM_DESC(enable, "Enable Digigram " CARD_NAME " soundcard."); | |||
61 | */ | 61 | */ |
62 | 62 | ||
63 | static struct pci_device_id snd_mixart_ids[] = { | 63 | static struct pci_device_id snd_mixart_ids[] = { |
64 | { 0x1057, 0x0003, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* MC8240 */ | 64 | { PCI_VDEVICE(MOTOROLA, 0x0003), 0, }, /* MC8240 */ |
65 | { 0, } | 65 | { 0, } |
66 | }; | 66 | }; |
67 | 67 | ||
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c index 522a040855d4..97a0731331a1 100644 --- a/sound/pci/nm256/nm256.c +++ b/sound/pci/nm256/nm256.c | |||
@@ -263,9 +263,9 @@ struct nm256 { | |||
263 | * PCI ids | 263 | * PCI ids |
264 | */ | 264 | */ |
265 | static struct pci_device_id snd_nm256_ids[] = { | 265 | static struct pci_device_id snd_nm256_ids[] = { |
266 | {PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 266 | {PCI_VDEVICE(NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO), 0}, |
267 | {PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 267 | {PCI_VDEVICE(NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO), 0}, |
268 | {PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 268 | {PCI_VDEVICE(NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO), 0}, |
269 | {0,}, | 269 | {0,}, |
270 | }; | 270 | }; |
271 | 271 | ||
diff --git a/sound/pci/oxygen/oxygen_io.c b/sound/pci/oxygen/oxygen_io.c index c1eb923f2ac9..09b2b2a36df5 100644 --- a/sound/pci/oxygen/oxygen_io.c +++ b/sound/pci/oxygen/oxygen_io.c | |||
@@ -215,17 +215,8 @@ EXPORT_SYMBOL(oxygen_write_spi); | |||
215 | 215 | ||
216 | void oxygen_write_i2c(struct oxygen *chip, u8 device, u8 map, u8 data) | 216 | void oxygen_write_i2c(struct oxygen *chip, u8 device, u8 map, u8 data) |
217 | { | 217 | { |
218 | unsigned long timeout; | ||
219 | |||
220 | /* should not need more than about 300 us */ | 218 | /* should not need more than about 300 us */ |
221 | timeout = jiffies + msecs_to_jiffies(1); | 219 | msleep(1); |
222 | do { | ||
223 | if (!(oxygen_read16(chip, OXYGEN_2WIRE_BUS_STATUS) | ||
224 | & OXYGEN_2WIRE_BUSY)) | ||
225 | break; | ||
226 | udelay(1); | ||
227 | cond_resched(); | ||
228 | } while (time_after_eq(timeout, jiffies)); | ||
229 | 220 | ||
230 | oxygen_write8(chip, OXYGEN_2WIRE_MAP, map); | 221 | oxygen_write8(chip, OXYGEN_2WIRE_MAP, map); |
231 | oxygen_write8(chip, OXYGEN_2WIRE_DATA, data); | 222 | oxygen_write8(chip, OXYGEN_2WIRE_DATA, data); |
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c index 312251d39696..9a8936e20744 100644 --- a/sound/pci/oxygen/oxygen_lib.c +++ b/sound/pci/oxygen/oxygen_lib.c | |||
@@ -260,6 +260,9 @@ oxygen_search_pci_id(struct oxygen *chip, const struct pci_device_id ids[]) | |||
260 | * chip didn't if the first EEPROM word was overwritten. | 260 | * chip didn't if the first EEPROM word was overwritten. |
261 | */ | 261 | */ |
262 | subdevice = oxygen_read_eeprom(chip, 2); | 262 | subdevice = oxygen_read_eeprom(chip, 2); |
263 | /* use default ID if EEPROM is missing */ | ||
264 | if (subdevice == 0xffff) | ||
265 | subdevice = 0x8788; | ||
263 | /* | 266 | /* |
264 | * We use only the subsystem device ID for searching because it is | 267 | * We use only the subsystem device ID for searching because it is |
265 | * unique even without the subsystem vendor ID, which may have been | 268 | * unique even without the subsystem vendor ID, which may have been |
diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c index 304da169bfdc..5401c547c4e3 100644 --- a/sound/pci/oxygen/oxygen_mixer.c +++ b/sound/pci/oxygen/oxygen_mixer.c | |||
@@ -575,8 +575,10 @@ static int ac97_switch_put(struct snd_kcontrol *ctl, | |||
575 | static int ac97_volume_info(struct snd_kcontrol *ctl, | 575 | static int ac97_volume_info(struct snd_kcontrol *ctl, |
576 | struct snd_ctl_elem_info *info) | 576 | struct snd_ctl_elem_info *info) |
577 | { | 577 | { |
578 | int stereo = (ctl->private_value >> 16) & 1; | ||
579 | |||
578 | info->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 580 | info->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
579 | info->count = 2; | 581 | info->count = stereo ? 2 : 1; |
580 | info->value.integer.min = 0; | 582 | info->value.integer.min = 0; |
581 | info->value.integer.max = 0x1f; | 583 | info->value.integer.max = 0x1f; |
582 | return 0; | 584 | return 0; |
@@ -587,6 +589,7 @@ static int ac97_volume_get(struct snd_kcontrol *ctl, | |||
587 | { | 589 | { |
588 | struct oxygen *chip = ctl->private_data; | 590 | struct oxygen *chip = ctl->private_data; |
589 | unsigned int codec = (ctl->private_value >> 24) & 1; | 591 | unsigned int codec = (ctl->private_value >> 24) & 1; |
592 | int stereo = (ctl->private_value >> 16) & 1; | ||
590 | unsigned int index = ctl->private_value & 0xff; | 593 | unsigned int index = ctl->private_value & 0xff; |
591 | u16 reg; | 594 | u16 reg; |
592 | 595 | ||
@@ -594,7 +597,8 @@ static int ac97_volume_get(struct snd_kcontrol *ctl, | |||
594 | reg = oxygen_read_ac97(chip, codec, index); | 597 | reg = oxygen_read_ac97(chip, codec, index); |
595 | mutex_unlock(&chip->mutex); | 598 | mutex_unlock(&chip->mutex); |
596 | value->value.integer.value[0] = 31 - (reg & 0x1f); | 599 | value->value.integer.value[0] = 31 - (reg & 0x1f); |
597 | value->value.integer.value[1] = 31 - ((reg >> 8) & 0x1f); | 600 | if (stereo) |
601 | value->value.integer.value[1] = 31 - ((reg >> 8) & 0x1f); | ||
598 | return 0; | 602 | return 0; |
599 | } | 603 | } |
600 | 604 | ||
@@ -603,6 +607,7 @@ static int ac97_volume_put(struct snd_kcontrol *ctl, | |||
603 | { | 607 | { |
604 | struct oxygen *chip = ctl->private_data; | 608 | struct oxygen *chip = ctl->private_data; |
605 | unsigned int codec = (ctl->private_value >> 24) & 1; | 609 | unsigned int codec = (ctl->private_value >> 24) & 1; |
610 | int stereo = (ctl->private_value >> 16) & 1; | ||
606 | unsigned int index = ctl->private_value & 0xff; | 611 | unsigned int index = ctl->private_value & 0xff; |
607 | u16 oldreg, newreg; | 612 | u16 oldreg, newreg; |
608 | int change; | 613 | int change; |
@@ -612,8 +617,11 @@ static int ac97_volume_put(struct snd_kcontrol *ctl, | |||
612 | newreg = oldreg; | 617 | newreg = oldreg; |
613 | newreg = (newreg & ~0x1f) | | 618 | newreg = (newreg & ~0x1f) | |
614 | (31 - (value->value.integer.value[0] & 0x1f)); | 619 | (31 - (value->value.integer.value[0] & 0x1f)); |
615 | newreg = (newreg & ~0x1f00) | | 620 | if (stereo) |
616 | ((31 - (value->value.integer.value[0] & 0x1f)) << 8); | 621 | newreg = (newreg & ~0x1f00) | |
622 | ((31 - (value->value.integer.value[1] & 0x1f)) << 8); | ||
623 | else | ||
624 | newreg = (newreg & ~0x1f00) | ((newreg & 0x1f) << 8); | ||
617 | change = newreg != oldreg; | 625 | change = newreg != oldreg; |
618 | if (change) | 626 | if (change) |
619 | oxygen_write_ac97(chip, codec, index, newreg); | 627 | oxygen_write_ac97(chip, codec, index, newreg); |
@@ -673,7 +681,7 @@ static int ac97_fp_rec_volume_put(struct snd_kcontrol *ctl, | |||
673 | .private_value = ((codec) << 24) | ((invert) << 16) | \ | 681 | .private_value = ((codec) << 24) | ((invert) << 16) | \ |
674 | ((bitnr) << 8) | (index), \ | 682 | ((bitnr) << 8) | (index), \ |
675 | } | 683 | } |
676 | #define AC97_VOLUME(xname, codec, index) { \ | 684 | #define AC97_VOLUME(xname, codec, index, stereo) { \ |
677 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 685 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
678 | .name = xname, \ | 686 | .name = xname, \ |
679 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ | 687 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
@@ -682,7 +690,7 @@ static int ac97_fp_rec_volume_put(struct snd_kcontrol *ctl, | |||
682 | .get = ac97_volume_get, \ | 690 | .get = ac97_volume_get, \ |
683 | .put = ac97_volume_put, \ | 691 | .put = ac97_volume_put, \ |
684 | .tlv = { .p = ac97_db_scale, }, \ | 692 | .tlv = { .p = ac97_db_scale, }, \ |
685 | .private_value = ((codec) << 24) | (index), \ | 693 | .private_value = ((codec) << 24) | ((stereo) << 16) | (index), \ |
686 | } | 694 | } |
687 | 695 | ||
688 | static DECLARE_TLV_DB_SCALE(monitor_db_scale, -1000, 1000, 0); | 696 | static DECLARE_TLV_DB_SCALE(monitor_db_scale, -1000, 1000, 0); |
@@ -882,18 +890,18 @@ static const struct { | |||
882 | }; | 890 | }; |
883 | 891 | ||
884 | static const struct snd_kcontrol_new ac97_controls[] = { | 892 | static const struct snd_kcontrol_new ac97_controls[] = { |
885 | AC97_VOLUME("Mic Capture Volume", 0, AC97_MIC), | 893 | AC97_VOLUME("Mic Capture Volume", 0, AC97_MIC, 0), |
886 | AC97_SWITCH("Mic Capture Switch", 0, AC97_MIC, 15, 1), | 894 | AC97_SWITCH("Mic Capture Switch", 0, AC97_MIC, 15, 1), |
887 | AC97_SWITCH("Mic Boost (+20dB)", 0, AC97_MIC, 6, 0), | 895 | AC97_SWITCH("Mic Boost (+20dB)", 0, AC97_MIC, 6, 0), |
888 | AC97_SWITCH("Line Capture Switch", 0, AC97_LINE, 15, 1), | 896 | AC97_SWITCH("Line Capture Switch", 0, AC97_LINE, 15, 1), |
889 | AC97_VOLUME("CD Capture Volume", 0, AC97_CD), | 897 | AC97_VOLUME("CD Capture Volume", 0, AC97_CD, 1), |
890 | AC97_SWITCH("CD Capture Switch", 0, AC97_CD, 15, 1), | 898 | AC97_SWITCH("CD Capture Switch", 0, AC97_CD, 15, 1), |
891 | AC97_VOLUME("Aux Capture Volume", 0, AC97_AUX), | 899 | AC97_VOLUME("Aux Capture Volume", 0, AC97_AUX, 1), |
892 | AC97_SWITCH("Aux Capture Switch", 0, AC97_AUX, 15, 1), | 900 | AC97_SWITCH("Aux Capture Switch", 0, AC97_AUX, 15, 1), |
893 | }; | 901 | }; |
894 | 902 | ||
895 | static const struct snd_kcontrol_new ac97_fp_controls[] = { | 903 | static const struct snd_kcontrol_new ac97_fp_controls[] = { |
896 | AC97_VOLUME("Front Panel Playback Volume", 1, AC97_HEADPHONE), | 904 | AC97_VOLUME("Front Panel Playback Volume", 1, AC97_HEADPHONE, 1), |
897 | AC97_SWITCH("Front Panel Playback Switch", 1, AC97_HEADPHONE, 15, 1), | 905 | AC97_SWITCH("Front Panel Playback Switch", 1, AC97_HEADPHONE, 15, 1), |
898 | { | 906 | { |
899 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 907 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
diff --git a/sound/pci/oxygen/oxygen_pcm.c b/sound/pci/oxygen/oxygen_pcm.c index 3b5ca70c9d4d..ef2345d82b86 100644 --- a/sound/pci/oxygen/oxygen_pcm.c +++ b/sound/pci/oxygen/oxygen_pcm.c | |||
@@ -469,9 +469,11 @@ static int oxygen_multich_hw_params(struct snd_pcm_substream *substream, | |||
469 | oxygen_write16_masked(chip, OXYGEN_I2S_MULTICH_FORMAT, | 469 | oxygen_write16_masked(chip, OXYGEN_I2S_MULTICH_FORMAT, |
470 | oxygen_rate(hw_params) | | 470 | oxygen_rate(hw_params) | |
471 | chip->model.dac_i2s_format | | 471 | chip->model.dac_i2s_format | |
472 | oxygen_i2s_mclk(hw_params) | | ||
472 | oxygen_i2s_bits(hw_params), | 473 | oxygen_i2s_bits(hw_params), |
473 | OXYGEN_I2S_RATE_MASK | | 474 | OXYGEN_I2S_RATE_MASK | |
474 | OXYGEN_I2S_FORMAT_MASK | | 475 | OXYGEN_I2S_FORMAT_MASK | |
476 | OXYGEN_I2S_MCLK_MASK | | ||
475 | OXYGEN_I2S_BITS_MASK); | 477 | OXYGEN_I2S_BITS_MASK); |
476 | oxygen_update_dac_routing(chip); | 478 | oxygen_update_dac_routing(chip); |
477 | oxygen_update_spdif_source(chip); | 479 | oxygen_update_spdif_source(chip); |
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c index bf971f7cfdc6..6ebcb6bdd712 100644 --- a/sound/pci/oxygen/virtuoso.c +++ b/sound/pci/oxygen/virtuoso.c | |||
@@ -635,6 +635,8 @@ static void xonar_d2_resume(struct oxygen *chip) | |||
635 | 635 | ||
636 | static void xonar_d1_resume(struct oxygen *chip) | 636 | static void xonar_d1_resume(struct oxygen *chip) |
637 | { | 637 | { |
638 | oxygen_set_bits8(chip, OXYGEN_FUNCTION, OXYGEN_FUNCTION_RESET_CODEC); | ||
639 | msleep(1); | ||
638 | cs43xx_init(chip); | 640 | cs43xx_init(chip); |
639 | xonar_enable_output(chip); | 641 | xonar_enable_output(chip); |
640 | } | 642 | } |
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index 235a71e5ac8d..b5ca02e2038c 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c | |||
@@ -2197,9 +2197,12 @@ static int __init alsa_card_riptide_init(void) | |||
2197 | if (err < 0) | 2197 | if (err < 0) |
2198 | return err; | 2198 | return err; |
2199 | #if defined(SUPPORT_JOYSTICK) | 2199 | #if defined(SUPPORT_JOYSTICK) |
2200 | pci_register_driver(&joystick_driver); | 2200 | err = pci_register_driver(&joystick_driver); |
2201 | /* On failure unregister formerly registered audio driver */ | ||
2202 | if (err < 0) | ||
2203 | pci_unregister_driver(&driver); | ||
2201 | #endif | 2204 | #endif |
2202 | return 0; | 2205 | return err; |
2203 | } | 2206 | } |
2204 | 2207 | ||
2205 | static void __exit alsa_card_riptide_exit(void) | 2208 | static void __exit alsa_card_riptide_exit(void) |
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c index d7b966e7c4cf..f977dba7cbd0 100644 --- a/sound/pci/rme32.c +++ b/sound/pci/rme32.c | |||
@@ -227,12 +227,9 @@ struct rme32 { | |||
227 | }; | 227 | }; |
228 | 228 | ||
229 | static struct pci_device_id snd_rme32_ids[] = { | 229 | static struct pci_device_id snd_rme32_ids[] = { |
230 | {PCI_VENDOR_ID_XILINX_RME, PCI_DEVICE_ID_RME_DIGI32, | 230 | {PCI_VDEVICE(XILINX_RME, PCI_DEVICE_ID_RME_DIGI32), 0,}, |
231 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0,}, | 231 | {PCI_VDEVICE(XILINX_RME, PCI_DEVICE_ID_RME_DIGI32_8), 0,}, |
232 | {PCI_VENDOR_ID_XILINX_RME, PCI_DEVICE_ID_RME_DIGI32_8, | 232 | {PCI_VDEVICE(XILINX_RME, PCI_DEVICE_ID_RME_DIGI32_PRO), 0,}, |
233 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0,}, | ||
234 | {PCI_VENDOR_ID_XILINX_RME, PCI_DEVICE_ID_RME_DIGI32_PRO, | ||
235 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0,}, | ||
236 | {0,} | 233 | {0,} |
237 | }; | 234 | }; |
238 | 235 | ||
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c index 55fb1c131f58..2ba5c0fd55db 100644 --- a/sound/pci/rme96.c +++ b/sound/pci/rme96.c | |||
@@ -232,14 +232,10 @@ struct rme96 { | |||
232 | }; | 232 | }; |
233 | 233 | ||
234 | static struct pci_device_id snd_rme96_ids[] = { | 234 | static struct pci_device_id snd_rme96_ids[] = { |
235 | { PCI_VENDOR_ID_XILINX, PCI_DEVICE_ID_RME_DIGI96, | 235 | { PCI_VDEVICE(XILINX, PCI_DEVICE_ID_RME_DIGI96), 0, }, |
236 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, | 236 | { PCI_VDEVICE(XILINX, PCI_DEVICE_ID_RME_DIGI96_8), 0, }, |
237 | { PCI_VENDOR_ID_XILINX, PCI_DEVICE_ID_RME_DIGI96_8, | 237 | { PCI_VDEVICE(XILINX, PCI_DEVICE_ID_RME_DIGI96_8_PRO), 0, }, |
238 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, | 238 | { PCI_VDEVICE(XILINX, PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST), 0, }, |
239 | { PCI_VENDOR_ID_XILINX, PCI_DEVICE_ID_RME_DIGI96_8_PRO, | ||
240 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, | ||
241 | { PCI_VENDOR_ID_XILINX, PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST, | ||
242 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, | ||
243 | { 0, } | 239 | { 0, } |
244 | }; | 240 | }; |
245 | 241 | ||
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index 3da5c029f93b..7bb827c7d806 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c | |||
@@ -3294,15 +3294,33 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) | |||
3294 | char *clock_source; | 3294 | char *clock_source; |
3295 | int x; | 3295 | int x; |
3296 | 3296 | ||
3297 | if (hdsp_check_for_iobox (hdsp)) { | 3297 | status = hdsp_read(hdsp, HDSP_statusRegister); |
3298 | snd_iprintf(buffer, "No I/O box connected.\nPlease connect one and upload firmware.\n"); | 3298 | status2 = hdsp_read(hdsp, HDSP_status2Register); |
3299 | |||
3300 | snd_iprintf(buffer, "%s (Card #%d)\n", hdsp->card_name, | ||
3301 | hdsp->card->number + 1); | ||
3302 | snd_iprintf(buffer, "Buffers: capture %p playback %p\n", | ||
3303 | hdsp->capture_buffer, hdsp->playback_buffer); | ||
3304 | snd_iprintf(buffer, "IRQ: %d Registers bus: 0x%lx VM: 0x%lx\n", | ||
3305 | hdsp->irq, hdsp->port, (unsigned long)hdsp->iobase); | ||
3306 | snd_iprintf(buffer, "Control register: 0x%x\n", hdsp->control_register); | ||
3307 | snd_iprintf(buffer, "Control2 register: 0x%x\n", | ||
3308 | hdsp->control2_register); | ||
3309 | snd_iprintf(buffer, "Status register: 0x%x\n", status); | ||
3310 | snd_iprintf(buffer, "Status2 register: 0x%x\n", status2); | ||
3311 | |||
3312 | if (hdsp_check_for_iobox(hdsp)) { | ||
3313 | snd_iprintf(buffer, "No I/O box connected.\n" | ||
3314 | "Please connect one and upload firmware.\n"); | ||
3299 | return; | 3315 | return; |
3300 | } | 3316 | } |
3301 | 3317 | ||
3302 | if (hdsp_check_for_firmware(hdsp, 0)) { | 3318 | if (hdsp_check_for_firmware(hdsp, 0)) { |
3303 | if (hdsp->state & HDSP_FirmwareCached) { | 3319 | if (hdsp->state & HDSP_FirmwareCached) { |
3304 | if (snd_hdsp_load_firmware_from_cache(hdsp) != 0) { | 3320 | if (snd_hdsp_load_firmware_from_cache(hdsp) != 0) { |
3305 | snd_iprintf(buffer, "Firmware loading from cache failed, please upload manually.\n"); | 3321 | snd_iprintf(buffer, "Firmware loading from " |
3322 | "cache failed, " | ||
3323 | "please upload manually.\n"); | ||
3306 | return; | 3324 | return; |
3307 | } | 3325 | } |
3308 | } else { | 3326 | } else { |
@@ -3319,18 +3337,6 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) | |||
3319 | } | 3337 | } |
3320 | } | 3338 | } |
3321 | 3339 | ||
3322 | status = hdsp_read(hdsp, HDSP_statusRegister); | ||
3323 | status2 = hdsp_read(hdsp, HDSP_status2Register); | ||
3324 | |||
3325 | snd_iprintf(buffer, "%s (Card #%d)\n", hdsp->card_name, hdsp->card->number + 1); | ||
3326 | snd_iprintf(buffer, "Buffers: capture %p playback %p\n", | ||
3327 | hdsp->capture_buffer, hdsp->playback_buffer); | ||
3328 | snd_iprintf(buffer, "IRQ: %d Registers bus: 0x%lx VM: 0x%lx\n", | ||
3329 | hdsp->irq, hdsp->port, (unsigned long)hdsp->iobase); | ||
3330 | snd_iprintf(buffer, "Control register: 0x%x\n", hdsp->control_register); | ||
3331 | snd_iprintf(buffer, "Control2 register: 0x%x\n", hdsp->control2_register); | ||
3332 | snd_iprintf(buffer, "Status register: 0x%x\n", status); | ||
3333 | snd_iprintf(buffer, "Status2 register: 0x%x\n", status2); | ||
3334 | snd_iprintf(buffer, "FIFO status: %d\n", hdsp_read(hdsp, HDSP_fifoStatus) & 0xff); | 3340 | snd_iprintf(buffer, "FIFO status: %d\n", hdsp_read(hdsp, HDSP_fifoStatus) & 0xff); |
3335 | snd_iprintf(buffer, "MIDI1 Output status: 0x%x\n", hdsp_read(hdsp, HDSP_midiStatusOut0)); | 3341 | snd_iprintf(buffer, "MIDI1 Output status: 0x%x\n", hdsp_read(hdsp, HDSP_midiStatusOut0)); |
3336 | snd_iprintf(buffer, "MIDI1 Input status: 0x%x\n", hdsp_read(hdsp, HDSP_midiStatusIn0)); | 3342 | snd_iprintf(buffer, "MIDI1 Input status: 0x%x\n", hdsp_read(hdsp, HDSP_midiStatusIn0)); |
@@ -3351,7 +3357,6 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) | |||
3351 | 3357 | ||
3352 | snd_iprintf(buffer, "\n"); | 3358 | snd_iprintf(buffer, "\n"); |
3353 | 3359 | ||
3354 | |||
3355 | switch (hdsp_clock_source(hdsp)) { | 3360 | switch (hdsp_clock_source(hdsp)) { |
3356 | case HDSP_CLOCK_SOURCE_AUTOSYNC: | 3361 | case HDSP_CLOCK_SOURCE_AUTOSYNC: |
3357 | clock_source = "AutoSync"; | 3362 | clock_source = "AutoSync"; |
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c index 7dc60ad4772e..1f6406c4534d 100644 --- a/sound/pci/sonicvibes.c +++ b/sound/pci/sonicvibes.c | |||
@@ -243,7 +243,7 @@ struct sonicvibes { | |||
243 | }; | 243 | }; |
244 | 244 | ||
245 | static struct pci_device_id snd_sonic_ids[] = { | 245 | static struct pci_device_id snd_sonic_ids[] = { |
246 | { 0x5333, 0xca00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, | 246 | { PCI_VDEVICE(S3, 0xca00), 0, }, |
247 | { 0, } | 247 | { 0, } |
248 | }; | 248 | }; |
249 | 249 | ||
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index 949fcaf6b70e..acfa4760da49 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c | |||
@@ -402,9 +402,9 @@ struct via82xx { | |||
402 | 402 | ||
403 | static struct pci_device_id snd_via82xx_ids[] = { | 403 | static struct pci_device_id snd_via82xx_ids[] = { |
404 | /* 0x1106, 0x3058 */ | 404 | /* 0x1106, 0x3058 */ |
405 | { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TYPE_CARD_VIA686, }, /* 686A */ | 405 | { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_82C686_5), TYPE_CARD_VIA686, }, /* 686A */ |
406 | /* 0x1106, 0x3059 */ | 406 | /* 0x1106, 0x3059 */ |
407 | { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8233_5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TYPE_CARD_VIA8233, }, /* VT8233 */ | 407 | { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8233_5), TYPE_CARD_VIA8233, }, /* VT8233 */ |
408 | { 0, } | 408 | { 0, } |
409 | }; | 409 | }; |
410 | 410 | ||
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c index 0d54e3503c1e..47eb61561dfc 100644 --- a/sound/pci/via82xx_modem.c +++ b/sound/pci/via82xx_modem.c | |||
@@ -261,7 +261,7 @@ struct via82xx_modem { | |||
261 | }; | 261 | }; |
262 | 262 | ||
263 | static struct pci_device_id snd_via82xx_modem_ids[] = { | 263 | static struct pci_device_id snd_via82xx_modem_ids[] = { |
264 | { 0x1106, 0x3068, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TYPE_CARD_VIA82XX_MODEM, }, | 264 | { PCI_VDEVICE(VIA, 0x3068), TYPE_CARD_VIA82XX_MODEM, }, |
265 | { 0, } | 265 | { 0, } |
266 | }; | 266 | }; |
267 | 267 | ||
diff --git a/sound/pci/vx222/vx222_ops.c b/sound/pci/vx222/vx222_ops.c index 6416d3f0c7be..a69e774d0b13 100644 --- a/sound/pci/vx222/vx222_ops.c +++ b/sound/pci/vx222/vx222_ops.c | |||
@@ -885,10 +885,10 @@ static int vx_input_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem | |||
885 | struct vx_core *_chip = snd_kcontrol_chip(kcontrol); | 885 | struct vx_core *_chip = snd_kcontrol_chip(kcontrol); |
886 | struct snd_vx222 *chip = (struct snd_vx222 *)_chip; | 886 | struct snd_vx222 *chip = (struct snd_vx222 *)_chip; |
887 | if (ucontrol->value.integer.value[0] < 0 || | 887 | if (ucontrol->value.integer.value[0] < 0 || |
888 | ucontrol->value.integer.value[0] < MIC_LEVEL_MAX) | 888 | ucontrol->value.integer.value[0] > MIC_LEVEL_MAX) |
889 | return -EINVAL; | 889 | return -EINVAL; |
890 | if (ucontrol->value.integer.value[1] < 0 || | 890 | if (ucontrol->value.integer.value[1] < 0 || |
891 | ucontrol->value.integer.value[1] < MIC_LEVEL_MAX) | 891 | ucontrol->value.integer.value[1] > MIC_LEVEL_MAX) |
892 | return -EINVAL; | 892 | return -EINVAL; |
893 | mutex_lock(&_chip->mixer_mutex); | 893 | mutex_lock(&_chip->mixer_mutex); |
894 | if (chip->input_level[0] != ucontrol->value.integer.value[0] || | 894 | if (chip->input_level[0] != ucontrol->value.integer.value[0] || |
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c index 4af66661f9b0..e6b18b90d451 100644 --- a/sound/pci/ymfpci/ymfpci.c +++ b/sound/pci/ymfpci/ymfpci.c | |||
@@ -67,12 +67,12 @@ module_param_array(rear_switch, bool, NULL, 0444); | |||
67 | MODULE_PARM_DESC(rear_switch, "Enable shared rear/line-in switch"); | 67 | MODULE_PARM_DESC(rear_switch, "Enable shared rear/line-in switch"); |
68 | 68 | ||
69 | static struct pci_device_id snd_ymfpci_ids[] = { | 69 | static struct pci_device_id snd_ymfpci_ids[] = { |
70 | { 0x1073, 0x0004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* YMF724 */ | 70 | { PCI_VDEVICE(YAMAHA, 0x0004), 0, }, /* YMF724 */ |
71 | { 0x1073, 0x000d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* YMF724F */ | 71 | { PCI_VDEVICE(YAMAHA, 0x000d), 0, }, /* YMF724F */ |
72 | { 0x1073, 0x000a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* YMF740 */ | 72 | { PCI_VDEVICE(YAMAHA, 0x000a), 0, }, /* YMF740 */ |
73 | { 0x1073, 0x000c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* YMF740C */ | 73 | { PCI_VDEVICE(YAMAHA, 0x000c), 0, }, /* YMF740C */ |
74 | { 0x1073, 0x0010, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* YMF744 */ | 74 | { PCI_VDEVICE(YAMAHA, 0x0010), 0, }, /* YMF744 */ |
75 | { 0x1073, 0x0012, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* YMF754 */ | 75 | { PCI_VDEVICE(YAMAHA, 0x0012), 0, }, /* YMF754 */ |
76 | { 0, } | 76 | { 0, } |
77 | }; | 77 | }; |
78 | 78 | ||
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index 2f0925236a1b..5518371db13f 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c | |||
@@ -834,7 +834,7 @@ static irqreturn_t snd_ymfpci_interrupt(int irq, void *dev_id) | |||
834 | status = snd_ymfpci_readw(chip, YDSXGR_INTFLAG); | 834 | status = snd_ymfpci_readw(chip, YDSXGR_INTFLAG); |
835 | if (status & 1) { | 835 | if (status & 1) { |
836 | if (chip->timer) | 836 | if (chip->timer) |
837 | snd_timer_interrupt(chip->timer, chip->timer->sticks); | 837 | snd_timer_interrupt(chip->timer, chip->timer_ticks); |
838 | } | 838 | } |
839 | snd_ymfpci_writew(chip, YDSXGR_INTFLAG, status); | 839 | snd_ymfpci_writew(chip, YDSXGR_INTFLAG, status); |
840 | 840 | ||
@@ -1885,8 +1885,18 @@ static int snd_ymfpci_timer_start(struct snd_timer *timer) | |||
1885 | unsigned int count; | 1885 | unsigned int count; |
1886 | 1886 | ||
1887 | chip = snd_timer_chip(timer); | 1887 | chip = snd_timer_chip(timer); |
1888 | count = (timer->sticks << 1) - 1; | ||
1889 | spin_lock_irqsave(&chip->reg_lock, flags); | 1888 | spin_lock_irqsave(&chip->reg_lock, flags); |
1889 | if (timer->sticks > 1) { | ||
1890 | chip->timer_ticks = timer->sticks; | ||
1891 | count = timer->sticks - 1; | ||
1892 | } else { | ||
1893 | /* | ||
1894 | * Divisor 1 is not allowed; fake it by using divisor 2 and | ||
1895 | * counting two ticks for each interrupt. | ||
1896 | */ | ||
1897 | chip->timer_ticks = 2; | ||
1898 | count = 2 - 1; | ||
1899 | } | ||
1890 | snd_ymfpci_writew(chip, YDSXGR_TIMERCOUNT, count); | 1900 | snd_ymfpci_writew(chip, YDSXGR_TIMERCOUNT, count); |
1891 | snd_ymfpci_writeb(chip, YDSXGR_TIMERCTRL, 0x03); | 1901 | snd_ymfpci_writeb(chip, YDSXGR_TIMERCTRL, 0x03); |
1892 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1902 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
@@ -1909,14 +1919,14 @@ static int snd_ymfpci_timer_precise_resolution(struct snd_timer *timer, | |||
1909 | unsigned long *num, unsigned long *den) | 1919 | unsigned long *num, unsigned long *den) |
1910 | { | 1920 | { |
1911 | *num = 1; | 1921 | *num = 1; |
1912 | *den = 48000; | 1922 | *den = 96000; |
1913 | return 0; | 1923 | return 0; |
1914 | } | 1924 | } |
1915 | 1925 | ||
1916 | static struct snd_timer_hardware snd_ymfpci_timer_hw = { | 1926 | static struct snd_timer_hardware snd_ymfpci_timer_hw = { |
1917 | .flags = SNDRV_TIMER_HW_AUTO, | 1927 | .flags = SNDRV_TIMER_HW_AUTO, |
1918 | .resolution = 20833, /* 1/fs = 20.8333...us */ | 1928 | .resolution = 10417, /* 1 / 96 kHz = 10.41666...us */ |
1919 | .ticks = 0x8000, | 1929 | .ticks = 0x10000, |
1920 | .start = snd_ymfpci_timer_start, | 1930 | .start = snd_ymfpci_timer_start, |
1921 | .stop = snd_ymfpci_timer_stop, | 1931 | .stop = snd_ymfpci_timer_stop, |
1922 | .precise_resolution = snd_ymfpci_timer_precise_resolution, | 1932 | .precise_resolution = snd_ymfpci_timer_precise_resolution, |