Lines Matching +full:dsp +full:- +full:gpio4
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 */
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()
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()
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()
237 * GPIO4: IEC958 Output on. 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()
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()
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()
411 // stop the DSP in snd_emu10k1_done()
412 if (emu->audigy) 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()
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()
655 /* firmware file names, per model, init-fw and dock-fw (optional) */
678 filename = firmware_names[emu->card_capabilities->emu_model][dock]; in snd_emu1010_load_firmware()
681 err = request_firmware(fw, filename, &emu->pci->dev); in snd_emu1010_load_firmware()
695 // The docking events clearly arrive prematurely - while the in snd_emu1010_load_dock_firmware()
701 dev_info(emu->card->dev, "emu1010: Loading Audio Dock Firmware\n"); in snd_emu1010_load_dock_firmware()
702 err = snd_emu1010_load_firmware(emu, 1, &emu->dock_fw); in snd_emu1010_load_dock_firmware()
708 dev_dbg(emu->card->dev, "emu1010: EMU_HANA+DOCK_ID = 0x%x\n", tmp); in snd_emu1010_load_dock_firmware()
711 dev_err(emu->card->dev, in snd_emu1010_load_dock_firmware()
716 dev_info(emu->card->dev, "emu1010: Audio Dock Firmware loaded\n"); in snd_emu1010_load_dock_firmware()
720 dev_info(emu->card->dev, "Audio Dock ver: %u.%u\n", tmp, tmp2); in snd_emu1010_load_dock_firmware()
738 dev_info(emu->card->dev, "emu1010: Audio Dock detached\n"); in emu1010_dock_event()
739 /* The hardware auto-mutes all, so we unmute again */ in emu1010_dock_event()
748 spin_lock_irq(&emu->reg_lock); in emu1010_clock_event()
750 emu->emu1010.clock_source = emu->emu1010.clock_fallback; in emu1010_clock_event()
751 emu->emu1010.wclock = 1 - emu->emu1010.clock_source; in emu1010_clock_event()
753 spin_unlock_irq(&emu->reg_lock); in emu1010_clock_event()
754 snd_ctl_build_ioff(&id, emu->ctl_clock_source, 0); in emu1010_clock_event()
755 snd_ctl_notify(emu->card, SNDRV_CTL_EVENT_MASK_VALUE, &id); in emu1010_clock_event()
764 if (emu->card->shutdown) in emu1010_work()
767 if (emu->suspend) in emu1010_work()
790 u16 sts = inw(emu->port + A_GPIO); in emu1010_interrupt()
791 u16 bit = emu->card_capabilities->ca0108_chip ? 0x2000 : 0x8000; in emu1010_interrupt()
795 schedule_work(&emu->emu1010.work); in emu1010_interrupt()
800 * ----------------------------
803 * 16 x 16-bit playback - snd_emu10k1_fx8010_playback_ops
804 * 16 x 32-bit capture - snd_emu10k1_capture_efx_ops
811 dev_info(emu->card->dev, "emu1010: Special config.\n"); in snd_emu10k1_emu1010_init()
815 outl(HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK, emu->port + HCFG); in snd_emu10k1_emu1010_init()
819 dev_info(emu->card->dev, "emu1010: Loading Hana Firmware\n"); in snd_emu10k1_emu1010_init()
820 err = snd_emu1010_load_firmware(emu, 0, &emu->firmware); in snd_emu10k1_emu1010_init()
822 dev_info(emu->card->dev, "emu1010: Loading Firmware failed\n"); in snd_emu10k1_emu1010_init()
830 dev_info(emu->card->dev, in snd_emu10k1_emu1010_init()
833 err = -ENODEV; in snd_emu10k1_emu1010_init()
837 dev_info(emu->card->dev, "emu1010: Hana Firmware loaded\n"); in snd_emu10k1_emu1010_init()
840 dev_info(emu->card->dev, "emu1010: Hana version: %u.%u\n", tmp, tmp2); in snd_emu10k1_emu1010_init()
845 dev_info(emu->card->dev, "emu1010: Card options = 0x%x\n", reg); in snd_emu10k1_emu1010_init()
848 if (emu->card_capabilities->no_adat) { in snd_emu10k1_emu1010_init()
849 emu->emu1010.optical_in = 0; /* IN_SPDIF */ in snd_emu10k1_emu1010_init()
850 emu->emu1010.optical_out = 0; /* OUT_SPDIF */ in snd_emu10k1_emu1010_init()
852 /* Optical -> ADAT I/O */ in snd_emu10k1_emu1010_init()
853 emu->emu1010.optical_in = 1; /* IN_ADAT */ in snd_emu10k1_emu1010_init()
854 emu->emu1010.optical_out = 1; /* OUT_ADAT */ in snd_emu10k1_emu1010_init()
856 tmp = (emu->emu1010.optical_in ? EMU_HANA_OPTICAL_IN_ADAT : EMU_HANA_OPTICAL_IN_SPDIF) | in snd_emu10k1_emu1010_init()
857 (emu->emu1010.optical_out ? EMU_HANA_OPTICAL_OUT_ADAT : EMU_HANA_OPTICAL_OUT_SPDIF); in snd_emu10k1_emu1010_init()
860 emu->emu1010.adc_pads = 0x00; in snd_emu10k1_emu1010_init()
861 snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, emu->emu1010.adc_pads); in snd_emu10k1_emu1010_init()
862 /* Unmute Audio dock DACs, Headphone source DAC-4. */ in snd_emu10k1_emu1010_init()
865 emu->emu1010.dac_pads = EMU_HANA_DOCK_DAC_PAD1 | EMU_HANA_DOCK_DAC_PAD2 | in snd_emu10k1_emu1010_init()
867 snd_emu1010_fpga_write(emu, EMU_HANA_DAC_PADS, emu->emu1010.dac_pads); in snd_emu10k1_emu1010_init()
874 emu->gpio_interrupt = emu1010_interrupt; in snd_emu10k1_emu1010_init()
880 emu->emu1010.clock_source = 1; /* 48000 */ in snd_emu10k1_emu1010_init()
881 emu->emu1010.clock_fallback = 1; /* 48000 */ in snd_emu10k1_emu1010_init()
885 emu->emu1010.wclock = EMU_HANA_WCLOCK_INT_48K; in snd_emu10k1_emu1010_init()
909 struct snd_emu10k1 *emu = card->private_data; in snd_emu10k1_free()
911 if (emu->port) { /* avoid access to already used hardware */ in snd_emu10k1_free()
916 if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1010) { in snd_emu10k1_free()
920 cancel_work_sync(&emu->emu1010.work); in snd_emu10k1_free()
921 mutex_destroy(&emu->emu1010.lock); in snd_emu10k1_free()
922 release_firmware(emu->firmware); in snd_emu10k1_free()
923 release_firmware(emu->dock_fw); in snd_emu10k1_free()
924 snd_util_memhdr_free(emu->memhdr); in snd_emu10k1_free()
925 if (emu->silent_page.area) in snd_emu10k1_free()
926 snd_dma_free_pages(&emu->silent_page); in snd_emu10k1_free()
927 if (emu->ptb_pages.area) in snd_emu10k1_free()
928 snd_dma_free_pages(&emu->ptb_pages); in snd_emu10k1_free()
929 vfree(emu->page_ptr_table); in snd_emu10k1_free()
930 vfree(emu->page_addr_table); in snd_emu10k1_free()
939 /* DSP: CA10300-IAT LF
940 * DAC: Cirrus Logic CS4382-KQZ
960 * 3: 0 - Digital Out, 1 - Line in
976 * 0 - Digital Out
977 * 1 - Line in
985 /* DSP: CA10300-IAT LF
986 * DAC: Cirrus Logic CS4382-KQZ
1003 /* DSP: CA0108-IAT
1004 * DAC: CS4382-KQ
1032 /* DSP: Tina2
1051 * 8-9: 0 = Line in/Mic, 2 = Optical in, 3 = Nothing.
1052 * A-B: 0 = Headphones, 2 = Optical out, 3 = Nothing.
1053 * C-D: 2 = Front/Rear/etc, 3 = nothing.
1054 * E-F: Always 0
1067 /* Attach MicroDock[M] to make it an E-MU 1616[m]. */
1071 .driver = "Audigy2", .name = "E-MU 02 CardBus [MAEM8950]",
1080 /* Attach 0202 daughter card to make it an E-MU 1212m, OR a
1081 * MicroDock[M] to make it an E-MU 1616[m]. */
1084 .driver = "Audigy2", .name = "E-MU 1010b PCI [MAEM8960]",
1092 /* Attach 0202 daughter card to make it an E-MU 1212m, OR a
1093 * MicroDockM to make it an E-MU 1616m. The non-m
1098 .driver = "Audigy2", .name = "E-MU 1010 PCIe [MAEM8986]",
1106 /* Attach 0202 daughter card to make it an E-MU 1212m, OR an
1107 * AudioDock[M] to make it an E-MU 1820[m]. */
1110 .driver = "Audigy2", .name = "E-MU 1010 [MAEM8810]",
1120 .driver = "Audigy2", .name = "E-MU 0404b PCI [MAEM8852]",
1129 /* Tested by James@superbug.co.uk 20-3-2007. */
1131 .driver = "Audigy2", .name = "E-MU 0404 [MAEM8850]",
1141 .driver = "Audigy2", .name = "E-MU 0404 PCIe [MAEM8984]",
1164 /* Tested by shane-alsa@cm.nu 5th Nov 2005 */
1212 /* DSP: CA0102-IAT
1213 * DAC: CS4382-KQ
1409 .driver = "EMU10K1", .name = "E-MU APS [PC545]",
1446 * detect that the device is behind a non-passthrough IOMMU.
1452 emu->iommu_workaround = false; in snd_emu10k1_detect_iommu()
1454 domain = iommu_get_domain_for_dev(emu->card->dev); in snd_emu10k1_detect_iommu()
1455 if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY) in snd_emu10k1_detect_iommu()
1458 dev_notice(emu->card->dev, in snd_emu10k1_detect_iommu()
1459 "non-passthrough IOMMU detected, widening DMA allocations"); in snd_emu10k1_detect_iommu()
1460 emu->iommu_workaround = true; in snd_emu10k1_detect_iommu()
1471 struct snd_emu10k1 *emu = card->private_data; in snd_emu10k1_create()
1484 card->private_free = snd_emu10k1_free; in snd_emu10k1_create()
1485 emu->card = card; in snd_emu10k1_create()
1486 spin_lock_init(&emu->reg_lock); in snd_emu10k1_create()
1487 spin_lock_init(&emu->emu_lock); in snd_emu10k1_create()
1488 spin_lock_init(&emu->spi_lock); in snd_emu10k1_create()
1489 spin_lock_init(&emu->i2c_lock); in snd_emu10k1_create()
1490 spin_lock_init(&emu->voice_lock); in snd_emu10k1_create()
1491 spin_lock_init(&emu->synth_lock); in snd_emu10k1_create()
1492 spin_lock_init(&emu->memblk_lock); in snd_emu10k1_create()
1493 mutex_init(&emu->fx8010.lock); in snd_emu10k1_create()
1494 INIT_LIST_HEAD(&emu->mapped_link_head); in snd_emu10k1_create()
1495 INIT_LIST_HEAD(&emu->mapped_order_link_head); in snd_emu10k1_create()
1496 emu->pci = pci; in snd_emu10k1_create()
1497 emu->irq = -1; in snd_emu10k1_create()
1498 emu->synth = NULL; in snd_emu10k1_create()
1499 emu->get_synth_voice = NULL; in snd_emu10k1_create()
1500 INIT_WORK(&emu->emu1010.work, emu1010_work); in snd_emu10k1_create()
1501 mutex_init(&emu->emu1010.lock); in snd_emu10k1_create()
1503 emu->revision = pci->revision; in snd_emu10k1_create()
1504 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &emu->serial); in snd_emu10k1_create()
1505 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &emu->model); in snd_emu10k1_create()
1506 dev_dbg(card->dev, in snd_emu10k1_create()
1508 pci->vendor, pci->device, emu->serial, emu->model); in snd_emu10k1_create()
1510 for (c = emu_chip_details; c->vendor; c++) { in snd_emu10k1_create()
1511 if (c->vendor == pci->vendor && c->device == pci->device) { in snd_emu10k1_create()
1513 if (c->subsystem && (c->subsystem == subsystem)) in snd_emu10k1_create()
1518 if (c->subsystem && (c->subsystem != emu->serial)) in snd_emu10k1_create()
1520 if (c->revision && c->revision != emu->revision) in snd_emu10k1_create()
1526 if (c->vendor == 0) { in snd_emu10k1_create()
1527 dev_err(card->dev, "emu10k1: Card not recognised\n"); in snd_emu10k1_create()
1528 return -ENOENT; in snd_emu10k1_create()
1530 emu->card_capabilities = c; in snd_emu10k1_create()
1531 if (c->subsystem && !subsystem) in snd_emu10k1_create()
1532 dev_dbg(card->dev, "Sound card name = %s\n", c->name); in snd_emu10k1_create()
1534 dev_dbg(card->dev, "Sound card name = %s, " in snd_emu10k1_create()
1536 "Forced to subsystem = 0x%x\n", c->name, in snd_emu10k1_create()
1537 pci->vendor, pci->device, emu->serial, c->subsystem); in snd_emu10k1_create()
1539 dev_dbg(card->dev, "Sound card name = %s, " in snd_emu10k1_create()
1541 c->name, pci->vendor, pci->device, in snd_emu10k1_create()
1542 emu->serial); in snd_emu10k1_create()
1544 if (!*card->id && c->id) in snd_emu10k1_create()
1545 strscpy(card->id, c->id, sizeof(card->id)); in snd_emu10k1_create()
1547 is_audigy = emu->audigy = c->emu10k2_chip; in snd_emu10k1_create()
1552 emu->address_mode = is_audigy ? 0 : 1; in snd_emu10k1_create()
1554 emu->dma_mask = emu->address_mode ? EMU10K1_DMA_MASK : AUDIGY_DMA_MASK; in snd_emu10k1_create()
1555 if (dma_set_mask_and_coherent(&pci->dev, emu->dma_mask) < 0) { in snd_emu10k1_create()
1556 dev_err(card->dev, in snd_emu10k1_create()
1558 emu->dma_mask); in snd_emu10k1_create()
1559 return -ENXIO; in snd_emu10k1_create()
1562 emu->gpr_base = A_FXGPREGBASE; in snd_emu10k1_create()
1564 emu->gpr_base = FXGPREGBASE; in snd_emu10k1_create()
1569 emu->port = pci_resource_start(pci, 0); in snd_emu10k1_create()
1571 emu->max_cache_pages = max_cache_bytes >> PAGE_SHIFT; in snd_emu10k1_create()
1573 page_table_size = sizeof(u32) * (emu->address_mode ? MAXPAGES1 : in snd_emu10k1_create()
1576 &emu->ptb_pages) < 0) in snd_emu10k1_create()
1577 return -ENOMEM; in snd_emu10k1_create()
1578 dev_dbg(card->dev, "page table address range is %.8lx:%.8lx\n", in snd_emu10k1_create()
1579 (unsigned long)emu->ptb_pages.addr, in snd_emu10k1_create()
1580 (unsigned long)(emu->ptb_pages.addr + emu->ptb_pages.bytes)); in snd_emu10k1_create()
1582 emu->page_ptr_table = vmalloc(array_size(sizeof(void *), in snd_emu10k1_create()
1583 emu->max_cache_pages)); in snd_emu10k1_create()
1584 emu->page_addr_table = vmalloc(array_size(sizeof(unsigned long), in snd_emu10k1_create()
1585 emu->max_cache_pages)); in snd_emu10k1_create()
1586 if (!emu->page_ptr_table || !emu->page_addr_table) in snd_emu10k1_create()
1587 return -ENOMEM; in snd_emu10k1_create()
1590 &emu->silent_page) < 0) in snd_emu10k1_create()
1591 return -ENOMEM; in snd_emu10k1_create()
1592 dev_dbg(card->dev, "silent page range is %.8lx:%.8lx\n", in snd_emu10k1_create()
1593 (unsigned long)emu->silent_page.addr, in snd_emu10k1_create()
1594 (unsigned long)(emu->silent_page.addr + in snd_emu10k1_create()
1595 emu->silent_page.bytes)); in snd_emu10k1_create()
1597 emu->memhdr = snd_util_memhdr_new(emu->max_cache_pages * PAGE_SIZE); in snd_emu10k1_create()
1598 if (!emu->memhdr) in snd_emu10k1_create()
1599 return -ENOMEM; in snd_emu10k1_create()
1600 emu->memhdr->block_extra_size = sizeof(struct snd_emu10k1_memblk) - in snd_emu10k1_create()
1611 emu->fx8010.extin_mask = extin_mask; in snd_emu10k1_create()
1612 emu->fx8010.extout_mask = extout_mask; in snd_emu10k1_create()
1613 emu->enable_ir = enable_ir; in snd_emu10k1_create()
1615 if (emu->card_capabilities->ca_cardbus_chip) { in snd_emu10k1_create()
1620 if (emu->card_capabilities->ecard) { in snd_emu10k1_create()
1624 } else if (emu->card_capabilities->emu_model) { in snd_emu10k1_create()
1636 emu->fx8010.itram_size = (16 * 1024)/2; in snd_emu10k1_create()
1637 emu->fx8010.etram_pages.area = NULL; in snd_emu10k1_create()
1638 emu->fx8010.etram_pages.bytes = 0; in snd_emu10k1_create()
1641 if (devm_request_irq(&pci->dev, pci->irq, snd_emu10k1_interrupt, in snd_emu10k1_create()
1643 return -EBUSY; in snd_emu10k1_create()
1644 emu->irq = pci->irq; in snd_emu10k1_create()
1645 card->sync_irq = emu->irq; in snd_emu10k1_create()
1661 emu->spdif_bits[0] = emu->spdif_bits[1] = in snd_emu10k1_create()
1662 emu->spdif_bits[2] = SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 | in snd_emu10k1_create()
1668 memset(emu->silent_page.area, 0, emu->silent_page.bytes); in snd_emu10k1_create()
1669 silent_page = emu->silent_page.addr << emu->address_mode; in snd_emu10k1_create()
1670 pgtbl = (__le32 *)emu->ptb_pages.area; in snd_emu10k1_create()
1671 for (idx = 0; idx < (emu->address_mode ? MAXPAGES1 : MAXPAGES0); idx++) in snd_emu10k1_create()
1676 emu->voices[idx].number = idx; in snd_emu10k1_create()
1720 if (emu->audigy) in alloc_pm_buffer()
1722 emu->saved_ptr = vmalloc(array3_size(4, NUM_G, size)); in alloc_pm_buffer()
1723 if (!emu->saved_ptr) in alloc_pm_buffer()
1724 return -ENOMEM; in alloc_pm_buffer()
1726 return -ENOMEM; in alloc_pm_buffer()
1727 if (emu->card_capabilities->ca0151_chip && in alloc_pm_buffer()
1729 return -ENOMEM; in alloc_pm_buffer()
1735 vfree(emu->saved_ptr); in free_pm_buffer()
1737 if (emu->card_capabilities->ca0151_chip) in free_pm_buffer()
1747 val = emu->saved_ptr; in snd_emu10k1_suspend_regs()
1751 if (emu->audigy) { in snd_emu10k1_suspend_regs()
1756 if (emu->audigy) in snd_emu10k1_suspend_regs()
1757 emu->saved_a_iocfg = inw(emu->port + A_IOCFG); in snd_emu10k1_suspend_regs()
1758 emu->saved_hcfg = inl(emu->port + HCFG); in snd_emu10k1_suspend_regs()
1763 if (emu->card_capabilities->ca_cardbus_chip) in snd_emu10k1_resume_init()
1765 if (emu->card_capabilities->ecard) in snd_emu10k1_resume_init()
1767 else if (emu->card_capabilities->emu_model) in snd_emu10k1_resume_init()
1771 snd_emu10k1_init(emu, emu->enable_ir); in snd_emu10k1_resume_init()
1783 if (emu->audigy) in snd_emu10k1_resume_regs()
1784 outw(emu->saved_a_iocfg, emu->port + A_IOCFG); in snd_emu10k1_resume_regs()
1785 outl(emu->saved_hcfg, emu->port + HCFG); in snd_emu10k1_resume_regs()
1787 val = emu->saved_ptr; in snd_emu10k1_resume_regs()
1791 if (emu->audigy) { in snd_emu10k1_resume_regs()