Lines Matching +full:audio +full:- +full:subsystem
1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * James Courtier-Dutton <James@superbug.co.uk>
85 if (emu->audigy) { in snd_emu10k1_voice_init()
128 { 0x0e, 0xcf }, /* Attenuation Left 0x01 = -103dB, 0xff = 24dB */
144 /* disable audio and lock cache */ in snd_emu10k1_init()
146 HCFG_MUTEBUTTONENABLE, emu->port + HCFG); in snd_emu10k1_init()
148 outl(0, emu->port + INTE); in snd_emu10k1_init()
169 if (emu->audigy) { in snd_emu10k1_init()
182 SPCS0, emu->spdif_bits[0], in snd_emu10k1_init()
183 SPCS1, emu->spdif_bits[1], in snd_emu10k1_init()
184 SPCS2, emu->spdif_bits[2], in snd_emu10k1_init()
187 if (emu->card_capabilities->emu_model) { in snd_emu10k1_init()
188 } else if (emu->card_capabilities->ca0151_chip) { /* audigy2 */ in snd_emu10k1_init()
195 /* Setup SRCMulti Input Audio Enable */ in snd_emu10k1_init()
199 /* Enabled Phased (8-channel) P16V playback */ in snd_emu10k1_init()
200 outl(0x0201, emu->port + HCFG2); in snd_emu10k1_init()
203 } else 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()
212 /* Setup SRCMulti Input Audio Enable */ in snd_emu10k1_init()
215 /* Setup SPDIF Out Audio Enable */ in snd_emu10k1_init()
221 tmp = inw(emu->port + A_IOCFG) & ~0x8; /* Clear bit 3 */ in snd_emu10k1_init()
222 outw(tmp, emu->port + A_IOCFG); in snd_emu10k1_init()
224 if (emu->card_capabilities->spi_dac) { /* Audigy 2 ZS Notebook with DAC Wolfson WM8768/WM8568 */ in snd_emu10k1_init()
234 * GPIO1: Speakers-enabled. in snd_emu10k1_init()
242 outw(0x76, emu->port + A_IOCFG); /* Windows uses 0x3f76 */ in snd_emu10k1_init()
244 if (emu->card_capabilities->i2c_adc) { /* Audigy 2 ZS Notebook with ADC Wolfson WM8775 */ in snd_emu10k1_init()
248 tmp = inw(emu->port + A_IOCFG); in snd_emu10k1_init()
249 outw(tmp | 0x4, emu->port + A_IOCFG); /* Set bit 2 for mic input */ in snd_emu10k1_init()
250 tmp = inw(emu->port + A_IOCFG); in snd_emu10k1_init()
255 emu->i2c_capture_volume[n][0] = 0xcf; in snd_emu10k1_init()
256 emu->i2c_capture_volume[n][1] = 0xcf; in snd_emu10k1_init()
261 snd_emu10k1_ptr_write(emu, PTB, 0, emu->ptb_pages.addr); in snd_emu10k1_init()
265 …silent_page = (emu->silent_page.addr << emu->address_mode) | (emu->address_mode ? MAP_PTI_MASK1 : … in snd_emu10k1_init()
271 if (emu->card_capabilities->emu_model) { in snd_emu10k1_init()
274 HCFG_AUDIOENABLE, emu->port + HCFG); in snd_emu10k1_init()
277 * Mute Disable Audio = 0 in snd_emu10k1_init()
282 } else if (emu->audigy) { in snd_emu10k1_init()
283 if (emu->revision == 4) /* audigy2 */ in snd_emu10k1_init()
287 HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG); in snd_emu10k1_init()
289 outl(HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG); in snd_emu10k1_init()
290 /* FIXME: Remove all these emu->model and replace it with a card recognition parameter, in snd_emu10k1_init()
291 * e.g. card_capabilities->joystick */ in snd_emu10k1_init()
292 } else if (emu->model == 0x20 || in snd_emu10k1_init()
293 emu->model == 0xc400 || in snd_emu10k1_init()
294 (emu->model == 0x21 && emu->revision < 6)) in snd_emu10k1_init()
295 outl(HCFG_LOCKTANKCACHE_MASK | HCFG_AUTOMUTE, emu->port + HCFG); in snd_emu10k1_init()
297 /* With on-chip joystick */ in snd_emu10k1_init()
298 outl(HCFG_LOCKTANKCACHE_MASK | HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG); in snd_emu10k1_init()
301 if (emu->card_capabilities->emu_model) { in snd_emu10k1_init()
303 } else if (emu->card_capabilities->i2c_adc) { in snd_emu10k1_init()
305 } else if (emu->audigy) { in snd_emu10k1_init()
306 u16 reg = inw(emu->port + A_IOCFG); in snd_emu10k1_init()
307 outw(reg | A_IOCFG_GPOUT2, emu->port + A_IOCFG); in snd_emu10k1_init()
309 outw(reg | A_IOCFG_GPOUT1 | A_IOCFG_GPOUT2, emu->port + A_IOCFG); in snd_emu10k1_init()
311 outw(reg, emu->port + A_IOCFG); in snd_emu10k1_init()
313 unsigned int reg = inl(emu->port + HCFG); in snd_emu10k1_init()
314 outl(reg | HCFG_GPOUT2, emu->port + HCFG); in snd_emu10k1_init()
316 outl(reg | HCFG_GPOUT1 | HCFG_GPOUT2, emu->port + HCFG); in snd_emu10k1_init()
318 outl(reg, emu->port + HCFG); in snd_emu10k1_init()
322 if (emu->card_capabilities->emu_model) { in snd_emu10k1_init()
324 } else if (emu->card_capabilities->i2c_adc) { in snd_emu10k1_init()
326 } else if (emu->audigy) { /* enable analog output */ in snd_emu10k1_init()
327 u16 reg = inw(emu->port + A_IOCFG); in snd_emu10k1_init()
328 outw(reg | A_IOCFG_GPOUT0, emu->port + A_IOCFG); in snd_emu10k1_init()
331 if (emu->address_mode == 0) { in snd_emu10k1_init()
333 outl(inl(emu->port + HCFG) | HCFG_EXPANDED_MEM, emu->port + HCFG); in snd_emu10k1_init()
342 * Enable the audio bit in snd_emu10k1_audio_enable()
344 outl(inl(emu->port + HCFG) | HCFG_AUDIOENABLE, emu->port + HCFG); in snd_emu10k1_audio_enable()
347 if (emu->card_capabilities->emu_model) { in snd_emu10k1_audio_enable()
349 } else if (emu->card_capabilities->i2c_adc) { in snd_emu10k1_audio_enable()
351 } else if (emu->audigy) { in snd_emu10k1_audio_enable()
352 outw(inw(emu->port + A_IOCFG) & ~0x44, emu->port + A_IOCFG); in snd_emu10k1_audio_enable()
354 if (emu->card_capabilities->ca0151_chip) { /* audigy2 */ in snd_emu10k1_audio_enable()
358 outw(inw(emu->port + A_IOCFG) | 0x0040, emu->port + A_IOCFG); in snd_emu10k1_audio_enable()
359 } else if (emu->card_capabilities->ca0108_chip) { /* audigy2 value */ in snd_emu10k1_audio_enable()
361 outw(inw(emu->port + A_IOCFG) | 0x0060, emu->port + A_IOCFG); in snd_emu10k1_audio_enable()
364 outw(inw(emu->port + A_IOCFG) | 0x0080, emu->port + A_IOCFG); in snd_emu10k1_audio_enable()
371 /* FIXME: the following routine disables LiveDrive-II !! */ in snd_emu10k1_audio_enable()
373 emu->tos_link = 0; in snd_emu10k1_audio_enable()
374 tmp = inl(emu->port + HCFG); in snd_emu10k1_audio_enable()
376 outl(tmp|0x800, emu->port + HCFG); in snd_emu10k1_audio_enable()
378 if (tmp != (inl(emu->port + HCFG) & ~0x800)) { in snd_emu10k1_audio_enable()
379 emu->tos_link = 1; in snd_emu10k1_audio_enable()
380 outl(tmp, emu->port + HCFG); in snd_emu10k1_audio_enable()
386 if (emu->card_capabilities->emu_model) in snd_emu10k1_audio_enable()
396 outl(0, emu->port + INTE); in snd_emu10k1_done()
412 if (emu->audigy) in snd_emu10k1_done()
439 /* disable audio and lock cache */ in snd_emu10k1_done()
440 outl(HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK | HCFG_MUTEBUTTONENABLE, emu->port + HCFG); in snd_emu10k1_done()
481 #define EC_CURRENT_PROM_VERSION 0x01 /* Self-explanatory. This should
485 #define EC_EEPROM_SIZE 0x40 /* ECARD EEPROM has 64 16-bit words */
496 * and is stored as a NULL-terminated
502 /* Most of this stuff is pretty self-evident. According to the hardware
516 * control latch will is loaded bit-serially by toggling the Modem control
529 hc_port = emu->port + HCFG; in snd_emu10k1_ecard_write()
566 snd_emu10k1_ecard_write(emu, emu->ecard_ctrl & ~EC_TRIM_CSN); in snd_emu10k1_ecard_setadcgain()
569 snd_emu10k1_ecard_write(emu, emu->ecard_ctrl & ~EC_TRIM_CSN); in snd_emu10k1_ecard_setadcgain()
574 value = emu->ecard_ctrl & ~(EC_TRIM_CSN | EC_TRIM_SDATA); in snd_emu10k1_ecard_setadcgain()
585 snd_emu10k1_ecard_write(emu, emu->ecard_ctrl); in snd_emu10k1_ecard_setadcgain()
593 emu->ecard_ctrl = EC_RAW_RUN_MODE | in snd_emu10k1_ecard_init()
598 * and enable audio output */ in snd_emu10k1_ecard_init()
599 hc_value = inl(emu->port + HCFG); in snd_emu10k1_ecard_init()
600 outl(hc_value | HCFG_AUDIOENABLE | HCFG_CODECFORMAT_I2S, emu->port + HCFG); in snd_emu10k1_ecard_init()
601 inl(emu->port + HCFG); in snd_emu10k1_ecard_init()
620 snd_emu10k1_ecard_write(emu, emu->ecard_ctrl); in snd_emu10k1_ecard_init()
634 * before the rest of the IO-Ports become active. in snd_emu10k1_cardbus_init()
636 special_port = emu->port + 0x38; in snd_emu10k1_cardbus_init()
664 return -EIO; in snd_emu1010_load_firmware_entry()
667 /* On E-MU 0404b it is a Xilinx Spartan III XC3S50 */ in snd_emu1010_load_firmware_entry()
668 /* GPIO7 -> FPGA PGMN in snd_emu1010_load_firmware_entry()
669 * GPIO6 -> FPGA CCLK in snd_emu1010_load_firmware_entry()
670 * GPIO5 -> FPGA DIN in snd_emu1010_load_firmware_entry()
671 * FPGA CONFIG OFF -> FPGA PGMN in snd_emu1010_load_firmware_entry()
673 spin_lock_irq(&emu->emu_lock); in snd_emu1010_load_firmware_entry()
674 outw(0x00, emu->port + A_GPIO); /* Set PGMN low for 100uS. */ in snd_emu1010_load_firmware_entry()
675 write_post = inw(emu->port + A_GPIO); in snd_emu1010_load_firmware_entry()
677 outw(0x80, emu->port + A_GPIO); /* Leave bit 7 set during netlist setup. */ in snd_emu1010_load_firmware_entry()
678 write_post = inw(emu->port + A_GPIO); in snd_emu1010_load_firmware_entry()
680 for (n = 0; n < fw_entry->size; n++) { in snd_emu1010_load_firmware_entry()
681 value = fw_entry->data[n]; in snd_emu1010_load_firmware_entry()
687 outw(reg, emu->port + A_GPIO); in snd_emu1010_load_firmware_entry()
688 write_post = inw(emu->port + A_GPIO); in snd_emu1010_load_firmware_entry()
689 outw(reg | 0x40, emu->port + A_GPIO); in snd_emu1010_load_firmware_entry()
690 write_post = inw(emu->port + A_GPIO); in snd_emu1010_load_firmware_entry()
694 outw(0x10, emu->port + A_GPIO); in snd_emu1010_load_firmware_entry()
695 write_post = inw(emu->port + A_GPIO); in snd_emu1010_load_firmware_entry()
696 spin_unlock_irq(&emu->emu_lock); in snd_emu1010_load_firmware_entry()
701 /* firmware file names, per model, init-fw and dock-fw (optional) */
724 filename = firmware_names[emu->card_capabilities->emu_model][dock]; in snd_emu1010_load_firmware()
727 err = request_firmware(fw, filename, &emu->pci->dev); in snd_emu1010_load_firmware()
743 if (emu->card->shutdown) in emu1010_firmware_work()
746 if (emu->suspend) in emu1010_firmware_work()
751 /* Audio Dock attached */ in emu1010_firmware_work()
752 /* Return to Audio Dock programming mode */ in emu1010_firmware_work()
753 dev_info(emu->card->dev, in emu1010_firmware_work()
754 "emu1010: Loading Audio Dock Firmware\n"); in emu1010_firmware_work()
757 err = snd_emu1010_load_firmware(emu, 1, &emu->dock_fw); in emu1010_firmware_work()
762 dev_info(emu->card->dev, in emu1010_firmware_work()
766 dev_info(emu->card->dev, in emu1010_firmware_work()
767 "emu1010: Loading Audio Dock Firmware file failed, reg = 0x%x\n", in emu1010_firmware_work()
771 dev_info(emu->card->dev, in emu1010_firmware_work()
772 "emu1010: Audio Dock Firmware loaded\n"); in emu1010_firmware_work()
775 dev_info(emu->card->dev, "Audio Dock ver: %u.%u\n", tmp, tmp2); in emu1010_firmware_work()
791 if (emu->card->shutdown) in emu1010_clock_work()
794 if (emu->suspend) in emu1010_clock_work()
798 spin_lock_irq(&emu->reg_lock); in emu1010_clock_work()
800 emu->emu1010.clock_source = emu->emu1010.clock_fallback; in emu1010_clock_work()
801 emu->emu1010.wclock = 1 - emu->emu1010.clock_source; in emu1010_clock_work()
803 spin_unlock_irq(&emu->reg_lock); in emu1010_clock_work()
804 snd_ctl_build_ioff(&id, emu->ctl_clock_source, 0); in emu1010_clock_work()
805 snd_ctl_notify(emu->card, SNDRV_CTL_EVENT_MASK_VALUE, &id); in emu1010_clock_work()
814 /* Audio Dock removed */ in emu1010_interrupt()
815 dev_info(emu->card->dev, "emu1010: Audio Dock detached\n"); in emu1010_interrupt()
816 /* The hardware auto-mutes all, so we unmute again */ in emu1010_interrupt()
819 schedule_work(&emu->emu1010.firmware_work); in emu1010_interrupt()
822 schedule_work(&emu->emu1010.clock_work); in emu1010_interrupt()
827 * ----------------------------
830 * 16 x 16-bit playback - snd_emu10k1_fx8010_playback_ops
831 * 16 x 32-bit capture - snd_emu10k1_capture_efx_ops
838 dev_info(emu->card->dev, "emu1010: Special config.\n"); in snd_emu10k1_emu1010_init()
840 /* Mute, and disable audio and lock cache, just in case. in snd_emu10k1_emu1010_init()
842 outl(HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK, emu->port + HCFG); in snd_emu10k1_emu1010_init()
844 /* Disable 48Volt power to Audio Dock */ in snd_emu10k1_emu1010_init()
849 dev_dbg(emu->card->dev, "reg1 = 0x%x\n", reg); in snd_emu10k1_emu1010_init()
857 dev_dbg(emu->card->dev, "reg2 = 0x%x\n", reg); in snd_emu10k1_emu1010_init()
860 dev_info(emu->card->dev, in snd_emu10k1_emu1010_init()
862 return -ENODEV; in snd_emu10k1_emu1010_init()
864 dev_info(emu->card->dev, "emu1010: EMU_HANA_ID = 0x%x\n", reg); in snd_emu10k1_emu1010_init()
866 err = snd_emu1010_load_firmware(emu, 0, &emu->firmware); in snd_emu10k1_emu1010_init()
868 dev_info(emu->card->dev, "emu1010: Loading Firmware failed\n"); in snd_emu10k1_emu1010_init()
876 dev_info(emu->card->dev, in snd_emu10k1_emu1010_init()
879 return -ENODEV; in snd_emu10k1_emu1010_init()
882 dev_info(emu->card->dev, "emu1010: Hana Firmware loaded\n"); in snd_emu10k1_emu1010_init()
885 dev_info(emu->card->dev, "emu1010: Hana version: %u.%u\n", tmp, tmp2); in snd_emu10k1_emu1010_init()
886 /* Enable 48Volt power to Audio Dock */ in snd_emu10k1_emu1010_init()
890 dev_info(emu->card->dev, "emu1010: Card options = 0x%x\n", reg); in snd_emu10k1_emu1010_init()
892 schedule_work(&emu->emu1010.firmware_work); in snd_emu10k1_emu1010_init()
893 if (emu->card_capabilities->no_adat) { in snd_emu10k1_emu1010_init()
894 emu->emu1010.optical_in = 0; /* IN_SPDIF */ in snd_emu10k1_emu1010_init()
895 emu->emu1010.optical_out = 0; /* OUT_SPDIF */ in snd_emu10k1_emu1010_init()
897 /* Optical -> ADAT I/O */ in snd_emu10k1_emu1010_init()
898 emu->emu1010.optical_in = 1; /* IN_ADAT */ in snd_emu10k1_emu1010_init()
899 emu->emu1010.optical_out = 1; /* OUT_ADAT */ in snd_emu10k1_emu1010_init()
901 tmp = (emu->emu1010.optical_in ? EMU_HANA_OPTICAL_IN_ADAT : EMU_HANA_OPTICAL_IN_SPDIF) | in snd_emu10k1_emu1010_init()
902 (emu->emu1010.optical_out ? EMU_HANA_OPTICAL_OUT_ADAT : EMU_HANA_OPTICAL_OUT_SPDIF); in snd_emu10k1_emu1010_init()
904 /* Set no attenuation on Audio Dock pads. */ in snd_emu10k1_emu1010_init()
905 emu->emu1010.adc_pads = 0x00; in snd_emu10k1_emu1010_init()
906 snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, emu->emu1010.adc_pads); in snd_emu10k1_emu1010_init()
907 /* Unmute Audio dock DACs, Headphone source DAC-4. */ in snd_emu10k1_emu1010_init()
910 emu->emu1010.dac_pads = EMU_HANA_DOCK_DAC_PAD1 | EMU_HANA_DOCK_DAC_PAD2 | in snd_emu10k1_emu1010_init()
912 snd_emu1010_fpga_write(emu, EMU_HANA_DAC_PADS, emu->emu1010.dac_pads); in snd_emu10k1_emu1010_init()
919 emu->gpio_interrupt = emu1010_interrupt; in snd_emu10k1_emu1010_init()
925 emu->emu1010.clock_source = 1; /* 48000 */ in snd_emu10k1_emu1010_init()
926 emu->emu1010.clock_fallback = 1; /* 48000 */ in snd_emu10k1_emu1010_init()
930 emu->emu1010.wclock = EMU_HANA_WCLOCK_INT_48K; in snd_emu10k1_emu1010_init()
952 struct snd_emu10k1 *emu = card->private_data; in snd_emu10k1_free()
954 if (emu->port) { /* avoid access to already used hardware */ in snd_emu10k1_free()
959 if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1010) { in snd_emu10k1_free()
960 /* Disable 48Volt power to Audio Dock */ in snd_emu10k1_free()
963 cancel_work_sync(&emu->emu1010.firmware_work); in snd_emu10k1_free()
964 cancel_work_sync(&emu->emu1010.clock_work); in snd_emu10k1_free()
965 release_firmware(emu->firmware); in snd_emu10k1_free()
966 release_firmware(emu->dock_fw); in snd_emu10k1_free()
967 snd_util_memhdr_free(emu->memhdr); in snd_emu10k1_free()
968 if (emu->silent_page.area) in snd_emu10k1_free()
969 snd_dma_free_pages(&emu->silent_page); in snd_emu10k1_free()
970 if (emu->ptb_pages.area) in snd_emu10k1_free()
971 snd_dma_free_pages(&emu->ptb_pages); in snd_emu10k1_free()
972 vfree(emu->page_ptr_table); in snd_emu10k1_free()
973 vfree(emu->page_addr_table); in snd_emu10k1_free()
982 /* DSP: CA10300-IAT LF
983 * DAC: Cirrus Logic CS4382-KQZ
988 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x10241102,
1003 * 3: 0 - Digital Out, 1 - Line in
1019 * 0 - Digital Out
1020 * 1 - Line in
1026 * Audio output 5.1 working. Side outputs not working.
1028 /* DSP: CA10300-IAT LF
1029 * DAC: Cirrus Logic CS4382-KQZ
1034 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x10211102,
1046 /* DSP: CA0108-IAT
1047 * DAC: CS4382-KQ
1061 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x10011102,
1070 /* Audio output 7.1/Headphones working.
1072 * Audio Mic/Line inputs working.
1094 * 8-9: 0 = Line in/Mic, 2 = Optical in, 3 = Nothing.
1095 * A-B: 0 = Headphones, 2 = Optical out, 3 = Nothing.
1096 * C-D: 2 = Front/Rear/etc, 3 = nothing.
1097 * E-F: Always 0
1100 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x20011102,
1110 /* Attach MicroDock[M] to make it an E-MU 1616[m]. */
1113 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x42011102,
1114 .driver = "Audigy2", .name = "E-MU 02 CardBus [MAEM8950]",
1123 /* Attach 0202 daughter card to make it an E-MU 1212m, OR a
1124 * MicroDock[M] to make it an E-MU 1616[m]. */
1126 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40041102,
1127 .driver = "Audigy2", .name = "E-MU 1010b PCI [MAEM8960]",
1135 /* Attach 0202 daughter card to make it an E-MU 1212m, OR a
1136 * MicroDockM to make it an E-MU 1616m. The non-m
1140 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40071102,
1141 .driver = "Audigy2", .name = "E-MU 1010 PCIe [MAEM8986]",
1149 /* Attach 0202 daughter card to make it an E-MU 1212m, OR an
1150 * AudioDock[M] to make it an E-MU 1820[m]. */
1152 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40011102,
1153 .driver = "Audigy2", .name = "E-MU 1010 [MAEM8810]",
1162 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40021102,
1163 .driver = "Audigy2", .name = "E-MU 0404b PCI [MAEM8852]",
1172 /* Tested by James@superbug.co.uk 20-3-2007. */
1173 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40021102,
1174 .driver = "Audigy2", .name = "E-MU 0404 [MAEM8850]",
1183 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40051102,
1184 .driver = "Audigy2", .name = "E-MU 0404 PCIe [MAEM8984]",
1198 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20071102,
1207 /* Tested by shane-alsa@cm.nu 5th Nov 2005 */
1211 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20061102,
1223 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20051102,
1233 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20021102,
1243 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20011102,
1255 /* DSP: CA0102-IAT
1256 * DAC: CS4382-KQ
1261 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10071102,
1273 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10051102,
1283 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10031102,
1295 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10021102,
1314 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00531102,
1320 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00521102,
1327 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00511102,
1339 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x100a1102,
1345 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x806b1102,
1351 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x806a1102,
1357 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80691102,
1366 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80661102,
1373 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80651102,
1379 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80641102,
1386 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102,
1394 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80511102,
1403 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80401102,
1408 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80321102,
1414 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80311102,
1420 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80281102,
1427 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80271102,
1433 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80261102,
1439 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80231102,
1445 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80221102,
1451 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x40011102,
1452 .driver = "EMU10K1", .name = "E-MU APS [PC545]",
1456 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x00211102,
1462 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x00201102,
1489 * detect that the device is behind a non-passthrough IOMMU.
1495 emu->iommu_workaround = false; in snd_emu10k1_detect_iommu()
1497 domain = iommu_get_domain_for_dev(emu->card->dev); in snd_emu10k1_detect_iommu()
1498 if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY) in snd_emu10k1_detect_iommu()
1501 dev_notice(emu->card->dev, in snd_emu10k1_detect_iommu()
1502 "non-passthrough IOMMU detected, widening DMA allocations"); in snd_emu10k1_detect_iommu()
1503 emu->iommu_workaround = true; in snd_emu10k1_detect_iommu()
1512 uint subsystem) in snd_emu10k1_create() argument
1514 struct snd_emu10k1 *emu = card->private_data; in snd_emu10k1_create()
1527 card->private_free = snd_emu10k1_free; in snd_emu10k1_create()
1528 emu->card = card; in snd_emu10k1_create()
1529 spin_lock_init(&emu->reg_lock); in snd_emu10k1_create()
1530 spin_lock_init(&emu->emu_lock); in snd_emu10k1_create()
1531 spin_lock_init(&emu->spi_lock); in snd_emu10k1_create()
1532 spin_lock_init(&emu->i2c_lock); in snd_emu10k1_create()
1533 spin_lock_init(&emu->voice_lock); in snd_emu10k1_create()
1534 spin_lock_init(&emu->synth_lock); in snd_emu10k1_create()
1535 spin_lock_init(&emu->memblk_lock); in snd_emu10k1_create()
1536 mutex_init(&emu->fx8010.lock); in snd_emu10k1_create()
1537 INIT_LIST_HEAD(&emu->mapped_link_head); in snd_emu10k1_create()
1538 INIT_LIST_HEAD(&emu->mapped_order_link_head); in snd_emu10k1_create()
1539 emu->pci = pci; in snd_emu10k1_create()
1540 emu->irq = -1; in snd_emu10k1_create()
1541 emu->synth = NULL; in snd_emu10k1_create()
1542 emu->get_synth_voice = NULL; in snd_emu10k1_create()
1543 INIT_WORK(&emu->emu1010.firmware_work, emu1010_firmware_work); in snd_emu10k1_create()
1544 INIT_WORK(&emu->emu1010.clock_work, emu1010_clock_work); in snd_emu10k1_create()
1546 emu->revision = pci->revision; in snd_emu10k1_create()
1547 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &emu->serial); in snd_emu10k1_create()
1548 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &emu->model); in snd_emu10k1_create()
1549 dev_dbg(card->dev, in snd_emu10k1_create()
1551 pci->vendor, pci->device, emu->serial, emu->model); in snd_emu10k1_create()
1553 for (c = emu_chip_details; c->vendor; c++) { in snd_emu10k1_create()
1554 if (c->vendor == pci->vendor && c->device == pci->device) { in snd_emu10k1_create()
1555 if (subsystem) { in snd_emu10k1_create()
1556 if (c->subsystem && (c->subsystem == subsystem)) in snd_emu10k1_create()
1561 if (c->subsystem && (c->subsystem != emu->serial)) in snd_emu10k1_create()
1563 if (c->revision && c->revision != emu->revision) in snd_emu10k1_create()
1569 if (c->vendor == 0) { in snd_emu10k1_create()
1570 dev_err(card->dev, "emu10k1: Card not recognised\n"); in snd_emu10k1_create()
1571 return -ENOENT; in snd_emu10k1_create()
1573 emu->card_capabilities = c; in snd_emu10k1_create()
1574 if (c->subsystem && !subsystem) in snd_emu10k1_create()
1575 dev_dbg(card->dev, "Sound card name = %s\n", c->name); in snd_emu10k1_create()
1576 else if (subsystem) in snd_emu10k1_create()
1577 dev_dbg(card->dev, "Sound card name = %s, " in snd_emu10k1_create()
1578 "vendor = 0x%x, device = 0x%x, subsystem = 0x%x. " in snd_emu10k1_create()
1579 "Forced to subsystem = 0x%x\n", c->name, in snd_emu10k1_create()
1580 pci->vendor, pci->device, emu->serial, c->subsystem); in snd_emu10k1_create()
1582 dev_dbg(card->dev, "Sound card name = %s, " in snd_emu10k1_create()
1583 "vendor = 0x%x, device = 0x%x, subsystem = 0x%x.\n", in snd_emu10k1_create()
1584 c->name, pci->vendor, pci->device, in snd_emu10k1_create()
1585 emu->serial); in snd_emu10k1_create()
1587 if (!*card->id && c->id) in snd_emu10k1_create()
1588 strscpy(card->id, c->id, sizeof(card->id)); in snd_emu10k1_create()
1590 is_audigy = emu->audigy = c->emu10k2_chip; in snd_emu10k1_create()
1595 emu->address_mode = is_audigy ? 0 : 1; in snd_emu10k1_create()
1597 emu->dma_mask = emu->address_mode ? EMU10K1_DMA_MASK : AUDIGY_DMA_MASK; in snd_emu10k1_create()
1598 if (dma_set_mask_and_coherent(&pci->dev, emu->dma_mask) < 0) { in snd_emu10k1_create()
1599 dev_err(card->dev, in snd_emu10k1_create()
1601 emu->dma_mask); in snd_emu10k1_create()
1602 return -ENXIO; in snd_emu10k1_create()
1605 emu->gpr_base = A_FXGPREGBASE; in snd_emu10k1_create()
1607 emu->gpr_base = FXGPREGBASE; in snd_emu10k1_create()
1612 emu->port = pci_resource_start(pci, 0); in snd_emu10k1_create()
1614 emu->max_cache_pages = max_cache_bytes >> PAGE_SHIFT; in snd_emu10k1_create()
1616 page_table_size = sizeof(u32) * (emu->address_mode ? MAXPAGES1 : in snd_emu10k1_create()
1619 &emu->ptb_pages) < 0) in snd_emu10k1_create()
1620 return -ENOMEM; in snd_emu10k1_create()
1621 dev_dbg(card->dev, "page table address range is %.8lx:%.8lx\n", in snd_emu10k1_create()
1622 (unsigned long)emu->ptb_pages.addr, in snd_emu10k1_create()
1623 (unsigned long)(emu->ptb_pages.addr + emu->ptb_pages.bytes)); in snd_emu10k1_create()
1625 emu->page_ptr_table = vmalloc(array_size(sizeof(void *), in snd_emu10k1_create()
1626 emu->max_cache_pages)); in snd_emu10k1_create()
1627 emu->page_addr_table = vmalloc(array_size(sizeof(unsigned long), in snd_emu10k1_create()
1628 emu->max_cache_pages)); in snd_emu10k1_create()
1629 if (!emu->page_ptr_table || !emu->page_addr_table) in snd_emu10k1_create()
1630 return -ENOMEM; in snd_emu10k1_create()
1633 &emu->silent_page) < 0) in snd_emu10k1_create()
1634 return -ENOMEM; in snd_emu10k1_create()
1635 dev_dbg(card->dev, "silent page range is %.8lx:%.8lx\n", in snd_emu10k1_create()
1636 (unsigned long)emu->silent_page.addr, in snd_emu10k1_create()
1637 (unsigned long)(emu->silent_page.addr + in snd_emu10k1_create()
1638 emu->silent_page.bytes)); in snd_emu10k1_create()
1640 emu->memhdr = snd_util_memhdr_new(emu->max_cache_pages * PAGE_SIZE); in snd_emu10k1_create()
1641 if (!emu->memhdr) in snd_emu10k1_create()
1642 return -ENOMEM; in snd_emu10k1_create()
1643 emu->memhdr->block_extra_size = sizeof(struct snd_emu10k1_memblk) - in snd_emu10k1_create()
1654 emu->fx8010.extin_mask = extin_mask; in snd_emu10k1_create()
1655 emu->fx8010.extout_mask = extout_mask; in snd_emu10k1_create()
1656 emu->enable_ir = enable_ir; in snd_emu10k1_create()
1658 if (emu->card_capabilities->ca_cardbus_chip) { in snd_emu10k1_create()
1663 if (emu->card_capabilities->ecard) { in snd_emu10k1_create()
1667 } else if (emu->card_capabilities->emu_model) { in snd_emu10k1_create()
1679 emu->fx8010.itram_size = (16 * 1024)/2; in snd_emu10k1_create()
1680 emu->fx8010.etram_pages.area = NULL; in snd_emu10k1_create()
1681 emu->fx8010.etram_pages.bytes = 0; in snd_emu10k1_create()
1684 if (devm_request_irq(&pci->dev, pci->irq, snd_emu10k1_interrupt, in snd_emu10k1_create()
1686 return -EBUSY; in snd_emu10k1_create()
1687 emu->irq = pci->irq; in snd_emu10k1_create()
1688 card->sync_irq = emu->irq; in snd_emu10k1_create()
1694 * Audio Channel = 1 (Left of 2) in snd_emu10k1_create()
1701 * AN = 0 (Audio data) in snd_emu10k1_create()
1704 emu->spdif_bits[0] = emu->spdif_bits[1] = in snd_emu10k1_create()
1705 emu->spdif_bits[2] = SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 | in snd_emu10k1_create()
1711 memset(emu->silent_page.area, 0, emu->silent_page.bytes); in snd_emu10k1_create()
1712 silent_page = emu->silent_page.addr << emu->address_mode; in snd_emu10k1_create()
1713 pgtbl = (__le32 *)emu->ptb_pages.area; in snd_emu10k1_create()
1714 for (idx = 0; idx < (emu->address_mode ? MAXPAGES1 : MAXPAGES0); idx++) in snd_emu10k1_create()
1719 emu->voices[idx].number = idx; in snd_emu10k1_create()
1763 if (emu->audigy) in alloc_pm_buffer()
1765 emu->saved_ptr = vmalloc(array3_size(4, NUM_G, size)); in alloc_pm_buffer()
1766 if (!emu->saved_ptr) in alloc_pm_buffer()
1767 return -ENOMEM; in alloc_pm_buffer()
1769 return -ENOMEM; in alloc_pm_buffer()
1770 if (emu->card_capabilities->ca0151_chip && in alloc_pm_buffer()
1772 return -ENOMEM; in alloc_pm_buffer()
1778 vfree(emu->saved_ptr); in free_pm_buffer()
1780 if (emu->card_capabilities->ca0151_chip) in free_pm_buffer()
1790 val = emu->saved_ptr; in snd_emu10k1_suspend_regs()
1794 if (emu->audigy) { in snd_emu10k1_suspend_regs()
1799 if (emu->audigy) in snd_emu10k1_suspend_regs()
1800 emu->saved_a_iocfg = inw(emu->port + A_IOCFG); in snd_emu10k1_suspend_regs()
1801 emu->saved_hcfg = inl(emu->port + HCFG); in snd_emu10k1_suspend_regs()
1806 if (emu->card_capabilities->ca_cardbus_chip) in snd_emu10k1_resume_init()
1808 if (emu->card_capabilities->ecard) in snd_emu10k1_resume_init()
1810 else if (emu->card_capabilities->emu_model) in snd_emu10k1_resume_init()
1814 snd_emu10k1_init(emu, emu->enable_ir); in snd_emu10k1_resume_init()
1826 if (emu->audigy) in snd_emu10k1_resume_regs()
1827 outw(emu->saved_a_iocfg, emu->port + A_IOCFG); in snd_emu10k1_resume_regs()
1828 outl(emu->saved_hcfg, emu->port + HCFG); in snd_emu10k1_resume_regs()
1830 val = emu->saved_ptr; in snd_emu10k1_resume_regs()
1834 if (emu->audigy) { in snd_emu10k1_resume_regs()