aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/emu10k1/emu10k1_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/emu10k1/emu10k1_main.c')
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c494
1 files changed, 258 insertions, 236 deletions
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index 2f283ea6ad9a..dee7ebabccee 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -69,7 +69,7 @@ MODULE_FIRMWARE(EMU1010_NOTEBOOK_FILENAME);
69 * EMU10K1 init / done 69 * EMU10K1 init / done
70 *************************************************************************/ 70 *************************************************************************/
71 71
72void snd_emu10k1_voice_init(struct snd_emu10k1 * emu, int ch) 72void snd_emu10k1_voice_init(struct snd_emu10k1 *emu, int ch)
73{ 73{
74 snd_emu10k1_ptr_write(emu, DCYSUSV, ch, 0); 74 snd_emu10k1_ptr_write(emu, DCYSUSV, ch, 0);
75 snd_emu10k1_ptr_write(emu, IP, ch, 0); 75 snd_emu10k1_ptr_write(emu, IP, ch, 0);
@@ -151,9 +151,9 @@ static unsigned int i2c_adc_init[][2] = {
151 { 0x12, 0x32 }, /* ALC Control 3 */ 151 { 0x12, 0x32 }, /* ALC Control 3 */
152 { 0x13, 0x00 }, /* Noise gate control */ 152 { 0x13, 0x00 }, /* Noise gate control */
153 { 0x14, 0xa6 }, /* Limiter control */ 153 { 0x14, 0xa6 }, /* Limiter control */
154 { 0x15, ADC_MUX_2 }, /* ADC Mixer control. Mic for Audigy 2 ZS Notebook */ 154 { 0x15, ADC_MUX_2 }, /* ADC Mixer control. Mic for A2ZS Notebook */
155}; 155};
156 156
157static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) 157static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
158{ 158{
159 unsigned int silent_page; 159 unsigned int silent_page;
@@ -161,8 +161,8 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
161 u32 tmp; 161 u32 tmp;
162 162
163 /* disable audio and lock cache */ 163 /* disable audio and lock cache */
164 outl(HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK | HCFG_MUTEBUTTONENABLE, 164 outl(HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK |
165 emu->port + HCFG); 165 HCFG_MUTEBUTTONENABLE, emu->port + HCFG);
166 166
167 /* reset recording buffers */ 167 /* reset recording buffers */
168 snd_emu10k1_ptr_write(emu, MICBS, 0, ADCBS_BUFSIZE_NONE); 168 snd_emu10k1_ptr_write(emu, MICBS, 0, ADCBS_BUFSIZE_NONE);
@@ -179,7 +179,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
179 snd_emu10k1_ptr_write(emu, SOLEL, 0, 0); 179 snd_emu10k1_ptr_write(emu, SOLEL, 0, 0);
180 snd_emu10k1_ptr_write(emu, SOLEH, 0, 0); 180 snd_emu10k1_ptr_write(emu, SOLEH, 0, 0);
181 181
182 if (emu->audigy){ 182 if (emu->audigy) {
183 /* set SPDIF bypass mode */ 183 /* set SPDIF bypass mode */
184 snd_emu10k1_ptr_write(emu, SPBYPASS, 0, SPBYPASS_FORMAT); 184 snd_emu10k1_ptr_write(emu, SPBYPASS, 0, SPBYPASS_FORMAT);
185 /* enable rear left + rear right AC97 slots */ 185 /* enable rear left + rear right AC97 slots */
@@ -197,12 +197,12 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
197 197
198 if (emu->card_capabilities->ca0151_chip) { /* audigy2 */ 198 if (emu->card_capabilities->ca0151_chip) { /* audigy2 */
199 /* Hacks for Alice3 to work independent of haP16V driver */ 199 /* Hacks for Alice3 to work independent of haP16V driver */
200 //Setup SRCMulti_I2S SamplingRate 200 /* Setup SRCMulti_I2S SamplingRate */
201 tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0); 201 tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0);
202 tmp &= 0xfffff1ff; 202 tmp &= 0xfffff1ff;
203 tmp |= (0x2<<9); 203 tmp |= (0x2<<9);
204 snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, 0, tmp); 204 snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, 0, tmp);
205 205
206 /* Setup SRCSel (Enable Spdif,I2S SRCMulti) */ 206 /* Setup SRCSel (Enable Spdif,I2S SRCMulti) */
207 snd_emu10k1_ptr20_write(emu, SRCSel, 0, 0x14); 207 snd_emu10k1_ptr20_write(emu, SRCSel, 0, 0x14);
208 /* Setup SRCMulti Input Audio Enable */ 208 /* Setup SRCMulti Input Audio Enable */
@@ -217,7 +217,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
217 if (emu->card_capabilities->ca0108_chip) { /* audigy2 Value */ 217 if (emu->card_capabilities->ca0108_chip) { /* audigy2 Value */
218 /* Hacks for Alice3 to work independent of haP16V driver */ 218 /* Hacks for Alice3 to work independent of haP16V driver */
219 snd_printk(KERN_INFO "Audigy2 value: Special config.\n"); 219 snd_printk(KERN_INFO "Audigy2 value: Special config.\n");
220 //Setup SRCMulti_I2S SamplingRate 220 /* Setup SRCMulti_I2S SamplingRate */
221 tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0); 221 tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0);
222 tmp &= 0xfffff1ff; 222 tmp &= 0xfffff1ff;
223 tmp |= (0x2<<9); 223 tmp |= (0x2<<9);
@@ -270,13 +270,13 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
270 size = ARRAY_SIZE(i2c_adc_init); 270 size = ARRAY_SIZE(i2c_adc_init);
271 for (n = 0; n < size; n++) 271 for (n = 0; n < size; n++)
272 snd_emu10k1_i2c_write(emu, i2c_adc_init[n][0], i2c_adc_init[n][1]); 272 snd_emu10k1_i2c_write(emu, i2c_adc_init[n][0], i2c_adc_init[n][1]);
273 for (n=0; n < 4; n++) { 273 for (n = 0; n < 4; n++) {
274 emu->i2c_capture_volume[n][0]= 0xcf; 274 emu->i2c_capture_volume[n][0] = 0xcf;
275 emu->i2c_capture_volume[n][1]= 0xcf; 275 emu->i2c_capture_volume[n][1] = 0xcf;
276 } 276 }
277 } 277 }
278 278
279 279
280 snd_emu10k1_ptr_write(emu, PTB, 0, emu->ptb_pages.addr); 280 snd_emu10k1_ptr_write(emu, PTB, 0, emu->ptb_pages.addr);
281 snd_emu10k1_ptr_write(emu, TCB, 0, 0); /* taken from original driver */ 281 snd_emu10k1_ptr_write(emu, TCB, 0, 0); /* taken from original driver */
282 snd_emu10k1_ptr_write(emu, TCBS, 0, 4); /* taken from original driver */ 282 snd_emu10k1_ptr_write(emu, TCBS, 0, 4); /* taken from original driver */
@@ -313,7 +313,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
313 (emu->model == 0x21 && emu->revision < 6)) 313 (emu->model == 0x21 && emu->revision < 6))
314 outl(HCFG_LOCKTANKCACHE_MASK | HCFG_AUTOMUTE, emu->port + HCFG); 314 outl(HCFG_LOCKTANKCACHE_MASK | HCFG_AUTOMUTE, emu->port + HCFG);
315 else 315 else
316 // With on-chip joystick 316 /* With on-chip joystick */
317 outl(HCFG_LOCKTANKCACHE_MASK | HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG); 317 outl(HCFG_LOCKTANKCACHE_MASK | HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG);
318 318
319 if (enable_ir) { /* enable IR for SB Live */ 319 if (enable_ir) { /* enable IR for SB Live */
@@ -335,9 +335,9 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
335 outl(reg | HCFG_GPOUT1 | HCFG_GPOUT2, emu->port + HCFG); 335 outl(reg | HCFG_GPOUT1 | HCFG_GPOUT2, emu->port + HCFG);
336 udelay(100); 336 udelay(100);
337 outl(reg, emu->port + HCFG); 337 outl(reg, emu->port + HCFG);
338 } 338 }
339 } 339 }
340 340
341 if (emu->card_capabilities->emu_model) { 341 if (emu->card_capabilities->emu_model) {
342 ; /* Disable all access to A_IOCFG for the emu1010 */ 342 ; /* Disable all access to A_IOCFG for the emu1010 */
343 } else if (emu->card_capabilities->i2c_adc) { 343 } else if (emu->card_capabilities->i2c_adc) {
@@ -364,7 +364,7 @@ static void snd_emu10k1_audio_enable(struct snd_emu10k1 *emu)
364 ; /* Disable A_IOCFG for Audigy 2 ZS Notebook */ 364 ; /* Disable A_IOCFG for Audigy 2 ZS Notebook */
365 } else if (emu->audigy) { 365 } else if (emu->audigy) {
366 outl(inl(emu->port + A_IOCFG) & ~0x44, emu->port + A_IOCFG); 366 outl(inl(emu->port + A_IOCFG) & ~0x44, emu->port + A_IOCFG);
367 367
368 if (emu->card_capabilities->ca0151_chip) { /* audigy2 */ 368 if (emu->card_capabilities->ca0151_chip) { /* audigy2 */
369 /* Unmute Analog now. Set GPO6 to 1 for Apollo. 369 /* Unmute Analog now. Set GPO6 to 1 for Apollo.
370 * This has to be done after init ALice3 I2SOut beyond 48KHz. 370 * This has to be done after init ALice3 I2SOut beyond 48KHz.
@@ -378,12 +378,12 @@ static void snd_emu10k1_audio_enable(struct snd_emu10k1 *emu)
378 outl(inl(emu->port + A_IOCFG) | 0x0080, emu->port + A_IOCFG); 378 outl(inl(emu->port + A_IOCFG) | 0x0080, emu->port + A_IOCFG);
379 } 379 }
380 } 380 }
381 381
382#if 0 382#if 0
383 { 383 {
384 unsigned int tmp; 384 unsigned int tmp;
385 /* FIXME: the following routine disables LiveDrive-II !! */ 385 /* FIXME: the following routine disables LiveDrive-II !! */
386 // TOSLink detection 386 /* TOSLink detection */
387 emu->tos_link = 0; 387 emu->tos_link = 0;
388 tmp = inl(emu->port + HCFG); 388 tmp = inl(emu->port + HCFG);
389 if (tmp & (HCFG_GPINPUT0 | HCFG_GPINPUT1)) { 389 if (tmp & (HCFG_GPINPUT0 | HCFG_GPINPUT1)) {
@@ -400,7 +400,7 @@ static void snd_emu10k1_audio_enable(struct snd_emu10k1 *emu)
400 snd_emu10k1_intr_enable(emu, INTE_PCIERRORENABLE); 400 snd_emu10k1_intr_enable(emu, INTE_PCIERRORENABLE);
401} 401}
402 402
403int snd_emu10k1_done(struct snd_emu10k1 * emu) 403int snd_emu10k1_done(struct snd_emu10k1 *emu)
404{ 404{
405 int ch; 405 int ch;
406 406
@@ -495,7 +495,7 @@ int snd_emu10k1_done(struct snd_emu10k1 * emu)
495 495
496#define EC_LAST_PROMFILE_ADDR 0x2f 496#define EC_LAST_PROMFILE_ADDR 0x2f
497 497
498#define EC_SERIALNUM_ADDR 0x30 /* First word of serial number. The 498#define EC_SERIALNUM_ADDR 0x30 /* First word of serial number. The
499 * can be up to 30 characters in length 499 * can be up to 30 characters in length
500 * and is stored as a NULL-terminated 500 * and is stored as a NULL-terminated
501 * ASCII string. Any unused bytes must be 501 * ASCII string. Any unused bytes must be
@@ -503,8 +503,8 @@ int snd_emu10k1_done(struct snd_emu10k1 * emu)
503#define EC_CHECKSUM_ADDR 0x3f /* Location at which checksum is stored */ 503#define EC_CHECKSUM_ADDR 0x3f /* Location at which checksum is stored */
504 504
505 505
506/* Most of this stuff is pretty self-evident. According to the hardware 506/* Most of this stuff is pretty self-evident. According to the hardware
507 * dudes, we need to leave the ADCCAL bit low in order to avoid a DC 507 * dudes, we need to leave the ADCCAL bit low in order to avoid a DC
508 * offset problem. Weird. 508 * offset problem. Weird.
509 */ 509 */
510#define EC_RAW_RUN_MODE (EC_DACMUTEN | EC_ADCRSTN | EC_TRIM_MUTEN | \ 510#define EC_RAW_RUN_MODE (EC_DACMUTEN | EC_ADCRSTN | EC_TRIM_MUTEN | \
@@ -523,7 +523,7 @@ int snd_emu10k1_done(struct snd_emu10k1 * emu)
523 * register. 523 * register.
524 */ 524 */
525 525
526static void snd_emu10k1_ecard_write(struct snd_emu10k1 * emu, unsigned int value) 526static void snd_emu10k1_ecard_write(struct snd_emu10k1 *emu, unsigned int value)
527{ 527{
528 unsigned short count; 528 unsigned short count;
529 unsigned int data; 529 unsigned int data;
@@ -561,7 +561,7 @@ static void snd_emu10k1_ecard_write(struct snd_emu10k1 * emu, unsigned int value
561 * channel. 561 * channel.
562 */ 562 */
563 563
564static void snd_emu10k1_ecard_setadcgain(struct snd_emu10k1 * emu, 564static void snd_emu10k1_ecard_setadcgain(struct snd_emu10k1 *emu,
565 unsigned short gain) 565 unsigned short gain)
566{ 566{
567 unsigned int bit; 567 unsigned int bit;
@@ -574,7 +574,7 @@ static void snd_emu10k1_ecard_setadcgain(struct snd_emu10k1 * emu,
574 574
575 for (bit = (1 << 15); bit; bit >>= 1) { 575 for (bit = (1 << 15); bit; bit >>= 1) {
576 unsigned int value; 576 unsigned int value;
577 577
578 value = emu->ecard_ctrl & ~(EC_TRIM_CSN | EC_TRIM_SDATA); 578 value = emu->ecard_ctrl & ~(EC_TRIM_CSN | EC_TRIM_SDATA);
579 579
580 if (gain & bit) 580 if (gain & bit)
@@ -589,7 +589,7 @@ static void snd_emu10k1_ecard_setadcgain(struct snd_emu10k1 * emu,
589 snd_emu10k1_ecard_write(emu, emu->ecard_ctrl); 589 snd_emu10k1_ecard_write(emu, emu->ecard_ctrl);
590} 590}
591 591
592static int snd_emu10k1_ecard_init(struct snd_emu10k1 * emu) 592static int snd_emu10k1_ecard_init(struct snd_emu10k1 *emu)
593{ 593{
594 unsigned int hc_value; 594 unsigned int hc_value;
595 595
@@ -598,7 +598,7 @@ static int snd_emu10k1_ecard_init(struct snd_emu10k1 * emu)
598 EC_SPDIF0_SELECT(EC_DEFAULT_SPDIF0_SEL) | 598 EC_SPDIF0_SELECT(EC_DEFAULT_SPDIF0_SEL) |
599 EC_SPDIF1_SELECT(EC_DEFAULT_SPDIF1_SEL); 599 EC_SPDIF1_SELECT(EC_DEFAULT_SPDIF1_SEL);
600 600
601 /* Step 0: Set the codec type in the hardware control register 601 /* Step 0: Set the codec type in the hardware control register
602 * and enable audio output */ 602 * and enable audio output */
603 hc_value = inl(emu->port + HCFG); 603 hc_value = inl(emu->port + HCFG);
604 outl(hc_value | HCFG_AUDIOENABLE | HCFG_CODECFORMAT_I2S, emu->port + HCFG); 604 outl(hc_value | HCFG_AUDIOENABLE | HCFG_CODECFORMAT_I2S, emu->port + HCFG);
@@ -629,7 +629,7 @@ static int snd_emu10k1_ecard_init(struct snd_emu10k1 * emu)
629 return 0; 629 return 0;
630} 630}
631 631
632static int snd_emu10k1_cardbus_init(struct snd_emu10k1 * emu) 632static int snd_emu10k1_cardbus_init(struct snd_emu10k1 *emu)
633{ 633{
634 unsigned long special_port; 634 unsigned long special_port;
635 unsigned int value; 635 unsigned int value;
@@ -656,7 +656,7 @@ static int snd_emu10k1_cardbus_init(struct snd_emu10k1 * emu)
656 return 0; 656 return 0;
657} 657}
658 658
659static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * filename) 659static int snd_emu1010_load_firmware(struct snd_emu10k1 *emu, const char *filename)
660{ 660{
661 int err; 661 int err;
662 int n, i; 662 int n, i;
@@ -666,11 +666,12 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * file
666 unsigned long flags; 666 unsigned long flags;
667 const struct firmware *fw_entry; 667 const struct firmware *fw_entry;
668 668
669 if ((err = request_firmware(&fw_entry, filename, &emu->pci->dev)) != 0) { 669 err = request_firmware(&fw_entry, filename, &emu->pci->dev);
670 snd_printk(KERN_ERR "firmware: %s not found. Err=%d\n",filename, err); 670 if (err != 0) {
671 snd_printk(KERN_ERR "firmware: %s not found. Err = %d\n", filename, err);
671 return err; 672 return err;
672 } 673 }
673 snd_printk(KERN_INFO "firmware size=0x%zx\n", fw_entry->size); 674 snd_printk(KERN_INFO "firmware size = 0x%zx\n", fw_entry->size);
674 675
675 /* The FPGA is a Xilinx Spartan IIE XC2S50E */ 676 /* The FPGA is a Xilinx Spartan IIE XC2S50E */
676 /* GPIO7 -> FPGA PGMN 677 /* GPIO7 -> FPGA PGMN
@@ -685,13 +686,13 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * file
685 outl(0x80, emu->port + A_IOCFG); /* Leave bit 7 set during netlist setup. */ 686 outl(0x80, emu->port + A_IOCFG); /* Leave bit 7 set during netlist setup. */
686 write_post = inl(emu->port + A_IOCFG); 687 write_post = inl(emu->port + A_IOCFG);
687 udelay(100); /* Allow FPGA memory to clean */ 688 udelay(100); /* Allow FPGA memory to clean */
688 for(n = 0; n < fw_entry->size; n++) { 689 for (n = 0; n < fw_entry->size; n++) {
689 value=fw_entry->data[n]; 690 value = fw_entry->data[n];
690 for(i = 0; i < 8; i++) { 691 for (i = 0; i < 8; i++) {
691 reg = 0x80; 692 reg = 0x80;
692 if (value & 0x1) 693 if (value & 0x1)
693 reg = reg | 0x20; 694 reg = reg | 0x20;
694 value = value >> 1; 695 value = value >> 1;
695 outl(reg, emu->port + A_IOCFG); 696 outl(reg, emu->port + A_IOCFG);
696 write_post = inl(emu->port + A_IOCFG); 697 write_post = inl(emu->port + A_IOCFG);
697 outl(reg | 0x40, emu->port + A_IOCFG); 698 outl(reg | 0x40, emu->port + A_IOCFG);
@@ -703,14 +704,14 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * file
703 write_post = inl(emu->port + A_IOCFG); 704 write_post = inl(emu->port + A_IOCFG);
704 spin_unlock_irqrestore(&emu->emu_lock, flags); 705 spin_unlock_irqrestore(&emu->emu_lock, flags);
705 706
706 release_firmware(fw_entry); 707 release_firmware(fw_entry);
707 return 0; 708 return 0;
708} 709}
709 710
710static int emu1010_firmware_thread(void *data) 711static int emu1010_firmware_thread(void *data)
711{ 712{
712 struct snd_emu10k1 * emu = data; 713 struct snd_emu10k1 *emu = data;
713 int tmp,tmp2; 714 int tmp, tmp2;
714 int reg; 715 int reg;
715 int err; 716 int err;
716 717
@@ -719,50 +720,50 @@ static int emu1010_firmware_thread(void *data)
719 msleep_interruptible(1000); 720 msleep_interruptible(1000);
720 if (kthread_should_stop()) 721 if (kthread_should_stop())
721 break; 722 break;
722 snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &tmp ); /* IRQ Status */ 723 snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &tmp); /* IRQ Status */
723 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg ); /* OPTIONS: Which cards are attached to the EMU */ 724 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg); /* OPTIONS: Which cards are attached to the EMU */
724 if (reg & EMU_HANA_OPTION_DOCK_OFFLINE) { 725 if (reg & EMU_HANA_OPTION_DOCK_OFFLINE) {
725 /* Audio Dock attached */ 726 /* Audio Dock attached */
726 /* Return to Audio Dock programming mode */ 727 /* Return to Audio Dock programming mode */
727 snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware\n"); 728 snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware\n");
728 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, EMU_HANA_FPGA_CONFIG_AUDIODOCK ); 729 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, EMU_HANA_FPGA_CONFIG_AUDIODOCK);
729 if (emu->card_capabilities->emu_model == 730 if (emu->card_capabilities->emu_model ==
730 EMU_MODEL_EMU1010) { 731 EMU_MODEL_EMU1010) {
731 if ((err = snd_emu1010_load_firmware(emu, DOCK_FILENAME)) != 0) { 732 err = snd_emu1010_load_firmware(emu, DOCK_FILENAME);
733 if (err != 0)
732 continue; 734 continue;
733 }
734 } else if (emu->card_capabilities->emu_model == 735 } else if (emu->card_capabilities->emu_model ==
735 EMU_MODEL_EMU1010B) { 736 EMU_MODEL_EMU1010B) {
736 if ((err = snd_emu1010_load_firmware(emu, MICRO_DOCK_FILENAME)) != 0) { 737 err = snd_emu1010_load_firmware(emu, MICRO_DOCK_FILENAME);
738 if (err != 0)
737 continue; 739 continue;
738 }
739 } else if (emu->card_capabilities->emu_model == 740 } else if (emu->card_capabilities->emu_model ==
740 EMU_MODEL_EMU1616) { 741 EMU_MODEL_EMU1616) {
741 if ((err = snd_emu1010_load_firmware(emu, MICRO_DOCK_FILENAME)) != 0) { 742 err = snd_emu1010_load_firmware(emu, MICRO_DOCK_FILENAME);
743 if (err != 0)
742 continue; 744 continue;
743 }
744 } 745 }
745 746
746 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0 ); 747 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0);
747 snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &reg ); 748 snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &reg);
748 snd_printk(KERN_INFO "emu1010: EMU_HANA+DOCK_IRQ_STATUS=0x%x\n",reg); 749 snd_printk(KERN_INFO "emu1010: EMU_HANA+DOCK_IRQ_STATUS = 0x%x\n", reg);
749 /* ID, should read & 0x7f = 0x55 when FPGA programmed. */ 750 /* ID, should read & 0x7f = 0x55 when FPGA programmed. */
750 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg ); 751 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg);
751 snd_printk(KERN_INFO "emu1010: EMU_HANA+DOCK_ID=0x%x\n",reg); 752 snd_printk(KERN_INFO "emu1010: EMU_HANA+DOCK_ID = 0x%x\n", reg);
752 if ((reg & 0x1f) != 0x15) { 753 if ((reg & 0x1f) != 0x15) {
753 /* FPGA failed to be programmed */ 754 /* FPGA failed to be programmed */
754 snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware file failed, reg=0x%x\n", reg); 755 snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware file failed, reg = 0x%x\n", reg);
755 continue; 756 continue;
756 } 757 }
757 snd_printk(KERN_INFO "emu1010: Audio Dock Firmware loaded\n"); 758 snd_printk(KERN_INFO "emu1010: Audio Dock Firmware loaded\n");
758 snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp ); 759 snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp);
759 snd_emu1010_fpga_read(emu, EMU_DOCK_MINOR_REV, &tmp2 ); 760 snd_emu1010_fpga_read(emu, EMU_DOCK_MINOR_REV, &tmp2);
760 snd_printk("Audio Dock ver:%d.%d\n",tmp ,tmp2); 761 snd_printk("Audio Dock ver:%d.%d\n", tmp, tmp2);
761 /* Sync clocking between 1010 and Dock */ 762 /* Sync clocking between 1010 and Dock */
762 /* Allow DLL to settle */ 763 /* Allow DLL to settle */
763 msleep(10); 764 msleep(10);
764 /* Unmute all. Default is muted after a firmware load */ 765 /* Unmute all. Default is muted after a firmware load */
765 snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE ); 766 snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE);
766 } 767 }
767 } 768 }
768 snd_printk(KERN_INFO "emu1010: firmware thread stopping\n"); 769 snd_printk(KERN_INFO "emu1010: firmware thread stopping\n");
@@ -800,10 +801,10 @@ static int emu1010_firmware_thread(void *data)
800 * 16 x 16-bit playback - snd_emu10k1_fx8010_playback_ops 801 * 16 x 16-bit playback - snd_emu10k1_fx8010_playback_ops
801 * 16 x 32-bit capture - snd_emu10k1_capture_efx_ops 802 * 16 x 32-bit capture - snd_emu10k1_capture_efx_ops
802 */ 803 */
803static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) 804static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
804{ 805{
805 unsigned int i; 806 unsigned int i;
806 int tmp,tmp2; 807 int tmp, tmp2;
807 int reg; 808 int reg;
808 int err; 809 int err;
809 const char *filename = NULL; 810 const char *filename = NULL;
@@ -818,7 +819,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
818 * Lock Tank Memory Cache, 819 * Lock Tank Memory Cache,
819 * Mute all codecs. 820 * Mute all codecs.
820 */ 821 */
821 outl(0x0005a004, emu->port + HCFG); 822 outl(0x0005a004, emu->port + HCFG);
822 /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave, 823 /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave,
823 * Mute all codecs. 824 * Mute all codecs.
824 */ 825 */
@@ -829,25 +830,25 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
829 outl(0x0005a000, emu->port + HCFG); 830 outl(0x0005a000, emu->port + HCFG);
830 831
831 /* Disable 48Volt power to Audio Dock */ 832 /* Disable 48Volt power to Audio Dock */
832 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0 ); 833 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0);
833 834
834 /* ID, should read & 0x7f = 0x55. (Bit 7 is the IRQ bit) */ 835 /* ID, should read & 0x7f = 0x55. (Bit 7 is the IRQ bit) */
835 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg ); 836 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg);
836 snd_printdd("reg1=0x%x\n",reg); 837 snd_printdd("reg1 = 0x%x\n", reg);
837 if ((reg & 0x3f) == 0x15) { 838 if ((reg & 0x3f) == 0x15) {
838 /* FPGA netlist already present so clear it */ 839 /* FPGA netlist already present so clear it */
839 /* Return to programming mode */ 840 /* Return to programming mode */
840 841
841 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0x02 ); 842 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0x02);
842 } 843 }
843 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg ); 844 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg);
844 snd_printdd("reg2=0x%x\n",reg); 845 snd_printdd("reg2 = 0x%x\n", reg);
845 if ((reg & 0x3f) == 0x15) { 846 if ((reg & 0x3f) == 0x15) {
846 /* FPGA failed to return to programming mode */ 847 /* FPGA failed to return to programming mode */
847 snd_printk(KERN_INFO "emu1010: FPGA failed to return to programming mode\n"); 848 snd_printk(KERN_INFO "emu1010: FPGA failed to return to programming mode\n");
848 return -ENODEV; 849 return -ENODEV;
849 } 850 }
850 snd_printk(KERN_INFO "emu1010: EMU_HANA_ID=0x%x\n",reg); 851 snd_printk(KERN_INFO "emu1010: EMU_HANA_ID = 0x%x\n", reg);
851 switch (emu->card_capabilities->emu_model) { 852 switch (emu->card_capabilities->emu_model) {
852 case EMU_MODEL_EMU1010: 853 case EMU_MODEL_EMU1010:
853 filename = HANA_FILENAME; 854 filename = HANA_FILENAME;
@@ -876,25 +877,25 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
876 } 877 }
877 878
878 /* ID, should read & 0x7f = 0x55 when FPGA programmed. */ 879 /* ID, should read & 0x7f = 0x55 when FPGA programmed. */
879 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg ); 880 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg);
880 if ((reg & 0x3f) != 0x15) { 881 if ((reg & 0x3f) != 0x15) {
881 /* FPGA failed to be programmed */ 882 /* FPGA failed to be programmed */
882 snd_printk(KERN_INFO "emu1010: Loading Hana Firmware file failed, reg=0x%x\n", reg); 883 snd_printk(KERN_INFO "emu1010: Loading Hana Firmware file failed, reg = 0x%x\n", reg);
883 return -ENODEV; 884 return -ENODEV;
884 } 885 }
885 886
886 snd_printk(KERN_INFO "emu1010: Hana Firmware loaded\n"); 887 snd_printk(KERN_INFO "emu1010: Hana Firmware loaded\n");
887 snd_emu1010_fpga_read(emu, EMU_HANA_MAJOR_REV, &tmp ); 888 snd_emu1010_fpga_read(emu, EMU_HANA_MAJOR_REV, &tmp);
888 snd_emu1010_fpga_read(emu, EMU_HANA_MINOR_REV, &tmp2 ); 889 snd_emu1010_fpga_read(emu, EMU_HANA_MINOR_REV, &tmp2);
889 snd_printk("Hana ver:%d.%d\n",tmp ,tmp2); 890 snd_printk("emu1010: Hana version: %d.%d\n", tmp, tmp2);
890 /* Enable 48Volt power to Audio Dock */ 891 /* Enable 48Volt power to Audio Dock */
891 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, EMU_HANA_DOCK_PWR_ON ); 892 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, EMU_HANA_DOCK_PWR_ON);
892 893
893 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg ); 894 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg);
894 snd_printk(KERN_INFO "emu1010: Card options=0x%x\n",reg); 895 snd_printk(KERN_INFO "emu1010: Card options = 0x%x\n", reg);
895 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg ); 896 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg);
896 snd_printk(KERN_INFO "emu1010: Card options=0x%x\n",reg); 897 snd_printk(KERN_INFO "emu1010: Card options = 0x%x\n", reg);
897 snd_emu1010_fpga_read(emu, EMU_HANA_OPTICAL_TYPE, &tmp ); 898 snd_emu1010_fpga_read(emu, EMU_HANA_OPTICAL_TYPE, &tmp);
898 /* Optical -> ADAT I/O */ 899 /* Optical -> ADAT I/O */
899 /* 0 : SPDIF 900 /* 0 : SPDIF
900 * 1 : ADAT 901 * 1 : ADAT
@@ -904,41 +905,42 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
904 tmp = 0; 905 tmp = 0;
905 tmp = (emu->emu1010.optical_in ? EMU_HANA_OPTICAL_IN_ADAT : 0) | 906 tmp = (emu->emu1010.optical_in ? EMU_HANA_OPTICAL_IN_ADAT : 0) |
906 (emu->emu1010.optical_out ? EMU_HANA_OPTICAL_OUT_ADAT : 0); 907 (emu->emu1010.optical_out ? EMU_HANA_OPTICAL_OUT_ADAT : 0);
907 snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, tmp ); 908 snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, tmp);
908 snd_emu1010_fpga_read(emu, EMU_HANA_ADC_PADS, &tmp ); 909 snd_emu1010_fpga_read(emu, EMU_HANA_ADC_PADS, &tmp);
909 /* Set no attenuation on Audio Dock pads. */ 910 /* Set no attenuation on Audio Dock pads. */
910 snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, 0x00 ); 911 snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, 0x00);
911 emu->emu1010.adc_pads = 0x00; 912 emu->emu1010.adc_pads = 0x00;
912 snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp ); 913 snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp);
913 /* Unmute Audio dock DACs, Headphone source DAC-4. */ 914 /* Unmute Audio dock DACs, Headphone source DAC-4. */
914 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30 ); 915 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30);
915 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12 ); 916 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12);
916 snd_emu1010_fpga_read(emu, EMU_HANA_DAC_PADS, &tmp ); 917 snd_emu1010_fpga_read(emu, EMU_HANA_DAC_PADS, &tmp);
917 /* DAC PADs. */ 918 /* DAC PADs. */
918 snd_emu1010_fpga_write(emu, EMU_HANA_DAC_PADS, 0x0f ); 919 snd_emu1010_fpga_write(emu, EMU_HANA_DAC_PADS, 0x0f);
919 emu->emu1010.dac_pads = 0x0f; 920 emu->emu1010.dac_pads = 0x0f;
920 snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp ); 921 snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp);
921 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30 ); 922 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30);
922 snd_emu1010_fpga_read(emu, EMU_HANA_SPDIF_MODE, &tmp ); 923 snd_emu1010_fpga_read(emu, EMU_HANA_SPDIF_MODE, &tmp);
923 /* SPDIF Format. Set Consumer mode, 24bit, copy enable */ 924 /* SPDIF Format. Set Consumer mode, 24bit, copy enable */
924 snd_emu1010_fpga_write(emu, EMU_HANA_SPDIF_MODE, 0x10 ); 925 snd_emu1010_fpga_write(emu, EMU_HANA_SPDIF_MODE, 0x10);
925 /* MIDI routing */ 926 /* MIDI routing */
926 snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19 ); 927 snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19);
927 /* Unknown. */ 928 /* Unknown. */
928 snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c ); 929 snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c);
929 /* snd_emu1010_fpga_write(emu, 0x09, 0x0f ); // IRQ Enable: All on */ 930 /* IRQ Enable: Alll on */
931 /* snd_emu1010_fpga_write(emu, 0x09, 0x0f ); */
930 /* IRQ Enable: All off */ 932 /* IRQ Enable: All off */
931 snd_emu1010_fpga_write(emu, EMU_HANA_IRQ_ENABLE, 0x00 ); 933 snd_emu1010_fpga_write(emu, EMU_HANA_IRQ_ENABLE, 0x00);
932 934
933 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg ); 935 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg);
934 snd_printk(KERN_INFO "emu1010: Card options3=0x%x\n",reg); 936 snd_printk(KERN_INFO "emu1010: Card options3 = 0x%x\n", reg);
935 /* Default WCLK set to 48kHz. */ 937 /* Default WCLK set to 48kHz. */
936 snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, 0x00 ); 938 snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, 0x00);
937 /* Word Clock source, Internal 48kHz x1 */ 939 /* Word Clock source, Internal 48kHz x1 */
938 snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K ); 940 snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K);
939 //snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K | EMU_HANA_WCLOCK_4X ); 941 /* snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K | EMU_HANA_WCLOCK_4X); */
940 /* Audio Dock LEDs. */ 942 /* Audio Dock LEDs. */
941 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12 ); 943 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12);
942 944
943#if 0 945#if 0
944 /* For 96kHz */ 946 /* For 96kHz */
@@ -992,7 +994,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
992 * Defaults only, users will set their own values anyways, let's 994 * Defaults only, users will set their own values anyways, let's
993 * just copy/paste. 995 * just copy/paste.
994 */ 996 */
995 997
996 snd_emu1010_fpga_link_dst_src_write(emu, 998 snd_emu1010_fpga_link_dst_src_write(emu,
997 EMU_DST_ALICE2_EMU32_8, EMU_SRC_DOCK_MIC_A1); 999 EMU_DST_ALICE2_EMU32_8, EMU_SRC_DOCK_MIC_A1);
998 snd_emu1010_fpga_link_dst_src_write(emu, 1000 snd_emu1010_fpga_link_dst_src_write(emu,
@@ -1037,19 +1039,19 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
1037 snd_emu1010_fpga_link_dst_src_write(emu, 1039 snd_emu1010_fpga_link_dst_src_write(emu,
1038 EMU_DST_ALICE2_EMU32_F, EMU_SRC_HAMOA_ADC_LEFT2); 1040 EMU_DST_ALICE2_EMU32_F, EMU_SRC_HAMOA_ADC_LEFT2);
1039#endif 1041#endif
1040 for (i = 0;i < 0x20; i++ ) { 1042 for (i = 0; i < 0x20; i++) {
1041 /* AudioDock Elink <- Silence */ 1043 /* AudioDock Elink <- Silence */
1042 snd_emu1010_fpga_link_dst_src_write(emu, 0x0100+i, EMU_SRC_SILENCE); 1044 snd_emu1010_fpga_link_dst_src_write(emu, 0x0100 + i, EMU_SRC_SILENCE);
1043 } 1045 }
1044 for (i = 0;i < 4; i++) { 1046 for (i = 0; i < 4; i++) {
1045 /* Hana SPDIF Out <- Silence */ 1047 /* Hana SPDIF Out <- Silence */
1046 snd_emu1010_fpga_link_dst_src_write(emu, 0x0200+i, EMU_SRC_SILENCE); 1048 snd_emu1010_fpga_link_dst_src_write(emu, 0x0200 + i, EMU_SRC_SILENCE);
1047 } 1049 }
1048 for (i = 0;i < 7; i++) { 1050 for (i = 0; i < 7; i++) {
1049 /* Hamoa DAC <- Silence */ 1051 /* Hamoa DAC <- Silence */
1050 snd_emu1010_fpga_link_dst_src_write(emu, 0x0300+i, EMU_SRC_SILENCE); 1052 snd_emu1010_fpga_link_dst_src_write(emu, 0x0300 + i, EMU_SRC_SILENCE);
1051 } 1053 }
1052 for (i = 0;i < 7; i++) { 1054 for (i = 0; i < 7; i++) {
1053 /* Hana ADAT Out <- Silence */ 1055 /* Hana ADAT Out <- Silence */
1054 snd_emu1010_fpga_link_dst_src_write(emu, EMU_DST_HANA_ADAT + i, EMU_SRC_SILENCE); 1056 snd_emu1010_fpga_link_dst_src_write(emu, EMU_DST_HANA_ADAT + i, EMU_SRC_SILENCE);
1055 } 1057 }
@@ -1065,30 +1067,30 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
1065 EMU_DST_ALICE_I2S2_LEFT, EMU_SRC_DOCK_ADC3_LEFT1); 1067 EMU_DST_ALICE_I2S2_LEFT, EMU_SRC_DOCK_ADC3_LEFT1);
1066 snd_emu1010_fpga_link_dst_src_write(emu, 1068 snd_emu1010_fpga_link_dst_src_write(emu,
1067 EMU_DST_ALICE_I2S2_RIGHT, EMU_SRC_DOCK_ADC3_RIGHT1); 1069 EMU_DST_ALICE_I2S2_RIGHT, EMU_SRC_DOCK_ADC3_RIGHT1);
1068 snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x01 ); // Unmute all 1070 snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x01); /* Unmute all */
1071
1072 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &tmp);
1069 1073
1070 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &tmp );
1071
1072 /* AC97 1.03, Any 32Meg of 2Gig address, Auto-Mute, EMU32 Slave, 1074 /* AC97 1.03, Any 32Meg of 2Gig address, Auto-Mute, EMU32 Slave,
1073 * Lock Sound Memory Cache, Lock Tank Memory Cache, 1075 * Lock Sound Memory Cache, Lock Tank Memory Cache,
1074 * Mute all codecs. 1076 * Mute all codecs.
1075 */ 1077 */
1076 outl(0x0000a000, emu->port + HCFG); 1078 outl(0x0000a000, emu->port + HCFG);
1077 /* AC97 1.03, Any 32Meg of 2Gig address, Auto-Mute, EMU32 Slave, 1079 /* AC97 1.03, Any 32Meg of 2Gig address, Auto-Mute, EMU32 Slave,
1078 * Lock Sound Memory Cache, Lock Tank Memory Cache, 1080 * Lock Sound Memory Cache, Lock Tank Memory Cache,
1079 * Un-Mute all codecs. 1081 * Un-Mute all codecs.
1080 */ 1082 */
1081 outl(0x0000a001, emu->port + HCFG); 1083 outl(0x0000a001, emu->port + HCFG);
1082 1084
1083 /* Initial boot complete. Now patches */ 1085 /* Initial boot complete. Now patches */
1084 1086
1085 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &tmp ); 1087 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &tmp);
1086 snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19 ); /* MIDI Route */ 1088 snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19); /* MIDI Route */
1087 snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c ); /* Unknown */ 1089 snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c); /* Unknown */
1088 snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19 ); /* MIDI Route */ 1090 snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19); /* MIDI Route */
1089 snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c ); /* Unknown */ 1091 snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c); /* Unknown */
1090 snd_emu1010_fpga_read(emu, EMU_HANA_SPDIF_MODE, &tmp ); 1092 snd_emu1010_fpga_read(emu, EMU_HANA_SPDIF_MODE, &tmp);
1091 snd_emu1010_fpga_write(emu, EMU_HANA_SPDIF_MODE, 0x10 ); /* SPDIF Format spdif (or 0x11 for aes/ebu) */ 1093 snd_emu1010_fpga_write(emu, EMU_HANA_SPDIF_MODE, 0x10); /* SPDIF Format spdif (or 0x11 for aes/ebu) */
1092 1094
1093 /* Start Micro/Audio Dock firmware loader thread */ 1095 /* Start Micro/Audio Dock firmware loader thread */
1094 if (!emu->emu1010.firmware_thread) { 1096 if (!emu->emu1010.firmware_thread) {
@@ -1218,20 +1220,20 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
1218 emu->emu1010.output_source[23] = 28; 1220 emu->emu1010.output_source[23] = 28;
1219 } 1221 }
1220 /* TEMP: Select SPDIF in/out */ 1222 /* TEMP: Select SPDIF in/out */
1221 //snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, 0x0); /* Output spdif */ 1223 /* snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, 0x0); */ /* Output spdif */
1222 1224
1223 /* TEMP: Select 48kHz SPDIF out */ 1225 /* TEMP: Select 48kHz SPDIF out */
1224 snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x0); /* Mute all */ 1226 snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x0); /* Mute all */
1225 snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, 0x0); /* Default fallback clock 48kHz */ 1227 snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, 0x0); /* Default fallback clock 48kHz */
1226 /* Word Clock source, Internal 48kHz x1 */ 1228 /* Word Clock source, Internal 48kHz x1 */
1227 snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K ); 1229 snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K);
1228 //snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K | EMU_HANA_WCLOCK_4X ); 1230 /* snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K | EMU_HANA_WCLOCK_4X); */
1229 emu->emu1010.internal_clock = 1; /* 48000 */ 1231 emu->emu1010.internal_clock = 1; /* 48000 */
1230 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12);/* Set LEDs on Audio Dock */ 1232 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12); /* Set LEDs on Audio Dock */
1231 snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x1); /* Unmute all */ 1233 snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x1); /* Unmute all */
1232 //snd_emu1010_fpga_write(emu, 0x7, 0x0); /* Mute all */ 1234 /* snd_emu1010_fpga_write(emu, 0x7, 0x0); */ /* Mute all */
1233 //snd_emu1010_fpga_write(emu, 0x7, 0x1); /* Unmute all */ 1235 /* snd_emu1010_fpga_write(emu, 0x7, 0x1); */ /* Unmute all */
1234 //snd_emu1010_fpga_write(emu, 0xe, 0x12); /* Set LEDs on Audio Dock */ 1236 /* snd_emu1010_fpga_write(emu, 0xe, 0x12); */ /* Set LEDs on Audio Dock */
1235 1237
1236 return 0; 1238 return 0;
1237} 1239}
@@ -1247,13 +1249,13 @@ static void free_pm_buffer(struct snd_emu10k1 *emu);
1247static int snd_emu10k1_free(struct snd_emu10k1 *emu) 1249static int snd_emu10k1_free(struct snd_emu10k1 *emu)
1248{ 1250{
1249 if (emu->port) { /* avoid access to already used hardware */ 1251 if (emu->port) { /* avoid access to already used hardware */
1250 snd_emu10k1_fx8010_tram_setup(emu, 0); 1252 snd_emu10k1_fx8010_tram_setup(emu, 0);
1251 snd_emu10k1_done(emu); 1253 snd_emu10k1_done(emu);
1252 snd_emu10k1_free_efx(emu); 1254 snd_emu10k1_free_efx(emu);
1253 } 1255 }
1254 if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1010) { 1256 if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1010) {
1255 /* Disable 48Volt power to Audio Dock */ 1257 /* Disable 48Volt power to Audio Dock */
1256 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0 ); 1258 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0);
1257 } 1259 }
1258 if (emu->emu1010.firmware_thread) 1260 if (emu->emu1010.firmware_thread)
1259 kthread_stop(emu->emu1010.firmware_thread); 1261 kthread_stop(emu->emu1010.firmware_thread);
@@ -1278,7 +1280,7 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu)
1278#endif 1280#endif
1279 if (emu->port) 1281 if (emu->port)
1280 pci_release_regions(emu->pci); 1282 pci_release_regions(emu->pci);
1281 if (emu->card_capabilities->ca0151_chip) /* P16V */ 1283 if (emu->card_capabilities->ca0151_chip) /* P16V */
1282 snd_p16v_free(emu); 1284 snd_p16v_free(emu);
1283 pci_disable_device(emu->pci); 1285 pci_disable_device(emu->pci);
1284 kfree(emu); 1286 kfree(emu);
@@ -1292,21 +1294,6 @@ static int snd_emu10k1_dev_free(struct snd_device *device)
1292} 1294}
1293 1295
1294static struct snd_emu_chip_details emu_chip_details[] = { 1296static struct snd_emu_chip_details emu_chip_details[] = {
1295 /* Audigy 2 Value AC3 out does not work yet. Need to find out how to turn off interpolators.*/
1296 /* Tested by James@superbug.co.uk 3rd July 2005 */
1297 /* DSP: CA0108-IAT
1298 * DAC: CS4382-KQ
1299 * ADC: Philips 1361T
1300 * AC97: STAC9750
1301 * CA0151: None
1302 */
1303 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x10011102,
1304 .driver = "Audigy2", .name = "Audigy 2 Value [SB0400]",
1305 .id = "Audigy2",
1306 .emu10k2_chip = 1,
1307 .ca0108_chip = 1,
1308 .spk71 = 1,
1309 .ac97_chip = 1} ,
1310 /* Audigy4 (Not PRO) SB0610 */ 1297 /* Audigy4 (Not PRO) SB0610 */
1311 /* Tested by James@superbug.co.uk 4th April 2006 */ 1298 /* Tested by James@superbug.co.uk 4th April 2006 */
1312 /* A_IOCFG bits 1299 /* A_IOCFG bits
@@ -1346,20 +1333,37 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1346 * CA0151: None 1333 * CA0151: None
1347 */ 1334 */
1348 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x10211102, 1335 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x10211102,
1349 .driver = "Audigy2", .name = "Audigy 4 [SB0610]", 1336 .driver = "Audigy2", .name = "SB Audigy 4 [SB0610]",
1350 .id = "Audigy2", 1337 .id = "Audigy2",
1351 .emu10k2_chip = 1, 1338 .emu10k2_chip = 1,
1352 .ca0108_chip = 1, 1339 .ca0108_chip = 1,
1353 .spk71 = 1, 1340 .spk71 = 1,
1354 .adc_1361t = 1, /* 24 bit capture instead of 16bit */ 1341 .adc_1361t = 1, /* 24 bit capture instead of 16bit */
1355 .ac97_chip = 1} , 1342 .ac97_chip = 1} ,
1343 /* Audigy 2 Value AC3 out does not work yet.
1344 * Need to find out how to turn off interpolators.
1345 */
1346 /* Tested by James@superbug.co.uk 3rd July 2005 */
1347 /* DSP: CA0108-IAT
1348 * DAC: CS4382-KQ
1349 * ADC: Philips 1361T
1350 * AC97: STAC9750
1351 * CA0151: None
1352 */
1353 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x10011102,
1354 .driver = "Audigy2", .name = "SB Audigy 2 Value [SB0400]",
1355 .id = "Audigy2",
1356 .emu10k2_chip = 1,
1357 .ca0108_chip = 1,
1358 .spk71 = 1,
1359 .ac97_chip = 1} ,
1356 /* Audigy 2 ZS Notebook Cardbus card.*/ 1360 /* Audigy 2 ZS Notebook Cardbus card.*/
1357 /* Tested by James@superbug.co.uk 6th November 2006 */ 1361 /* Tested by James@superbug.co.uk 6th November 2006 */
1358 /* Audio output 7.1/Headphones working. 1362 /* Audio output 7.1/Headphones working.
1359 * Digital output working. (AC3 not checked, only PCM) 1363 * Digital output working. (AC3 not checked, only PCM)
1360 * Audio Mic/Line inputs working. 1364 * Audio Mic/Line inputs working.
1361 * Digital input not tested. 1365 * Digital input not tested.
1362 */ 1366 */
1363 /* DSP: Tina2 1367 /* DSP: Tina2
1364 * DAC: Wolfson WM8768/WM8568 1368 * DAC: Wolfson WM8768/WM8568
1365 * ADC: Wolfson WM8775 1369 * ADC: Wolfson WM8775
@@ -1386,7 +1390,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1386 * 1390 *
1387 */ 1391 */
1388 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x20011102, 1392 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x20011102,
1389 .driver = "Audigy2", .name = "Audigy 2 ZS Notebook [SB0530]", 1393 .driver = "Audigy2", .name = "SB Audigy 2 ZS Notebook [SB0530]",
1390 .id = "Audigy2", 1394 .id = "Audigy2",
1391 .emu10k2_chip = 1, 1395 .emu10k2_chip = 1,
1392 .ca0108_chip = 1, 1396 .ca0108_chip = 1,
@@ -1396,7 +1400,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1396 .spk71 = 1} , 1400 .spk71 = 1} ,
1397 /* Tested by James@superbug.co.uk 4th Nov 2007. */ 1401 /* Tested by James@superbug.co.uk 4th Nov 2007. */
1398 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x42011102, 1402 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x42011102,
1399 .driver = "Audigy2", .name = "E-mu 1010 Notebook [MAEM8950]", 1403 .driver = "Audigy2", .name = "E-mu 1010 Notebook [MAEM8950]",
1400 .id = "EMU1010", 1404 .id = "EMU1010",
1401 .emu10k2_chip = 1, 1405 .emu10k2_chip = 1,
1402 .ca0108_chip = 1, 1406 .ca0108_chip = 1,
@@ -1404,47 +1408,49 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1404 .spk71 = 1 , 1408 .spk71 = 1 ,
1405 .emu_model = EMU_MODEL_EMU1616}, 1409 .emu_model = EMU_MODEL_EMU1616},
1406 /* Tested by James@superbug.co.uk 4th Nov 2007. */ 1410 /* Tested by James@superbug.co.uk 4th Nov 2007. */
1411 /* This is MAEM8960, 0202 is MAEM 8980 */
1407 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40041102, 1412 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40041102,
1408 .driver = "Audigy2", .name = "E-mu 1010b PCI [MAEM????]", 1413 .driver = "Audigy2", .name = "E-mu 1010b PCI [MAEM8960]",
1409 .id = "EMU1010", 1414 .id = "EMU1010",
1410 .emu10k2_chip = 1, 1415 .emu10k2_chip = 1,
1411 .ca0108_chip = 1, 1416 .ca0108_chip = 1,
1412 .spk71 = 1, 1417 .spk71 = 1,
1413 .emu_model = EMU_MODEL_EMU1010B}, 1418 .emu_model = EMU_MODEL_EMU1010B}, /* EMU 1010 new revision */
1414 /* Tested by James@superbug.co.uk 8th July 2005. */ 1419 /* Tested by James@superbug.co.uk 8th July 2005. */
1420 /* This is MAEM8810, 0202 is MAEM8820 */
1415 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40011102, 1421 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40011102,
1416 .driver = "Audigy2", .name = "E-mu 1010 [4001]", 1422 .driver = "Audigy2", .name = "E-mu 1010 [MAEM8810]",
1417 .id = "EMU1010", 1423 .id = "EMU1010",
1418 .emu10k2_chip = 1, 1424 .emu10k2_chip = 1,
1419 .ca0102_chip = 1, 1425 .ca0102_chip = 1,
1420 .spk71 = 1, 1426 .spk71 = 1,
1421 .emu_model = EMU_MODEL_EMU1010}, /* Emu 1010 */ 1427 .emu_model = EMU_MODEL_EMU1010}, /* EMU 1010 old revision */
1422 /* EMU0404b */ 1428 /* EMU0404b */
1423 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40021102, 1429 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40021102,
1424 .driver = "Audigy2", .name = "E-mu 0404b [4002]", 1430 .driver = "Audigy2", .name = "E-mu 0404b PCI [MAEM8852]",
1425 .id = "EMU0404", 1431 .id = "EMU0404",
1426 .emu10k2_chip = 1, 1432 .emu10k2_chip = 1,
1427 .ca0108_chip = 1, 1433 .ca0108_chip = 1,
1428 .spk71 = 1, 1434 .spk71 = 1,
1429 .emu_model = EMU_MODEL_EMU0404}, /* EMU 0404 */ 1435 .emu_model = EMU_MODEL_EMU0404}, /* EMU 0404 new revision */
1430 /* Tested by James@superbug.co.uk 20-3-2007. */ 1436 /* Tested by James@superbug.co.uk 20-3-2007. */
1431 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40021102, 1437 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40021102,
1432 .driver = "Audigy2", .name = "E-mu 0404 [4002]", 1438 .driver = "Audigy2", .name = "E-mu 0404 [MAEM8850]",
1433 .id = "EMU0404", 1439 .id = "EMU0404",
1434 .emu10k2_chip = 1, 1440 .emu10k2_chip = 1,
1435 .ca0102_chip = 1, 1441 .ca0102_chip = 1,
1436 .spk71 = 1, 1442 .spk71 = 1,
1437 .emu_model = EMU_MODEL_EMU0404}, /* EMU 0404 */ 1443 .emu_model = EMU_MODEL_EMU0404}, /* EMU 0404 */
1438 /* Audigy4 (Not PRO) SB0610 */ 1444 /* Note that all E-mu cards require kernel 2.6 or newer. */
1439 {.vendor = 0x1102, .device = 0x0008, 1445 {.vendor = 0x1102, .device = 0x0008,
1440 .driver = "Audigy2", .name = "Audigy 2 Value [Unknown]", 1446 .driver = "Audigy2", .name = "SB Audigy 2 Value [Unknown]",
1441 .id = "Audigy2", 1447 .id = "Audigy2",
1442 .emu10k2_chip = 1, 1448 .emu10k2_chip = 1,
1443 .ca0108_chip = 1, 1449 .ca0108_chip = 1,
1444 .ac97_chip = 1} , 1450 .ac97_chip = 1} ,
1445 /* Tested by James@superbug.co.uk 3rd July 2005 */ 1451 /* Tested by James@superbug.co.uk 3rd July 2005 */
1446 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20071102, 1452 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20071102,
1447 .driver = "Audigy2", .name = "Audigy 4 PRO [SB0380]", 1453 .driver = "Audigy2", .name = "SB Audigy 4 PRO [SB0380]",
1448 .id = "Audigy2", 1454 .id = "Audigy2",
1449 .emu10k2_chip = 1, 1455 .emu10k2_chip = 1,
1450 .ca0102_chip = 1, 1456 .ca0102_chip = 1,
@@ -1457,7 +1463,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1457 * Just like 0x20021102 1463 * Just like 0x20021102
1458 */ 1464 */
1459 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20061102, 1465 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20061102,
1460 .driver = "Audigy2", .name = "Audigy 2 [SB0350b]", 1466 .driver = "Audigy2", .name = "SB Audigy 2 [SB0350b]",
1461 .id = "Audigy2", 1467 .id = "Audigy2",
1462 .emu10k2_chip = 1, 1468 .emu10k2_chip = 1,
1463 .ca0102_chip = 1, 1469 .ca0102_chip = 1,
@@ -1466,7 +1472,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1466 .spdif_bug = 1, 1472 .spdif_bug = 1,
1467 .ac97_chip = 1} , 1473 .ac97_chip = 1} ,
1468 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20021102, 1474 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20021102,
1469 .driver = "Audigy2", .name = "Audigy 2 ZS [SB0350]", 1475 .driver = "Audigy2", .name = "SB Audigy 2 ZS [SB0350]",
1470 .id = "Audigy2", 1476 .id = "Audigy2",
1471 .emu10k2_chip = 1, 1477 .emu10k2_chip = 1,
1472 .ca0102_chip = 1, 1478 .ca0102_chip = 1,
@@ -1475,7 +1481,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1475 .spdif_bug = 1, 1481 .spdif_bug = 1,
1476 .ac97_chip = 1} , 1482 .ac97_chip = 1} ,
1477 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20011102, 1483 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20011102,
1478 .driver = "Audigy2", .name = "Audigy 2 ZS [2001]", 1484 .driver = "Audigy2", .name = "SB Audigy 2 ZS [SB0360]",
1479 .id = "Audigy2", 1485 .id = "Audigy2",
1480 .emu10k2_chip = 1, 1486 .emu10k2_chip = 1,
1481 .ca0102_chip = 1, 1487 .ca0102_chip = 1,
@@ -1492,7 +1498,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1492 * CA0151: Yes 1498 * CA0151: Yes
1493 */ 1499 */
1494 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10071102, 1500 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10071102,
1495 .driver = "Audigy2", .name = "Audigy 2 [SB0240]", 1501 .driver = "Audigy2", .name = "SB Audigy 2 [SB0240]",
1496 .id = "Audigy2", 1502 .id = "Audigy2",
1497 .emu10k2_chip = 1, 1503 .emu10k2_chip = 1,
1498 .ca0102_chip = 1, 1504 .ca0102_chip = 1,
@@ -1502,7 +1508,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1502 .adc_1361t = 1, /* 24 bit capture instead of 16bit */ 1508 .adc_1361t = 1, /* 24 bit capture instead of 16bit */
1503 .ac97_chip = 1} , 1509 .ac97_chip = 1} ,
1504 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10051102, 1510 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10051102,
1505 .driver = "Audigy2", .name = "Audigy 2 EX [1005]", 1511 .driver = "Audigy2", .name = "SB Audigy 2 Platinum EX [SB0280]",
1506 .id = "Audigy2", 1512 .id = "Audigy2",
1507 .emu10k2_chip = 1, 1513 .emu10k2_chip = 1,
1508 .ca0102_chip = 1, 1514 .ca0102_chip = 1,
@@ -1512,7 +1518,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1512 /* Dell OEM/Creative Labs Audigy 2 ZS */ 1518 /* Dell OEM/Creative Labs Audigy 2 ZS */
1513 /* See ALSA bug#1365 */ 1519 /* See ALSA bug#1365 */
1514 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10031102, 1520 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10031102,
1515 .driver = "Audigy2", .name = "Audigy 2 ZS [SB0353]", 1521 .driver = "Audigy2", .name = "SB Audigy 2 ZS [SB0353]",
1516 .id = "Audigy2", 1522 .id = "Audigy2",
1517 .emu10k2_chip = 1, 1523 .emu10k2_chip = 1,
1518 .ca0102_chip = 1, 1524 .ca0102_chip = 1,
@@ -1521,7 +1527,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1521 .spdif_bug = 1, 1527 .spdif_bug = 1,
1522 .ac97_chip = 1} , 1528 .ac97_chip = 1} ,
1523 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10021102, 1529 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10021102,
1524 .driver = "Audigy2", .name = "Audigy 2 Platinum [SB0240P]", 1530 .driver = "Audigy2", .name = "SB Audigy 2 Platinum [SB0240P]",
1525 .id = "Audigy2", 1531 .id = "Audigy2",
1526 .emu10k2_chip = 1, 1532 .emu10k2_chip = 1,
1527 .ca0102_chip = 1, 1533 .ca0102_chip = 1,
@@ -1532,7 +1538,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1532 .adc_1361t = 1, /* 24 bit capture instead of 16bit. Fixes ALSA bug#324 */ 1538 .adc_1361t = 1, /* 24 bit capture instead of 16bit. Fixes ALSA bug#324 */
1533 .ac97_chip = 1} , 1539 .ac97_chip = 1} ,
1534 {.vendor = 0x1102, .device = 0x0004, .revision = 0x04, 1540 {.vendor = 0x1102, .device = 0x0004, .revision = 0x04,
1535 .driver = "Audigy2", .name = "Audigy 2 [Unknown]", 1541 .driver = "Audigy2", .name = "SB Audigy 2 [Unknown]",
1536 .id = "Audigy2", 1542 .id = "Audigy2",
1537 .emu10k2_chip = 1, 1543 .emu10k2_chip = 1,
1538 .ca0102_chip = 1, 1544 .ca0102_chip = 1,
@@ -1540,78 +1546,79 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1540 .spdif_bug = 1, 1546 .spdif_bug = 1,
1541 .ac97_chip = 1} , 1547 .ac97_chip = 1} ,
1542 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00531102, 1548 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00531102,
1543 .driver = "Audigy", .name = "Audigy 1 [SB0090]", 1549 .driver = "Audigy", .name = "SB Audigy 1 [SB0092]",
1544 .id = "Audigy", 1550 .id = "Audigy",
1545 .emu10k2_chip = 1, 1551 .emu10k2_chip = 1,
1546 .ca0102_chip = 1, 1552 .ca0102_chip = 1,
1547 .ac97_chip = 1} , 1553 .ac97_chip = 1} ,
1548 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00521102, 1554 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00521102,
1549 .driver = "Audigy", .name = "Audigy 1 ES [SB0160]", 1555 .driver = "Audigy", .name = "SB Audigy 1 ES [SB0160]",
1550 .id = "Audigy", 1556 .id = "Audigy",
1551 .emu10k2_chip = 1, 1557 .emu10k2_chip = 1,
1552 .ca0102_chip = 1, 1558 .ca0102_chip = 1,
1553 .spdif_bug = 1, 1559 .spdif_bug = 1,
1554 .ac97_chip = 1} , 1560 .ac97_chip = 1} ,
1555 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00511102, 1561 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00511102,
1556 .driver = "Audigy", .name = "Audigy 1 [SB0090]", 1562 .driver = "Audigy", .name = "SB Audigy 1 [SB0090]",
1557 .id = "Audigy", 1563 .id = "Audigy",
1558 .emu10k2_chip = 1, 1564 .emu10k2_chip = 1,
1559 .ca0102_chip = 1, 1565 .ca0102_chip = 1,
1560 .ac97_chip = 1} , 1566 .ac97_chip = 1} ,
1561 {.vendor = 0x1102, .device = 0x0004, 1567 {.vendor = 0x1102, .device = 0x0004,
1562 .driver = "Audigy", .name = "Audigy 1 [Unknown]", 1568 .driver = "Audigy", .name = "Audigy 1 [Unknown]",
1563 .id = "Audigy", 1569 .id = "Audigy",
1564 .emu10k2_chip = 1, 1570 .emu10k2_chip = 1,
1565 .ca0102_chip = 1, 1571 .ca0102_chip = 1,
1566 .ac97_chip = 1} , 1572 .ac97_chip = 1} ,
1567 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x806B1102, 1573 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x100a1102,
1568 .driver = "EMU10K1", .name = "SBLive! [SB0105]", 1574 .driver = "EMU10K1", .name = "SB Live! 5.1 [SB0220]",
1575 .id = "Live",
1576 .emu10k1_chip = 1,
1577 .ac97_chip = 1,
1578 .sblive51 = 1} ,
1579 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x806b1102,
1580 .driver = "EMU10K1", .name = "SB Live! [SB0105]",
1569 .id = "Live", 1581 .id = "Live",
1570 .emu10k1_chip = 1, 1582 .emu10k1_chip = 1,
1571 .ac97_chip = 1, 1583 .ac97_chip = 1,
1572 .sblive51 = 1} , 1584 .sblive51 = 1} ,
1573 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x806A1102, 1585 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x806a1102,
1574 .driver = "EMU10K1", .name = "SBLive! Value [SB0103]", 1586 .driver = "EMU10K1", .name = "SB Live! Value [SB0103]",
1575 .id = "Live", 1587 .id = "Live",
1576 .emu10k1_chip = 1, 1588 .emu10k1_chip = 1,
1577 .ac97_chip = 1, 1589 .ac97_chip = 1,
1578 .sblive51 = 1} , 1590 .sblive51 = 1} ,
1579 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80691102, 1591 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80691102,
1580 .driver = "EMU10K1", .name = "SBLive! Value [SB0101]", 1592 .driver = "EMU10K1", .name = "SB Live! Value [SB0101]",
1581 .id = "Live", 1593 .id = "Live",
1582 .emu10k1_chip = 1, 1594 .emu10k1_chip = 1,
1583 .ac97_chip = 1, 1595 .ac97_chip = 1,
1584 .sblive51 = 1} , 1596 .sblive51 = 1} ,
1585 /* Tested by ALSA bug#1680 26th December 2005 */ 1597 /* Tested by ALSA bug#1680 26th December 2005 */
1586 /* note: It really has SB0220 written on the card. */ 1598 /* note: It really has SB0220 written on the card, */
1599 /* but it's SB0228 according to kx.inf */
1587 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80661102, 1600 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80661102,
1588 .driver = "EMU10K1", .name = "SB Live 5.1 Dell OEM [SB0220]", 1601 .driver = "EMU10K1", .name = "SB Live! 5.1 Dell OEM [SB0228]",
1589 .id = "Live", 1602 .id = "Live",
1590 .emu10k1_chip = 1, 1603 .emu10k1_chip = 1,
1591 .ac97_chip = 1, 1604 .ac97_chip = 1,
1592 .sblive51 = 1} , 1605 .sblive51 = 1} ,
1593 /* Tested by Thomas Zehetbauer 27th Aug 2005 */ 1606 /* Tested by Thomas Zehetbauer 27th Aug 2005 */
1594 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80651102, 1607 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80651102,
1595 .driver = "EMU10K1", .name = "SB Live 5.1 [SB0220]", 1608 .driver = "EMU10K1", .name = "SB Live! 5.1 [SB0220]",
1596 .id = "Live",
1597 .emu10k1_chip = 1,
1598 .ac97_chip = 1,
1599 .sblive51 = 1} ,
1600 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x100a1102,
1601 .driver = "EMU10K1", .name = "SB Live 5.1 [SB0220]",
1602 .id = "Live", 1609 .id = "Live",
1603 .emu10k1_chip = 1, 1610 .emu10k1_chip = 1,
1604 .ac97_chip = 1, 1611 .ac97_chip = 1,
1605 .sblive51 = 1} , 1612 .sblive51 = 1} ,
1606 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80641102, 1613 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80641102,
1607 .driver = "EMU10K1", .name = "SB Live 5.1", 1614 .driver = "EMU10K1", .name = "SB Live! 5.1",
1608 .id = "Live", 1615 .id = "Live",
1609 .emu10k1_chip = 1, 1616 .emu10k1_chip = 1,
1610 .ac97_chip = 1, 1617 .ac97_chip = 1,
1611 .sblive51 = 1} , 1618 .sblive51 = 1} ,
1612 /* Tested by alsa bugtrack user "hus" bug #1297 12th Aug 2005 */ 1619 /* Tested by alsa bugtrack user "hus" bug #1297 12th Aug 2005 */
1613 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102, 1620 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102,
1614 .driver = "EMU10K1", .name = "SBLive 5.1 [SB0060]", 1621 .driver = "EMU10K1", .name = "SB Live! 5.1 [SB0060]",
1615 .id = "Live", 1622 .id = "Live",
1616 .emu10k1_chip = 1, 1623 .emu10k1_chip = 1,
1617 .ac97_chip = 2, /* ac97 is optional; both SBLive 5.1 and platinum 1624 .ac97_chip = 2, /* ac97 is optional; both SBLive 5.1 and platinum
@@ -1619,78 +1626,78 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1619 */ 1626 */
1620 .sblive51 = 1} , 1627 .sblive51 = 1} ,
1621 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80511102, 1628 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80511102,
1622 .driver = "EMU10K1", .name = "SBLive! Value [CT4850]", 1629 .driver = "EMU10K1", .name = "SB Live! Value [CT4850]",
1623 .id = "Live", 1630 .id = "Live",
1624 .emu10k1_chip = 1, 1631 .emu10k1_chip = 1,
1625 .ac97_chip = 1, 1632 .ac97_chip = 1,
1626 .sblive51 = 1} , 1633 .sblive51 = 1} ,
1627 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80401102, 1634 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80401102,
1628 .driver = "EMU10K1", .name = "SBLive! Platinum [CT4760P]", 1635 .driver = "EMU10K1", .name = "SB Live! Platinum [CT4760P]",
1629 .id = "Live", 1636 .id = "Live",
1630 .emu10k1_chip = 1, 1637 .emu10k1_chip = 1,
1631 .ac97_chip = 1} , 1638 .ac97_chip = 1} ,
1632 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80321102, 1639 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80321102,
1633 .driver = "EMU10K1", .name = "SBLive! Value [CT4871]", 1640 .driver = "EMU10K1", .name = "SB Live! Value [CT4871]",
1634 .id = "Live", 1641 .id = "Live",
1635 .emu10k1_chip = 1, 1642 .emu10k1_chip = 1,
1636 .ac97_chip = 1, 1643 .ac97_chip = 1,
1637 .sblive51 = 1} , 1644 .sblive51 = 1} ,
1638 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80311102, 1645 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80311102,
1639 .driver = "EMU10K1", .name = "SBLive! Value [CT4831]", 1646 .driver = "EMU10K1", .name = "SB Live! Value [CT4831]",
1640 .id = "Live", 1647 .id = "Live",
1641 .emu10k1_chip = 1, 1648 .emu10k1_chip = 1,
1642 .ac97_chip = 1, 1649 .ac97_chip = 1,
1643 .sblive51 = 1} , 1650 .sblive51 = 1} ,
1644 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80281102, 1651 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80281102,
1645 .driver = "EMU10K1", .name = "SBLive! Value [CT4870]", 1652 .driver = "EMU10K1", .name = "SB Live! Value [CT4870]",
1646 .id = "Live", 1653 .id = "Live",
1647 .emu10k1_chip = 1, 1654 .emu10k1_chip = 1,
1648 .ac97_chip = 1, 1655 .ac97_chip = 1,
1649 .sblive51 = 1} , 1656 .sblive51 = 1} ,
1650 /* Tested by James@superbug.co.uk 3rd July 2005 */ 1657 /* Tested by James@superbug.co.uk 3rd July 2005 */
1651 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80271102, 1658 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80271102,
1652 .driver = "EMU10K1", .name = "SBLive! Value [CT4832]", 1659 .driver = "EMU10K1", .name = "SB Live! Value [CT4832]",
1653 .id = "Live", 1660 .id = "Live",
1654 .emu10k1_chip = 1, 1661 .emu10k1_chip = 1,
1655 .ac97_chip = 1, 1662 .ac97_chip = 1,
1656 .sblive51 = 1} , 1663 .sblive51 = 1} ,
1657 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80261102, 1664 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80261102,
1658 .driver = "EMU10K1", .name = "SBLive! Value [CT4830]", 1665 .driver = "EMU10K1", .name = "SB Live! Value [CT4830]",
1659 .id = "Live", 1666 .id = "Live",
1660 .emu10k1_chip = 1, 1667 .emu10k1_chip = 1,
1661 .ac97_chip = 1, 1668 .ac97_chip = 1,
1662 .sblive51 = 1} , 1669 .sblive51 = 1} ,
1663 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80231102, 1670 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80231102,
1664 .driver = "EMU10K1", .name = "SB PCI512 [CT4790]", 1671 .driver = "EMU10K1", .name = "SB PCI512 [CT4790]",
1665 .id = "Live", 1672 .id = "Live",
1666 .emu10k1_chip = 1, 1673 .emu10k1_chip = 1,
1667 .ac97_chip = 1, 1674 .ac97_chip = 1,
1668 .sblive51 = 1} , 1675 .sblive51 = 1} ,
1669 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80221102, 1676 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80221102,
1670 .driver = "EMU10K1", .name = "SBLive! Value [CT4780]", 1677 .driver = "EMU10K1", .name = "SB Live! Value [CT4780]",
1671 .id = "Live", 1678 .id = "Live",
1672 .emu10k1_chip = 1, 1679 .emu10k1_chip = 1,
1673 .ac97_chip = 1, 1680 .ac97_chip = 1,
1674 .sblive51 = 1} , 1681 .sblive51 = 1} ,
1675 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x40011102, 1682 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x40011102,
1676 .driver = "EMU10K1", .name = "E-mu APS [4001]", 1683 .driver = "EMU10K1", .name = "E-mu APS [PC545]",
1677 .id = "APS", 1684 .id = "APS",
1678 .emu10k1_chip = 1, 1685 .emu10k1_chip = 1,
1679 .ecard = 1} , 1686 .ecard = 1} ,
1680 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x00211102, 1687 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x00211102,
1681 .driver = "EMU10K1", .name = "SBLive! [CT4620]", 1688 .driver = "EMU10K1", .name = "SB Live! [CT4620]",
1682 .id = "Live", 1689 .id = "Live",
1683 .emu10k1_chip = 1, 1690 .emu10k1_chip = 1,
1684 .ac97_chip = 1, 1691 .ac97_chip = 1,
1685 .sblive51 = 1} , 1692 .sblive51 = 1} ,
1686 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x00201102, 1693 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x00201102,
1687 .driver = "EMU10K1", .name = "SBLive! Value [CT4670]", 1694 .driver = "EMU10K1", .name = "SB Live! Value [CT4670]",
1688 .id = "Live", 1695 .id = "Live",
1689 .emu10k1_chip = 1, 1696 .emu10k1_chip = 1,
1690 .ac97_chip = 1, 1697 .ac97_chip = 1,
1691 .sblive51 = 1} , 1698 .sblive51 = 1} ,
1692 {.vendor = 0x1102, .device = 0x0002, 1699 {.vendor = 0x1102, .device = 0x0002,
1693 .driver = "EMU10K1", .name = "SB Live [Unknown]", 1700 .driver = "EMU10K1", .name = "SB Live! [Unknown]",
1694 .id = "Live", 1701 .id = "Live",
1695 .emu10k1_chip = 1, 1702 .emu10k1_chip = 1,
1696 .ac97_chip = 1, 1703 .ac97_chip = 1,
@@ -1699,13 +1706,13 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1699}; 1706};
1700 1707
1701int __devinit snd_emu10k1_create(struct snd_card *card, 1708int __devinit snd_emu10k1_create(struct snd_card *card,
1702 struct pci_dev * pci, 1709 struct pci_dev *pci,
1703 unsigned short extin_mask, 1710 unsigned short extin_mask,
1704 unsigned short extout_mask, 1711 unsigned short extout_mask,
1705 long max_cache_bytes, 1712 long max_cache_bytes,
1706 int enable_ir, 1713 int enable_ir,
1707 uint subsystem, 1714 uint subsystem,
1708 struct snd_emu10k1 ** remu) 1715 struct snd_emu10k1 **remu)
1709{ 1716{
1710 struct snd_emu10k1 *emu; 1717 struct snd_emu10k1 *emu;
1711 int idx, err; 1718 int idx, err;
@@ -1715,11 +1722,12 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
1715 static struct snd_device_ops ops = { 1722 static struct snd_device_ops ops = {
1716 .dev_free = snd_emu10k1_dev_free, 1723 .dev_free = snd_emu10k1_dev_free,
1717 }; 1724 };
1718 1725
1719 *remu = NULL; 1726 *remu = NULL;
1720 1727
1721 /* enable PCI device */ 1728 /* enable PCI device */
1722 if ((err = pci_enable_device(pci)) < 0) 1729 err = pci_enable_device(pci);
1730 if (err < 0)
1723 return err; 1731 return err;
1724 1732
1725 emu = kzalloc(sizeof(*emu), GFP_KERNEL); 1733 emu = kzalloc(sizeof(*emu), GFP_KERNEL);
@@ -1746,16 +1754,17 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
1746 emu->revision = pci->revision; 1754 emu->revision = pci->revision;
1747 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &emu->serial); 1755 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &emu->serial);
1748 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &emu->model); 1756 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &emu->model);
1749 snd_printdd("vendor=0x%x, device=0x%x, subsystem_vendor_id=0x%x, subsystem_id=0x%x\n",pci->vendor, pci->device, emu->serial, emu->model); 1757 snd_printdd("vendor = 0x%x, device = 0x%x, subsystem_vendor_id = 0x%x, subsystem_id = 0x%x\n", pci->vendor, pci->device, emu->serial, emu->model);
1750 1758
1751 for (c = emu_chip_details; c->vendor; c++) { 1759 for (c = emu_chip_details; c->vendor; c++) {
1752 if (c->vendor == pci->vendor && c->device == pci->device) { 1760 if (c->vendor == pci->vendor && c->device == pci->device) {
1753 if (subsystem) { 1761 if (subsystem) {
1754 if (c->subsystem && (c->subsystem == subsystem) ) { 1762 if (c->subsystem && (c->subsystem == subsystem))
1755 break; 1763 break;
1756 } else continue; 1764 else
1765 continue;
1757 } else { 1766 } else {
1758 if (c->subsystem && (c->subsystem != emu->serial) ) 1767 if (c->subsystem && (c->subsystem != emu->serial))
1759 continue; 1768 continue;
1760 if (c->revision && c->revision != emu->revision) 1769 if (c->revision && c->revision != emu->revision)
1761 continue; 1770 continue;
@@ -1771,14 +1780,18 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
1771 } 1780 }
1772 emu->card_capabilities = c; 1781 emu->card_capabilities = c;
1773 if (c->subsystem && !subsystem) 1782 if (c->subsystem && !subsystem)
1774 snd_printdd("Sound card name=%s\n", c->name); 1783 snd_printdd("Sound card name = %s\n", c->name);
1775 else if (subsystem) 1784 else if (subsystem)
1776 snd_printdd("Sound card name=%s, vendor=0x%x, device=0x%x, subsystem=0x%x. Forced to subsytem=0x%x\n", 1785 snd_printdd("Sound card name = %s, "
1777 c->name, pci->vendor, pci->device, emu->serial, c->subsystem); 1786 "vendor = 0x%x, device = 0x%x, subsystem = 0x%x. "
1778 else 1787 "Forced to subsytem = 0x%x\n", c->name,
1779 snd_printdd("Sound card name=%s, vendor=0x%x, device=0x%x, subsystem=0x%x.\n", 1788 pci->vendor, pci->device, emu->serial, c->subsystem);
1780 c->name, pci->vendor, pci->device, emu->serial); 1789 else
1781 1790 snd_printdd("Sound card name = %s, "
1791 "vendor = 0x%x, device = 0x%x, subsystem = 0x%x.\n",
1792 c->name, pci->vendor, pci->device,
1793 emu->serial);
1794
1782 if (!*card->id && c->id) { 1795 if (!*card->id && c->id) {
1783 int i, n = 0; 1796 int i, n = 0;
1784 strlcpy(card->id, c->id, sizeof(card->id)); 1797 strlcpy(card->id, c->id, sizeof(card->id));
@@ -1812,7 +1825,8 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
1812 else 1825 else
1813 emu->gpr_base = FXGPREGBASE; 1826 emu->gpr_base = FXGPREGBASE;
1814 1827
1815 if ((err = pci_request_regions(pci, "EMU10K1")) < 0) { 1828 err = pci_request_regions(pci, "EMU10K1");
1829 if (err < 0) {
1816 kfree(emu); 1830 kfree(emu);
1817 pci_disable_device(pci); 1831 pci_disable_device(pci);
1818 return err; 1832 return err;
@@ -1859,21 +1873,25 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
1859 emu->enable_ir = enable_ir; 1873 emu->enable_ir = enable_ir;
1860 1874
1861 if (emu->card_capabilities->ca_cardbus_chip) { 1875 if (emu->card_capabilities->ca_cardbus_chip) {
1862 if ((err = snd_emu10k1_cardbus_init(emu)) < 0) 1876 err = snd_emu10k1_cardbus_init(emu);
1877 if (err < 0)
1863 goto error; 1878 goto error;
1864 } 1879 }
1865 if (emu->card_capabilities->ecard) { 1880 if (emu->card_capabilities->ecard) {
1866 if ((err = snd_emu10k1_ecard_init(emu)) < 0) 1881 err = snd_emu10k1_ecard_init(emu);
1882 if (err < 0)
1867 goto error; 1883 goto error;
1868 } else if (emu->card_capabilities->emu_model) { 1884 } else if (emu->card_capabilities->emu_model) {
1869 if ((err = snd_emu10k1_emu1010_init(emu)) < 0) { 1885 err = snd_emu10k1_emu1010_init(emu);
1870 snd_emu10k1_free(emu); 1886 if (err < 0) {
1871 return err; 1887 snd_emu10k1_free(emu);
1872 } 1888 return err;
1889 }
1873 } else { 1890 } else {
1874 /* 5.1: Enable the additional AC97 Slots. If the emu10k1 version 1891 /* 5.1: Enable the additional AC97 Slots. If the emu10k1 version
1875 does not support this, it shouldn't do any harm */ 1892 does not support this, it shouldn't do any harm */
1876 snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE); 1893 snd_emu10k1_ptr_write(emu, AC97SLOT, 0,
1894 AC97SLOT_CNTR|AC97SLOT_LFE);
1877 } 1895 }
1878 1896
1879 /* initialize TRAM setup */ 1897 /* initialize TRAM setup */
@@ -1913,7 +1931,7 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
1913 snd_emu10k1_synth_alloc(emu, 4096); 1931 snd_emu10k1_synth_alloc(emu, 4096);
1914 if (emu->reserved_page) 1932 if (emu->reserved_page)
1915 emu->reserved_page->map_locked = 1; 1933 emu->reserved_page->map_locked = 1;
1916 1934
1917 /* Clear silent pages and set up pointers */ 1935 /* Clear silent pages and set up pointers */
1918 memset(emu->silent_page.area, 0, PAGE_SIZE); 1936 memset(emu->silent_page.area, 0, PAGE_SIZE);
1919 silent_page = emu->silent_page.addr << 1; 1937 silent_page = emu->silent_page.addr << 1;
@@ -1926,19 +1944,23 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
1926 emu->voices[idx].number = idx; 1944 emu->voices[idx].number = idx;
1927 } 1945 }
1928 1946
1929 if ((err = snd_emu10k1_init(emu, enable_ir, 0)) < 0) 1947 err = snd_emu10k1_init(emu, enable_ir, 0);
1948 if (err < 0)
1930 goto error; 1949 goto error;
1931#ifdef CONFIG_PM 1950#ifdef CONFIG_PM
1932 if ((err = alloc_pm_buffer(emu)) < 0) 1951 err = alloc_pm_buffer(emu);
1952 if (err < 0)
1933 goto error; 1953 goto error;
1934#endif 1954#endif
1935 1955
1936 /* Initialize the effect engine */ 1956 /* Initialize the effect engine */
1937 if ((err = snd_emu10k1_init_efx(emu)) < 0) 1957 err = snd_emu10k1_init_efx(emu);
1958 if (err < 0)
1938 goto error; 1959 goto error;
1939 snd_emu10k1_audio_enable(emu); 1960 snd_emu10k1_audio_enable(emu);
1940 1961
1941 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, emu, &ops)) < 0) 1962 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, emu, &ops);
1963 if (err < 0)
1942 goto error; 1964 goto error;
1943 1965
1944#ifdef CONFIG_PROC_FS 1966#ifdef CONFIG_PROC_FS
@@ -1978,7 +2000,7 @@ static int __devinit alloc_pm_buffer(struct snd_emu10k1 *emu)
1978 if (emu->audigy) 2000 if (emu->audigy)
1979 size += ARRAY_SIZE(saved_regs_audigy); 2001 size += ARRAY_SIZE(saved_regs_audigy);
1980 emu->saved_ptr = vmalloc(4 * NUM_G * size); 2002 emu->saved_ptr = vmalloc(4 * NUM_G * size);
1981 if (! emu->saved_ptr) 2003 if (!emu->saved_ptr)
1982 return -ENOMEM; 2004 return -ENOMEM;
1983 if (snd_emu10k1_efx_alloc_pm_buffer(emu) < 0) 2005 if (snd_emu10k1_efx_alloc_pm_buffer(emu) < 0)
1984 return -ENOMEM; 2006 return -ENOMEM;
@@ -2023,7 +2045,7 @@ void snd_emu10k1_resume_init(struct snd_emu10k1 *emu)
2023 if (emu->card_capabilities->ecard) 2045 if (emu->card_capabilities->ecard)
2024 snd_emu10k1_ecard_init(emu); 2046 snd_emu10k1_ecard_init(emu);
2025 else if (emu->card_capabilities->emu_model) 2047 else if (emu->card_capabilities->emu_model)
2026 snd_emu10k1_emu1010_init(emu); 2048 snd_emu10k1_emu1010_init(emu);
2027 else 2049 else
2028 snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE); 2050 snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE);
2029 snd_emu10k1_init(emu, emu->enable_ir, 1); 2051 snd_emu10k1_init(emu, emu->enable_ir, 1);