• Home
  • Raw
  • Download

Lines Matching +full:asi +full:- +full:format

1 // SPDX-License-Identifier: GPL-2.0-or-later
74 #define DESKTOP_EFX_FILE "ctefx-desktop.bin"
75 #define R3DI_EFX_FILE "ctefx-r3di.bin"
115 #define VNODES_COUNT (VNODE_END_NID - VNODE_START_NID)
126 #define OUT_EFFECTS_COUNT (OUT_EFFECT_END_NID - OUT_EFFECT_START_NID)
134 #define IN_EFFECTS_COUNT (IN_EFFECT_END_NID - IN_EFFECT_START_NID)
154 #define EFFECTS_COUNT (EFFECT_END_NID - EFFECT_START_NID)
163 * X-bass.
182 int params; /* number of default non-on/off params */
223 { .name = "X-Bass",
304 #define TUNING_CTLS_COUNT (TUNING_CTL_END_NID - TUNING_CTL_START_NID)
600 * DSP reqs for handling full-range speakers/bass redirection. If a speaker is
604 * enabled. X-Bass must be disabled when using these.
609 /* Between 0x16-0x1a are the X-Bass reqs. */
763 { .name = "Low (16-31",
766 { .name = "Medium (32-149",
769 { .name = "High (150-600",
866 /* Tracker for the SPDIF-in path is bypassed/enabled */
884 /* Decode Loop (DSP->SRC->DSP) is disabled/enabled */
886 /* De-emphasis filter on DAC-1 disabled/enabled */
888 /* De-emphasis filter on DAC-2 disabled/enabled */
890 /* De-emphasis filter on DAC-3 disabled/enabled */
892 /* High-pass filter on ADC_B disabled/enabled */
894 /* High-pass filter on ADC_C disabled/enabled */
904 /* ASI rate is 48kHz/96kHz */
931 * sense given the fact the AE-5 uses it and has the ASI flag set.
1012 DSP_DOWNLOAD_FAILED = -1,
1018 /* retrieve parameters from hda format */
1095 /* AE-5 Control values */
1110 * AE-5 all use PCI region 2 to toggle GPIO and other currently unknown
1148 #define ca0132_quirk(spec) ((spec)->quirk)
1149 #define ca0132_use_pci_mmio(spec) ((spec)->use_pci_mmio)
1150 #define ca0132_use_alt_functions(spec) ((spec)->use_alt_functions)
1151 #define ca0132_use_alt_controls(spec) ((spec)->use_alt_controls)
1175 { 0x0b, 0x01017010 }, /* Port G -- Lineout FRONT L/R */
1179 { 0x0f, 0x0221701f }, /* Port A -- BackPanel HP */
1180 { 0x10, 0x01017012 }, /* Port D -- Center/LFE or FP Hp */
1181 { 0x11, 0x01017014 }, /* Port B -- LineMicIn2 / Rear L/R */
1182 { 0x12, 0x01a170f0 }, /* Port C -- LineIn1 */
1190 { 0x0b, 0x01047110 }, /* Port G -- Lineout FRONT L/R */
1191 { 0x0c, 0x414510f0 }, /* SPDIF Out 1 - Disabled*/
1193 { 0x0e, 0x41c520f0 }, /* SPDIF In - Disabled*/
1194 { 0x0f, 0x0122711f }, /* Port A -- BackPanel HP */
1195 { 0x10, 0x01017111 }, /* Port D -- Center/LFE */
1196 { 0x11, 0x01017114 }, /* Port B -- LineMicIn2 / Rear L/R */
1197 { 0x12, 0x01a271f0 }, /* Port C -- LineIn1 */
1205 { 0x0b, 0x01014110 }, /* Port G -- Lineout FRONT L/R */
1209 { 0x0f, 0x0221401f }, /* Port A -- BackPanel HP */
1210 { 0x10, 0x01016011 }, /* Port D -- Center/LFE or FP Hp */
1211 { 0x11, 0x01011014 }, /* Port B -- LineMicIn2 / Rear L/R */
1212 { 0x12, 0x02a090f0 }, /* Port C -- LineIn1 */
1218 /* Sound Blaster AE-5 pin configs taken from Windows Driver */
1220 { 0x0b, 0x01017010 }, /* Port G -- Lineout FRONT L/R */
1224 { 0x0f, 0x01017114 }, /* Port A -- Rear L/R. */
1225 { 0x10, 0x01017012 }, /* Port D -- Center/LFE or FP Hp */
1226 { 0x11, 0x012170ff }, /* Port B -- LineMicIn2 / Rear Headphone */
1227 { 0x12, 0x01a170f0 }, /* Port C -- LineIn1 */
1235 { 0x0b, 0x01014110 }, /* Port G -- Lineout FRONT L/R */
1239 { 0x0f, 0x0221401f }, /* Port A -- BackPanel HP */
1240 { 0x10, 0x01016011 }, /* Port D -- Center/LFE or FP Hp */
1241 { 0x11, 0x01011014 }, /* Port B -- LineMicIn2 / Rear L/R */
1242 { 0x12, 0x02a090f0 }, /* Port C -- LineIn1 */
1273 SND_PCI_QUIRK(0x1458, 0xA036, "Gigabyte GA-Z170X-Gaming 7", QUIRK_R3DI),
1277 SND_PCI_QUIRK(0x1102, 0x0051, "Sound Blaster AE-5", QUIRK_AE5),
1278 SND_PCI_QUIRK(0x1102, 0x0191, "Sound Blaster AE-5 Plus", QUIRK_AE5),
1279 SND_PCI_QUIRK(0x1102, 0x0081, "Sound Blaster AE-7", QUIRK_AE7),
1486 return ((response == -1) ? -1 : 0); in codec_send_command()
1524 return -EIO; in chipio_send()
1528 * Write chip address through the vendor widget -- NOT protected by the Mutex!
1533 struct ca0132_spec *spec = codec->spec; in chipio_write_address()
1536 if (spec->curr_chip_addx == chip_addx) in chipio_write_address()
1543 if (res != -EIO) { in chipio_write_address()
1549 spec->curr_chip_addx = (res < 0) ? ~0U : chip_addx; in chipio_write_address()
1555 * Write data through the vendor widget -- NOT protected by the Mutex!
1559 struct ca0132_spec *spec = codec->spec; in chipio_write_data()
1565 if (res != -EIO) { in chipio_write_data()
1573 spec->curr_chip_addx = (res != -EIO) ? in chipio_write_data()
1574 (spec->curr_chip_addx + 4) : ~0U; in chipio_write_data()
1579 * Write multiple data through the vendor widget -- NOT protected by the Mutex!
1589 return -EINVAL; in chipio_write_data_multiple()
1592 while ((count-- != 0) && (status == 0)) in chipio_write_data_multiple()
1600 * Read data through the vendor widget -- NOT protected by the Mutex!
1604 struct ca0132_spec *spec = codec->spec; in chipio_read_data()
1610 if (res != -EIO) { in chipio_read_data()
1615 if (res != -EIO) { in chipio_read_data()
1624 spec->curr_chip_addx = (res != -EIO) ? in chipio_read_data()
1625 (spec->curr_chip_addx + 4) : ~0U; in chipio_read_data()
1636 struct ca0132_spec *spec = codec->spec; in chipio_write()
1639 mutex_lock(&spec->chipio_mutex); in chipio_write()
1651 mutex_unlock(&spec->chipio_mutex); in chipio_write()
1687 struct ca0132_spec *spec = codec->spec; in chipio_write_multiple()
1690 mutex_lock(&spec->chipio_mutex); in chipio_write_multiple()
1697 mutex_unlock(&spec->chipio_mutex); in chipio_write_multiple()
1709 struct ca0132_spec *spec = codec->spec; in chipio_read()
1712 mutex_lock(&spec->chipio_mutex); in chipio_read()
1724 mutex_unlock(&spec->chipio_mutex); in chipio_read()
1750 struct ca0132_spec *spec = codec->spec; in chipio_set_control_param()
1758 mutex_lock(&spec->chipio_mutex); in chipio_set_control_param()
1767 mutex_unlock(&spec->chipio_mutex); in chipio_set_control_param()
1860 * 0x80-0xFF.
1876 struct ca0132_spec *spec = codec->spec; in chipio_enable_clocks()
1878 mutex_lock(&spec->chipio_mutex); in chipio_enable_clocks()
1891 mutex_unlock(&spec->chipio_mutex); in chipio_enable_clocks()
1911 return -EIO; in dspio_send()
1937 struct ca0132_spec *spec = codec->spec; in dspio_write()
1942 mutex_lock(&spec->chipio_mutex); in dspio_write()
1957 mutex_unlock(&spec->chipio_mutex); in dspio_write()
1960 -EIO : 0; in dspio_write()
1973 return -EINVAL; in dspio_write_multiple()
1991 if (status == -EIO) in dspio_read()
1995 if (status == -EIO || in dspio_read()
1997 return -EIO; in dspio_read()
2015 return -1; in dspio_read_multiple()
2112 struct ca0132_spec *spec = codec->spec; in dspio_get_response_data()
2117 return -EIO; in dspio_get_response_data()
2119 if ((data & 0x00ffffff) == spec->wait_scp_header) { in dspio_get_response_data()
2120 spec->scp_resp_header = data; in dspio_get_response_data()
2121 spec->scp_resp_count = data >> 27; in dspio_get_response_data()
2122 count = spec->wait_num_data; in dspio_get_response_data()
2123 dspio_read_multiple(codec, spec->scp_resp_data, in dspio_get_response_data()
2124 &spec->scp_resp_count, count); in dspio_get_response_data()
2128 return -EIO; in dspio_get_response_data()
2141 struct ca0132_spec *spec = codec->spec; in dspio_send_scp_message()
2142 int status = -1; in dspio_send_scp_message()
2162 return -EINVAL; in dspio_send_scp_message()
2166 return -EINVAL; in dspio_send_scp_message()
2168 spec->wait_scp_header = *((unsigned int *)send_buf); in dspio_send_scp_message()
2173 spec->wait_scp_header &= 0xffff0000; in dspio_send_scp_message()
2174 spec->wait_scp_header |= (resp_src_id << 8) | (resp_target_id); in dspio_send_scp_message()
2175 spec->wait_num_data = return_buf_size/sizeof(unsigned int) - 1; in dspio_send_scp_message()
2176 spec->wait_scp = 1; in dspio_send_scp_message()
2183 spec->wait_scp = 0; in dspio_send_scp_message()
2192 } while (spec->wait_scp && time_before(jiffies, timeout)); in dspio_send_scp_message()
2194 if (!spec->wait_scp) { in dspio_send_scp_message()
2196 memcpy(&ret_msg->hdr, &spec->scp_resp_header, 4); in dspio_send_scp_message()
2197 memcpy(&ret_msg->data, spec->scp_resp_data, in dspio_send_scp_message()
2198 spec->wait_num_data); in dspio_send_scp_message()
2199 *bytes_returned = (spec->scp_resp_count + 1) * 4; in dspio_send_scp_message()
2202 status = -EIO; in dspio_send_scp_message()
2204 spec->wait_scp = 0; in dspio_send_scp_message()
2238 return -EINVAL; in dspio_scp()
2242 return -EINVAL; in dspio_scp()
2247 return -EINVAL; in dspio_scp()
2279 ret_size = (ret_bytes - sizeof(scp_reply.hdr)) in dspio_scp()
2284 return -EINVAL; in dspio_scp()
2287 return -EINVAL; in dspio_scp()
2290 return -EINVAL; in dspio_scp()
2296 codec_dbg(codec, "reply ill-formed or errflag set\n"); in dspio_scp()
2297 return -EIO; in dspio_scp()
2335 codec_dbg(codec, " dspio_alloc_dma_chan() -- begin\n"); in dspio_alloc_dma_chan()
2347 return -EBUSY; in dspio_alloc_dma_chan()
2351 codec_dbg(codec, " dspio_alloc_dma_chan() -- complete\n"); in dspio_alloc_dma_chan()
2364 codec_dbg(codec, " dspio_free_dma_chan() -- begin\n"); in dspio_free_dma_chan()
2376 codec_dbg(codec, " dspio_free_dma_chan() -- complete\n"); in dspio_free_dma_chan()
2427 retry--; in dsp_reset()
2428 } while (res == -EIO && retry); in dsp_reset()
2432 return -EIO; in dsp_reset()
2484 codec_dbg(codec, "-- dsp_dma_setup_common() -- Begin ---------\n"); in dsp_dma_setup_common()
2488 return -EINVAL; in dsp_dma_setup_common()
2493 return -EBUSY; in dsp_dma_setup_common()
2500 return -ENXIO; in dsp_dma_setup_common()
2577 codec_dbg(codec, "-- dsp_dma_setup_common() -- Complete ------\n"); in dsp_dma_setup_common()
2583 * Setup the DSP DMA per-transfer-specific registers
2600 const unsigned int max_dma_count = 1 << (DSPDMAC_XFRCNT_BCNT_HIBIT - in dsp_dma_setup()
2603 codec_dbg(codec, "-- dsp_dma_setup() -- Begin ---------\n"); in dsp_dma_setup()
2607 return -EINVAL; in dsp_dma_setup()
2613 return -ENXIO; in dsp_dma_setup()
2638 adr_ofs = (count - 1) << (DSPDMAC_DSPADROFS_BOFS_LOBIT + in dsp_dma_setup()
2649 base_cnt = (count - 1) << DSPDMAC_XFRCNT_BCNT_LOBIT; in dsp_dma_setup()
2651 cur_cnt = (count - 1) << DSPDMAC_XFRCNT_CCNT_LOBIT; in dsp_dma_setup()
2668 codec_dbg(codec, "-- dsp_dma_setup() -- Complete ---------\n"); in dsp_dma_setup()
2682 codec_dbg(codec, "-- dsp_dma_start() -- Begin ---------\n"); in dsp_dma_start()
2692 codec_dbg(codec, "-- dsp_dma_start() Read CHNLSTART\n"); in dsp_dma_start()
2704 codec_dbg(codec, "-- dsp_dma_start() -- Complete ---------\n"); in dsp_dma_start()
2718 codec_dbg(codec, "-- dsp_dma_stop() -- Begin ---------\n"); in dsp_dma_stop()
2728 codec_dbg(codec, "-- dsp_dma_stop() Read CHNLSTART\n"); in dsp_dma_stop()
2739 codec_dbg(codec, "-- dsp_dma_stop() -- Complete ---------\n"); in dsp_dma_stop()
2770 val |= (ports_per_channel - 1) << 4; in dsp_allocate_router_ports()
2771 val |= num_chans - 1; in dsp_allocate_router_ports()
2822 codec_dbg(codec, " dsp_allocate_ports() -- begin\n"); in dsp_allocate_ports()
2826 return -EINVAL; in dsp_allocate_ports()
2832 codec_dbg(codec, " dsp_allocate_ports() -- complete\n"); in dsp_allocate_ports()
2850 return -EINVAL; in dsp_allocate_ports_format()
2867 codec_dbg(codec, " dsp_free_ports() -- begin\n"); in dsp_free_ports()
2874 codec_dbg(codec, " dsp_free_ports() -- complete\n"); in dsp_free_ports()
2916 struct hda_codec *codec = dma->codec; in dma_reset()
2917 struct ca0132_spec *spec = codec->spec; in dma_reset()
2920 if (dma->dmab->area) in dma_reset()
2921 snd_hda_codec_load_dsp_cleanup(codec, dma->dmab); in dma_reset()
2924 dma->m_converter_format, in dma_reset()
2925 dma->buf_size, in dma_reset()
2926 dma->dmab); in dma_reset()
2929 spec->dsp_stream_id = status; in dma_reset()
2948 snd_hda_codec_load_dsp_trigger(dma->codec, cmd); in dma_set_state()
2954 return dma->dmab->bytes; in dma_get_buffer_size()
2959 return dma->dmab->area; in dma_get_buffer_addr()
2966 memcpy(dma->dmab->area, data, count); in dma_xfer()
2972 unsigned short *format) in dma_get_converter_format() argument
2974 if (format) in dma_get_converter_format()
2975 *format = dma->m_converter_format; in dma_get_converter_format()
2980 struct ca0132_spec *spec = dma->codec->spec; in dma_get_stream_id()
2982 return spec->dsp_stream_id; in dma_get_stream_id()
2997 return p->magic == g_magic_value; in is_valid()
3002 return g_chip_addr_magic_value == p->chip_addr; in is_hci_prog_list_seg()
3007 return p->count == 0; in is_last()
3012 return struct_size(p, data, p->count); in dsp_sizeof()
3028 * The segment data is in the format of successive pairs of words.
3038 if (fls == NULL || fls->chip_addr != g_chip_addr_magic_value) { in dspxfr_hci_write()
3040 return -EINVAL; in dspxfr_hci_write()
3043 count = fls->count; in dspxfr_hci_write()
3044 data = (u32 *)(fls->data); in dspxfr_hci_write()
3051 count -= 2; in dspxfr_hci_write()
3058 * Write a block of data into DSP code or data RAM using pre-allocated
3063 * @reloc: Relocation address for loading single-segment overlays, or 0 for
3068 * @ovly: TRUE if overlay format is required
3101 return -EINVAL; in dspxfr_one_seg()
3114 return -EINVAL; in dspxfr_one_seg()
3117 data = fls->data; in dspxfr_one_seg()
3118 chip_addx = fls->chip_addr; in dspxfr_one_seg()
3119 words_to_write = fls->count; in dspxfr_one_seg()
3130 return -EINVAL; in dspxfr_one_seg()
3140 return -EINVAL; in dspxfr_one_seg()
3153 return -EINVAL; in dspxfr_one_seg()
3159 buffer_size_words -= buffer_size_words % hda_frame_size_words; in dspxfr_one_seg()
3168 return -EINVAL; in dspxfr_one_seg()
3177 words_to_write -= remainder_words; in dspxfr_one_seg()
3204 return -EIO; in dspxfr_one_seg()
3244 words_to_write -= run_size_words; in dspxfr_one_seg()
3260 * @reloc: Relocation address for loading single-segment overlays, or 0 for
3264 * @ovly: TRUE if overlay format is required
3275 struct ca0132_spec *spec = codec->spec; in dspxfr_image()
3285 return -EINVAL; in dspxfr_image()
3289 return -ENOMEM; in dspxfr_image()
3291 dma_engine->dmab = kzalloc(sizeof(*dma_engine->dmab), GFP_KERNEL); in dspxfr_image()
3292 if (!dma_engine->dmab) { in dspxfr_image()
3294 return -ENOMEM; in dspxfr_image()
3297 dma_engine->codec = codec; in dspxfr_image()
3299 dma_engine->m_converter_format = hda_format; in dspxfr_image()
3300 dma_engine->buf_size = (ovly ? DSP_DMA_WRITE_BUFLEN_OVLY : in dspxfr_image()
3309 codec_dbg(codec, "set converter format fail\n"); in dspxfr_image()
3314 dma_engine->m_converter_format, in dspxfr_image()
3315 dma_engine->buf_size, in dspxfr_image()
3316 dma_engine->dmab); in dspxfr_image()
3319 spec->dsp_stream_id = status; in dspxfr_image()
3349 status = -EINVAL; in dspxfr_image()
3378 if (dma_engine->dmab->area) in dspxfr_image()
3379 snd_hda_codec_load_dsp_cleanup(codec, dma_engine->dmab); in dspxfr_image()
3380 kfree(dma_engine->dmab); in dspxfr_image()
3391 struct ca0132_spec *spec = codec->spec; in dspload_post_setup()
3392 codec_dbg(codec, "---- dspload_post_setup ------\n"); in dspload_post_setup()
3404 * dspload_image - Download DSP from a DSP Image Fast Load structure.
3408 * @ovly: TRUE if overlay format is required
3409 * @reloc: Relocation address for loading single-segment overlays, or 0 for
3416 * linear, non-constant sized element array of structures, each of which
3432 codec_dbg(codec, "---- dspload_image begin ------\n"); in dspload_image()
3508 * ca0113 related functions. The ca0113 acts as the HDA bus for the pci-e
3514 * For cards with PCI-E region2 (Sound Blaster Z/ZxR, Recon3D, and AE-5)
3515 * the mmio address 0x320 is used to set GPIO pins. The format for the data
3518 * AE-5 note: The AE-5 seems to use pins 2 and 3 to somehow set the color value
3519 * of the on-card LED. It seems to use pin 2 for data, then toggles 3 to on and
3525 struct ca0132_spec *spec = codec->spec; in ca0113_mmio_gpio_set()
3531 writew(gpio_data, spec->mem_base + 0x320); in ca0113_mmio_gpio_set()
3535 * Special pci region2 commands that are only used by the AE-5. They follow
3536 * a set format, and require reads at certain points to seemingly 'clear'
3540 * target-id, and value.
3545 struct ca0132_spec *spec = codec->spec; in ca0113_mmio_command_set()
3548 writel(0x0000007e, spec->mem_base + 0x210); in ca0113_mmio_command_set()
3549 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set()
3550 writel(0x0000005a, spec->mem_base + 0x210); in ca0113_mmio_command_set()
3551 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set()
3552 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set()
3554 writel(0x00800005, spec->mem_base + 0x20c); in ca0113_mmio_command_set()
3555 writel(group, spec->mem_base + 0x804); in ca0113_mmio_command_set()
3557 writel(0x00800005, spec->mem_base + 0x20c); in ca0113_mmio_command_set()
3562 writel(write_val, spec->mem_base + 0x204); in ca0113_mmio_command_set()
3568 readl(spec->mem_base + 0x860); in ca0113_mmio_command_set()
3569 readl(spec->mem_base + 0x854); in ca0113_mmio_command_set()
3570 readl(spec->mem_base + 0x840); in ca0113_mmio_command_set()
3572 writel(0x00800004, spec->mem_base + 0x20c); in ca0113_mmio_command_set()
3573 writel(0x00000000, spec->mem_base + 0x210); in ca0113_mmio_command_set()
3574 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set()
3575 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set()
3584 struct ca0132_spec *spec = codec->spec; in ca0113_mmio_command_set_type2()
3587 writel(0x0000007e, spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3588 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3589 writel(0x0000005a, spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3590 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3591 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3593 writel(0x00800003, spec->mem_base + 0x20c); in ca0113_mmio_command_set_type2()
3594 writel(group, spec->mem_base + 0x804); in ca0113_mmio_command_set_type2()
3596 writel(0x00800005, spec->mem_base + 0x20c); in ca0113_mmio_command_set_type2()
3601 writel(write_val, spec->mem_base + 0x204); in ca0113_mmio_command_set_type2()
3603 readl(spec->mem_base + 0x860); in ca0113_mmio_command_set_type2()
3604 readl(spec->mem_base + 0x854); in ca0113_mmio_command_set_type2()
3605 readl(spec->mem_base + 0x840); in ca0113_mmio_command_set_type2()
3607 writel(0x00800004, spec->mem_base + 0x20c); in ca0113_mmio_command_set_type2()
3608 writel(0x00000000, spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3609 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3610 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3623 struct ca0132_spec *spec = codec->spec; in ca0132_gpio_init()
3646 struct ca0132_spec *spec = codec->spec; in ca0132_gpio_setup()
3677 /* Bit 1 - Switch between front/rear mic. 0 = rear, 1 = front */
3679 /* Bit 2 - Switch between headphone/line out. 0 = Headphone, 1 = Line */
3730 snd_hda_codec_write(codec, codec->core.afg, 0, in r3di_gpio_mic_set()
3745 snd_hda_codec_write(codec, codec->core.afg, 0, in r3di_gpio_dsp_status_set()
3752 snd_hda_codec_write(codec, codec->core.afg, 0, in r3di_gpio_dsp_status_set()
3759 snd_hda_codec_write(codec, codec->core.afg, 0, in r3di_gpio_dsp_status_set()
3769 unsigned int format, in ca0132_playback_pcm_prepare() argument
3772 struct ca0132_spec *spec = codec->spec; in ca0132_playback_pcm_prepare()
3774 snd_hda_codec_setup_stream(codec, spec->dacs[0], stream_tag, 0, format); in ca0132_playback_pcm_prepare()
3783 struct ca0132_spec *spec = codec->spec; in ca0132_playback_pcm_cleanup()
3785 if (spec->dsp_state == DSP_DOWNLOADING) in ca0132_playback_pcm_cleanup()
3790 if (spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]) in ca0132_playback_pcm_cleanup()
3793 snd_hda_codec_cleanup_stream(codec, spec->dacs[0]); in ca0132_playback_pcm_cleanup()
3802 struct ca0132_spec *spec = codec->spec; in ca0132_playback_pcm_delay()
3804 struct snd_pcm_runtime *runtime = substream->runtime; in ca0132_playback_pcm_delay()
3806 if (spec->dsp_state != DSP_DOWNLOADED) in ca0132_playback_pcm_delay()
3810 if (spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]) { in ca0132_playback_pcm_delay()
3811 if ((spec->effects_switch[SURROUND - EFFECT_START_NID]) || in ca0132_playback_pcm_delay()
3812 (spec->effects_switch[DIALOG_PLUS - EFFECT_START_NID])) in ca0132_playback_pcm_delay()
3817 if (spec->cur_out_type == SPEAKER_OUT) in ca0132_playback_pcm_delay()
3820 return (latency * runtime->rate) / 1000; in ca0132_playback_pcm_delay()
3830 struct ca0132_spec *spec = codec->spec; in ca0132_dig_playback_pcm_open()
3831 return snd_hda_multi_out_dig_open(codec, &spec->multiout); in ca0132_dig_playback_pcm_open()
3837 unsigned int format, in ca0132_dig_playback_pcm_prepare() argument
3840 struct ca0132_spec *spec = codec->spec; in ca0132_dig_playback_pcm_prepare()
3841 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, in ca0132_dig_playback_pcm_prepare()
3842 stream_tag, format, substream); in ca0132_dig_playback_pcm_prepare()
3849 struct ca0132_spec *spec = codec->spec; in ca0132_dig_playback_pcm_cleanup()
3850 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); in ca0132_dig_playback_pcm_cleanup()
3857 struct ca0132_spec *spec = codec->spec; in ca0132_dig_playback_pcm_close()
3858 return snd_hda_multi_out_dig_close(codec, &spec->multiout); in ca0132_dig_playback_pcm_close()
3867 unsigned int format, in ca0132_capture_pcm_prepare() argument
3870 snd_hda_codec_setup_stream(codec, hinfo->nid, in ca0132_capture_pcm_prepare()
3871 stream_tag, 0, format); in ca0132_capture_pcm_prepare()
3880 struct ca0132_spec *spec = codec->spec; in ca0132_capture_pcm_cleanup()
3882 if (spec->dsp_state == DSP_DOWNLOADING) in ca0132_capture_pcm_cleanup()
3885 snd_hda_codec_cleanup_stream(codec, hinfo->nid); in ca0132_capture_pcm_cleanup()
3893 struct ca0132_spec *spec = codec->spec; in ca0132_capture_pcm_delay()
3895 struct snd_pcm_runtime *runtime = substream->runtime; in ca0132_capture_pcm_delay()
3897 if (spec->dsp_state != DSP_DOWNLOADED) in ca0132_capture_pcm_delay()
3900 if (spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID]) in ca0132_capture_pcm_delay()
3903 return (latency * runtime->rate) / 1000; in ca0132_capture_pcm_delay()
3967 * values -90 to 9. -90 is the lowest decibel value for both the ADC's and the
4015 * This table counts from float 10 to 1000, which is the range of the x-bass
4125 struct ca0132_spec *spec = codec->spec; in tuning_ctl_get()
4127 long *valp = ucontrol->value.integer.value; in tuning_ctl_get()
4128 int idx = nid - TUNING_CTL_START_NID; in tuning_ctl_get()
4130 *valp = spec->cur_ctl_vals[idx]; in tuning_ctl_get()
4138 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in voice_focus_ctl_info()
4139 uinfo->count = chs == 3 ? 2 : 1; in voice_focus_ctl_info()
4140 uinfo->value.integer.min = 20; in voice_focus_ctl_info()
4141 uinfo->value.integer.max = 180; in voice_focus_ctl_info()
4142 uinfo->value.integer.step = 1; in voice_focus_ctl_info()
4151 struct ca0132_spec *spec = codec->spec; in voice_focus_ctl_put()
4153 long *valp = ucontrol->value.integer.value; in voice_focus_ctl_put()
4156 idx = nid - TUNING_CTL_START_NID; in voice_focus_ctl_put()
4158 if (spec->cur_ctl_vals[idx] == *valp) in voice_focus_ctl_put()
4161 spec->cur_ctl_vals[idx] = *valp; in voice_focus_ctl_put()
4163 idx = *valp - 20; in voice_focus_ctl_put()
4173 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in mic_svm_ctl_info()
4174 uinfo->count = chs == 3 ? 2 : 1; in mic_svm_ctl_info()
4175 uinfo->value.integer.min = 0; in mic_svm_ctl_info()
4176 uinfo->value.integer.max = 100; in mic_svm_ctl_info()
4177 uinfo->value.integer.step = 1; in mic_svm_ctl_info()
4186 struct ca0132_spec *spec = codec->spec; in mic_svm_ctl_put()
4188 long *valp = ucontrol->value.integer.value; in mic_svm_ctl_put()
4191 idx = nid - TUNING_CTL_START_NID; in mic_svm_ctl_put()
4193 if (spec->cur_ctl_vals[idx] == *valp) in mic_svm_ctl_put()
4196 spec->cur_ctl_vals[idx] = *valp; in mic_svm_ctl_put()
4208 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in equalizer_ctl_info()
4209 uinfo->count = chs == 3 ? 2 : 1; in equalizer_ctl_info()
4210 uinfo->value.integer.min = 0; in equalizer_ctl_info()
4211 uinfo->value.integer.max = 48; in equalizer_ctl_info()
4212 uinfo->value.integer.step = 1; in equalizer_ctl_info()
4221 struct ca0132_spec *spec = codec->spec; in equalizer_ctl_put()
4223 long *valp = ucontrol->value.integer.value; in equalizer_ctl_put()
4226 idx = nid - TUNING_CTL_START_NID; in equalizer_ctl_put()
4228 if (spec->cur_ctl_vals[idx] == *valp) in equalizer_ctl_put()
4231 spec->cur_ctl_vals[idx] = *valp; in equalizer_ctl_put()
4240 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(eq_db_scale, -2400, 100, 0);
4302 struct ca0132_spec *spec = codec->spec; in ca0132_init_tuning_defaults()
4305 /* Wedge Angle defaults to 30. 10 below is 30 - 20. 20 is min. */ in ca0132_init_tuning_defaults()
4306 spec->cur_ctl_vals[WEDGE_ANGLE - TUNING_CTL_START_NID] = 10; in ca0132_init_tuning_defaults()
4308 spec->cur_ctl_vals[SVM_LEVEL - TUNING_CTL_START_NID] = 74; in ca0132_init_tuning_defaults()
4312 spec->cur_ctl_vals[i] = 24; in ca0132_init_tuning_defaults()
4319 * If jack inserted, headphone will be selected, else built-in speakers
4324 struct ca0132_spec *spec = codec->spec; in ca0132_select_out()
4335 auto_jack = spec->vnode_lswitch[VNID_HP_ASEL - VNODE_START_NID]; in ca0132_select_out()
4338 jack_present = snd_hda_jack_detect(codec, spec->unsol_tag_hp); in ca0132_select_out()
4341 spec->vnode_lswitch[VNID_HP_SEL - VNODE_START_NID]; in ca0132_select_out()
4344 spec->cur_out_type = HEADPHONE_OUT; in ca0132_select_out()
4346 spec->cur_out_type = SPEAKER_OUT; in ca0132_select_out()
4348 if (spec->cur_out_type == SPEAKER_OUT) { in ca0132_select_out()
4362 snd_hda_codec_write(codec, spec->out_pins[1], 0, in ca0132_select_out()
4364 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4366 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4368 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4372 pin_ctl = snd_hda_codec_read(codec, spec->out_pins[1], 0, in ca0132_select_out()
4374 snd_hda_set_pin_ctl(codec, spec->out_pins[1], in ca0132_select_out()
4377 pin_ctl = snd_hda_codec_read(codec, spec->out_pins[0], 0, in ca0132_select_out()
4379 snd_hda_set_pin_ctl(codec, spec->out_pins[0], in ca0132_select_out()
4395 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4397 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4399 snd_hda_codec_write(codec, spec->out_pins[1], 0, in ca0132_select_out()
4401 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4405 pin_ctl = snd_hda_codec_read(codec, spec->out_pins[0], 0, in ca0132_select_out()
4407 snd_hda_set_pin_ctl(codec, spec->out_pins[0], in ca0132_select_out()
4410 pin_ctl = snd_hda_codec_read(codec, spec->out_pins[1], 0, in ca0132_select_out()
4412 snd_hda_set_pin_ctl(codec, spec->out_pins[1], in ca0132_select_out()
4428 struct ca0132_spec *spec = codec->spec; in ae5_mmio_select_out()
4438 ca0113_mmio_command_set(codec, out_cmds->group[i], in ae5_mmio_select_out()
4439 out_cmds->target[i], in ae5_mmio_select_out()
4440 out_cmds->vals[spec->cur_out_type][i]); in ae5_mmio_select_out()
4445 struct ca0132_spec *spec = codec->spec; in ca0132_alt_set_full_range_speaker()
4450 /* 2.0/4.0 setup has no LFE channel, so setting full-range does nothing. */ in ca0132_alt_set_full_range_speaker()
4451 if (spec->channel_cfg_val == SPEAKER_CHANNELS_4_0 in ca0132_alt_set_full_range_speaker()
4452 || spec->channel_cfg_val == SPEAKER_CHANNELS_2_0) in ca0132_alt_set_full_range_speaker()
4455 /* Set front L/R full range. Zero for full-range, one for redirection. */ in ca0132_alt_set_full_range_speaker()
4456 tmp = spec->speaker_range_val[0] ? FLOAT_ZERO : FLOAT_ONE; in ca0132_alt_set_full_range_speaker()
4462 /* When setting full-range rear, both rear and center/lfe are set. */ in ca0132_alt_set_full_range_speaker()
4463 tmp = spec->speaker_range_val[1] ? FLOAT_ZERO : FLOAT_ONE; in ca0132_alt_set_full_range_speaker()
4475 * Only the AE series cards set this value when setting full-range, in ca0132_alt_set_full_range_speaker()
4491 struct ca0132_spec *spec = codec->spec; in ca0132_alt_surround_set_bass_redirection()
4495 if (val && spec->channel_cfg_val != SPEAKER_CHANNELS_4_0 && in ca0132_alt_surround_set_bass_redirection()
4496 spec->channel_cfg_val != SPEAKER_CHANNELS_2_0) in ca0132_alt_surround_set_bass_redirection()
4507 tmp = float_xbass_xover_lookup[spec->xbass_xover_freq]; in ca0132_alt_surround_set_bass_redirection()
4524 struct ca0132_spec *spec = codec->spec; in ca0132_alt_select_out_get_quirk_data()
4541 struct ca0132_spec *spec = codec->spec; in ca0132_alt_select_out_quirk_set()
4549 out_info = &quirk_data->out_set_info[spec->cur_out_type]; in ca0132_alt_select_out_quirk_set()
4550 if (quirk_data->is_ae_series) in ca0132_alt_select_out_quirk_set()
4553 if (out_info->has_hda_gpio) { in ca0132_alt_select_out_quirk_set()
4554 gpio_data = snd_hda_codec_read(codec, codec->core.afg, 0, in ca0132_alt_select_out_quirk_set()
4557 if (out_info->hda_gpio_set) in ca0132_alt_select_out_quirk_set()
4558 gpio_data |= (1 << out_info->hda_gpio_pin); in ca0132_alt_select_out_quirk_set()
4560 gpio_data &= ~(1 << out_info->hda_gpio_pin); in ca0132_alt_select_out_quirk_set()
4562 snd_hda_codec_write(codec, codec->core.afg, 0, in ca0132_alt_select_out_quirk_set()
4566 if (out_info->mmio_gpio_count) { in ca0132_alt_select_out_quirk_set()
4567 for (i = 0; i < out_info->mmio_gpio_count; i++) { in ca0132_alt_select_out_quirk_set()
4568 ca0113_mmio_gpio_set(codec, out_info->mmio_gpio_pin[i], in ca0132_alt_select_out_quirk_set()
4569 out_info->mmio_gpio_set[i]); in ca0132_alt_select_out_quirk_set()
4573 if (out_info->scp_cmds_count) { in ca0132_alt_select_out_quirk_set()
4574 for (i = 0; i < out_info->scp_cmds_count; i++) { in ca0132_alt_select_out_quirk_set()
4576 out_info->scp_cmd_mid[i], in ca0132_alt_select_out_quirk_set()
4577 out_info->scp_cmd_req[i], in ca0132_alt_select_out_quirk_set()
4578 out_info->scp_cmd_val[i]); in ca0132_alt_select_out_quirk_set()
4584 chipio_set_control_param(codec, 0x0d, out_info->dac2port); in ca0132_alt_select_out_quirk_set()
4586 if (out_info->has_chipio_write) { in ca0132_alt_select_out_quirk_set()
4587 chipio_write(codec, out_info->chipio_write_addr, in ca0132_alt_select_out_quirk_set()
4588 out_info->chipio_write_data); in ca0132_alt_select_out_quirk_set()
4591 if (quirk_data->has_headphone_gain) { in ca0132_alt_select_out_quirk_set()
4592 if (spec->cur_out_type != HEADPHONE_OUT) { in ca0132_alt_select_out_quirk_set()
4593 if (quirk_data->is_ae_series) in ca0132_alt_select_out_quirk_set()
4598 if (quirk_data->is_ae_series) in ca0132_alt_select_out_quirk_set()
4600 spec->ae5_headphone_gain_val); in ca0132_alt_select_out_quirk_set()
4603 spec->zxr_gain_set); in ca0132_alt_select_out_quirk_set()
4629 * It also adds the ability to auto-detect the front headphone port.
4633 struct ca0132_spec *spec = codec->spec; in ca0132_alt_select_out()
4639 hda_nid_t headphone_nid = spec->out_pins[1]; in ca0132_alt_select_out()
4645 auto_jack = spec->vnode_lswitch[VNID_HP_ASEL - VNODE_START_NID]; in ca0132_alt_select_out()
4653 jack_present = snd_hda_jack_detect(codec, spec->unsol_tag_hp) || in ca0132_alt_select_out()
4654 snd_hda_jack_detect(codec, spec->unsol_tag_front_hp); in ca0132_alt_select_out()
4657 spec->cur_out_type = HEADPHONE_OUT; in ca0132_alt_select_out()
4659 spec->cur_out_type = SPEAKER_OUT; in ca0132_alt_select_out()
4661 spec->cur_out_type = spec->out_enum_val; in ca0132_alt_select_out()
4663 outfx_set = spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]; in ca0132_alt_select_out()
4673 switch (spec->cur_out_type) { in ca0132_alt_select_out()
4678 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_alt_select_out()
4682 ca0132_set_out_node_pincfg(codec, spec->out_pins[1], 0, 0); in ca0132_alt_select_out()
4683 /* Set front L-R to output. */ in ca0132_alt_select_out()
4684 ca0132_set_out_node_pincfg(codec, spec->out_pins[0], 1, 0); in ca0132_alt_select_out()
4686 ca0132_set_out_node_pincfg(codec, spec->out_pins[2], 1, 0); in ca0132_alt_select_out()
4688 ca0132_set_out_node_pincfg(codec, spec->out_pins[3], 1, 0); in ca0132_alt_select_out()
4695 if (!outfx_set && spec->channel_cfg_val == SPEAKER_CHANNELS_2_0) in ca0132_alt_select_out()
4698 tmp = speaker_channel_cfgs[spec->channel_cfg_val].val; in ca0132_alt_select_out()
4707 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_alt_select_out()
4711 ca0132_set_out_node_pincfg(codec, spec->out_pins[0], 0, 0); in ca0132_alt_select_out()
4712 ca0132_set_out_node_pincfg(codec, spec->out_pins[2], 0, 0); in ca0132_alt_select_out()
4713 ca0132_set_out_node_pincfg(codec, spec->out_pins[3], 0, 0); in ca0132_alt_select_out()
4716 if (snd_hda_jack_detect(codec, spec->unsol_tag_front_hp)) in ca0132_alt_select_out()
4717 headphone_nid = spec->out_pins[2]; in ca0132_alt_select_out()
4718 else if (snd_hda_jack_detect(codec, spec->unsol_tag_hp)) in ca0132_alt_select_out()
4719 headphone_nid = spec->out_pins[1]; in ca0132_alt_select_out()
4733 * If output effects are enabled, set the X-Bass effect value again to in ca0132_alt_select_out()
4739 spec->effects_switch[X_BASS - EFFECT_START_NID]); in ca0132_alt_select_out()
4755 if (spec->cur_out_type == SPEAKER_OUT) in ca0132_alt_select_out()
4757 spec->bass_redirection_val); in ca0132_alt_select_out()
4767 if (spec->cur_out_type == SPEAKER_OUT) { in ca0132_alt_select_out()
4786 ca0132_alt_select_out(spec->codec); in ca0132_unsol_hp_delayed()
4788 ca0132_select_out(spec->codec); in ca0132_unsol_hp_delayed()
4790 jack = snd_hda_jack_tbl_get(spec->codec, spec->unsol_tag_hp); in ca0132_unsol_hp_delayed()
4792 jack->block_report = 0; in ca0132_unsol_hp_delayed()
4793 snd_hda_jack_report_sync(spec->codec); in ca0132_unsol_hp_delayed()
4809 struct ca0132_spec *spec = codec->spec; in ca0132_set_vipsource()
4812 if (spec->dsp_state != DSP_DOWNLOADED) in ca0132_set_vipsource()
4816 if (!spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID] || in ca0132_set_vipsource()
4821 if (spec->cur_mic_type == DIGITAL_MIC) in ca0132_set_vipsource()
4831 if (spec->cur_mic_type == DIGITAL_MIC) in ca0132_set_vipsource()
4847 struct ca0132_spec *spec = codec->spec; in ca0132_alt_set_vipsource()
4850 if (spec->dsp_state != DSP_DOWNLOADED) in ca0132_alt_set_vipsource()
4859 if (!spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID] || in ca0132_alt_set_vipsource()
4860 (val == 0) || spec->in_enum_val == REAR_LINE_IN) { in ca0132_alt_set_vipsource()
4873 if (spec->in_enum_val == REAR_LINE_IN) in ca0132_alt_set_vipsource()
4891 if (spec->effects_switch[VOICE_FOCUS - EFFECT_START_NID]) in ca0132_alt_set_vipsource()
4913 * If jack inserted, ext.mic will be selected, else built-in mic
4918 struct ca0132_spec *spec = codec->spec; in ca0132_select_mic()
4926 auto_jack = spec->vnode_lswitch[VNID_AMIC1_ASEL - VNODE_START_NID]; in ca0132_select_mic()
4929 jack_present = snd_hda_jack_detect(codec, spec->unsol_tag_amic1); in ca0132_select_mic()
4932 spec->vnode_lswitch[VNID_AMIC1_SEL - VNODE_START_NID]; in ca0132_select_mic()
4935 spec->cur_mic_type = LINE_MIC_IN; in ca0132_select_mic()
4937 spec->cur_mic_type = DIGITAL_MIC; in ca0132_select_mic()
4939 if (spec->cur_mic_type == DIGITAL_MIC) { in ca0132_select_mic()
4946 spec->effects_switch in ca0132_select_mic()
4947 [VOICE_FOCUS - EFFECT_START_NID]); in ca0132_select_mic()
4952 ca0132_mic_boost_set(codec, spec->cur_mic_boost); in ca0132_select_mic()
4965 * The front mic has no jack-detection, so the only way to switch to it
4970 struct ca0132_spec *spec = codec->spec; in ca0132_alt_select_in()
4980 spec->cur_mic_type = spec->in_enum_val; in ca0132_alt_select_in()
4982 switch (spec->cur_mic_type) { in ca0132_alt_select_in()
5040 ca0132_alt_mic_boost_set(codec, spec->mic_boost_enum_val); in ca0132_alt_select_in()
5133 ca0132_alt_mic_boost_set(codec, spec->mic_boost_enum_val); in ca0132_alt_select_in()
5149 struct ca0132_spec *spec = codec->spec; in ca0132_is_vnode_effective()
5154 nid = spec->shared_out_nid; in ca0132_is_vnode_effective()
5157 nid = spec->shared_mic_nid; in ca0132_is_vnode_effective()
5175 struct ca0132_spec *spec = codec->spec; in ca0132_voicefx_set()
5180 tmp = spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID] ? in ca0132_voicefx_set()
5197 struct ca0132_spec *spec = codec->spec; in ca0132_effects_set()
5201 int idx = nid - EFFECT_START_NID; in ca0132_effects_set()
5209 if (!spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]) in ca0132_effects_set()
5211 if (spec->cur_out_type == SPEAKER_OUT && nid == X_BASS) { in ca0132_effects_set()
5212 channel_cfg = spec->channel_cfg_val; in ca0132_effects_set()
5222 if (!spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID]) in ca0132_effects_set()
5225 /* Voice Focus applies to 2-ch Mic, Digital Mic */ in ca0132_effects_set()
5226 if ((nid == VOICE_FOCUS) && (spec->cur_mic_type != DIGITAL_MIC)) in ca0132_effects_set()
5231 && (spec->cur_mic_type != REAR_LINE_IN)) { in ca0132_effects_set()
5232 if (spec->effects_switch[CRYSTAL_VOICE - in ca0132_effects_set()
5235 if (spec->effects_switch[VOICE_FOCUS - in ca0132_effects_set()
5250 && (spec->cur_mic_type != REAR_LINE_IN)) { in ca0132_effects_set()
5251 if (spec->effects_switch[CRYSTAL_VOICE - in ca0132_effects_set()
5253 if (spec->effects_switch[NOISE_REDUCTION - in ca0132_effects_set()
5266 spec->in_enum_val == REAR_LINE_IN) in ca0132_effects_set()
5288 struct ca0132_spec *spec = codec->spec; in ca0132_pe_switch_set()
5293 spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]); in ca0132_pe_switch_set()
5298 i = OUT_EFFECT_START_NID - EFFECT_START_NID; in ca0132_pe_switch_set()
5302 ret |= ca0132_effects_set(codec, nid, spec->effects_switch[i]); in ca0132_pe_switch_set()
5310 struct ca0132_spec *spec = codec->spec; in stop_mic1()
5311 unsigned int oldval = snd_hda_codec_read(codec, spec->adcs[0], 0, in stop_mic1()
5314 snd_hda_codec_write(codec, spec->adcs[0], 0, in stop_mic1()
5323 struct ca0132_spec *spec = codec->spec; in resume_mic1()
5326 snd_hda_codec_write(codec, spec->adcs[0], 0, in resume_mic1()
5336 struct ca0132_spec *spec = codec->spec; in ca0132_cvoice_switch_set()
5342 spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID]); in ca0132_cvoice_switch_set()
5344 i = IN_EFFECT_START_NID - EFFECT_START_NID; in ca0132_cvoice_switch_set()
5348 ret |= ca0132_effects_set(codec, nid, spec->effects_switch[i]); in ca0132_cvoice_switch_set()
5351 ret |= ca0132_voicefx_set(codec, (spec->voicefx_val ? 1 : 0)); in ca0132_cvoice_switch_set()
5365 struct ca0132_spec *spec = codec->spec; in ca0132_mic_boost_set()
5369 ret = snd_hda_codec_amp_update(codec, spec->input_pins[0], 0, in ca0132_mic_boost_set()
5372 ret = snd_hda_codec_amp_update(codec, spec->input_pins[0], 0, in ca0132_mic_boost_set()
5380 struct ca0132_spec *spec = codec->spec; in ca0132_alt_mic_boost_set()
5383 ret = snd_hda_codec_amp_update(codec, spec->input_pins[0], 0, in ca0132_alt_mic_boost_set()
5417 struct ca0132_spec *spec = codec->spec; in ca0132_vnode_switch_set()
5422 spec->vnode_lswitch[VNID_HP_ASEL - VNODE_START_NID]; in ca0132_vnode_switch_set()
5434 spec->vnode_lswitch[VNID_AMIC1_ASEL - VNODE_START_NID]; in ca0132_vnode_switch_set()
5460 mutex_lock(&codec->control_mutex); in ca0132_vnode_switch_set()
5461 pval = kcontrol->private_value; in ca0132_vnode_switch_set()
5462 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(shared_nid, ch, in ca0132_vnode_switch_set()
5465 kcontrol->private_value = pval; in ca0132_vnode_switch_set()
5466 mutex_unlock(&codec->control_mutex); in ca0132_vnode_switch_set()
5515 &(lookup[idx - 1]), sizeof(unsigned int)); in ca0132_alt_slider_ctl_set()
5536 struct ca0132_spec *spec = codec->spec; in ca0132_alt_xbass_xover_slider_ctl_get()
5537 long *valp = ucontrol->value.integer.value; in ca0132_alt_xbass_xover_slider_ctl_get()
5541 *valp = spec->bass_redirect_xover_freq; in ca0132_alt_xbass_xover_slider_ctl_get()
5543 *valp = spec->xbass_xover_freq; in ca0132_alt_xbass_xover_slider_ctl_get()
5552 struct ca0132_spec *spec = codec->spec; in ca0132_alt_slider_ctl_get()
5554 long *valp = ucontrol->value.integer.value; in ca0132_alt_slider_ctl_get()
5555 int idx = nid - OUT_EFFECT_START_NID; in ca0132_alt_slider_ctl_get()
5557 *valp = spec->fx_ctl_val[idx]; in ca0132_alt_slider_ctl_get()
5562 * The X-bass crossover starts at 10hz, so the min is 1. The
5568 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in ca0132_alt_xbass_xover_slider_info()
5569 uinfo->count = 1; in ca0132_alt_xbass_xover_slider_info()
5570 uinfo->value.integer.min = 1; in ca0132_alt_xbass_xover_slider_info()
5571 uinfo->value.integer.max = 100; in ca0132_alt_xbass_xover_slider_info()
5572 uinfo->value.integer.step = 1; in ca0132_alt_xbass_xover_slider_info()
5582 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in ca0132_alt_effect_slider_info()
5583 uinfo->count = chs == 3 ? 2 : 1; in ca0132_alt_effect_slider_info()
5584 uinfo->value.integer.min = 0; in ca0132_alt_effect_slider_info()
5585 uinfo->value.integer.max = 100; in ca0132_alt_effect_slider_info()
5586 uinfo->value.integer.step = 1; in ca0132_alt_effect_slider_info()
5595 struct ca0132_spec *spec = codec->spec; in ca0132_alt_xbass_xover_slider_put()
5597 long *valp = ucontrol->value.integer.value; in ca0132_alt_xbass_xover_slider_put()
5602 cur_val = &spec->bass_redirect_xover_freq; in ca0132_alt_xbass_xover_slider_put()
5604 cur_val = &spec->xbass_xover_freq; in ca0132_alt_xbass_xover_slider_put()
5625 struct ca0132_spec *spec = codec->spec; in ca0132_alt_effect_slider_put()
5627 long *valp = ucontrol->value.integer.value; in ca0132_alt_effect_slider_put()
5630 idx = nid - EFFECT_START_NID; in ca0132_alt_effect_slider_put()
5632 if (spec->fx_ctl_val[idx] == *valp) in ca0132_alt_effect_slider_put()
5635 spec->fx_ctl_val[idx] = *valp; in ca0132_alt_effect_slider_put()
5647 * traditional 0-100 in alsamixer that goes in big steps. I like enum better.
5658 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_mic_boost_info()
5659 uinfo->count = 1; in ca0132_alt_mic_boost_info()
5660 uinfo->value.enumerated.items = MIC_BOOST_NUM_OF_STEPS; in ca0132_alt_mic_boost_info()
5661 if (uinfo->value.enumerated.item >= MIC_BOOST_NUM_OF_STEPS) in ca0132_alt_mic_boost_info()
5662 uinfo->value.enumerated.item = MIC_BOOST_NUM_OF_STEPS - 1; in ca0132_alt_mic_boost_info()
5663 sprintf(namestr, "%d %s", (uinfo->value.enumerated.item * 10), sfx); in ca0132_alt_mic_boost_info()
5664 strcpy(uinfo->value.enumerated.name, namestr); in ca0132_alt_mic_boost_info()
5672 struct ca0132_spec *spec = codec->spec; in ca0132_alt_mic_boost_get()
5674 ucontrol->value.enumerated.item[0] = spec->mic_boost_enum_val; in ca0132_alt_mic_boost_get()
5682 struct ca0132_spec *spec = codec->spec; in ca0132_alt_mic_boost_put()
5683 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_mic_boost_put()
5692 spec->mic_boost_enum_val = sel; in ca0132_alt_mic_boost_put()
5694 if (spec->in_enum_val != REAR_LINE_IN) in ca0132_alt_mic_boost_put()
5695 ca0132_alt_mic_boost_set(codec, spec->mic_boost_enum_val); in ca0132_alt_mic_boost_put()
5701 * Sound BlasterX AE-5 Headphone Gain Controls.
5710 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ae5_headphone_gain_info()
5711 uinfo->count = 1; in ae5_headphone_gain_info()
5712 uinfo->value.enumerated.items = AE5_HEADPHONE_GAIN_MAX; in ae5_headphone_gain_info()
5713 if (uinfo->value.enumerated.item >= AE5_HEADPHONE_GAIN_MAX) in ae5_headphone_gain_info()
5714 uinfo->value.enumerated.item = AE5_HEADPHONE_GAIN_MAX - 1; in ae5_headphone_gain_info()
5716 ae5_headphone_gain_presets[uinfo->value.enumerated.item].name, in ae5_headphone_gain_info()
5718 strcpy(uinfo->value.enumerated.name, namestr); in ae5_headphone_gain_info()
5726 struct ca0132_spec *spec = codec->spec; in ae5_headphone_gain_get()
5728 ucontrol->value.enumerated.item[0] = spec->ae5_headphone_gain_val; in ae5_headphone_gain_get()
5736 struct ca0132_spec *spec = codec->spec; in ae5_headphone_gain_put()
5737 int sel = ucontrol->value.enumerated.item[0]; in ae5_headphone_gain_put()
5746 spec->ae5_headphone_gain_val = sel; in ae5_headphone_gain_put()
5748 if (spec->out_enum_val == HEADPHONE_OUT) in ae5_headphone_gain_put()
5749 ae5_headphone_gain_set(codec, spec->ae5_headphone_gain_val); in ae5_headphone_gain_put()
5755 * Sound BlasterX AE-5 sound filter enumerated control.
5764 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ae5_sound_filter_info()
5765 uinfo->count = 1; in ae5_sound_filter_info()
5766 uinfo->value.enumerated.items = AE5_SOUND_FILTER_MAX; in ae5_sound_filter_info()
5767 if (uinfo->value.enumerated.item >= AE5_SOUND_FILTER_MAX) in ae5_sound_filter_info()
5768 uinfo->value.enumerated.item = AE5_SOUND_FILTER_MAX - 1; in ae5_sound_filter_info()
5770 ae5_filter_presets[uinfo->value.enumerated.item].name); in ae5_sound_filter_info()
5771 strcpy(uinfo->value.enumerated.name, namestr); in ae5_sound_filter_info()
5779 struct ca0132_spec *spec = codec->spec; in ae5_sound_filter_get()
5781 ucontrol->value.enumerated.item[0] = spec->ae5_filter_val; in ae5_sound_filter_get()
5789 struct ca0132_spec *spec = codec->spec; in ae5_sound_filter_put()
5790 int sel = ucontrol->value.enumerated.item[0]; in ae5_sound_filter_put()
5799 spec->ae5_filter_val = sel; in ae5_sound_filter_put()
5809 * front microphone has no auto-detect, and we need a way to set the rear
5810 * as line-in
5815 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_input_source_info()
5816 uinfo->count = 1; in ca0132_alt_input_source_info()
5817 uinfo->value.enumerated.items = IN_SRC_NUM_OF_INPUTS; in ca0132_alt_input_source_info()
5818 if (uinfo->value.enumerated.item >= IN_SRC_NUM_OF_INPUTS) in ca0132_alt_input_source_info()
5819 uinfo->value.enumerated.item = IN_SRC_NUM_OF_INPUTS - 1; in ca0132_alt_input_source_info()
5820 strcpy(uinfo->value.enumerated.name, in ca0132_alt_input_source_info()
5821 in_src_str[uinfo->value.enumerated.item]); in ca0132_alt_input_source_info()
5829 struct ca0132_spec *spec = codec->spec; in ca0132_alt_input_source_get()
5831 ucontrol->value.enumerated.item[0] = spec->in_enum_val; in ca0132_alt_input_source_get()
5839 struct ca0132_spec *spec = codec->spec; in ca0132_alt_input_source_put()
5840 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_input_source_put()
5844 * The AE-7 has no front microphone, so limit items to 2: rear mic and in ca0132_alt_input_source_put()
5845 * line-in. in ca0132_alt_input_source_put()
5856 spec->in_enum_val = sel; in ca0132_alt_input_source_put()
5867 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_output_select_get_info()
5868 uinfo->count = 1; in ca0132_alt_output_select_get_info()
5869 uinfo->value.enumerated.items = NUM_OF_OUTPUTS; in ca0132_alt_output_select_get_info()
5870 if (uinfo->value.enumerated.item >= NUM_OF_OUTPUTS) in ca0132_alt_output_select_get_info()
5871 uinfo->value.enumerated.item = NUM_OF_OUTPUTS - 1; in ca0132_alt_output_select_get_info()
5872 strcpy(uinfo->value.enumerated.name, in ca0132_alt_output_select_get_info()
5873 out_type_str[uinfo->value.enumerated.item]); in ca0132_alt_output_select_get_info()
5881 struct ca0132_spec *spec = codec->spec; in ca0132_alt_output_select_get()
5883 ucontrol->value.enumerated.item[0] = spec->out_enum_val; in ca0132_alt_output_select_get()
5891 struct ca0132_spec *spec = codec->spec; in ca0132_alt_output_select_put()
5892 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_output_select_put()
5902 spec->out_enum_val = sel; in ca0132_alt_output_select_put()
5904 auto_jack = spec->vnode_lswitch[VNID_HP_ASEL - VNODE_START_NID]; in ca0132_alt_output_select_put()
5918 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_speaker_channel_cfg_get_info()
5919 uinfo->count = 1; in ca0132_alt_speaker_channel_cfg_get_info()
5920 uinfo->value.enumerated.items = items; in ca0132_alt_speaker_channel_cfg_get_info()
5921 if (uinfo->value.enumerated.item >= items) in ca0132_alt_speaker_channel_cfg_get_info()
5922 uinfo->value.enumerated.item = items - 1; in ca0132_alt_speaker_channel_cfg_get_info()
5923 strcpy(uinfo->value.enumerated.name, in ca0132_alt_speaker_channel_cfg_get_info()
5924 speaker_channel_cfgs[uinfo->value.enumerated.item].name); in ca0132_alt_speaker_channel_cfg_get_info()
5932 struct ca0132_spec *spec = codec->spec; in ca0132_alt_speaker_channel_cfg_get()
5934 ucontrol->value.enumerated.item[0] = spec->channel_cfg_val; in ca0132_alt_speaker_channel_cfg_get()
5942 struct ca0132_spec *spec = codec->spec; in ca0132_alt_speaker_channel_cfg_put()
5943 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_speaker_channel_cfg_put()
5952 spec->channel_cfg_val = sel; in ca0132_alt_speaker_channel_cfg_put()
5954 if (spec->out_enum_val == SPEAKER_OUT) in ca0132_alt_speaker_channel_cfg_put()
5971 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_svm_setting_info()
5972 uinfo->count = 1; in ca0132_alt_svm_setting_info()
5973 uinfo->value.enumerated.items = NUM_OF_SVM_SETTINGS; in ca0132_alt_svm_setting_info()
5974 if (uinfo->value.enumerated.item >= NUM_OF_SVM_SETTINGS) in ca0132_alt_svm_setting_info()
5975 uinfo->value.enumerated.item = NUM_OF_SVM_SETTINGS - 1; in ca0132_alt_svm_setting_info()
5976 strcpy(uinfo->value.enumerated.name, in ca0132_alt_svm_setting_info()
5977 out_svm_set_enum_str[uinfo->value.enumerated.item]); in ca0132_alt_svm_setting_info()
5985 struct ca0132_spec *spec = codec->spec; in ca0132_alt_svm_setting_get()
5987 ucontrol->value.enumerated.item[0] = spec->smart_volume_setting; in ca0132_alt_svm_setting_get()
5995 struct ca0132_spec *spec = codec->spec; in ca0132_alt_svm_setting_put()
5996 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_svm_setting_put()
5998 unsigned int idx = SMART_VOLUME - EFFECT_START_NID; in ca0132_alt_svm_setting_put()
6007 spec->smart_volume_setting = sel; in ca0132_alt_svm_setting_put()
6035 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_eq_preset_info()
6036 uinfo->count = 1; in ca0132_alt_eq_preset_info()
6037 uinfo->value.enumerated.items = items; in ca0132_alt_eq_preset_info()
6038 if (uinfo->value.enumerated.item >= items) in ca0132_alt_eq_preset_info()
6039 uinfo->value.enumerated.item = items - 1; in ca0132_alt_eq_preset_info()
6040 strcpy(uinfo->value.enumerated.name, in ca0132_alt_eq_preset_info()
6041 ca0132_alt_eq_presets[uinfo->value.enumerated.item].name); in ca0132_alt_eq_preset_info()
6049 struct ca0132_spec *spec = codec->spec; in ca0132_alt_eq_preset_get()
6051 ucontrol->value.enumerated.item[0] = spec->eq_preset_val; in ca0132_alt_eq_preset_get()
6059 struct ca0132_spec *spec = codec->spec; in ca0132_alt_eq_preset_put()
6061 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_eq_preset_put()
6082 spec->eq_preset_val = sel; in ca0132_alt_eq_preset_put()
6092 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_voicefx_info()
6093 uinfo->count = 1; in ca0132_voicefx_info()
6094 uinfo->value.enumerated.items = items; in ca0132_voicefx_info()
6095 if (uinfo->value.enumerated.item >= items) in ca0132_voicefx_info()
6096 uinfo->value.enumerated.item = items - 1; in ca0132_voicefx_info()
6097 strcpy(uinfo->value.enumerated.name, in ca0132_voicefx_info()
6098 ca0132_voicefx_presets[uinfo->value.enumerated.item].name); in ca0132_voicefx_info()
6106 struct ca0132_spec *spec = codec->spec; in ca0132_voicefx_get()
6108 ucontrol->value.enumerated.item[0] = spec->voicefx_val; in ca0132_voicefx_get()
6116 struct ca0132_spec *spec = codec->spec; in ca0132_voicefx_put()
6118 int sel = ucontrol->value.enumerated.item[0]; in ca0132_voicefx_put()
6139 spec->voicefx_val = sel; in ca0132_voicefx_put()
6151 struct ca0132_spec *spec = codec->spec; in ca0132_switch_get()
6154 long *valp = ucontrol->value.integer.value; in ca0132_switch_get()
6159 *valp = spec->vnode_lswitch[nid - VNODE_START_NID]; in ca0132_switch_get()
6163 *valp = spec->vnode_rswitch[nid - VNODE_START_NID]; in ca0132_switch_get()
6171 *valp = spec->effects_switch[nid - EFFECT_START_NID]; in ca0132_switch_get()
6176 if (nid == spec->input_pins[0]) { in ca0132_switch_get()
6177 *valp = spec->cur_mic_boost; in ca0132_switch_get()
6182 *valp = spec->zxr_gain_set; in ca0132_switch_get()
6187 *valp = spec->speaker_range_val[nid - SPEAKER_FULL_RANGE_FRONT]; in ca0132_switch_get()
6192 *valp = spec->bass_redirection_val; in ca0132_switch_get()
6203 struct ca0132_spec *spec = codec->spec; in ca0132_switch_put()
6206 long *valp = ucontrol->value.integer.value; in ca0132_switch_put()
6216 spec->vnode_lswitch[nid - VNODE_START_NID] = *valp; in ca0132_switch_put()
6220 spec->vnode_rswitch[nid - VNODE_START_NID] = *valp; in ca0132_switch_put()
6229 spec->effects_switch[nid - EFFECT_START_NID] = *valp; in ca0132_switch_put()
6236 spec->effects_switch[nid - EFFECT_START_NID] = *valp; in ca0132_switch_put()
6244 spec->effects_switch[nid - EFFECT_START_NID] = *valp; in ca0132_switch_put()
6250 if (nid == spec->input_pins[0]) { in ca0132_switch_put()
6251 spec->cur_mic_boost = *valp; in ca0132_switch_put()
6253 if (spec->in_enum_val != REAR_LINE_IN) in ca0132_switch_put()
6257 if (spec->cur_mic_type != DIGITAL_MIC) in ca0132_switch_put()
6265 spec->zxr_gain_set = *valp; in ca0132_switch_put()
6266 if (spec->cur_out_type == HEADPHONE_OUT) in ca0132_switch_put()
6275 spec->speaker_range_val[nid - SPEAKER_FULL_RANGE_FRONT] = *valp; in ca0132_switch_put()
6276 if (spec->cur_out_type == SPEAKER_OUT) in ca0132_switch_put()
6283 spec->bass_redirection_val = *valp; in ca0132_switch_put()
6284 if (spec->cur_out_type == SPEAKER_OUT) in ca0132_switch_put()
6305 struct ca0132_spec *spec = codec->spec; in ca0132_alt_dsp_volume_put()
6314 lookup_val = spec->vnode_lvol[nid - VNODE_START_NID]; in ca0132_alt_dsp_volume_put()
6321 lookup_val = spec->vnode_rvol[nid - VNODE_START_NID]; in ca0132_alt_dsp_volume_put()
6337 struct ca0132_spec *spec = codec->spec; in ca0132_volume_info()
6347 nid = spec->shared_out_nid; in ca0132_volume_info()
6348 mutex_lock(&codec->control_mutex); in ca0132_volume_info()
6349 pval = kcontrol->private_value; in ca0132_volume_info()
6350 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(nid, ch, 0, dir); in ca0132_volume_info()
6352 kcontrol->private_value = pval; in ca0132_volume_info()
6353 mutex_unlock(&codec->control_mutex); in ca0132_volume_info()
6357 nid = spec->shared_mic_nid; in ca0132_volume_info()
6358 mutex_lock(&codec->control_mutex); in ca0132_volume_info()
6359 pval = kcontrol->private_value; in ca0132_volume_info()
6360 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(nid, ch, 0, dir); in ca0132_volume_info()
6362 kcontrol->private_value = pval; in ca0132_volume_info()
6363 mutex_unlock(&codec->control_mutex); in ca0132_volume_info()
6375 struct ca0132_spec *spec = codec->spec; in ca0132_volume_get()
6378 long *valp = ucontrol->value.integer.value; in ca0132_volume_get()
6382 *valp = spec->vnode_lvol[nid - VNODE_START_NID]; in ca0132_volume_get()
6386 *valp = spec->vnode_rvol[nid - VNODE_START_NID]; in ca0132_volume_get()
6396 struct ca0132_spec *spec = codec->spec; in ca0132_volume_put()
6399 long *valp = ucontrol->value.integer.value; in ca0132_volume_put()
6406 spec->vnode_lvol[nid - VNODE_START_NID] = *valp; in ca0132_volume_put()
6410 spec->vnode_rvol[nid - VNODE_START_NID] = *valp; in ca0132_volume_put()
6421 mutex_lock(&codec->control_mutex); in ca0132_volume_put()
6422 pval = kcontrol->private_value; in ca0132_volume_put()
6423 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(shared_nid, ch, in ca0132_volume_put()
6426 kcontrol->private_value = pval; in ca0132_volume_put()
6427 mutex_unlock(&codec->control_mutex); in ca0132_volume_put()
6443 struct ca0132_spec *spec = codec->spec; in ca0132_alt_volume_put()
6446 long *valp = ucontrol->value.integer.value; in ca0132_alt_volume_put()
6461 spec->vnode_lvol[vnid - VNODE_START_NID] = *valp; in ca0132_alt_volume_put()
6465 spec->vnode_rvol[vnid - VNODE_START_NID] = *valp; in ca0132_alt_volume_put()
6471 mutex_lock(&codec->control_mutex); in ca0132_alt_volume_put()
6473 mutex_unlock(&codec->control_mutex); in ca0132_alt_volume_put()
6483 struct ca0132_spec *spec = codec->spec; in ca0132_volume_tlv()
6493 nid = spec->shared_out_nid; in ca0132_volume_tlv()
6494 mutex_lock(&codec->control_mutex); in ca0132_volume_tlv()
6495 pval = kcontrol->private_value; in ca0132_volume_tlv()
6496 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(nid, ch, 0, dir); in ca0132_volume_tlv()
6498 kcontrol->private_value = pval; in ca0132_volume_tlv()
6499 mutex_unlock(&codec->control_mutex); in ca0132_volume_tlv()
6503 nid = spec->shared_mic_nid; in ca0132_volume_tlv()
6504 mutex_lock(&codec->control_mutex); in ca0132_volume_tlv()
6505 pval = kcontrol->private_value; in ca0132_volume_tlv()
6506 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(nid, ch, 0, dir); in ca0132_volume_tlv()
6508 kcontrol->private_value = pval; in ca0132_volume_tlv()
6509 mutex_unlock(&codec->control_mutex); in ca0132_volume_tlv()
6556 struct ca0132_spec *spec = codec->spec; in add_fx_switch()
6655 CA0132_CODEC_MUTE_MONO("Full-Range Front Speakers", in ca0132_alt_add_front_full_range_switch()
6665 CA0132_CODEC_MUTE_MONO("Full-Range Rear Speakers", in ca0132_alt_add_rear_full_range_switch()
6674 * channel on speakers that are set as not being full-range. On configurations
6676 * replacement for X-Bass on configurations with an LFE channel.
6707 * because the front microphone has no auto-detect, and Line-in has to be set
6740 * Add headphone gain enumerated control for the AE-5. This switches between
6741 * three modes, low, medium, and high. When non-headphone outputs are selected,
6747 HDA_CODEC_MUTE_MONO("AE-5: Headphone Gain", in ae5_add_headphone_gain_enum()
6757 * Add sound filter enumerated control for the AE-5. This adds three different
6764 HDA_CODEC_MUTE_MONO("AE-5: Sound Filter", in ae5_add_sound_filter_enum()
6815 list_for_each_entry(pcm, &codec->pcm_list_head, list) { in ca0132_alt_add_chmap_ctls()
6817 &pcm->stream[SNDRV_PCM_STREAM_PLAYBACK]; in ca0132_alt_add_chmap_ctls()
6822 if (hinfo->channels_max == 6) { in ca0132_alt_add_chmap_ctls()
6823 err = snd_pcm_add_chmap_ctls(pcm->pcm, in ca0132_alt_add_chmap_ctls()
6825 elem, hinfo->channels_max, 0, &chmap); in ca0132_alt_add_chmap_ctls()
6841 HDA_CODEC_VOLUME("Analog-Mic2 Capture Volume", 0x08, 0, HDA_INPUT),
6842 HDA_CODEC_MUTE("Analog-Mic2 Capture Switch", 0x08, 0, HDA_INPUT),
6845 CA0132_CODEC_MUTE_MONO("Mic1-Boost (30dB) Capture Switch",
6859 * Desktop specific control mixer. Removes auto-detect for mic, and adds
6905 struct ca0132_spec *spec = codec->spec; in ca0132_build_controls()
6910 for (i = 0; i < spec->num_mixers; i++) { in ca0132_build_controls()
6911 err = snd_hda_add_new_ctls(codec, spec->mixers[i]); in ca0132_build_controls()
6917 snd_hda_set_vmaster_tlv(codec, spec->dacs[0], HDA_OUTPUT, in ca0132_build_controls()
6918 spec->tlv); in ca0132_build_controls()
6920 spec->tlv, ca0132_alt_follower_pfxs, in ca0132_build_controls()
6925 true, &spec->vmaster_mute.sw_kctl); in ca0132_build_controls()
6937 if (i == (ECHO_CANCELLATION - IN_EFFECT_START_NID + in ca0132_build_controls()
6972 num_sliders = OUT_EFFECTS_COUNT - 1; in ca0132_build_controls()
6983 "X-Bass Crossover", EFX_DIR_OUT); in ca0132_build_controls()
7031 * header on the card, and aux-in is handled by the DBPro board. in ca0132_build_controls()
7063 err = snd_hda_jack_add_kctls(codec, &spec->autocfg); in ca0132_build_controls()
7067 if (spec->dig_out) { in ca0132_build_controls()
7068 err = snd_hda_create_spdif_out_ctls(codec, spec->dig_out, in ca0132_build_controls()
7069 spec->dig_out); in ca0132_build_controls()
7072 err = snd_hda_create_spdif_share_sw(codec, &spec->multiout); in ca0132_build_controls()
7075 /* spec->multiout.share_spdif = 1; */ in ca0132_build_controls()
7078 if (spec->dig_in) { in ca0132_build_controls()
7079 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in); in ca0132_build_controls()
7092 struct ca0132_spec *spec = codec->spec; in dbpro_build_controls()
7095 if (spec->dig_out) { in dbpro_build_controls()
7096 err = snd_hda_create_spdif_out_ctls(codec, spec->dig_out, in dbpro_build_controls()
7097 spec->dig_out); in dbpro_build_controls()
7102 if (spec->dig_in) { in dbpro_build_controls()
7103 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in); in dbpro_build_controls()
7156 struct ca0132_spec *spec = codec->spec; in ca0132_build_pcms()
7161 return -ENOMEM; in ca0132_build_pcms()
7163 info->own_chmap = true; in ca0132_build_pcms()
7164 info->stream[SNDRV_PCM_STREAM_PLAYBACK].chmap in ca0132_build_pcms()
7167 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = ca0132_pcm_analog_playback; in ca0132_build_pcms()
7168 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->dacs[0]; in ca0132_build_pcms()
7169 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = in ca0132_build_pcms()
7170 spec->multiout.max_channels; in ca0132_build_pcms()
7171 info->stream[SNDRV_PCM_STREAM_CAPTURE] = ca0132_pcm_analog_capture; in ca0132_build_pcms()
7172 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = 1; in ca0132_build_pcms()
7173 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adcs[0]; in ca0132_build_pcms()
7177 info = snd_hda_codec_pcm_new(codec, "CA0132 Analog Mic-In2"); in ca0132_build_pcms()
7179 return -ENOMEM; in ca0132_build_pcms()
7180 info->stream[SNDRV_PCM_STREAM_CAPTURE] = in ca0132_build_pcms()
7182 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = 1; in ca0132_build_pcms()
7183 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adcs[1]; in ca0132_build_pcms()
7188 return -ENOMEM; in ca0132_build_pcms()
7189 info->stream[SNDRV_PCM_STREAM_CAPTURE] = ca0132_pcm_analog_capture; in ca0132_build_pcms()
7190 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = 1; in ca0132_build_pcms()
7191 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adcs[2]; in ca0132_build_pcms()
7193 if (!spec->dig_out && !spec->dig_in) in ca0132_build_pcms()
7198 return -ENOMEM; in ca0132_build_pcms()
7199 info->pcm_type = HDA_PCM_TYPE_SPDIF; in ca0132_build_pcms()
7200 if (spec->dig_out) { in ca0132_build_pcms()
7201 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = in ca0132_build_pcms()
7203 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->dig_out; in ca0132_build_pcms()
7205 if (spec->dig_in) { in ca0132_build_pcms()
7206 info->stream[SNDRV_PCM_STREAM_CAPTURE] = in ca0132_build_pcms()
7208 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in; in ca0132_build_pcms()
7216 struct ca0132_spec *spec = codec->spec; in dbpro_build_pcms()
7221 return -ENOMEM; in dbpro_build_pcms()
7222 info->stream[SNDRV_PCM_STREAM_CAPTURE] = ca0132_pcm_analog_capture; in dbpro_build_pcms()
7223 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = 1; in dbpro_build_pcms()
7224 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adcs[0]; in dbpro_build_pcms()
7227 if (!spec->dig_out && !spec->dig_in) in dbpro_build_pcms()
7232 return -ENOMEM; in dbpro_build_pcms()
7233 info->pcm_type = HDA_PCM_TYPE_SPDIF; in dbpro_build_pcms()
7234 if (spec->dig_out) { in dbpro_build_pcms()
7235 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = in dbpro_build_pcms()
7237 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->dig_out; in dbpro_build_pcms()
7239 if (spec->dig_in) { in dbpro_build_pcms()
7240 info->stream[SNDRV_PCM_STREAM_CAPTURE] = in dbpro_build_pcms()
7242 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in; in dbpro_build_pcms()
7293 * Switch between Digital built-in mic and analog mic.
7297 struct ca0132_spec *spec = codec->spec; in ca0132_set_dmic()
7307 /* set DMic input as 2-ch */ in ca0132_set_dmic()
7311 val = spec->dmic_ctl; in ca0132_set_dmic()
7313 snd_hda_codec_write(codec, spec->input_pins[0], 0, in ca0132_set_dmic()
7316 if (!(spec->dmic_ctl & 0x20)) in ca0132_set_dmic()
7323 val = spec->dmic_ctl; in ca0132_set_dmic()
7326 snd_hda_codec_write(codec, spec->input_pins[0], 0, in ca0132_set_dmic()
7329 if (!(spec->dmic_ctl & 0x20)) in ca0132_set_dmic()
7341 struct ca0132_spec *spec = codec->spec; in ca0132_init_dmic()
7349 * Bit 2-0: MPIO select in ca0132_init_dmic()
7351 * Bit 7-4: reserved in ca0132_init_dmic()
7354 snd_hda_codec_write(codec, spec->input_pins[0], 0, in ca0132_init_dmic()
7358 * Bit 2-0: Data1 MPIO select in ca0132_init_dmic()
7360 * Bit 6-4: Data2 MPIO select in ca0132_init_dmic()
7364 snd_hda_codec_write(codec, spec->input_pins[0], 0, in ca0132_init_dmic()
7367 /* Use Ch-0 and Ch-1. Rate is 48K, mode 1. Disable DMic first. in ca0132_init_dmic()
7368 * Bit 3-0: Channel mask in ca0132_init_dmic()
7379 spec->dmic_ctl = val; in ca0132_init_dmic()
7380 snd_hda_codec_write(codec, spec->input_pins[0], 0, in ca0132_init_dmic()
7389 struct ca0132_spec *spec = codec->spec; in ca0132_init_analog_mic2()
7391 mutex_lock(&spec->chipio_mutex); in ca0132_init_analog_mic2()
7404 mutex_unlock(&spec->chipio_mutex); in ca0132_init_analog_mic2()
7409 struct ca0132_spec *spec = codec->spec; in ca0132_refresh_widget_caps()
7415 for (i = 0; i < spec->multiout.num_dacs; i++) in ca0132_refresh_widget_caps()
7416 refresh_amp_caps(codec, spec->dacs[i], HDA_OUTPUT); in ca0132_refresh_widget_caps()
7418 for (i = 0; i < spec->num_outputs; i++) in ca0132_refresh_widget_caps()
7419 refresh_amp_caps(codec, spec->out_pins[i], HDA_OUTPUT); in ca0132_refresh_widget_caps()
7421 for (i = 0; i < spec->num_inputs; i++) { in ca0132_refresh_widget_caps()
7422 refresh_amp_caps(codec, spec->adcs[i], HDA_INPUT); in ca0132_refresh_widget_caps()
7423 refresh_amp_caps(codec, spec->input_pins[i], HDA_INPUT); in ca0132_refresh_widget_caps()
7431 /* Non-zero values are floating point 0.000198. */
7436 /* Non-zero values are floating point 0.000220. */
7441 /* Non-zero values are floating point 0.000100. */
7450 struct ca0132_spec *spec = codec->spec; in ca0132_alt_init_speaker_tuning()
7495 struct ca0132_spec *spec = codec->spec; in ca0132_alt_create_dummy_stream()
7501 snd_hda_codec_setup_stream(codec, spec->dacs[0], spec->dsp_stream_id, in ca0132_alt_create_dummy_stream()
7504 snd_hda_codec_cleanup_stream(codec, spec->dacs[0]); in ca0132_alt_create_dummy_stream()
7508 * Initialize mic for non-chromebook ca0132 implementations.
7512 struct ca0132_spec *spec = codec->spec; in ca0132_alt_init_analog_mics()
7542 struct ca0132_spec *spec = codec->spec; in sbz_connect_streams()
7544 mutex_lock(&spec->chipio_mutex); in sbz_connect_streams()
7563 mutex_unlock(&spec->chipio_mutex); in sbz_connect_streams()
7574 struct ca0132_spec *spec = codec->spec; in sbz_chipio_startup_data()
7576 mutex_lock(&spec->chipio_mutex); in sbz_chipio_startup_data()
7616 mutex_unlock(&spec->chipio_mutex); in sbz_chipio_startup_data()
7625 struct ca0132_spec *spec = codec->spec; in ca0132_alt_dsp_scp_startup()
7672 struct ca0132_spec *spec = codec->spec; in ca0132_alt_dsp_initial_mic_setup()
7703 struct ca0132_spec *spec = codec->spec; in ae5_post_dsp_register_set()
7711 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7712 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7713 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7714 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7715 writeb(0x00, spec->mem_base + 0x100); in ae5_post_dsp_register_set()
7716 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7717 writeb(0x00, spec->mem_base + 0x100); in ae5_post_dsp_register_set()
7718 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7719 writeb(0x00, spec->mem_base + 0x100); in ae5_post_dsp_register_set()
7720 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7721 writeb(0x00, spec->mem_base + 0x100); in ae5_post_dsp_register_set()
7722 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7734 * AE-5's registry values in Windows. in ae5_post_dsp_param_setup()
7738 * I believe ASI is 'audio serial interface' and that it's used to in ae5_post_dsp_param_setup()
7739 * change colors on the external LED strip connected to the AE-5. in ae5_post_dsp_param_setup()
7784 struct ca0132_spec *spec = codec->spec; in ae5_post_dsp_stream_setup()
7786 mutex_lock(&spec->chipio_mutex); in ae5_post_dsp_stream_setup()
7811 mutex_unlock(&spec->chipio_mutex); in ae5_post_dsp_stream_setup()
7816 struct ca0132_spec *spec = codec->spec; in ae5_post_dsp_startup_data()
7818 mutex_lock(&spec->chipio_mutex); in ae5_post_dsp_startup_data()
7843 mutex_unlock(&spec->chipio_mutex); in ae5_post_dsp_startup_data()
7853 struct ca0132_spec *spec = codec->spec; in ae7_post_dsp_setup_ports()
7856 mutex_lock(&spec->chipio_mutex); in ae7_post_dsp_setup_ports()
7866 /* Addresses are incremented by 4-bytes. */ in ae7_post_dsp_setup_ports()
7884 mutex_unlock(&spec->chipio_mutex); in ae7_post_dsp_setup_ports()
7889 struct ca0132_spec *spec = codec->spec; in ae7_post_dsp_asi_stream_setup()
7891 mutex_lock(&spec->chipio_mutex); in ae7_post_dsp_asi_stream_setup()
7909 mutex_unlock(&spec->chipio_mutex); in ae7_post_dsp_asi_stream_setup()
7932 struct ca0132_spec *spec = codec->spec; in ae7_post_dsp_asi_setup_ports()
7941 mutex_lock(&spec->chipio_mutex); in ae7_post_dsp_asi_setup_ports()
7981 * know what data is being sent. Interestingly, the AE-5 seems to go in ae7_post_dsp_asi_setup_ports()
7983 * step, but the AE-7 does. in ae7_post_dsp_asi_setup_ports()
8007 mutex_unlock(&spec->chipio_mutex); in ae7_post_dsp_asi_setup_ports()
8011 * The Windows driver has commands that seem to setup ASI, which I believe to
8057 struct ca0132_spec *spec = codec->spec; in ca0132_setup_defaults()
8062 if (spec->dsp_state != DSP_DOWNLOADED) in ca0132_setup_defaults()
8102 struct ca0132_spec *spec = codec->spec; in r3d_setup_defaults()
8107 if (spec->dsp_state != DSP_DOWNLOADED) in r3d_setup_defaults()
8152 struct ca0132_spec *spec = codec->spec; in sbz_setup_defaults()
8157 if (spec->dsp_state != DSP_DOWNLOADED) in sbz_setup_defaults()
8207 * Setup default parameters for the Sound BlasterX AE-5 DSP.
8211 struct ca0132_spec *spec = codec->spec; in ae5_setup_defaults()
8216 if (spec->dsp_state != DSP_DOWNLOADED) in ae5_setup_defaults()
8276 * Setup default parameters for the Sound Blaster AE-7 DSP.
8280 struct ca0132_spec *spec = codec->spec; in ae7_setup_defaults()
8285 if (spec->dsp_state != DSP_DOWNLOADED) in ae7_setup_defaults()
8365 struct ca0132_spec *spec = codec->spec; in ca0132_init_flags()
8398 struct ca0132_spec *spec = codec->spec; in ca0132_init_params()
8429 struct ca0132_spec *spec = codec->spec; in ca0132_download_dsp_images()
8442 codec->card->dev) != 0) in ca0132_download_dsp_images()
8449 codec->card->dev) != 0) in ca0132_download_dsp_images()
8464 codec->card->dev) != 0) in ca0132_download_dsp_images()
8468 dsp_os_image = (struct dsp_image_seg *)(fw_entry->data); in ca0132_download_dsp_images()
8484 struct ca0132_spec *spec = codec->spec; in ca0132_download_dsp()
8490 if (spec->dsp_state == DSP_DOWNLOAD_FAILED) in ca0132_download_dsp()
8494 if (spec->dsp_state != DSP_DOWNLOADED) { in ca0132_download_dsp()
8495 spec->dsp_state = DSP_DOWNLOADING; in ca0132_download_dsp()
8498 spec->dsp_state = DSP_DOWNLOAD_FAILED; in ca0132_download_dsp()
8500 spec->dsp_state = DSP_DOWNLOADED; in ca0132_download_dsp()
8504 if (spec->dsp_state == DSP_DOWNLOADED && !ca0132_use_alt_functions(spec)) in ca0132_download_dsp()
8511 struct ca0132_spec *spec = codec->spec; in ca0132_process_dsp_response()
8515 if (spec->wait_scp) { in ca0132_process_dsp_response()
8517 spec->wait_scp = 0; in ca0132_process_dsp_response()
8526 struct ca0132_spec *spec = codec->spec; in hp_callback()
8529 /* Delay enabling the HP amp, to let the mic-detection in hp_callback()
8532 tbl = snd_hda_jack_tbl_get(codec, cb->nid); in hp_callback()
8534 tbl->block_report = 1; in hp_callback()
8535 schedule_delayed_work(&spec->unsol_hp_work, msecs_to_jiffies(500)); in hp_callback()
8540 struct ca0132_spec *spec = codec->spec; in amic_callback()
8550 struct ca0132_spec *spec = codec->spec; in ca0132_init_unsol()
8551 snd_hda_jack_detect_enable_callback(codec, spec->unsol_tag_hp, hp_callback); in ca0132_init_unsol()
8552 snd_hda_jack_detect_enable_callback(codec, spec->unsol_tag_amic1, in ca0132_init_unsol()
8559 spec->unsol_tag_front_hp, hp_callback); in ca0132_init_unsol()
8639 struct ca0132_spec *spec = codec->spec; in ca0132_init_chip()
8644 mutex_init(&spec->chipio_mutex); in ca0132_init_chip()
8646 spec->cur_out_type = SPEAKER_OUT; in ca0132_init_chip()
8648 spec->cur_mic_type = DIGITAL_MIC; in ca0132_init_chip()
8650 spec->cur_mic_type = REAR_MIC; in ca0132_init_chip()
8652 spec->cur_mic_boost = 0; in ca0132_init_chip()
8655 spec->vnode_lvol[i] = 0x5a; in ca0132_init_chip()
8656 spec->vnode_rvol[i] = 0x5a; in ca0132_init_chip()
8657 spec->vnode_lswitch[i] = 0; in ca0132_init_chip()
8658 spec->vnode_rswitch[i] = 0; in ca0132_init_chip()
8667 spec->effects_switch[i] = on ? 1 : 0; in ca0132_init_chip()
8671 * ca0132 codecs. Also sets x-bass crossover frequency to 80hz. in ca0132_init_chip()
8675 spec->speaker_range_val[0] = 1; in ca0132_init_chip()
8676 spec->speaker_range_val[1] = 1; in ca0132_init_chip()
8678 spec->xbass_xover_freq = 8; in ca0132_init_chip()
8680 spec->fx_ctl_val[i] = effect_slider_defaults[i]; in ca0132_init_chip()
8682 spec->bass_redirect_xover_freq = 8; in ca0132_init_chip()
8685 spec->voicefx_val = 0; in ca0132_init_chip()
8686 spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID] = 1; in ca0132_init_chip()
8687 spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID] = 0; in ca0132_init_chip()
8690 * The ZxR doesn't have a front panel header, and it's line-in is on in ca0132_init_chip()
8692 * to make sure that spec->in_enum_val is set properly. in ca0132_init_chip()
8695 spec->in_enum_val = REAR_MIC; in ca0132_init_chip()
8716 struct ca0132_spec *spec = codec->spec; in sbz_region2_exit()
8720 writeb(0x0, spec->mem_base + 0x100); in sbz_region2_exit()
8722 writeb(0xb3, spec->mem_base + 0x304); in sbz_region2_exit()
8787 sbz_gpio_shutdown_commands(codec, 0x07, 0x07, -1); in sbz_exit_chip()
8922 struct ca0132_spec *spec = codec->spec; in sbz_dsp_startup_check()
8929 if (spec->startup_check_entered) in sbz_dsp_startup_check()
8932 spec->startup_check_entered = true; in sbz_dsp_startup_check()
8954 spec->dsp_state = DSP_DOWNLOAD_INIT; in sbz_dsp_startup_check()
8955 codec->patch_ops.init(codec); in sbz_dsp_startup_check()
8965 reload--; in sbz_dsp_startup_check()
9002 struct ca0132_spec *spec = codec->spec; in sbz_pre_dsp_setup()
9004 writel(0x00820680, spec->mem_base + 0x01C); in sbz_pre_dsp_setup()
9005 writel(0x00820680, spec->mem_base + 0x01C); in sbz_pre_dsp_setup()
9094 struct ca0132_spec *spec = codec->spec; in ca0132_mmio_init_sbz()
9100 writel(0x00000000, spec->mem_base + addr[i]); in ca0132_mmio_init_sbz()
9123 writel(tmp[i], spec->mem_base + addr[cur_addr + i]); in ca0132_mmio_init_sbz()
9139 writel(data[i], spec->mem_base + addr[cur_addr + i]); in ca0132_mmio_init_sbz()
9144 struct ca0132_spec *spec = codec->spec; in ca0132_mmio_init_ae5()
9153 writel(0x00000680, spec->mem_base + 0x1c); in ca0132_mmio_init_ae5()
9154 writel(0x00880680, spec->mem_base + 0x1c); in ca0132_mmio_init_ae5()
9159 * AE-7 shares all writes with the AE-5, except that it writes in ca0132_mmio_init_ae5()
9163 writel(0x00800001, spec->mem_base + addr[i]); in ca0132_mmio_init_ae5()
9167 writel(data[i], spec->mem_base + addr[i]); in ca0132_mmio_init_ae5()
9171 writel(0x00880680, spec->mem_base + 0x1c); in ca0132_mmio_init_ae5()
9176 struct ca0132_spec *spec = codec->spec; in ca0132_mmio_init()
9209 struct ca0132_spec *spec = codec->spec; in ae5_register_set()
9240 writeb(tmp[i], spec->mem_base + addr[cur_addr]); in ae5_register_set()
9247 writeb(data[i], spec->mem_base + addr[cur_addr]); in ae5_register_set()
9250 writel(data[i], spec->mem_base + addr[cur_addr]); in ae5_register_set()
9252 writel(0x00800001, spec->mem_base + 0x20c); in ae5_register_set()
9280 struct ca0132_spec *spec = codec->spec; in ca0132_alt_init()
9289 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9290 snd_hda_sequence_write(codec, spec->desktop_init_verbs); in ca0132_alt_init()
9298 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9303 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9304 snd_hda_sequence_write(codec, spec->desktop_init_verbs); in ca0132_alt_init()
9313 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9314 snd_hda_sequence_write(codec, spec->desktop_init_verbs); in ca0132_alt_init()
9323 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9324 snd_hda_sequence_write(codec, spec->desktop_init_verbs); in ca0132_alt_init()
9331 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9332 snd_hda_sequence_write(codec, spec->desktop_init_verbs); in ca0132_alt_init()
9341 struct ca0132_spec *spec = codec->spec; in ca0132_init()
9342 struct auto_pin_cfg *cfg = &spec->autocfg; in ca0132_init()
9356 if (spec->dsp_state == DSP_DOWNLOADED) { in ca0132_init()
9359 spec->dsp_reload = true; in ca0132_init()
9360 spec->dsp_state = DSP_DOWNLOAD_INIT; in ca0132_init()
9368 if (spec->dsp_state != DSP_DOWNLOAD_FAILED) in ca0132_init()
9369 spec->dsp_state = DSP_DOWNLOAD_INIT; in ca0132_init()
9370 spec->curr_chip_addx = INVALID_CHIP_ADDRESS; in ca0132_init()
9384 snd_hda_sequence_write(codec, spec->base_init_verbs); in ca0132_init()
9415 for (i = 0; i < spec->num_outputs; i++) in ca0132_init()
9416 init_output(codec, spec->out_pins[i], spec->dacs[0]); in ca0132_init()
9418 init_output(codec, cfg->dig_out_pins[0], spec->dig_out); in ca0132_init()
9420 for (i = 0; i < spec->num_inputs; i++) in ca0132_init()
9421 init_input(codec, spec->input_pins[i], spec->adcs[i]); in ca0132_init()
9423 init_input(codec, cfg->dig_in_pin, spec->dig_in); in ca0132_init()
9426 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_init()
9436 snd_hda_sequence_write(codec, spec->spec_init_verbs); in ca0132_init()
9451 if (spec->dsp_reload) { in ca0132_init()
9452 spec->dsp_reload = false; in ca0132_init()
9463 struct ca0132_spec *spec = codec->spec; in dbpro_init()
9464 struct auto_pin_cfg *cfg = &spec->autocfg; in dbpro_init()
9467 init_output(codec, cfg->dig_out_pins[0], spec->dig_out); in dbpro_init()
9468 init_input(codec, cfg->dig_in_pin, spec->dig_in); in dbpro_init()
9470 for (i = 0; i < spec->num_inputs; i++) in dbpro_init()
9471 init_input(codec, spec->input_pins[i], spec->adcs[i]); in dbpro_init()
9478 struct ca0132_spec *spec = codec->spec; in ca0132_free()
9480 cancel_delayed_work_sync(&spec->unsol_hp_work); in ca0132_free()
9505 snd_hda_sequence_write(codec, spec->base_exit_verbs); in ca0132_free()
9510 if (spec->mem_base) in ca0132_free()
9511 pci_iounmap(codec->bus->pci, spec->mem_base); in ca0132_free()
9513 kfree(spec->spec_init_verbs); in ca0132_free()
9514 kfree(codec->spec); in ca0132_free()
9519 struct ca0132_spec *spec = codec->spec; in dbpro_free()
9523 kfree(spec->spec_init_verbs); in dbpro_free()
9524 kfree(codec->spec); in dbpro_free()
9529 codec->patch_ops.free(codec); in ca0132_reboot_notify()
9535 struct ca0132_spec *spec = codec->spec; in ca0132_suspend()
9537 cancel_delayed_work_sync(&spec->unsol_hp_work); in ca0132_suspend()
9563 struct ca0132_spec *spec = codec->spec; in ca0132_config()
9565 spec->dacs[0] = 0x2; in ca0132_config()
9566 spec->dacs[1] = 0x3; in ca0132_config()
9567 spec->dacs[2] = 0x4; in ca0132_config()
9569 spec->multiout.dac_nids = spec->dacs; in ca0132_config()
9570 spec->multiout.num_dacs = 3; in ca0132_config()
9573 spec->multiout.max_channels = 2; in ca0132_config()
9575 spec->multiout.max_channels = 6; in ca0132_config()
9612 spec->num_outputs = 2; in ca0132_config()
9613 spec->out_pins[0] = 0x0b; /* speaker out */ in ca0132_config()
9614 spec->out_pins[1] = 0x0f; in ca0132_config()
9615 spec->shared_out_nid = 0x2; in ca0132_config()
9616 spec->unsol_tag_hp = 0x0f; in ca0132_config()
9618 spec->adcs[0] = 0x7; /* digital mic / analog mic1 */ in ca0132_config()
9619 spec->adcs[1] = 0x8; /* analog mic2 */ in ca0132_config()
9620 spec->adcs[2] = 0xa; /* what u hear */ in ca0132_config()
9622 spec->num_inputs = 3; in ca0132_config()
9623 spec->input_pins[0] = 0x12; in ca0132_config()
9624 spec->input_pins[1] = 0x11; in ca0132_config()
9625 spec->input_pins[2] = 0x13; in ca0132_config()
9626 spec->shared_mic_nid = 0x7; in ca0132_config()
9627 spec->unsol_tag_amic1 = 0x11; in ca0132_config()
9631 spec->num_outputs = 2; in ca0132_config()
9632 spec->out_pins[0] = 0x0B; /* Line out */ in ca0132_config()
9633 spec->out_pins[1] = 0x0F; /* Rear headphone out */ in ca0132_config()
9634 spec->out_pins[2] = 0x10; /* Front Headphone / Center/LFE*/ in ca0132_config()
9635 spec->out_pins[3] = 0x11; /* Rear surround */ in ca0132_config()
9636 spec->shared_out_nid = 0x2; in ca0132_config()
9637 spec->unsol_tag_hp = spec->out_pins[1]; in ca0132_config()
9638 spec->unsol_tag_front_hp = spec->out_pins[2]; in ca0132_config()
9640 spec->adcs[0] = 0x7; /* Rear Mic / Line-in */ in ca0132_config()
9641 spec->adcs[1] = 0x8; /* Front Mic, but only if no DSP */ in ca0132_config()
9642 spec->adcs[2] = 0xa; /* what u hear */ in ca0132_config()
9644 spec->num_inputs = 2; in ca0132_config()
9645 spec->input_pins[0] = 0x12; /* Rear Mic / Line-in */ in ca0132_config()
9646 spec->input_pins[1] = 0x13; /* What U Hear */ in ca0132_config()
9647 spec->shared_mic_nid = 0x7; in ca0132_config()
9648 spec->unsol_tag_amic1 = spec->input_pins[0]; in ca0132_config()
9651 spec->dig_out = 0x05; in ca0132_config()
9652 spec->multiout.dig_out_nid = spec->dig_out; in ca0132_config()
9653 spec->dig_in = 0x09; in ca0132_config()
9656 spec->num_outputs = 2; in ca0132_config()
9657 spec->out_pins[0] = 0x0B; /* Line out */ in ca0132_config()
9658 spec->out_pins[1] = 0x0F; /* Rear headphone out */ in ca0132_config()
9659 spec->out_pins[2] = 0x10; /* Center/LFE */ in ca0132_config()
9660 spec->out_pins[3] = 0x11; /* Rear surround */ in ca0132_config()
9661 spec->shared_out_nid = 0x2; in ca0132_config()
9662 spec->unsol_tag_hp = spec->out_pins[1]; in ca0132_config()
9663 spec->unsol_tag_front_hp = spec->out_pins[2]; in ca0132_config()
9665 spec->adcs[0] = 0x7; /* Rear Mic / Line-in */ in ca0132_config()
9666 spec->adcs[1] = 0x8; /* Not connected, no front mic */ in ca0132_config()
9667 spec->adcs[2] = 0xa; /* what u hear */ in ca0132_config()
9669 spec->num_inputs = 2; in ca0132_config()
9670 spec->input_pins[0] = 0x12; /* Rear Mic / Line-in */ in ca0132_config()
9671 spec->input_pins[1] = 0x13; /* What U Hear */ in ca0132_config()
9672 spec->shared_mic_nid = 0x7; in ca0132_config()
9673 spec->unsol_tag_amic1 = spec->input_pins[0]; in ca0132_config()
9676 spec->adcs[0] = 0x8; /* ZxR DBPro Aux In */ in ca0132_config()
9678 spec->num_inputs = 1; in ca0132_config()
9679 spec->input_pins[0] = 0x11; /* RCA Line-in */ in ca0132_config()
9681 spec->dig_out = 0x05; in ca0132_config()
9682 spec->multiout.dig_out_nid = spec->dig_out; in ca0132_config()
9684 spec->dig_in = 0x09; in ca0132_config()
9688 spec->num_outputs = 2; in ca0132_config()
9689 spec->out_pins[0] = 0x0B; /* Line out */ in ca0132_config()
9690 spec->out_pins[1] = 0x11; /* Rear headphone out */ in ca0132_config()
9691 spec->out_pins[2] = 0x10; /* Front Headphone / Center/LFE*/ in ca0132_config()
9692 spec->out_pins[3] = 0x0F; /* Rear surround */ in ca0132_config()
9693 spec->shared_out_nid = 0x2; in ca0132_config()
9694 spec->unsol_tag_hp = spec->out_pins[1]; in ca0132_config()
9695 spec->unsol_tag_front_hp = spec->out_pins[2]; in ca0132_config()
9697 spec->adcs[0] = 0x7; /* Rear Mic / Line-in */ in ca0132_config()
9698 spec->adcs[1] = 0x8; /* Front Mic, but only if no DSP */ in ca0132_config()
9699 spec->adcs[2] = 0xa; /* what u hear */ in ca0132_config()
9701 spec->num_inputs = 2; in ca0132_config()
9702 spec->input_pins[0] = 0x12; /* Rear Mic / Line-in */ in ca0132_config()
9703 spec->input_pins[1] = 0x13; /* What U Hear */ in ca0132_config()
9704 spec->shared_mic_nid = 0x7; in ca0132_config()
9705 spec->unsol_tag_amic1 = spec->input_pins[0]; in ca0132_config()
9708 spec->dig_out = 0x05; in ca0132_config()
9709 spec->multiout.dig_out_nid = spec->dig_out; in ca0132_config()
9712 spec->num_outputs = 2; in ca0132_config()
9713 spec->out_pins[0] = 0x0B; /* Line out */ in ca0132_config()
9714 spec->out_pins[1] = 0x0F; /* Rear headphone out */ in ca0132_config()
9715 spec->out_pins[2] = 0x10; /* Front Headphone / Center/LFE*/ in ca0132_config()
9716 spec->out_pins[3] = 0x11; /* Rear surround */ in ca0132_config()
9717 spec->shared_out_nid = 0x2; in ca0132_config()
9718 spec->unsol_tag_hp = spec->out_pins[1]; in ca0132_config()
9719 spec->unsol_tag_front_hp = spec->out_pins[2]; in ca0132_config()
9721 spec->adcs[0] = 0x07; /* Rear Mic / Line-in */ in ca0132_config()
9722 spec->adcs[1] = 0x08; /* Front Mic, but only if no DSP */ in ca0132_config()
9723 spec->adcs[2] = 0x0a; /* what u hear */ in ca0132_config()
9725 spec->num_inputs = 2; in ca0132_config()
9726 spec->input_pins[0] = 0x12; /* Rear Mic / Line-in */ in ca0132_config()
9727 spec->input_pins[1] = 0x13; /* What U Hear */ in ca0132_config()
9728 spec->shared_mic_nid = 0x7; in ca0132_config()
9729 spec->unsol_tag_amic1 = spec->input_pins[0]; in ca0132_config()
9732 spec->dig_out = 0x05; in ca0132_config()
9733 spec->multiout.dig_out_nid = spec->dig_out; in ca0132_config()
9736 spec->num_outputs = 2; in ca0132_config()
9737 spec->out_pins[0] = 0x0b; /* speaker out */ in ca0132_config()
9738 spec->out_pins[1] = 0x10; /* headphone out */ in ca0132_config()
9739 spec->shared_out_nid = 0x2; in ca0132_config()
9740 spec->unsol_tag_hp = spec->out_pins[1]; in ca0132_config()
9742 spec->adcs[0] = 0x7; /* digital mic / analog mic1 */ in ca0132_config()
9743 spec->adcs[1] = 0x8; /* analog mic2 */ in ca0132_config()
9744 spec->adcs[2] = 0xa; /* what u hear */ in ca0132_config()
9746 spec->num_inputs = 3; in ca0132_config()
9747 spec->input_pins[0] = 0x12; in ca0132_config()
9748 spec->input_pins[1] = 0x11; in ca0132_config()
9749 spec->input_pins[2] = 0x13; in ca0132_config()
9750 spec->shared_mic_nid = 0x7; in ca0132_config()
9751 spec->unsol_tag_amic1 = spec->input_pins[0]; in ca0132_config()
9754 spec->dig_out = 0x05; in ca0132_config()
9755 spec->multiout.dig_out_nid = spec->dig_out; in ca0132_config()
9756 spec->dig_in = 0x09; in ca0132_config()
9765 struct ca0132_spec *spec = codec->spec; in ca0132_prepare_verbs()
9767 spec->chip_init_verbs = ca0132_init_verbs0; in ca0132_prepare_verbs()
9773 spec->desktop_init_verbs = ca0132_init_verbs1; in ca0132_prepare_verbs()
9774 spec->spec_init_verbs = kcalloc(NUM_SPEC_VERBS, in ca0132_prepare_verbs()
9777 if (!spec->spec_init_verbs) in ca0132_prepare_verbs()
9778 return -ENOMEM; in ca0132_prepare_verbs()
9781 spec->spec_init_verbs[0].nid = 0x0b; in ca0132_prepare_verbs()
9782 spec->spec_init_verbs[0].param = 0x78D; in ca0132_prepare_verbs()
9783 spec->spec_init_verbs[0].verb = 0x00; in ca0132_prepare_verbs()
9787 spec->spec_init_verbs[2].nid = 0x0b; in ca0132_prepare_verbs()
9788 spec->spec_init_verbs[2].param = AC_VERB_SET_EAPD_BTLENABLE; in ca0132_prepare_verbs()
9789 spec->spec_init_verbs[2].verb = 0x02; in ca0132_prepare_verbs()
9791 spec->spec_init_verbs[3].nid = 0x10; in ca0132_prepare_verbs()
9792 spec->spec_init_verbs[3].param = 0x78D; in ca0132_prepare_verbs()
9793 spec->spec_init_verbs[3].verb = 0x02; in ca0132_prepare_verbs()
9795 spec->spec_init_verbs[4].nid = 0x10; in ca0132_prepare_verbs()
9796 spec->spec_init_verbs[4].param = AC_VERB_SET_EAPD_BTLENABLE; in ca0132_prepare_verbs()
9797 spec->spec_init_verbs[4].verb = 0x02; in ca0132_prepare_verbs()
9800 /* Terminator: spec->spec_init_verbs[NUM_SPEC_VERBS-1] */ in ca0132_prepare_verbs()
9812 struct ca0132_spec *spec = codec->spec; in sbz_detect_quirk()
9814 switch (codec->core.subsystem_id) { in sbz_detect_quirk()
9816 spec->quirk = QUIRK_ZXR; in sbz_detect_quirk()
9819 spec->quirk = QUIRK_ZXR_DBPRO; in sbz_detect_quirk()
9822 spec->quirk = QUIRK_SBZ; in sbz_detect_quirk()
9837 return -ENOMEM; in patch_ca0132()
9838 codec->spec = spec; in patch_ca0132()
9839 spec->codec = codec; in patch_ca0132()
9842 quirk = snd_pci_quirk_lookup(codec->bus->pci, ca0132_quirks); in patch_ca0132()
9844 spec->quirk = quirk->value; in patch_ca0132()
9846 spec->quirk = QUIRK_NONE; in patch_ca0132()
9851 codec->patch_ops = dbpro_patch_ops; in patch_ca0132()
9853 codec->patch_ops = ca0132_patch_ops; in patch_ca0132()
9855 codec->pcm_format_first = 1; in patch_ca0132()
9856 codec->no_sticky_stream = 1; in patch_ca0132()
9859 spec->dsp_state = DSP_DOWNLOAD_INIT; in patch_ca0132()
9860 spec->num_mixers = 1; in patch_ca0132()
9865 spec->mixers[0] = desktop_mixer; in patch_ca0132()
9869 spec->mixers[0] = desktop_mixer; in patch_ca0132()
9875 spec->mixers[0] = desktop_mixer; in patch_ca0132()
9879 spec->mixers[0] = r3di_mixer; in patch_ca0132()
9883 spec->mixers[0] = desktop_mixer; in patch_ca0132()
9884 snd_hda_codec_set_name(codec, "Sound BlasterX AE-5"); in patch_ca0132()
9887 spec->mixers[0] = desktop_mixer; in patch_ca0132()
9888 snd_hda_codec_set_name(codec, "Sound Blaster AE-7"); in patch_ca0132()
9891 spec->mixers[0] = ca0132_mixer; in patch_ca0132()
9902 spec->use_alt_controls = true; in patch_ca0132()
9903 spec->use_alt_functions = true; in patch_ca0132()
9904 spec->use_pci_mmio = true; in patch_ca0132()
9907 spec->use_alt_controls = true; in patch_ca0132()
9908 spec->use_alt_functions = true; in patch_ca0132()
9909 spec->use_pci_mmio = false; in patch_ca0132()
9912 spec->use_alt_controls = false; in patch_ca0132()
9913 spec->use_alt_functions = false; in patch_ca0132()
9914 spec->use_pci_mmio = false; in patch_ca0132()
9919 if (spec->use_pci_mmio) { in patch_ca0132()
9920 spec->mem_base = pci_iomap(codec->bus->pci, 2, 0xC20); in patch_ca0132()
9921 if (spec->mem_base == NULL) { in patch_ca0132()
9923 spec->quirk = QUIRK_NONE; in patch_ca0132()
9928 spec->base_init_verbs = ca0132_base_init_verbs; in patch_ca0132()
9929 spec->base_exit_verbs = ca0132_base_exit_verbs; in patch_ca0132()
9931 INIT_DELAYED_WORK(&spec->unsol_hp_work, ca0132_unsol_hp_delayed); in patch_ca0132()
9941 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL); in patch_ca0132()