Lines Matching +full:non +full:- +full:live

1 // SPDX-License-Identifier: GPL-2.0-or-later
7 * Copyright (c) by James Courtier-Dutton <James@superbug.co.uk>
13 * --
16 * --
92 if (emu->audigy) { in snd_emu10k1_voice_init()
133 { 0x0e, 0xcf }, /* Attenuation Left 0x01 = -103dB, 0xff = 24dB */
151 HCFG_MUTEBUTTONENABLE, emu->port + HCFG); in snd_emu10k1_init()
162 outl(0, emu->port + INTE); in snd_emu10k1_init()
168 if (emu->audigy) { in snd_emu10k1_init()
180 snd_emu10k1_ptr_write(emu, SPCS0, 0, emu->spdif_bits[0]); in snd_emu10k1_init()
181 snd_emu10k1_ptr_write(emu, SPCS1, 0, emu->spdif_bits[1]); in snd_emu10k1_init()
182 snd_emu10k1_ptr_write(emu, SPCS2, 0, emu->spdif_bits[2]); in snd_emu10k1_init()
184 if (emu->card_capabilities->ca0151_chip) { /* audigy2 */ in snd_emu10k1_init()
198 /* Enabled Phased (8-channel) P16V playback */ in snd_emu10k1_init()
199 outl(0x0201, emu->port + HCFG2); in snd_emu10k1_init()
203 if (emu->card_capabilities->ca0108_chip) { /* audigy2 Value */ in snd_emu10k1_init()
205 dev_info(emu->card->dev, "Audigy2 value: Special config.\n"); in snd_emu10k1_init()
213 outl(0x600000, emu->port + 0x20); in snd_emu10k1_init()
214 outl(0x14, emu->port + 0x24); in snd_emu10k1_init()
217 outl(0x7b0000, emu->port + 0x20); in snd_emu10k1_init()
218 outl(0xFF000000, emu->port + 0x24); in snd_emu10k1_init()
224 outl(0x7a0000, emu->port + 0x20); in snd_emu10k1_init()
225 outl(0xFF000000, emu->port + 0x24); in snd_emu10k1_init()
226 tmp = inl(emu->port + A_IOCFG) & ~0x8; /* Clear bit 3 */ in snd_emu10k1_init()
227 outl(tmp, emu->port + A_IOCFG); in snd_emu10k1_init()
229 if (emu->card_capabilities->spi_dac) { /* Audigy 2 ZS Notebook with DAC Wolfson WM8768/WM8568 */ in snd_emu10k1_init()
239 * GPIO1: Speakers-enabled. in snd_emu10k1_init()
247 outl(0x76, emu->port + A_IOCFG); /* Windows uses 0x3f76 */ in snd_emu10k1_init()
249 if (emu->card_capabilities->i2c_adc) { /* Audigy 2 ZS Notebook with ADC Wolfson WM8775 */ in snd_emu10k1_init()
253 tmp = inl(emu->port + A_IOCFG); in snd_emu10k1_init()
254 outl(tmp | 0x4, emu->port + A_IOCFG); /* Set bit 2 for mic input */ in snd_emu10k1_init()
255 tmp = inl(emu->port + A_IOCFG); in snd_emu10k1_init()
260 emu->i2c_capture_volume[n][0] = 0xcf; in snd_emu10k1_init()
261 emu->i2c_capture_volume[n][1] = 0xcf; in snd_emu10k1_init()
266 snd_emu10k1_ptr_write(emu, PTB, 0, emu->ptb_pages.addr); in snd_emu10k1_init()
270 …silent_page = (emu->silent_page.addr << emu->address_mode) | (emu->address_mode ? MAP_PTI_MASK1 : … in snd_emu10k1_init()
276 if (emu->card_capabilities->emu_model) { in snd_emu10k1_init()
279 HCFG_AUDIOENABLE, emu->port + HCFG); in snd_emu10k1_init()
287 } else if (emu->audigy) { in snd_emu10k1_init()
288 if (emu->revision == 4) /* audigy2 */ in snd_emu10k1_init()
292 HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG); in snd_emu10k1_init()
294 outl(HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG); in snd_emu10k1_init()
295 /* FIXME: Remove all these emu->model and replace it with a card recognition parameter, in snd_emu10k1_init()
296 * e.g. card_capabilities->joystick */ in snd_emu10k1_init()
297 } else if (emu->model == 0x20 || in snd_emu10k1_init()
298 emu->model == 0xc400 || in snd_emu10k1_init()
299 (emu->model == 0x21 && emu->revision < 6)) in snd_emu10k1_init()
300 outl(HCFG_LOCKTANKCACHE_MASK | HCFG_AUTOMUTE, emu->port + HCFG); in snd_emu10k1_init()
302 /* With on-chip joystick */ in snd_emu10k1_init()
303 outl(HCFG_LOCKTANKCACHE_MASK | HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG); in snd_emu10k1_init()
305 if (enable_ir) { /* enable IR for SB Live */ in snd_emu10k1_init()
306 if (emu->card_capabilities->emu_model) { in snd_emu10k1_init()
308 } else if (emu->card_capabilities->i2c_adc) { in snd_emu10k1_init()
310 } else if (emu->audigy) { in snd_emu10k1_init()
311 unsigned int reg = inl(emu->port + A_IOCFG); in snd_emu10k1_init()
312 outl(reg | A_IOCFG_GPOUT2, emu->port + A_IOCFG); in snd_emu10k1_init()
314 outl(reg | A_IOCFG_GPOUT1 | A_IOCFG_GPOUT2, emu->port + A_IOCFG); in snd_emu10k1_init()
316 outl(reg, emu->port + A_IOCFG); in snd_emu10k1_init()
318 unsigned int reg = inl(emu->port + HCFG); in snd_emu10k1_init()
319 outl(reg | HCFG_GPOUT2, emu->port + HCFG); in snd_emu10k1_init()
321 outl(reg | HCFG_GPOUT1 | HCFG_GPOUT2, emu->port + HCFG); in snd_emu10k1_init()
323 outl(reg, emu->port + HCFG); in snd_emu10k1_init()
327 if (emu->card_capabilities->emu_model) { in snd_emu10k1_init()
329 } else if (emu->card_capabilities->i2c_adc) { in snd_emu10k1_init()
331 } else if (emu->audigy) { /* enable analog output */ in snd_emu10k1_init()
332 unsigned int reg = inl(emu->port + A_IOCFG); in snd_emu10k1_init()
333 outl(reg | A_IOCFG_GPOUT0, emu->port + A_IOCFG); in snd_emu10k1_init()
336 if (emu->address_mode == 0) { in snd_emu10k1_init()
338 outl(inl(emu->port + HCFG) | HCFG_EXPANDED_MEM, emu->port + HCFG); in snd_emu10k1_init()
349 outl(inl(emu->port + HCFG) | HCFG_AUDIOENABLE, emu->port + HCFG); in snd_emu10k1_audio_enable()
352 if (emu->card_capabilities->emu_model) { in snd_emu10k1_audio_enable()
354 } else if (emu->card_capabilities->i2c_adc) { in snd_emu10k1_audio_enable()
356 } else if (emu->audigy) { in snd_emu10k1_audio_enable()
357 outl(inl(emu->port + A_IOCFG) & ~0x44, emu->port + A_IOCFG); in snd_emu10k1_audio_enable()
359 if (emu->card_capabilities->ca0151_chip) { /* audigy2 */ in snd_emu10k1_audio_enable()
363 outl(inl(emu->port + A_IOCFG) | 0x0040, emu->port + A_IOCFG); in snd_emu10k1_audio_enable()
364 } else if (emu->card_capabilities->ca0108_chip) { /* audigy2 value */ in snd_emu10k1_audio_enable()
366 outl(inl(emu->port + A_IOCFG) | 0x0060, emu->port + A_IOCFG); in snd_emu10k1_audio_enable()
369 outl(inl(emu->port + A_IOCFG) | 0x0080, emu->port + A_IOCFG); in snd_emu10k1_audio_enable()
376 /* FIXME: the following routine disables LiveDrive-II !! */ in snd_emu10k1_audio_enable()
378 emu->tos_link = 0; in snd_emu10k1_audio_enable()
379 tmp = inl(emu->port + HCFG); in snd_emu10k1_audio_enable()
381 outl(tmp|0x800, emu->port + HCFG); in snd_emu10k1_audio_enable()
383 if (tmp != (inl(emu->port + HCFG) & ~0x800)) { in snd_emu10k1_audio_enable()
384 emu->tos_link = 1; in snd_emu10k1_audio_enable()
385 outl(tmp, emu->port + HCFG); in snd_emu10k1_audio_enable()
398 outl(0, emu->port + INTE); in snd_emu10k1_done()
422 if (emu->audigy) in snd_emu10k1_done()
434 outl(HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK | HCFG_MUTEBUTTONENABLE, emu->port + HCFG); in snd_emu10k1_done()
476 #define EC_CURRENT_PROM_VERSION 0x01 /* Self-explanatory. This should
480 #define EC_EEPROM_SIZE 0x40 /* ECARD EEPROM has 64 16-bit words */
491 * and is stored as a NULL-terminated
497 /* Most of this stuff is pretty self-evident. According to the hardware
511 * control latch will is loaded bit-serially by toggling the Modem control
524 hc_port = emu->port + HCFG; in snd_emu10k1_ecard_write()
561 snd_emu10k1_ecard_write(emu, emu->ecard_ctrl & ~EC_TRIM_CSN); in snd_emu10k1_ecard_setadcgain()
564 snd_emu10k1_ecard_write(emu, emu->ecard_ctrl & ~EC_TRIM_CSN); in snd_emu10k1_ecard_setadcgain()
569 value = emu->ecard_ctrl & ~(EC_TRIM_CSN | EC_TRIM_SDATA); in snd_emu10k1_ecard_setadcgain()
580 snd_emu10k1_ecard_write(emu, emu->ecard_ctrl); in snd_emu10k1_ecard_setadcgain()
588 emu->ecard_ctrl = EC_RAW_RUN_MODE | in snd_emu10k1_ecard_init()
594 hc_value = inl(emu->port + HCFG); in snd_emu10k1_ecard_init()
595 outl(hc_value | HCFG_AUDIOENABLE | HCFG_CODECFORMAT_I2S, emu->port + HCFG); in snd_emu10k1_ecard_init()
596 inl(emu->port + HCFG); in snd_emu10k1_ecard_init()
615 snd_emu10k1_ecard_write(emu, emu->ecard_ctrl); in snd_emu10k1_ecard_init()
629 * before the rest of the IO-Ports become active. in snd_emu10k1_cardbus_init()
631 special_port = emu->port + 0x38; in snd_emu10k1_cardbus_init()
660 return -EIO; in snd_emu1010_load_firmware_entry()
663 /* GPIO7 -> FPGA PGMN in snd_emu1010_load_firmware_entry()
664 * GPIO6 -> FPGA CCLK in snd_emu1010_load_firmware_entry()
665 * GPIO5 -> FPGA DIN in snd_emu1010_load_firmware_entry()
666 * FPGA CONFIG OFF -> FPGA PGMN in snd_emu1010_load_firmware_entry()
668 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu1010_load_firmware_entry()
669 outl(0x00, emu->port + A_IOCFG); /* Set PGMN low for 1uS. */ in snd_emu1010_load_firmware_entry()
670 write_post = inl(emu->port + A_IOCFG); in snd_emu1010_load_firmware_entry()
672 outl(0x80, emu->port + A_IOCFG); /* Leave bit 7 set during netlist setup. */ in snd_emu1010_load_firmware_entry()
673 write_post = inl(emu->port + A_IOCFG); in snd_emu1010_load_firmware_entry()
675 for (n = 0; n < fw_entry->size; n++) { in snd_emu1010_load_firmware_entry()
676 value = fw_entry->data[n]; in snd_emu1010_load_firmware_entry()
682 outl(reg, emu->port + A_IOCFG); in snd_emu1010_load_firmware_entry()
683 write_post = inl(emu->port + A_IOCFG); in snd_emu1010_load_firmware_entry()
684 outl(reg | 0x40, emu->port + A_IOCFG); in snd_emu1010_load_firmware_entry()
685 write_post = inl(emu->port + A_IOCFG); in snd_emu1010_load_firmware_entry()
689 outl(0x10, emu->port + A_IOCFG); in snd_emu1010_load_firmware_entry()
690 write_post = inl(emu->port + A_IOCFG); in snd_emu1010_load_firmware_entry()
691 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu1010_load_firmware_entry()
696 /* firmware file names, per model, init-fw and dock-fw (optional) */
719 filename = firmware_names[emu->card_capabilities->emu_model][dock]; in snd_emu1010_load_firmware()
722 err = request_firmware(fw, filename, &emu->pci->dev); in snd_emu1010_load_firmware()
738 if (emu->card->shutdown) in emu1010_firmware_work()
741 if (emu->suspend) in emu1010_firmware_work()
749 dev_info(emu->card->dev, in emu1010_firmware_work()
753 err = snd_emu1010_load_firmware(emu, 1, &emu->dock_fw); in emu1010_firmware_work()
759 dev_info(emu->card->dev, in emu1010_firmware_work()
763 dev_info(emu->card->dev, in emu1010_firmware_work()
767 dev_info(emu->card->dev, in emu1010_firmware_work()
772 dev_info(emu->card->dev, in emu1010_firmware_work()
776 dev_info(emu->card->dev, "Audio Dock ver: %u.%u\n", tmp, tmp2); in emu1010_firmware_work()
782 } else if (!reg && emu->emu1010.last_reg) { in emu1010_firmware_work()
784 dev_info(emu->card->dev, "emu1010: Audio Dock detached\n"); in emu1010_firmware_work()
790 emu->emu1010.last_reg = reg; in emu1010_firmware_work()
791 if (!emu->card->shutdown) in emu1010_firmware_work()
792 schedule_delayed_work(&emu->emu1010.firmware_work, in emu1010_firmware_work()
797 * EMU-1010 - details found out from this driver, official MS Win drivers,
801 * ---------------------
803 * * conversion of 32-bit data coming over EMU32 links from HANA FPGA
804 * to 2 x 16-bit, using internal DSP instructions
807 * 32 x 32-bit serial EMU32 output channels
812 * ---------------
816 * * two crystals - for 44.1kHz and 48kHz multiples
818 * * inputs/outputs to Alice2 - see above
821 * ----------------------------
824 * 16 x 16-bit playback - snd_emu10k1_fx8010_playback_ops
825 * 16 x 32-bit capture - snd_emu10k1_capture_efx_ops
833 dev_info(emu->card->dev, "emu1010: Special config.\n"); in snd_emu10k1_emu1010_init()
834 /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave, in snd_emu10k1_emu1010_init()
838 outl(0x0005a00c, emu->port + HCFG); in snd_emu10k1_emu1010_init()
839 /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave, in snd_emu10k1_emu1010_init()
843 outl(0x0005a004, emu->port + HCFG); in snd_emu10k1_emu1010_init()
844 /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave, in snd_emu10k1_emu1010_init()
847 outl(0x0005a000, emu->port + HCFG); in snd_emu10k1_emu1010_init()
848 /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave, in snd_emu10k1_emu1010_init()
851 outl(0x0005a000, emu->port + HCFG); in snd_emu10k1_emu1010_init()
858 dev_dbg(emu->card->dev, "reg1 = 0x%x\n", reg); in snd_emu10k1_emu1010_init()
866 dev_dbg(emu->card->dev, "reg2 = 0x%x\n", reg); in snd_emu10k1_emu1010_init()
869 dev_info(emu->card->dev, in snd_emu10k1_emu1010_init()
871 return -ENODEV; in snd_emu10k1_emu1010_init()
873 dev_info(emu->card->dev, "emu1010: EMU_HANA_ID = 0x%x\n", reg); in snd_emu10k1_emu1010_init()
875 err = snd_emu1010_load_firmware(emu, 0, &emu->firmware); in snd_emu10k1_emu1010_init()
877 dev_info(emu->card->dev, "emu1010: Loading Firmware failed\n"); in snd_emu10k1_emu1010_init()
885 dev_info(emu->card->dev, in snd_emu10k1_emu1010_init()
888 return -ENODEV; in snd_emu10k1_emu1010_init()
891 dev_info(emu->card->dev, "emu1010: Hana Firmware loaded\n"); in snd_emu10k1_emu1010_init()
894 dev_info(emu->card->dev, "emu1010: Hana version: %u.%u\n", tmp, tmp2); in snd_emu10k1_emu1010_init()
899 dev_info(emu->card->dev, "emu1010: Card options = 0x%x\n", reg); in snd_emu10k1_emu1010_init()
901 dev_info(emu->card->dev, "emu1010: Card options = 0x%x\n", reg); in snd_emu10k1_emu1010_init()
903 /* Optical -> ADAT I/O */ in snd_emu10k1_emu1010_init()
907 emu->emu1010.optical_in = 1; /* IN_ADAT */ in snd_emu10k1_emu1010_init()
908 emu->emu1010.optical_out = 1; /* IN_ADAT */ in snd_emu10k1_emu1010_init()
910 tmp = (emu->emu1010.optical_in ? EMU_HANA_OPTICAL_IN_ADAT : 0) | in snd_emu10k1_emu1010_init()
911 (emu->emu1010.optical_out ? EMU_HANA_OPTICAL_OUT_ADAT : 0); in snd_emu10k1_emu1010_init()
916 emu->emu1010.adc_pads = 0x00; in snd_emu10k1_emu1010_init()
918 /* Unmute Audio dock DACs, Headphone source DAC-4. */ in snd_emu10k1_emu1010_init()
924 emu->emu1010.dac_pads = 0x0f; in snd_emu10k1_emu1010_init()
940 dev_info(emu->card->dev, "emu1010: Card options3 = 0x%x\n", reg); in snd_emu10k1_emu1010_init()
997 /* Pavel Hofman - setting defaults for 8 more capture channels in snd_emu10k1_emu1010_init()
1047 /* AudioDock Elink <- Silence */ in snd_emu10k1_emu1010_init()
1051 /* Hana SPDIF Out <- Silence */ in snd_emu10k1_emu1010_init()
1055 /* Hamoa DAC <- Silence */ in snd_emu10k1_emu1010_init()
1059 /* Hana ADAT Out <- Silence */ in snd_emu10k1_emu1010_init()
1078 /* AC97 1.03, Any 32Meg of 2Gig address, Auto-Mute, EMU32 Slave, in snd_emu10k1_emu1010_init()
1082 outl(0x0000a000, emu->port + HCFG); in snd_emu10k1_emu1010_init()
1083 /* AC97 1.03, Any 32Meg of 2Gig address, Auto-Mute, EMU32 Slave, in snd_emu10k1_emu1010_init()
1085 * Un-Mute all codecs. in snd_emu10k1_emu1010_init()
1087 outl(0x0000a001, emu->port + HCFG); in snd_emu10k1_emu1010_init()
1110 if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1616) { in snd_emu10k1_emu1010_init()
1115 emu->emu1010.output_source[0] = 17; in snd_emu10k1_emu1010_init()
1118 emu->emu1010.output_source[1] = 18; in snd_emu10k1_emu1010_init()
1121 emu->emu1010.output_source[2] = 19; in snd_emu10k1_emu1010_init()
1124 emu->emu1010.output_source[3] = 20; in snd_emu10k1_emu1010_init()
1127 emu->emu1010.output_source[4] = 21; in snd_emu10k1_emu1010_init()
1130 emu->emu1010.output_source[5] = 22; in snd_emu10k1_emu1010_init()
1134 emu->emu1010.output_source[16] = 17; in snd_emu10k1_emu1010_init()
1137 emu->emu1010.output_source[17] = 18; in snd_emu10k1_emu1010_init()
1142 emu->emu1010.output_source[0] = 21; in snd_emu10k1_emu1010_init()
1145 emu->emu1010.output_source[1] = 22; in snd_emu10k1_emu1010_init()
1148 emu->emu1010.output_source[2] = 23; in snd_emu10k1_emu1010_init()
1151 emu->emu1010.output_source[3] = 24; in snd_emu10k1_emu1010_init()
1154 emu->emu1010.output_source[4] = 25; in snd_emu10k1_emu1010_init()
1157 emu->emu1010.output_source[5] = 26; in snd_emu10k1_emu1010_init()
1160 emu->emu1010.output_source[6] = 27; in snd_emu10k1_emu1010_init()
1163 emu->emu1010.output_source[7] = 28; in snd_emu10k1_emu1010_init()
1167 emu->emu1010.output_source[8] = 21; in snd_emu10k1_emu1010_init()
1170 emu->emu1010.output_source[9] = 22; in snd_emu10k1_emu1010_init()
1174 emu->emu1010.output_source[10] = 21; in snd_emu10k1_emu1010_init()
1177 emu->emu1010.output_source[11] = 22; in snd_emu10k1_emu1010_init()
1181 emu->emu1010.output_source[12] = 21; in snd_emu10k1_emu1010_init()
1184 emu->emu1010.output_source[13] = 22; in snd_emu10k1_emu1010_init()
1188 emu->emu1010.output_source[14] = 21; in snd_emu10k1_emu1010_init()
1191 emu->emu1010.output_source[15] = 22; in snd_emu10k1_emu1010_init()
1195 emu->emu1010.output_source[16] = 21; in snd_emu10k1_emu1010_init()
1198 emu->emu1010.output_source[17] = 22; in snd_emu10k1_emu1010_init()
1201 emu->emu1010.output_source[18] = 23; in snd_emu10k1_emu1010_init()
1204 emu->emu1010.output_source[19] = 24; in snd_emu10k1_emu1010_init()
1207 emu->emu1010.output_source[20] = 25; in snd_emu10k1_emu1010_init()
1210 emu->emu1010.output_source[21] = 26; in snd_emu10k1_emu1010_init()
1213 emu->emu1010.output_source[22] = 27; in snd_emu10k1_emu1010_init()
1216 emu->emu1010.output_source[23] = 28; in snd_emu10k1_emu1010_init()
1227 emu->emu1010.internal_clock = 1; /* 48000 */ in snd_emu10k1_emu1010_init()
1247 if (emu->port) { /* avoid access to already used hardware */ in snd_emu10k1_free()
1252 if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1010) { in snd_emu10k1_free()
1256 cancel_delayed_work_sync(&emu->emu1010.firmware_work); in snd_emu10k1_free()
1257 release_firmware(emu->firmware); in snd_emu10k1_free()
1258 release_firmware(emu->dock_fw); in snd_emu10k1_free()
1259 if (emu->irq >= 0) in snd_emu10k1_free()
1260 free_irq(emu->irq, emu); in snd_emu10k1_free()
1261 snd_util_memhdr_free(emu->memhdr); in snd_emu10k1_free()
1262 if (emu->silent_page.area) in snd_emu10k1_free()
1263 snd_dma_free_pages(&emu->silent_page); in snd_emu10k1_free()
1264 if (emu->ptb_pages.area) in snd_emu10k1_free()
1265 snd_dma_free_pages(&emu->ptb_pages); in snd_emu10k1_free()
1266 vfree(emu->page_ptr_table); in snd_emu10k1_free()
1267 vfree(emu->page_addr_table); in snd_emu10k1_free()
1271 if (emu->port) in snd_emu10k1_free()
1272 pci_release_regions(emu->pci); in snd_emu10k1_free()
1273 if (emu->card_capabilities->ca0151_chip) /* P16V */ in snd_emu10k1_free()
1275 pci_disable_device(emu->pci); in snd_emu10k1_free()
1282 struct snd_emu10k1 *emu = device->device_data; in snd_emu10k1_dev_free()
1289 /* DSP: CA10300-IAT LF
1290 * DAC: Cirrus Logic CS4382-KQZ
1310 * 3: 0 - Digital Out, 1 - Line in
1326 * 0 - Digital Out
1327 * 1 - Line in
1335 /* DSP: CA10300-IAT LF
1336 * DAC: Cirrus Logic CS4382-KQZ
1353 /* DSP: CA0108-IAT
1354 * DAC: CS4382-KQ
1392 * 8-9: 0 = Line in/Mic, 2 = Optical in, 3 = Nothing.
1393 * A-B: 0 = Headphones, 2 = Optical out, 3 = Nothing.
1394 * C-D: 2 = Front/Rear/etc, 3 = nothing.
1395 * E-F: Always 0
1409 .driver = "Audigy2", .name = "E-mu 1010 Notebook [MAEM8950]",
1419 .driver = "Audigy2", .name = "E-mu 1010b PCI [MAEM8960]",
1428 .driver = "Audigy2", .name = "E-mu 1010 PCIe [MAEM8986]",
1437 .driver = "Audigy2", .name = "E-mu 1010 [MAEM8810]",
1445 .driver = "Audigy2", .name = "E-mu 0404b PCI [MAEM8852]",
1451 /* Tested by James@superbug.co.uk 20-3-2007. */
1453 .driver = "Audigy2", .name = "E-mu 0404 [MAEM8850]",
1461 .driver = "Audigy2", .name = "E-mu 0404 PCIe [MAEM8984]",
1467 /* Note that all E-mu cards require kernel 2.6 or newer. */
1484 /* Tested by shane-alsa@cm.nu 5th Nov 2005 */
1532 /* DSP: CA0102-IAT
1533 * DAC: CS4382-KQ
1613 .driver = "EMU10K1", .name = "SB Live! 5.1 [SB0220]",
1614 .id = "Live",
1619 .driver = "EMU10K1", .name = "SB Live! [SB0105]",
1620 .id = "Live",
1625 .driver = "EMU10K1", .name = "SB Live! Value [SB0103]",
1626 .id = "Live",
1631 .driver = "EMU10K1", .name = "SB Live! Value [SB0101]",
1632 .id = "Live",
1640 .driver = "EMU10K1", .name = "SB Live! 5.1 Dell OEM [SB0228]",
1641 .id = "Live",
1647 .driver = "EMU10K1", .name = "SB Live! 5.1 [SB0220]",
1648 .id = "Live",
1653 .driver = "EMU10K1", .name = "SB Live! 5.1",
1654 .id = "Live",
1660 .driver = "EMU10K1", .name = "SB Live! 5.1 [SB0060]",
1661 .id = "Live",
1668 .driver = "EMU10K1", .name = "SB Live! Value [CT4850]",
1669 .id = "Live",
1674 .driver = "EMU10K1", .name = "SB Live! Platinum [CT4760P]",
1675 .id = "Live",
1679 .driver = "EMU10K1", .name = "SB Live! Value [CT4871]",
1680 .id = "Live",
1685 .driver = "EMU10K1", .name = "SB Live! Value [CT4831]",
1686 .id = "Live",
1691 .driver = "EMU10K1", .name = "SB Live! Value [CT4870]",
1692 .id = "Live",
1698 .driver = "EMU10K1", .name = "SB Live! Value [CT4832]",
1699 .id = "Live",
1704 .driver = "EMU10K1", .name = "SB Live! Value [CT4830]",
1705 .id = "Live",
1711 .id = "Live",
1716 .driver = "EMU10K1", .name = "SB Live! Value [CT4780]",
1717 .id = "Live",
1722 .driver = "EMU10K1", .name = "E-mu APS [PC545]",
1727 .driver = "EMU10K1", .name = "SB Live! [CT4620]",
1728 .id = "Live",
1733 .driver = "EMU10K1", .name = "SB Live! Value [CT4670]",
1734 .id = "Live",
1739 .driver = "EMU10K1", .name = "SB Live! [Unknown]",
1740 .id = "Live",
1759 * detect that the device is behind a non-passthrough IOMMU.
1765 emu->iommu_workaround = false; in snd_emu10k1_detect_iommu()
1767 if (!iommu_present(emu->card->dev->bus)) in snd_emu10k1_detect_iommu()
1770 domain = iommu_get_domain_for_dev(emu->card->dev); in snd_emu10k1_detect_iommu()
1771 if (domain && domain->type == IOMMU_DOMAIN_IDENTITY) in snd_emu10k1_detect_iommu()
1774 dev_notice(emu->card->dev, in snd_emu10k1_detect_iommu()
1775 "non-passthrough IOMMU detected, widening DMA allocations"); in snd_emu10k1_detect_iommu()
1776 emu->iommu_workaround = true; in snd_emu10k1_detect_iommu()
1809 return -ENOMEM; in snd_emu10k1_create()
1811 emu->card = card; in snd_emu10k1_create()
1812 spin_lock_init(&emu->reg_lock); in snd_emu10k1_create()
1813 spin_lock_init(&emu->emu_lock); in snd_emu10k1_create()
1814 spin_lock_init(&emu->spi_lock); in snd_emu10k1_create()
1815 spin_lock_init(&emu->i2c_lock); in snd_emu10k1_create()
1816 spin_lock_init(&emu->voice_lock); in snd_emu10k1_create()
1817 spin_lock_init(&emu->synth_lock); in snd_emu10k1_create()
1818 spin_lock_init(&emu->memblk_lock); in snd_emu10k1_create()
1819 mutex_init(&emu->fx8010.lock); in snd_emu10k1_create()
1820 INIT_LIST_HEAD(&emu->mapped_link_head); in snd_emu10k1_create()
1821 INIT_LIST_HEAD(&emu->mapped_order_link_head); in snd_emu10k1_create()
1822 emu->pci = pci; in snd_emu10k1_create()
1823 emu->irq = -1; in snd_emu10k1_create()
1824 emu->synth = NULL; in snd_emu10k1_create()
1825 emu->get_synth_voice = NULL; in snd_emu10k1_create()
1826 INIT_DELAYED_WORK(&emu->emu1010.firmware_work, emu1010_firmware_work); in snd_emu10k1_create()
1828 emu->revision = pci->revision; in snd_emu10k1_create()
1829 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &emu->serial); in snd_emu10k1_create()
1830 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &emu->model); in snd_emu10k1_create()
1831 dev_dbg(card->dev, in snd_emu10k1_create()
1833 pci->vendor, pci->device, emu->serial, emu->model); in snd_emu10k1_create()
1835 for (c = emu_chip_details; c->vendor; c++) { in snd_emu10k1_create()
1836 if (c->vendor == pci->vendor && c->device == pci->device) { in snd_emu10k1_create()
1838 if (c->subsystem && (c->subsystem == subsystem)) in snd_emu10k1_create()
1843 if (c->subsystem && (c->subsystem != emu->serial)) in snd_emu10k1_create()
1845 if (c->revision && c->revision != emu->revision) in snd_emu10k1_create()
1851 if (c->vendor == 0) { in snd_emu10k1_create()
1852 dev_err(card->dev, "emu10k1: Card not recognised\n"); in snd_emu10k1_create()
1855 return -ENOENT; in snd_emu10k1_create()
1857 emu->card_capabilities = c; in snd_emu10k1_create()
1858 if (c->subsystem && !subsystem) in snd_emu10k1_create()
1859 dev_dbg(card->dev, "Sound card name = %s\n", c->name); in snd_emu10k1_create()
1861 dev_dbg(card->dev, "Sound card name = %s, " in snd_emu10k1_create()
1863 "Forced to subsystem = 0x%x\n", c->name, in snd_emu10k1_create()
1864 pci->vendor, pci->device, emu->serial, c->subsystem); in snd_emu10k1_create()
1866 dev_dbg(card->dev, "Sound card name = %s, " in snd_emu10k1_create()
1868 c->name, pci->vendor, pci->device, in snd_emu10k1_create()
1869 emu->serial); in snd_emu10k1_create()
1871 if (!*card->id && c->id) in snd_emu10k1_create()
1872 strlcpy(card->id, c->id, sizeof(card->id)); in snd_emu10k1_create()
1874 is_audigy = emu->audigy = c->emu10k2_chip; in snd_emu10k1_create()
1879 emu->address_mode = is_audigy ? 0 : 1; in snd_emu10k1_create()
1881 emu->dma_mask = emu->address_mode ? EMU10K1_DMA_MASK : AUDIGY_DMA_MASK; in snd_emu10k1_create()
1882 if (dma_set_mask_and_coherent(&pci->dev, emu->dma_mask) < 0) { in snd_emu10k1_create()
1883 dev_err(card->dev, in snd_emu10k1_create()
1885 emu->dma_mask); in snd_emu10k1_create()
1888 return -ENXIO; in snd_emu10k1_create()
1891 emu->gpr_base = A_FXGPREGBASE; in snd_emu10k1_create()
1893 emu->gpr_base = FXGPREGBASE; in snd_emu10k1_create()
1901 emu->port = pci_resource_start(pci, 0); in snd_emu10k1_create()
1903 emu->max_cache_pages = max_cache_bytes >> PAGE_SHIFT; in snd_emu10k1_create()
1905 page_table_size = sizeof(u32) * (emu->address_mode ? MAXPAGES1 : in snd_emu10k1_create()
1908 &emu->ptb_pages) < 0) { in snd_emu10k1_create()
1909 err = -ENOMEM; in snd_emu10k1_create()
1912 dev_dbg(card->dev, "page table address range is %.8lx:%.8lx\n", in snd_emu10k1_create()
1913 (unsigned long)emu->ptb_pages.addr, in snd_emu10k1_create()
1914 (unsigned long)(emu->ptb_pages.addr + emu->ptb_pages.bytes)); in snd_emu10k1_create()
1916 emu->page_ptr_table = vmalloc(array_size(sizeof(void *), in snd_emu10k1_create()
1917 emu->max_cache_pages)); in snd_emu10k1_create()
1918 emu->page_addr_table = vmalloc(array_size(sizeof(unsigned long), in snd_emu10k1_create()
1919 emu->max_cache_pages)); in snd_emu10k1_create()
1920 if (emu->page_ptr_table == NULL || emu->page_addr_table == NULL) { in snd_emu10k1_create()
1921 err = -ENOMEM; in snd_emu10k1_create()
1926 &emu->silent_page) < 0) { in snd_emu10k1_create()
1927 err = -ENOMEM; in snd_emu10k1_create()
1930 dev_dbg(card->dev, "silent page range is %.8lx:%.8lx\n", in snd_emu10k1_create()
1931 (unsigned long)emu->silent_page.addr, in snd_emu10k1_create()
1932 (unsigned long)(emu->silent_page.addr + in snd_emu10k1_create()
1933 emu->silent_page.bytes)); in snd_emu10k1_create()
1935 emu->memhdr = snd_util_memhdr_new(emu->max_cache_pages * PAGE_SIZE); in snd_emu10k1_create()
1936 if (emu->memhdr == NULL) { in snd_emu10k1_create()
1937 err = -ENOMEM; in snd_emu10k1_create()
1940 emu->memhdr->block_extra_size = sizeof(struct snd_emu10k1_memblk) - in snd_emu10k1_create()
1945 emu->fx8010.fxbus_mask = 0x303f; in snd_emu10k1_create()
1950 emu->fx8010.extin_mask = extin_mask; in snd_emu10k1_create()
1951 emu->fx8010.extout_mask = extout_mask; in snd_emu10k1_create()
1952 emu->enable_ir = enable_ir; in snd_emu10k1_create()
1954 if (emu->card_capabilities->ca_cardbus_chip) { in snd_emu10k1_create()
1959 if (emu->card_capabilities->ecard) { in snd_emu10k1_create()
1963 } else if (emu->card_capabilities->emu_model) { in snd_emu10k1_create()
1977 emu->fx8010.itram_size = (16 * 1024)/2; in snd_emu10k1_create()
1978 emu->fx8010.etram_pages.area = NULL; in snd_emu10k1_create()
1979 emu->fx8010.etram_pages.bytes = 0; in snd_emu10k1_create()
1982 if (request_irq(pci->irq, snd_emu10k1_interrupt, IRQF_SHARED, in snd_emu10k1_create()
1984 err = -EBUSY; in snd_emu10k1_create()
1987 emu->irq = pci->irq; in snd_emu10k1_create()
1988 card->sync_irq = emu->irq; in snd_emu10k1_create()
2004 emu->spdif_bits[0] = emu->spdif_bits[1] = in snd_emu10k1_create()
2005 emu->spdif_bits[2] = SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 | in snd_emu10k1_create()
2011 memset(emu->silent_page.area, 0, emu->silent_page.bytes); in snd_emu10k1_create()
2012 silent_page = emu->silent_page.addr << emu->address_mode; in snd_emu10k1_create()
2013 pgtbl = (__le32 *)emu->ptb_pages.area; in snd_emu10k1_create()
2014 for (idx = 0; idx < (emu->address_mode ? MAXPAGES1 : MAXPAGES0); idx++) in snd_emu10k1_create()
2019 emu->voices[idx].emu = emu; in snd_emu10k1_create()
2020 emu->voices[idx].number = idx; in snd_emu10k1_create()
2075 if (emu->audigy) in alloc_pm_buffer()
2077 emu->saved_ptr = vmalloc(array3_size(4, NUM_G, size)); in alloc_pm_buffer()
2078 if (!emu->saved_ptr) in alloc_pm_buffer()
2079 return -ENOMEM; in alloc_pm_buffer()
2081 return -ENOMEM; in alloc_pm_buffer()
2082 if (emu->card_capabilities->ca0151_chip && in alloc_pm_buffer()
2084 return -ENOMEM; in alloc_pm_buffer()
2090 vfree(emu->saved_ptr); in free_pm_buffer()
2092 if (emu->card_capabilities->ca0151_chip) in free_pm_buffer()
2102 val = emu->saved_ptr; in snd_emu10k1_suspend_regs()
2106 if (emu->audigy) { in snd_emu10k1_suspend_regs()
2111 if (emu->audigy) in snd_emu10k1_suspend_regs()
2112 emu->saved_a_iocfg = inl(emu->port + A_IOCFG); in snd_emu10k1_suspend_regs()
2113 emu->saved_hcfg = inl(emu->port + HCFG); in snd_emu10k1_suspend_regs()
2118 if (emu->card_capabilities->ca_cardbus_chip) in snd_emu10k1_resume_init()
2120 if (emu->card_capabilities->ecard) in snd_emu10k1_resume_init()
2122 else if (emu->card_capabilities->emu_model) in snd_emu10k1_resume_init()
2126 snd_emu10k1_init(emu, emu->enable_ir, 1); in snd_emu10k1_resume_init()
2138 if (emu->audigy) in snd_emu10k1_resume_regs()
2139 outl(emu->saved_a_iocfg, emu->port + A_IOCFG); in snd_emu10k1_resume_regs()
2140 outl(emu->saved_hcfg, emu->port + HCFG); in snd_emu10k1_resume_regs()
2142 val = emu->saved_ptr; in snd_emu10k1_resume_regs()
2146 if (emu->audigy) { in snd_emu10k1_resume_regs()