diff options
Diffstat (limited to 'sound/pci/emu10k1/emu10k1_main.c')
-rw-r--r-- | sound/pci/emu10k1/emu10k1_main.c | 616 |
1 files changed, 488 insertions, 128 deletions
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 972ec40d8166..80aa585eade4 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c | |||
@@ -3,8 +3,10 @@ | |||
3 | * Creative Labs, Inc. | 3 | * Creative Labs, Inc. |
4 | * Routines for control of EMU10K1 chips | 4 | * Routines for control of EMU10K1 chips |
5 | * | 5 | * |
6 | * Copyright (c) by James Courtier-Dutton <James@superbug.demon.co.uk> | 6 | * Copyright (c) by James Courtier-Dutton <James@superbug.co.uk> |
7 | * Added support for Audigy 2 Value. | 7 | * Added support for Audigy 2 Value. |
8 | * Added EMU 1010 support. | ||
9 | * General bug fixes and enhancements. | ||
8 | * | 10 | * |
9 | * | 11 | * |
10 | * BUGS: | 12 | * BUGS: |
@@ -41,8 +43,10 @@ | |||
41 | 43 | ||
42 | #include <sound/core.h> | 44 | #include <sound/core.h> |
43 | #include <sound/emu10k1.h> | 45 | #include <sound/emu10k1.h> |
46 | #include <linux/firmware.h> | ||
44 | #include "p16v.h" | 47 | #include "p16v.h" |
45 | #include "tina2.h" | 48 | #include "tina2.h" |
49 | #include "p17v.h" | ||
46 | 50 | ||
47 | 51 | ||
48 | /************************************************************************* | 52 | /************************************************************************* |
@@ -117,11 +121,28 @@ static unsigned int spi_dac_init[] = { | |||
117 | 0x0622, | 121 | 0x0622, |
118 | 0x1400, | 122 | 0x1400, |
119 | }; | 123 | }; |
124 | |||
125 | static unsigned int i2c_adc_init[][2] = { | ||
126 | { 0x17, 0x00 }, /* Reset */ | ||
127 | { 0x07, 0x00 }, /* Timeout */ | ||
128 | { 0x0b, 0x22 }, /* Interface control */ | ||
129 | { 0x0c, 0x22 }, /* Master mode control */ | ||
130 | { 0x0d, 0x08 }, /* Powerdown control */ | ||
131 | { 0x0e, 0xcf }, /* Attenuation Left 0x01 = -103dB, 0xff = 24dB */ | ||
132 | { 0x0f, 0xcf }, /* Attenuation Right 0.5dB steps */ | ||
133 | { 0x10, 0x7b }, /* ALC Control 1 */ | ||
134 | { 0x11, 0x00 }, /* ALC Control 2 */ | ||
135 | { 0x12, 0x32 }, /* ALC Control 3 */ | ||
136 | { 0x13, 0x00 }, /* Noise gate control */ | ||
137 | { 0x14, 0xa6 }, /* Limiter control */ | ||
138 | { 0x15, ADC_MUX_2 }, /* ADC Mixer control. Mic for Audigy 2 ZS Notebook */ | ||
139 | }; | ||
120 | 140 | ||
121 | static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) | 141 | static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) |
122 | { | 142 | { |
123 | unsigned int silent_page; | 143 | unsigned int silent_page; |
124 | int ch; | 144 | int ch; |
145 | u32 tmp; | ||
125 | 146 | ||
126 | /* disable audio and lock cache */ | 147 | /* disable audio and lock cache */ |
127 | outl(HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK | HCFG_MUTEBUTTONENABLE, | 148 | outl(HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK | HCFG_MUTEBUTTONENABLE, |
@@ -160,8 +181,6 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) | |||
160 | 181 | ||
161 | if (emu->card_capabilities->ca0151_chip) { /* audigy2 */ | 182 | if (emu->card_capabilities->ca0151_chip) { /* audigy2 */ |
162 | /* Hacks for Alice3 to work independent of haP16V driver */ | 183 | /* Hacks for Alice3 to work independent of haP16V driver */ |
163 | u32 tmp; | ||
164 | |||
165 | //Setup SRCMulti_I2S SamplingRate | 184 | //Setup SRCMulti_I2S SamplingRate |
166 | tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0); | 185 | tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0); |
167 | tmp &= 0xfffff1ff; | 186 | tmp &= 0xfffff1ff; |
@@ -181,8 +200,6 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) | |||
181 | } | 200 | } |
182 | if (emu->card_capabilities->ca0108_chip) { /* audigy2 Value */ | 201 | if (emu->card_capabilities->ca0108_chip) { /* audigy2 Value */ |
183 | /* Hacks for Alice3 to work independent of haP16V driver */ | 202 | /* Hacks for Alice3 to work independent of haP16V driver */ |
184 | u32 tmp; | ||
185 | |||
186 | snd_printk(KERN_INFO "Audigy2 value: Special config.\n"); | 203 | snd_printk(KERN_INFO "Audigy2 value: Special config.\n"); |
187 | //Setup SRCMulti_I2S SamplingRate | 204 | //Setup SRCMulti_I2S SamplingRate |
188 | tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0); | 205 | tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0); |
@@ -211,7 +228,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) | |||
211 | int size, n; | 228 | int size, n; |
212 | 229 | ||
213 | size = ARRAY_SIZE(spi_dac_init); | 230 | size = ARRAY_SIZE(spi_dac_init); |
214 | for (n=0; n < size; n++) | 231 | for (n = 0; n < size; n++) |
215 | snd_emu10k1_spi_write(emu, spi_dac_init[n]); | 232 | snd_emu10k1_spi_write(emu, spi_dac_init[n]); |
216 | 233 | ||
217 | snd_emu10k1_ptr20_write(emu, 0x60, 0, 0x10); | 234 | snd_emu10k1_ptr20_write(emu, 0x60, 0, 0x10); |
@@ -228,6 +245,23 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) | |||
228 | outl(0x76, emu->port + A_IOCFG); /* Windows uses 0x3f76 */ | 245 | outl(0x76, emu->port + A_IOCFG); /* Windows uses 0x3f76 */ |
229 | 246 | ||
230 | } | 247 | } |
248 | if (emu->card_capabilities->i2c_adc) { /* Audigy 2 ZS Notebook with ADC Wolfson WM8775 */ | ||
249 | int size, n; | ||
250 | |||
251 | snd_emu10k1_ptr20_write(emu, P17V_I2S_SRC_SEL, 0, 0x2020205f); | ||
252 | tmp = inl(emu->port + A_IOCFG); | ||
253 | outl(tmp | 0x4, emu->port + A_IOCFG); /* Set bit 2 for mic input */ | ||
254 | tmp = inl(emu->port + A_IOCFG); | ||
255 | size = ARRAY_SIZE(i2c_adc_init); | ||
256 | for (n = 0; n < size; n++) | ||
257 | snd_emu10k1_i2c_write(emu, i2c_adc_init[n][0], i2c_adc_init[n][1]); | ||
258 | for (n=0; n < 4; n++) { | ||
259 | emu->i2c_capture_volume[n][0]= 0xcf; | ||
260 | emu->i2c_capture_volume[n][1]= 0xcf; | ||
261 | } | ||
262 | |||
263 | } | ||
264 | |||
231 | 265 | ||
232 | snd_emu10k1_ptr_write(emu, PTB, 0, emu->ptb_pages.addr); | 266 | snd_emu10k1_ptr_write(emu, PTB, 0, emu->ptb_pages.addr); |
233 | snd_emu10k1_ptr_write(emu, TCB, 0, 0); /* taken from original driver */ | 267 | snd_emu10k1_ptr_write(emu, TCB, 0, 0); /* taken from original driver */ |
@@ -239,6 +273,10 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) | |||
239 | snd_emu10k1_ptr_write(emu, MAPB, ch, silent_page); | 273 | snd_emu10k1_ptr_write(emu, MAPB, ch, silent_page); |
240 | } | 274 | } |
241 | 275 | ||
276 | if (emu->card_capabilities->emu1010) { | ||
277 | outl(HCFG_AUTOMUTE_ASYNC | | ||
278 | HCFG_EMU32_SLAVE | | ||
279 | HCFG_AUDIOENABLE, emu->port + HCFG); | ||
242 | /* | 280 | /* |
243 | * Hokay, setup HCFG | 281 | * Hokay, setup HCFG |
244 | * Mute Disable Audio = 0 | 282 | * Mute Disable Audio = 0 |
@@ -246,7 +284,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) | |||
246 | * Lock Sound Memory = 0 | 284 | * Lock Sound Memory = 0 |
247 | * Auto Mute = 1 | 285 | * Auto Mute = 1 |
248 | */ | 286 | */ |
249 | if (emu->audigy) { | 287 | } else if (emu->audigy) { |
250 | if (emu->revision == 4) /* audigy2 */ | 288 | if (emu->revision == 4) /* audigy2 */ |
251 | outl(HCFG_AUDIOENABLE | | 289 | outl(HCFG_AUDIOENABLE | |
252 | HCFG_AC3ENABLE_CDSPDIF | | 290 | HCFG_AC3ENABLE_CDSPDIF | |
@@ -265,8 +303,10 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) | |||
265 | outl(HCFG_LOCKTANKCACHE_MASK | HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG); | 303 | outl(HCFG_LOCKTANKCACHE_MASK | HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG); |
266 | 304 | ||
267 | if (enable_ir) { /* enable IR for SB Live */ | 305 | if (enable_ir) { /* enable IR for SB Live */ |
268 | if ( emu->card_capabilities->emu1212m) { | 306 | if (emu->card_capabilities->emu1010) { |
269 | ; /* Disable all access to A_IOCFG for the emu1212m */ | 307 | ; /* Disable all access to A_IOCFG for the emu1010 */ |
308 | } else if (emu->card_capabilities->i2c_adc) { | ||
309 | ; /* Disable A_IOCFG for Audigy 2 ZS Notebook */ | ||
270 | } else if (emu->audigy) { | 310 | } else if (emu->audigy) { |
271 | unsigned int reg = inl(emu->port + A_IOCFG); | 311 | unsigned int reg = inl(emu->port + A_IOCFG); |
272 | outl(reg | A_IOCFG_GPOUT2, emu->port + A_IOCFG); | 312 | outl(reg | A_IOCFG_GPOUT2, emu->port + A_IOCFG); |
@@ -284,8 +324,10 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) | |||
284 | } | 324 | } |
285 | } | 325 | } |
286 | 326 | ||
287 | if ( emu->card_capabilities->emu1212m) { | 327 | if (emu->card_capabilities->emu1010) { |
288 | ; /* Disable all access to A_IOCFG for the emu1212m */ | 328 | ; /* Disable all access to A_IOCFG for the emu1010 */ |
329 | } else if (emu->card_capabilities->i2c_adc) { | ||
330 | ; /* Disable A_IOCFG for Audigy 2 ZS Notebook */ | ||
289 | } else if (emu->audigy) { /* enable analog output */ | 331 | } else if (emu->audigy) { /* enable analog output */ |
290 | unsigned int reg = inl(emu->port + A_IOCFG); | 332 | unsigned int reg = inl(emu->port + A_IOCFG); |
291 | outl(reg | A_IOCFG_GPOUT0, emu->port + A_IOCFG); | 333 | outl(reg | A_IOCFG_GPOUT0, emu->port + A_IOCFG); |
@@ -302,8 +344,10 @@ static void snd_emu10k1_audio_enable(struct snd_emu10k1 *emu) | |||
302 | outl(inl(emu->port + HCFG) | HCFG_AUDIOENABLE, emu->port + HCFG); | 344 | outl(inl(emu->port + HCFG) | HCFG_AUDIOENABLE, emu->port + HCFG); |
303 | 345 | ||
304 | /* Enable analog/digital outs on audigy */ | 346 | /* Enable analog/digital outs on audigy */ |
305 | if ( emu->card_capabilities->emu1212m) { | 347 | if (emu->card_capabilities->emu1010) { |
306 | ; /* Disable all access to A_IOCFG for the emu1212m */ | 348 | ; /* Disable all access to A_IOCFG for the emu1010 */ |
349 | } else if (emu->card_capabilities->i2c_adc) { | ||
350 | ; /* Disable A_IOCFG for Audigy 2 ZS Notebook */ | ||
307 | } else if (emu->audigy) { | 351 | } else if (emu->audigy) { |
308 | outl(inl(emu->port + A_IOCFG) & ~0x44, emu->port + A_IOCFG); | 352 | outl(inl(emu->port + A_IOCFG) & ~0x44, emu->port + A_IOCFG); |
309 | 353 | ||
@@ -596,133 +640,423 @@ static int snd_emu10k1_cardbus_init(struct snd_emu10k1 * emu) | |||
596 | return 0; | 640 | return 0; |
597 | } | 641 | } |
598 | 642 | ||
599 | static int snd_emu1212m_fpga_write(struct snd_emu10k1 * emu, int reg, int value) | 643 | static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * filename) |
600 | { | 644 | { |
601 | if (reg<0 || reg>0x3f) | 645 | int err; |
602 | return 1; | 646 | int n, i; |
603 | reg+=0x40; /* 0x40 upwards are registers. */ | 647 | int reg; |
604 | if (value<0 || value>0x3f) /* 0 to 0x3f are values */ | 648 | int value; |
605 | return 1; | 649 | const struct firmware *fw_entry; |
606 | outl(reg, emu->port + A_IOCFG); | 650 | |
607 | outl(reg | 0x80, emu->port + A_IOCFG); /* High bit clocks the value into the fpga. */ | 651 | if ((err = request_firmware(&fw_entry, filename, &emu->pci->dev)) != 0) { |
608 | outl(value, emu->port + A_IOCFG); | 652 | snd_printk(KERN_ERR "firmware: %s not found. Err=%d\n",filename, err); |
609 | outl(value | 0x80 , emu->port + A_IOCFG); /* High bit clocks the value into the fpga. */ | 653 | return err; |
610 | 654 | } | |
611 | return 0; | 655 | snd_printk(KERN_INFO "firmware size=0x%zx\n", fw_entry->size); |
612 | } | 656 | if (fw_entry->size != 0x133a4) { |
613 | 657 | snd_printk(KERN_ERR "firmware: %s wrong size.\n",filename); | |
614 | static int snd_emu1212m_fpga_read(struct snd_emu10k1 * emu, int reg, int *value) | 658 | return -EINVAL; |
615 | { | 659 | } |
616 | if (reg<0 || reg>0x3f) | ||
617 | return 1; | ||
618 | reg+=0x40; /* 0x40 upwards are registers. */ | ||
619 | outl(reg, emu->port + A_IOCFG); | ||
620 | outl(reg | 0x80, emu->port + A_IOCFG); /* High bit clocks the value into the fpga. */ | ||
621 | *value = inl(emu->port + A_IOCFG); | ||
622 | |||
623 | return 0; | ||
624 | } | ||
625 | 660 | ||
626 | static int snd_emu1212m_fpga_netlist_write(struct snd_emu10k1 * emu, int reg, int value) | 661 | /* The FPGA is a Xilinx Spartan IIE XC2S50E */ |
627 | { | 662 | /* GPIO7 -> FPGA PGMN |
628 | snd_emu1212m_fpga_write(emu, 0x00, ((reg >> 8) & 0x3f) ); | 663 | * GPIO6 -> FPGA CCLK |
629 | snd_emu1212m_fpga_write(emu, 0x01, (reg & 0x3f) ); | 664 | * GPIO5 -> FPGA DIN |
630 | snd_emu1212m_fpga_write(emu, 0x02, ((value >> 8) & 0x3f) ); | 665 | * FPGA CONFIG OFF -> FPGA PGMN |
631 | snd_emu1212m_fpga_write(emu, 0x03, (value & 0x3f) ); | 666 | */ |
667 | outl(0x00, emu->port + A_IOCFG); /* Set PGMN low for 1uS. */ | ||
668 | udelay(1); | ||
669 | outl(0x80, emu->port + A_IOCFG); /* Leave bit 7 set during netlist setup. */ | ||
670 | udelay(100); /* Allow FPGA memory to clean */ | ||
671 | for(n = 0; n < fw_entry->size; n++) { | ||
672 | value=fw_entry->data[n]; | ||
673 | for(i = 0; i < 8; i++) { | ||
674 | reg = 0x80; | ||
675 | if (value & 0x1) | ||
676 | reg = reg | 0x20; | ||
677 | value = value >> 1; | ||
678 | outl(reg, emu->port + A_IOCFG); | ||
679 | outl(reg | 0x40, emu->port + A_IOCFG); | ||
680 | } | ||
681 | } | ||
682 | /* After programming, set GPIO bit 4 high again. */ | ||
683 | outl(0x10, emu->port + A_IOCFG); | ||
684 | |||
632 | 685 | ||
686 | release_firmware(fw_entry); | ||
633 | return 0; | 687 | return 0; |
634 | } | 688 | } |
635 | 689 | ||
636 | static int snd_emu10k1_emu1212m_init(struct snd_emu10k1 * emu) | 690 | static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) |
637 | { | 691 | { |
638 | unsigned int i; | 692 | unsigned int i; |
639 | int tmp; | 693 | int tmp,tmp2; |
640 | 694 | int reg; | |
641 | snd_printk(KERN_ERR "emu1212m: Special config.\n"); | 695 | int err; |
696 | const char *hana_filename = "emu/hana.fw"; | ||
697 | const char *dock_filename = "emu/audio_dock.fw"; | ||
698 | |||
699 | snd_printk(KERN_INFO "emu1010: Special config.\n"); | ||
700 | /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave, | ||
701 | * Lock Sound Memory Cache, Lock Tank Memory Cache, | ||
702 | * Mute all codecs. | ||
703 | */ | ||
642 | outl(0x0005a00c, emu->port + HCFG); | 704 | outl(0x0005a00c, emu->port + HCFG); |
643 | outl(0x0005a004, emu->port + HCFG); | 705 | /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave, |
706 | * Lock Tank Memory Cache, | ||
707 | * Mute all codecs. | ||
708 | */ | ||
709 | outl(0x0005a004, emu->port + HCFG); | ||
710 | /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave, | ||
711 | * Mute all codecs. | ||
712 | */ | ||
644 | outl(0x0005a000, emu->port + HCFG); | 713 | outl(0x0005a000, emu->port + HCFG); |
714 | /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave, | ||
715 | * Mute all codecs. | ||
716 | */ | ||
645 | outl(0x0005a000, emu->port + HCFG); | 717 | outl(0x0005a000, emu->port + HCFG); |
646 | 718 | ||
647 | snd_emu1212m_fpga_read(emu, 0x22, &tmp ); | 719 | /* Disable 48Volt power to Audio Dock */ |
648 | snd_emu1212m_fpga_read(emu, 0x23, &tmp ); | 720 | snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0 ); |
649 | snd_emu1212m_fpga_read(emu, 0x24, &tmp ); | 721 | |
650 | snd_emu1212m_fpga_write(emu, 0x04, 0x01 ); | 722 | /* ID, should read & 0x7f = 0x55. (Bit 7 is the IRQ bit) */ |
651 | snd_emu1212m_fpga_read(emu, 0x0b, &tmp ); | 723 | snd_emu1010_fpga_read(emu, EMU_HANA_ID, ® ); |
652 | snd_emu1212m_fpga_write(emu, 0x0b, 0x01 ); | 724 | snd_printdd("reg1=0x%x\n",reg); |
653 | snd_emu1212m_fpga_read(emu, 0x10, &tmp ); | 725 | if (reg == 0x55) { |
654 | snd_emu1212m_fpga_write(emu, 0x10, 0x00 ); | 726 | /* FPGA netlist already present so clear it */ |
655 | snd_emu1212m_fpga_read(emu, 0x11, &tmp ); | 727 | /* Return to programming mode */ |
656 | snd_emu1212m_fpga_write(emu, 0x11, 0x30 ); | 728 | |
657 | snd_emu1212m_fpga_read(emu, 0x13, &tmp ); | 729 | snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0x02 ); |
658 | snd_emu1212m_fpga_write(emu, 0x13, 0x0f ); | ||
659 | snd_emu1212m_fpga_read(emu, 0x11, &tmp ); | ||
660 | snd_emu1212m_fpga_write(emu, 0x11, 0x30 ); | ||
661 | snd_emu1212m_fpga_read(emu, 0x0a, &tmp ); | ||
662 | snd_emu1212m_fpga_write(emu, 0x0a, 0x10 ); | ||
663 | snd_emu1212m_fpga_write(emu, 0x0c, 0x19 ); | ||
664 | snd_emu1212m_fpga_write(emu, 0x12, 0x0c ); | ||
665 | snd_emu1212m_fpga_write(emu, 0x09, 0x0f ); | ||
666 | snd_emu1212m_fpga_write(emu, 0x06, 0x00 ); | ||
667 | snd_emu1212m_fpga_write(emu, 0x05, 0x00 ); | ||
668 | snd_emu1212m_fpga_write(emu, 0x0e, 0x12 ); | ||
669 | snd_emu1212m_fpga_netlist_write(emu, 0x0000, 0x0200); | ||
670 | snd_emu1212m_fpga_netlist_write(emu, 0x0001, 0x0201); | ||
671 | snd_emu1212m_fpga_netlist_write(emu, 0x0002, 0x0500); | ||
672 | snd_emu1212m_fpga_netlist_write(emu, 0x0003, 0x0501); | ||
673 | snd_emu1212m_fpga_netlist_write(emu, 0x0004, 0x0400); | ||
674 | snd_emu1212m_fpga_netlist_write(emu, 0x0005, 0x0401); | ||
675 | snd_emu1212m_fpga_netlist_write(emu, 0x0006, 0x0402); | ||
676 | snd_emu1212m_fpga_netlist_write(emu, 0x0007, 0x0403); | ||
677 | snd_emu1212m_fpga_netlist_write(emu, 0x0008, 0x0404); | ||
678 | snd_emu1212m_fpga_netlist_write(emu, 0x0009, 0x0405); | ||
679 | snd_emu1212m_fpga_netlist_write(emu, 0x000a, 0x0406); | ||
680 | snd_emu1212m_fpga_netlist_write(emu, 0x000b, 0x0407); | ||
681 | snd_emu1212m_fpga_netlist_write(emu, 0x000c, 0x0100); | ||
682 | snd_emu1212m_fpga_netlist_write(emu, 0x000d, 0x0104); | ||
683 | snd_emu1212m_fpga_netlist_write(emu, 0x000e, 0x0200); | ||
684 | snd_emu1212m_fpga_netlist_write(emu, 0x000f, 0x0201); | ||
685 | for (i=0;i < 0x20;i++) { | ||
686 | snd_emu1212m_fpga_netlist_write(emu, 0x0100+i, 0x0000); | ||
687 | } | 730 | } |
688 | for (i=0;i < 4;i++) { | 731 | snd_emu1010_fpga_read(emu, EMU_HANA_ID, ® ); |
689 | snd_emu1212m_fpga_netlist_write(emu, 0x0200+i, 0x0000); | 732 | snd_printdd("reg2=0x%x\n",reg); |
733 | if (reg == 0x55) { | ||
734 | /* FPGA failed to return to programming mode */ | ||
735 | return -ENODEV; | ||
690 | } | 736 | } |
691 | for (i=0;i < 7;i++) { | 737 | snd_printk(KERN_INFO "emu1010: EMU_HANA_ID=0x%x\n",reg); |
692 | snd_emu1212m_fpga_netlist_write(emu, 0x0300+i, 0x0000); | 738 | if ((err = snd_emu1010_load_firmware(emu, hana_filename)) != 0) { |
739 | snd_printk(KERN_INFO "emu1010: Loading Hana Firmware file %s failed\n", hana_filename); | ||
740 | return err; | ||
693 | } | 741 | } |
694 | for (i=0;i < 7;i++) { | 742 | |
695 | snd_emu1212m_fpga_netlist_write(emu, 0x0400+i, 0x0000); | 743 | /* ID, should read & 0x7f = 0x55 when FPGA programmed. */ |
744 | snd_emu1010_fpga_read(emu, EMU_HANA_ID, ® ); | ||
745 | if (reg != 0x55) { | ||
746 | /* FPGA failed to be programmed */ | ||
747 | snd_printk(KERN_INFO "emu1010: Loading Hana Firmware file failed, reg=0x%x\n", reg); | ||
748 | return -ENODEV; | ||
696 | } | 749 | } |
697 | snd_emu1212m_fpga_netlist_write(emu, 0x0500, 0x0108); | ||
698 | snd_emu1212m_fpga_netlist_write(emu, 0x0501, 0x010c); | ||
699 | snd_emu1212m_fpga_netlist_write(emu, 0x0600, 0x0110); | ||
700 | snd_emu1212m_fpga_netlist_write(emu, 0x0601, 0x0114); | ||
701 | snd_emu1212m_fpga_netlist_write(emu, 0x0700, 0x0118); | ||
702 | snd_emu1212m_fpga_netlist_write(emu, 0x0701, 0x011c); | ||
703 | snd_emu1212m_fpga_write(emu, 0x07, 0x01 ); | ||
704 | 750 | ||
705 | snd_emu1212m_fpga_read(emu, 0x21, &tmp ); | 751 | snd_printk(KERN_INFO "emu1010: Hana Firmware loaded\n"); |
752 | snd_emu1010_fpga_read(emu, EMU_HANA_MAJOR_REV, &tmp ); | ||
753 | snd_emu1010_fpga_read(emu, EMU_HANA_MINOR_REV, &tmp2 ); | ||
754 | snd_printk("Hana ver:%d.%d\n",tmp ,tmp2); | ||
755 | /* Enable 48Volt power to Audio Dock */ | ||
756 | snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, EMU_HANA_DOCK_PWR_ON ); | ||
757 | |||
758 | snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, ® ); | ||
759 | snd_printk(KERN_INFO "emu1010: Card options=0x%x\n",reg); | ||
760 | snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, ® ); | ||
761 | snd_printk(KERN_INFO "emu1010: Card options=0x%x\n",reg); | ||
762 | snd_emu1010_fpga_read(emu, EMU_HANA_OPTICAL_TYPE, &tmp ); | ||
763 | /* ADAT input. */ | ||
764 | snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, 0x01 ); | ||
765 | snd_emu1010_fpga_read(emu, EMU_HANA_ADC_PADS, &tmp ); | ||
766 | /* Set no attenuation on Audio Dock pads. */ | ||
767 | snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, 0x00 ); | ||
768 | emu->emu1010.adc_pads = 0x00; | ||
769 | snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp ); | ||
770 | /* Unmute Audio dock DACs, Headphone source DAC-4. */ | ||
771 | snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30 ); | ||
772 | snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12 ); | ||
773 | snd_emu1010_fpga_read(emu, EMU_HANA_DAC_PADS, &tmp ); | ||
774 | /* DAC PADs. */ | ||
775 | snd_emu1010_fpga_write(emu, EMU_HANA_DAC_PADS, 0x0f ); | ||
776 | emu->emu1010.dac_pads = 0x0f; | ||
777 | snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp ); | ||
778 | snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30 ); | ||
779 | snd_emu1010_fpga_read(emu, EMU_HANA_SPDIF_MODE, &tmp ); | ||
780 | /* SPDIF Format. Set Consumer mode, 24bit, copy enable */ | ||
781 | snd_emu1010_fpga_write(emu, EMU_HANA_SPDIF_MODE, 0x10 ); | ||
782 | /* MIDI routing */ | ||
783 | snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19 ); | ||
784 | /* Unknown. */ | ||
785 | snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c ); | ||
786 | /* snd_emu1010_fpga_write(emu, 0x09, 0x0f ); // IRQ Enable: All on */ | ||
787 | /* IRQ Enable: All off */ | ||
788 | snd_emu1010_fpga_write(emu, EMU_HANA_IRQ_ENABLE, 0x00 ); | ||
789 | |||
790 | snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, ® ); | ||
791 | snd_printk(KERN_INFO "emu1010: Card options3=0x%x\n",reg); | ||
792 | /* Default WCLK set to 48kHz. */ | ||
793 | snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, 0x00 ); | ||
794 | /* Word Clock source, Internal 48kHz x1 */ | ||
795 | snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K ); | ||
796 | //snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K | EMU_HANA_WCLOCK_4X ); | ||
797 | /* Audio Dock LEDs. */ | ||
798 | snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12 ); | ||
706 | 799 | ||
707 | outl(0x0000a000, emu->port + HCFG); | 800 | #if 0 |
801 | /* For 96kHz */ | ||
802 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
803 | EMU_DST_ALICE2_EMU32_0, EMU_SRC_HAMOA_ADC_LEFT1); | ||
804 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
805 | EMU_DST_ALICE2_EMU32_1, EMU_SRC_HAMOA_ADC_RIGHT1); | ||
806 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
807 | EMU_DST_ALICE2_EMU32_4, EMU_SRC_HAMOA_ADC_LEFT2); | ||
808 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
809 | EMU_DST_ALICE2_EMU32_5, EMU_SRC_HAMOA_ADC_RIGHT2); | ||
810 | #endif | ||
811 | #if 0 | ||
812 | /* For 192kHz */ | ||
813 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
814 | EMU_DST_ALICE2_EMU32_0, EMU_SRC_HAMOA_ADC_LEFT1); | ||
815 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
816 | EMU_DST_ALICE2_EMU32_1, EMU_SRC_HAMOA_ADC_RIGHT1); | ||
817 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
818 | EMU_DST_ALICE2_EMU32_2, EMU_SRC_HAMOA_ADC_LEFT2); | ||
819 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
820 | EMU_DST_ALICE2_EMU32_3, EMU_SRC_HAMOA_ADC_RIGHT2); | ||
821 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
822 | EMU_DST_ALICE2_EMU32_4, EMU_SRC_HAMOA_ADC_LEFT3); | ||
823 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
824 | EMU_DST_ALICE2_EMU32_5, EMU_SRC_HAMOA_ADC_RIGHT3); | ||
825 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
826 | EMU_DST_ALICE2_EMU32_6, EMU_SRC_HAMOA_ADC_LEFT4); | ||
827 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
828 | EMU_DST_ALICE2_EMU32_7, EMU_SRC_HAMOA_ADC_RIGHT4); | ||
829 | #endif | ||
830 | #if 1 | ||
831 | /* For 48kHz */ | ||
832 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
833 | EMU_DST_ALICE2_EMU32_0, EMU_SRC_DOCK_MIC_A1); | ||
834 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
835 | EMU_DST_ALICE2_EMU32_1, EMU_SRC_DOCK_MIC_B1); | ||
836 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
837 | EMU_DST_ALICE2_EMU32_2, EMU_SRC_HAMOA_ADC_LEFT2); | ||
838 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
839 | EMU_DST_ALICE2_EMU32_3, EMU_SRC_HAMOA_ADC_LEFT2); | ||
840 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
841 | EMU_DST_ALICE2_EMU32_4, EMU_SRC_DOCK_ADC1_LEFT1); | ||
842 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
843 | EMU_DST_ALICE2_EMU32_5, EMU_SRC_DOCK_ADC1_RIGHT1); | ||
844 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
845 | EMU_DST_ALICE2_EMU32_6, EMU_SRC_DOCK_ADC2_LEFT1); | ||
846 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
847 | EMU_DST_ALICE2_EMU32_7, EMU_SRC_DOCK_ADC2_RIGHT1); | ||
848 | #endif | ||
849 | #if 0 | ||
850 | /* Original */ | ||
851 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
852 | EMU_DST_ALICE2_EMU32_4, EMU_SRC_HANA_ADAT); | ||
853 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
854 | EMU_DST_ALICE2_EMU32_5, EMU_SRC_HANA_ADAT + 1); | ||
855 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
856 | EMU_DST_ALICE2_EMU32_6, EMU_SRC_HANA_ADAT + 2); | ||
857 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
858 | EMU_DST_ALICE2_EMU32_7, EMU_SRC_HANA_ADAT + 3); | ||
859 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
860 | EMU_DST_ALICE2_EMU32_8, EMU_SRC_HANA_ADAT + 4); | ||
861 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
862 | EMU_DST_ALICE2_EMU32_9, EMU_SRC_HANA_ADAT + 5); | ||
863 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
864 | EMU_DST_ALICE2_EMU32_A, EMU_SRC_HANA_ADAT + 6); | ||
865 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
866 | EMU_DST_ALICE2_EMU32_B, EMU_SRC_HANA_ADAT + 7); | ||
867 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
868 | EMU_DST_ALICE2_EMU32_C, EMU_SRC_DOCK_MIC_A1); | ||
869 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
870 | EMU_DST_ALICE2_EMU32_D, EMU_SRC_DOCK_MIC_B1); | ||
871 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
872 | EMU_DST_ALICE2_EMU32_E, EMU_SRC_HAMOA_ADC_LEFT2); | ||
873 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
874 | EMU_DST_ALICE2_EMU32_F, EMU_SRC_HAMOA_ADC_LEFT2); | ||
875 | #endif | ||
876 | for (i = 0;i < 0x20; i++ ) { | ||
877 | /* AudioDock Elink <- Silence */ | ||
878 | snd_emu1010_fpga_link_dst_src_write(emu, 0x0100+i, EMU_SRC_SILENCE); | ||
879 | } | ||
880 | for (i = 0;i < 4; i++) { | ||
881 | /* Hana SPDIF Out <- Silence */ | ||
882 | snd_emu1010_fpga_link_dst_src_write(emu, 0x0200+i, EMU_SRC_SILENCE); | ||
883 | } | ||
884 | for (i = 0;i < 7; i++) { | ||
885 | /* Hamoa DAC <- Silence */ | ||
886 | snd_emu1010_fpga_link_dst_src_write(emu, 0x0300+i, EMU_SRC_SILENCE); | ||
887 | } | ||
888 | for (i = 0;i < 7; i++) { | ||
889 | /* Hana ADAT Out <- Silence */ | ||
890 | snd_emu1010_fpga_link_dst_src_write(emu, EMU_DST_HANA_ADAT + i, EMU_SRC_SILENCE); | ||
891 | } | ||
892 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
893 | EMU_DST_ALICE_I2S0_LEFT, EMU_SRC_DOCK_ADC1_LEFT1); | ||
894 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
895 | EMU_DST_ALICE_I2S0_RIGHT, EMU_SRC_DOCK_ADC1_RIGHT1); | ||
896 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
897 | EMU_DST_ALICE_I2S1_LEFT, EMU_SRC_DOCK_ADC2_LEFT1); | ||
898 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
899 | EMU_DST_ALICE_I2S1_RIGHT, EMU_SRC_DOCK_ADC2_RIGHT1); | ||
900 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
901 | EMU_DST_ALICE_I2S2_LEFT, EMU_SRC_DOCK_ADC3_LEFT1); | ||
902 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
903 | EMU_DST_ALICE_I2S2_RIGHT, EMU_SRC_DOCK_ADC3_RIGHT1); | ||
904 | snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x01 ); // Unmute all | ||
905 | |||
906 | snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &tmp ); | ||
907 | |||
908 | /* AC97 1.03, Any 32Meg of 2Gig address, Auto-Mute, EMU32 Slave, | ||
909 | * Lock Sound Memory Cache, Lock Tank Memory Cache, | ||
910 | * Mute all codecs. | ||
911 | */ | ||
912 | outl(0x0000a000, emu->port + HCFG); | ||
913 | /* AC97 1.03, Any 32Meg of 2Gig address, Auto-Mute, EMU32 Slave, | ||
914 | * Lock Sound Memory Cache, Lock Tank Memory Cache, | ||
915 | * Un-Mute all codecs. | ||
916 | */ | ||
708 | outl(0x0000a001, emu->port + HCFG); | 917 | outl(0x0000a001, emu->port + HCFG); |
918 | |||
709 | /* Initial boot complete. Now patches */ | 919 | /* Initial boot complete. Now patches */ |
710 | 920 | ||
711 | snd_emu1212m_fpga_read(emu, 0x21, &tmp ); | 921 | snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &tmp ); |
712 | snd_emu1212m_fpga_write(emu, 0x0c, 0x19 ); | 922 | snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19 ); /* MIDI Route */ |
713 | snd_emu1212m_fpga_write(emu, 0x12, 0x0c ); | 923 | snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c ); /* Unknown */ |
714 | snd_emu1212m_fpga_write(emu, 0x0c, 0x19 ); | 924 | snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19 ); /* MIDI Route */ |
715 | snd_emu1212m_fpga_write(emu, 0x12, 0x0c ); | 925 | snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c ); /* Unknown */ |
716 | snd_emu1212m_fpga_read(emu, 0x0a, &tmp ); | 926 | snd_emu1010_fpga_read(emu, EMU_HANA_SPDIF_MODE, &tmp ); |
717 | snd_emu1212m_fpga_write(emu, 0x0a, 0x10 ); | 927 | snd_emu1010_fpga_write(emu, EMU_HANA_SPDIF_MODE, 0x10 ); /* SPDIF Format spdif (or 0x11 for aes/ebu) */ |
718 | 928 | ||
719 | snd_emu1212m_fpga_read(emu, 0x20, &tmp ); | 929 | /* Delay to allow Audio Dock to settle */ |
720 | snd_emu1212m_fpga_read(emu, 0x21, &tmp ); | 930 | msleep(100); |
721 | 931 | snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &tmp ); /* IRQ Status */ | |
722 | snd_emu1212m_fpga_netlist_write(emu, 0x0300, 0x0312); | 932 | snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, ® ); /* OPTIONS: Which cards are attached to the EMU */ |
723 | snd_emu1212m_fpga_netlist_write(emu, 0x0301, 0x0313); | 933 | /* FIXME: The loading of this should be able to happen any time, |
724 | snd_emu1212m_fpga_netlist_write(emu, 0x0200, 0x0302); | 934 | * as the user can plug/unplug it at any time |
725 | snd_emu1212m_fpga_netlist_write(emu, 0x0201, 0x0303); | 935 | */ |
936 | if (reg & (EMU_HANA_OPTION_DOCK_ONLINE | EMU_HANA_OPTION_DOCK_OFFLINE) ) { | ||
937 | /* Audio Dock attached */ | ||
938 | /* Return to Audio Dock programming mode */ | ||
939 | snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware\n"); | ||
940 | snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, EMU_HANA_FPGA_CONFIG_AUDIODOCK ); | ||
941 | if ((err = snd_emu1010_load_firmware(emu, dock_filename)) != 0) { | ||
942 | return err; | ||
943 | } | ||
944 | snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0 ); | ||
945 | snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, ® ); | ||
946 | snd_printk(KERN_INFO "emu1010: EMU_HANA+DOCK_IRQ_STATUS=0x%x\n",reg); | ||
947 | /* ID, should read & 0x7f = 0x55 when FPGA programmed. */ | ||
948 | snd_emu1010_fpga_read(emu, EMU_HANA_ID, ® ); | ||
949 | snd_printk(KERN_INFO "emu1010: EMU_HANA+DOCK_ID=0x%x\n",reg); | ||
950 | if (reg != 0x55) { | ||
951 | /* FPGA failed to be programmed */ | ||
952 | snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware file failed, reg=0x%x\n", reg); | ||
953 | return 0; | ||
954 | return -ENODEV; | ||
955 | } | ||
956 | snd_printk(KERN_INFO "emu1010: Audio Dock Firmware loaded\n"); | ||
957 | snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp ); | ||
958 | snd_emu1010_fpga_read(emu, EMU_DOCK_MINOR_REV, &tmp2 ); | ||
959 | snd_printk("Audio Dock ver:%d.%d\n",tmp ,tmp2); | ||
960 | } | ||
961 | #if 0 | ||
962 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
963 | EMU_DST_HAMOA_DAC_LEFT1, EMU_SRC_ALICE_EMU32B + 2); /* ALICE2 bus 0xa2 */ | ||
964 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
965 | EMU_DST_HAMOA_DAC_RIGHT1, EMU_SRC_ALICE_EMU32B + 3); /* ALICE2 bus 0xa3 */ | ||
966 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
967 | EMU_DST_HANA_SPDIF_LEFT1, EMU_SRC_ALICE_EMU32A + 2); /* ALICE2 bus 0xb2 */ | ||
968 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
969 | EMU_DST_HANA_SPDIF_RIGHT1, EMU_SRC_ALICE_EMU32A + 3); /* ALICE2 bus 0xb3 */ | ||
970 | #endif | ||
971 | /* Default outputs */ | ||
972 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
973 | EMU_DST_DOCK_DAC1_LEFT1, EMU_SRC_ALICE_EMU32A + 0); /* ALICE2 bus 0xa0 */ | ||
974 | emu->emu1010.output_source[0] = 21; | ||
975 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
976 | EMU_DST_DOCK_DAC1_RIGHT1, EMU_SRC_ALICE_EMU32A + 1); | ||
977 | emu->emu1010.output_source[1] = 22; | ||
978 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
979 | EMU_DST_DOCK_DAC2_LEFT1, EMU_SRC_ALICE_EMU32A + 2); | ||
980 | emu->emu1010.output_source[2] = 23; | ||
981 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
982 | EMU_DST_DOCK_DAC2_RIGHT1, EMU_SRC_ALICE_EMU32A + 3); | ||
983 | emu->emu1010.output_source[3] = 24; | ||
984 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
985 | EMU_DST_DOCK_DAC3_LEFT1, EMU_SRC_ALICE_EMU32A + 4); | ||
986 | emu->emu1010.output_source[4] = 25; | ||
987 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
988 | EMU_DST_DOCK_DAC3_RIGHT1, EMU_SRC_ALICE_EMU32A + 5); | ||
989 | emu->emu1010.output_source[5] = 26; | ||
990 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
991 | EMU_DST_DOCK_DAC4_LEFT1, EMU_SRC_ALICE_EMU32A + 6); | ||
992 | emu->emu1010.output_source[6] = 27; | ||
993 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
994 | EMU_DST_DOCK_DAC4_RIGHT1, EMU_SRC_ALICE_EMU32A + 7); | ||
995 | emu->emu1010.output_source[7] = 28; | ||
996 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
997 | EMU_DST_DOCK_PHONES_LEFT1, EMU_SRC_ALICE_EMU32A + 0); /* ALICE2 bus 0xa0 */ | ||
998 | emu->emu1010.output_source[8] = 21; | ||
999 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
1000 | EMU_DST_DOCK_PHONES_RIGHT1, EMU_SRC_ALICE_EMU32A + 1); | ||
1001 | emu->emu1010.output_source[9] = 22; | ||
1002 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
1003 | EMU_DST_DOCK_SPDIF_LEFT1, EMU_SRC_ALICE_EMU32A + 0); /* ALICE2 bus 0xa0 */ | ||
1004 | emu->emu1010.output_source[10] = 21; | ||
1005 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
1006 | EMU_DST_DOCK_SPDIF_RIGHT1, EMU_SRC_ALICE_EMU32A + 1); | ||
1007 | emu->emu1010.output_source[11] = 22; | ||
1008 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
1009 | EMU_DST_HANA_SPDIF_LEFT1, EMU_SRC_ALICE_EMU32A + 0); /* ALICE2 bus 0xa0 */ | ||
1010 | emu->emu1010.output_source[12] = 21; | ||
1011 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
1012 | EMU_DST_HANA_SPDIF_RIGHT1, EMU_SRC_ALICE_EMU32A + 1); | ||
1013 | emu->emu1010.output_source[13] = 22; | ||
1014 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
1015 | EMU_DST_HAMOA_DAC_LEFT1, EMU_SRC_ALICE_EMU32A + 0); /* ALICE2 bus 0xa0 */ | ||
1016 | emu->emu1010.output_source[14] = 21; | ||
1017 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
1018 | EMU_DST_HAMOA_DAC_RIGHT1, EMU_SRC_ALICE_EMU32A + 1); | ||
1019 | emu->emu1010.output_source[15] = 22; | ||
1020 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
1021 | EMU_DST_HANA_ADAT, EMU_SRC_ALICE_EMU32A + 0); /* ALICE2 bus 0xa0 */ | ||
1022 | emu->emu1010.output_source[16] = 21; | ||
1023 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
1024 | EMU_DST_HANA_ADAT + 1, EMU_SRC_ALICE_EMU32A + 1); | ||
1025 | emu->emu1010.output_source[17] = 22; | ||
1026 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
1027 | EMU_DST_HANA_ADAT + 2, EMU_SRC_ALICE_EMU32A + 2); | ||
1028 | emu->emu1010.output_source[18] = 23; | ||
1029 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
1030 | EMU_DST_HANA_ADAT + 3, EMU_SRC_ALICE_EMU32A + 3); | ||
1031 | emu->emu1010.output_source[19] = 24; | ||
1032 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
1033 | EMU_DST_HANA_ADAT + 4, EMU_SRC_ALICE_EMU32A + 4); | ||
1034 | emu->emu1010.output_source[20] = 25; | ||
1035 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
1036 | EMU_DST_HANA_ADAT + 5, EMU_SRC_ALICE_EMU32A + 5); | ||
1037 | emu->emu1010.output_source[21] = 26; | ||
1038 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
1039 | EMU_DST_HANA_ADAT + 6, EMU_SRC_ALICE_EMU32A + 6); | ||
1040 | emu->emu1010.output_source[22] = 27; | ||
1041 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
1042 | EMU_DST_HANA_ADAT + 7, EMU_SRC_ALICE_EMU32A + 7); | ||
1043 | emu->emu1010.output_source[23] = 28; | ||
1044 | |||
1045 | /* TEMP: Select SPDIF in/out */ | ||
1046 | snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, 0x0); /* Output spdif */ | ||
1047 | |||
1048 | /* TEMP: Select 48kHz SPDIF out */ | ||
1049 | snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x0); /* Mute all */ | ||
1050 | snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, 0x0); /* Default fallback clock 48kHz */ | ||
1051 | /* Word Clock source, Internal 48kHz x1 */ | ||
1052 | snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K ); | ||
1053 | //snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K | EMU_HANA_WCLOCK_4X ); | ||
1054 | emu->emu1010.internal_clock = 1; /* 48000 */ | ||
1055 | snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12);/* Set LEDs on Audio Dock */ | ||
1056 | snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x1); /* Unmute all */ | ||
1057 | //snd_emu1010_fpga_write(emu, 0x7, 0x0); /* Mute all */ | ||
1058 | //snd_emu1010_fpga_write(emu, 0x7, 0x1); /* Unmute all */ | ||
1059 | //snd_emu1010_fpga_write(emu, 0xe, 0x12); /* Set LEDs on Audio Dock */ | ||
726 | 1060 | ||
727 | return 0; | 1061 | return 0; |
728 | } | 1062 | } |
@@ -747,6 +1081,10 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu) | |||
747 | } | 1081 | } |
748 | snd_emu10k1_free_efx(emu); | 1082 | snd_emu10k1_free_efx(emu); |
749 | } | 1083 | } |
1084 | if (emu->card_capabilities->emu1010) { | ||
1085 | /* Disable 48Volt power to Audio Dock */ | ||
1086 | snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0 ); | ||
1087 | } | ||
750 | if (emu->memhdr) | 1088 | if (emu->memhdr) |
751 | snd_util_memhdr_free(emu->memhdr); | 1089 | snd_util_memhdr_free(emu->memhdr); |
752 | if (emu->silent_page.area) | 1090 | if (emu->silent_page.area) |
@@ -838,10 +1176,11 @@ static struct snd_emu_chip_details emu_chip_details[] = { | |||
838 | .adc_1361t = 1, /* 24 bit capture instead of 16bit */ | 1176 | .adc_1361t = 1, /* 24 bit capture instead of 16bit */ |
839 | .ac97_chip = 1} , | 1177 | .ac97_chip = 1} , |
840 | /* Audigy 2 ZS Notebook Cardbus card.*/ | 1178 | /* Audigy 2 ZS Notebook Cardbus card.*/ |
841 | /* Tested by James@superbug.co.uk 22th December 2005 */ | 1179 | /* Tested by James@superbug.co.uk 6th November 2006 */ |
842 | /* Audio output 7.1/Headphones working. | 1180 | /* Audio output 7.1/Headphones working. |
843 | * Digital output working. (AC3 not checked, only PCM) | 1181 | * Digital output working. (AC3 not checked, only PCM) |
844 | * Audio inputs not tested. | 1182 | * Audio Mic/Line inputs working. |
1183 | * Digital input not tested. | ||
845 | */ | 1184 | */ |
846 | /* DSP: Tina2 | 1185 | /* DSP: Tina2 |
847 | * DAC: Wolfson WM8768/WM8568 | 1186 | * DAC: Wolfson WM8768/WM8568 |
@@ -849,6 +1188,25 @@ static struct snd_emu_chip_details emu_chip_details[] = { | |||
849 | * AC97: None | 1188 | * AC97: None |
850 | * CA0151: None | 1189 | * CA0151: None |
851 | */ | 1190 | */ |
1191 | /* Tested by James@superbug.co.uk 4th April 2006 */ | ||
1192 | /* A_IOCFG bits | ||
1193 | * Output | ||
1194 | * 0: Not Used | ||
1195 | * 1: 0 = Mute all the 7.1 channel out. 1 = unmute. | ||
1196 | * 2: Analog input 0 = line in, 1 = mic in | ||
1197 | * 3: Not Used | ||
1198 | * 4: Digital output 0 = off, 1 = on. | ||
1199 | * 5: Not Used | ||
1200 | * 6: Not Used | ||
1201 | * 7: Not Used | ||
1202 | * Input | ||
1203 | * All bits 1 (0x3fxx) means nothing plugged in. | ||
1204 | * 8-9: 0 = Line in/Mic, 2 = Optical in, 3 = Nothing. | ||
1205 | * A-B: 0 = Headphones, 2 = Optical out, 3 = Nothing. | ||
1206 | * C-D: 2 = Front/Rear/etc, 3 = nothing. | ||
1207 | * E-F: Always 0 | ||
1208 | * | ||
1209 | */ | ||
852 | {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x20011102, | 1210 | {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x20011102, |
853 | .driver = "Audigy2", .name = "Audigy 2 ZS Notebook [SB0530]", | 1211 | .driver = "Audigy2", .name = "Audigy 2 ZS Notebook [SB0530]", |
854 | .id = "Audigy2", | 1212 | .id = "Audigy2", |
@@ -856,6 +1214,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { | |||
856 | .ca0108_chip = 1, | 1214 | .ca0108_chip = 1, |
857 | .ca_cardbus_chip = 1, | 1215 | .ca_cardbus_chip = 1, |
858 | .spi_dac = 1, | 1216 | .spi_dac = 1, |
1217 | .i2c_adc = 1, | ||
859 | .spk71 = 1} , | 1218 | .spk71 = 1} , |
860 | {.vendor = 0x1102, .device = 0x0008, | 1219 | {.vendor = 0x1102, .device = 0x0008, |
861 | .driver = "Audigy2", .name = "Audigy 2 Value [Unknown]", | 1220 | .driver = "Audigy2", .name = "Audigy 2 Value [Unknown]", |
@@ -865,11 +1224,12 @@ static struct snd_emu_chip_details emu_chip_details[] = { | |||
865 | .ac97_chip = 1} , | 1224 | .ac97_chip = 1} , |
866 | /* Tested by James@superbug.co.uk 8th July 2005. No sound available yet. */ | 1225 | /* Tested by James@superbug.co.uk 8th July 2005. No sound available yet. */ |
867 | {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40011102, | 1226 | {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40011102, |
868 | .driver = "Audigy2", .name = "E-mu 1212m [4001]", | 1227 | .driver = "Audigy2", .name = "E-mu 1010 [4001]", |
869 | .id = "EMU1212m", | 1228 | .id = "EMU1010", |
870 | .emu10k2_chip = 1, | 1229 | .emu10k2_chip = 1, |
871 | .ca0102_chip = 1, | 1230 | .ca0102_chip = 1, |
872 | .emu1212m = 1} , | 1231 | .spk71 = 1, |
1232 | .emu1010 = 1} , | ||
873 | /* Tested by James@superbug.co.uk 3rd July 2005 */ | 1233 | /* Tested by James@superbug.co.uk 3rd July 2005 */ |
874 | {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20071102, | 1234 | {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20071102, |
875 | .driver = "Audigy2", .name = "Audigy 4 PRO [SB0380]", | 1235 | .driver = "Audigy2", .name = "Audigy 4 PRO [SB0380]", |
@@ -1297,8 +1657,8 @@ int __devinit snd_emu10k1_create(struct snd_card *card, | |||
1297 | } else if (emu->card_capabilities->ca_cardbus_chip) { | 1657 | } else if (emu->card_capabilities->ca_cardbus_chip) { |
1298 | if ((err = snd_emu10k1_cardbus_init(emu)) < 0) | 1658 | if ((err = snd_emu10k1_cardbus_init(emu)) < 0) |
1299 | goto error; | 1659 | goto error; |
1300 | } else if (emu->card_capabilities->emu1212m) { | 1660 | } else if (emu->card_capabilities->emu1010) { |
1301 | if ((err = snd_emu10k1_emu1212m_init(emu)) < 0) { | 1661 | if ((err = snd_emu10k1_emu1010_init(emu)) < 0) { |
1302 | snd_emu10k1_free(emu); | 1662 | snd_emu10k1_free(emu); |
1303 | return err; | 1663 | return err; |
1304 | } | 1664 | } |
@@ -1446,8 +1806,8 @@ void snd_emu10k1_resume_init(struct snd_emu10k1 *emu) | |||
1446 | snd_emu10k1_ecard_init(emu); | 1806 | snd_emu10k1_ecard_init(emu); |
1447 | else if (emu->card_capabilities->ca_cardbus_chip) | 1807 | else if (emu->card_capabilities->ca_cardbus_chip) |
1448 | snd_emu10k1_cardbus_init(emu); | 1808 | snd_emu10k1_cardbus_init(emu); |
1449 | else if (emu->card_capabilities->emu1212m) | 1809 | else if (emu->card_capabilities->emu1010) |
1450 | snd_emu10k1_emu1212m_init(emu); | 1810 | snd_emu10k1_emu1010_init(emu); |
1451 | else | 1811 | else |
1452 | snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE); | 1812 | snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE); |
1453 | snd_emu10k1_init(emu, emu->enable_ir, 1); | 1813 | snd_emu10k1_init(emu, emu->enable_ir, 1); |