Lines Matching +full:num +full:- +full:interpolation +full:- +full:steps
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 */
931 * sense given the fact the AE-5 uses it and has the ASI flag set.
1012 DSP_DOWNLOAD_FAILED = -1,
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, 0x01a170ff }, /* 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, 0x0081, "Sound Blaster AE-7", QUIRK_AE7),
1485 return ((response == -1) ? -1 : 0); in codec_send_command()
1523 return -EIO; in chipio_send()
1527 * Write chip address through the vendor widget -- NOT protected by the Mutex!
1532 struct ca0132_spec *spec = codec->spec; in chipio_write_address()
1535 if (spec->curr_chip_addx == chip_addx) in chipio_write_address()
1542 if (res != -EIO) { in chipio_write_address()
1548 spec->curr_chip_addx = (res < 0) ? ~0U : chip_addx; in chipio_write_address()
1554 * Write data through the vendor widget -- NOT protected by the Mutex!
1558 struct ca0132_spec *spec = codec->spec; in chipio_write_data()
1564 if (res != -EIO) { in chipio_write_data()
1572 spec->curr_chip_addx = (res != -EIO) ? in chipio_write_data()
1573 (spec->curr_chip_addx + 4) : ~0U; in chipio_write_data()
1578 * Write multiple data through the vendor widget -- NOT protected by the Mutex!
1588 return -EINVAL; in chipio_write_data_multiple()
1591 while ((count-- != 0) && (status == 0)) in chipio_write_data_multiple()
1599 * Read data through the vendor widget -- NOT protected by the Mutex!
1603 struct ca0132_spec *spec = codec->spec; in chipio_read_data()
1609 if (res != -EIO) { in chipio_read_data()
1614 if (res != -EIO) { in chipio_read_data()
1623 spec->curr_chip_addx = (res != -EIO) ? in chipio_read_data()
1624 (spec->curr_chip_addx + 4) : ~0U; in chipio_read_data()
1635 struct ca0132_spec *spec = codec->spec; in chipio_write()
1638 mutex_lock(&spec->chipio_mutex); in chipio_write()
1650 mutex_unlock(&spec->chipio_mutex); in chipio_write()
1686 struct ca0132_spec *spec = codec->spec; in chipio_write_multiple()
1689 mutex_lock(&spec->chipio_mutex); in chipio_write_multiple()
1696 mutex_unlock(&spec->chipio_mutex); in chipio_write_multiple()
1708 struct ca0132_spec *spec = codec->spec; in chipio_read()
1711 mutex_lock(&spec->chipio_mutex); in chipio_read()
1723 mutex_unlock(&spec->chipio_mutex); in chipio_read()
1749 struct ca0132_spec *spec = codec->spec; in chipio_set_control_param()
1757 mutex_lock(&spec->chipio_mutex); in chipio_set_control_param()
1766 mutex_unlock(&spec->chipio_mutex); in chipio_set_control_param()
1859 * 0x80-0xFF.
1875 struct ca0132_spec *spec = codec->spec; in chipio_enable_clocks()
1877 mutex_lock(&spec->chipio_mutex); in chipio_enable_clocks()
1890 mutex_unlock(&spec->chipio_mutex); in chipio_enable_clocks()
1910 return -EIO; in dspio_send()
1936 struct ca0132_spec *spec = codec->spec; in dspio_write()
1941 mutex_lock(&spec->chipio_mutex); in dspio_write()
1956 mutex_unlock(&spec->chipio_mutex); in dspio_write()
1959 -EIO : 0; in dspio_write()
1972 return -EINVAL; in dspio_write_multiple()
1990 if (status == -EIO) in dspio_read()
1994 if (status == -EIO || in dspio_read()
1996 return -EIO; in dspio_read()
2014 return -1; in dspio_read_multiple()
2111 struct ca0132_spec *spec = codec->spec; in dspio_get_response_data()
2116 return -EIO; in dspio_get_response_data()
2118 if ((data & 0x00ffffff) == spec->wait_scp_header) { in dspio_get_response_data()
2119 spec->scp_resp_header = data; in dspio_get_response_data()
2120 spec->scp_resp_count = data >> 27; in dspio_get_response_data()
2121 count = spec->wait_num_data; in dspio_get_response_data()
2122 dspio_read_multiple(codec, spec->scp_resp_data, in dspio_get_response_data()
2123 &spec->scp_resp_count, count); in dspio_get_response_data()
2127 return -EIO; in dspio_get_response_data()
2140 struct ca0132_spec *spec = codec->spec; in dspio_send_scp_message()
2141 int status = -1; in dspio_send_scp_message()
2161 return -EINVAL; in dspio_send_scp_message()
2165 return -EINVAL; in dspio_send_scp_message()
2167 spec->wait_scp_header = *((unsigned int *)send_buf); in dspio_send_scp_message()
2172 spec->wait_scp_header &= 0xffff0000; in dspio_send_scp_message()
2173 spec->wait_scp_header |= (resp_src_id << 8) | (resp_target_id); in dspio_send_scp_message()
2174 spec->wait_num_data = return_buf_size/sizeof(unsigned int) - 1; in dspio_send_scp_message()
2175 spec->wait_scp = 1; in dspio_send_scp_message()
2182 spec->wait_scp = 0; in dspio_send_scp_message()
2191 } while (spec->wait_scp && time_before(jiffies, timeout)); in dspio_send_scp_message()
2193 if (!spec->wait_scp) { in dspio_send_scp_message()
2195 memcpy(&ret_msg->hdr, &spec->scp_resp_header, 4); in dspio_send_scp_message()
2196 memcpy(&ret_msg->data, spec->scp_resp_data, in dspio_send_scp_message()
2197 spec->wait_num_data); in dspio_send_scp_message()
2198 *bytes_returned = (spec->scp_resp_count + 1) * 4; in dspio_send_scp_message()
2201 status = -EIO; in dspio_send_scp_message()
2203 spec->wait_scp = 0; in dspio_send_scp_message()
2237 return -EINVAL; in dspio_scp()
2241 return -EINVAL; in dspio_scp()
2246 return -EINVAL; in dspio_scp()
2278 ret_size = (ret_bytes - sizeof(scp_reply.hdr)) in dspio_scp()
2283 return -EINVAL; in dspio_scp()
2286 return -EINVAL; in dspio_scp()
2289 return -EINVAL; in dspio_scp()
2295 codec_dbg(codec, "reply ill-formed or errflag set\n"); in dspio_scp()
2296 return -EIO; in dspio_scp()
2334 codec_dbg(codec, " dspio_alloc_dma_chan() -- begin\n"); in dspio_alloc_dma_chan()
2346 return -EBUSY; in dspio_alloc_dma_chan()
2350 codec_dbg(codec, " dspio_alloc_dma_chan() -- complete\n"); in dspio_alloc_dma_chan()
2363 codec_dbg(codec, " dspio_free_dma_chan() -- begin\n"); in dspio_free_dma_chan()
2375 codec_dbg(codec, " dspio_free_dma_chan() -- complete\n"); in dspio_free_dma_chan()
2426 retry--; in dsp_reset()
2427 } while (res == -EIO && retry); in dsp_reset()
2431 return -EIO; in dsp_reset()
2483 codec_dbg(codec, "-- dsp_dma_setup_common() -- Begin ---------\n"); in dsp_dma_setup_common()
2486 codec_dbg(codec, "dma chan num invalid\n"); in dsp_dma_setup_common()
2487 return -EINVAL; in dsp_dma_setup_common()
2492 return -EBUSY; in dsp_dma_setup_common()
2499 return -ENXIO; in dsp_dma_setup_common()
2576 codec_dbg(codec, "-- dsp_dma_setup_common() -- Complete ------\n"); in dsp_dma_setup_common()
2582 * Setup the DSP DMA per-transfer-specific registers
2599 const unsigned int max_dma_count = 1 << (DSPDMAC_XFRCNT_BCNT_HIBIT - in dsp_dma_setup()
2602 codec_dbg(codec, "-- dsp_dma_setup() -- Begin ---------\n"); in dsp_dma_setup()
2606 return -EINVAL; in dsp_dma_setup()
2612 return -ENXIO; in dsp_dma_setup()
2637 adr_ofs = (count - 1) << (DSPDMAC_DSPADROFS_BOFS_LOBIT + in dsp_dma_setup()
2648 base_cnt = (count - 1) << DSPDMAC_XFRCNT_BCNT_LOBIT; in dsp_dma_setup()
2650 cur_cnt = (count - 1) << DSPDMAC_XFRCNT_CCNT_LOBIT; in dsp_dma_setup()
2667 codec_dbg(codec, "-- dsp_dma_setup() -- Complete ---------\n"); in dsp_dma_setup()
2681 codec_dbg(codec, "-- dsp_dma_start() -- Begin ---------\n"); in dsp_dma_start()
2691 codec_dbg(codec, "-- dsp_dma_start() Read CHNLSTART\n"); in dsp_dma_start()
2703 codec_dbg(codec, "-- dsp_dma_start() -- Complete ---------\n"); in dsp_dma_start()
2717 codec_dbg(codec, "-- dsp_dma_stop() -- Begin ---------\n"); in dsp_dma_stop()
2727 codec_dbg(codec, "-- dsp_dma_stop() Read CHNLSTART\n"); in dsp_dma_stop()
2738 codec_dbg(codec, "-- dsp_dma_stop() -- Complete ---------\n"); in dsp_dma_stop()
2769 val |= (ports_per_channel - 1) << 4; in dsp_allocate_router_ports()
2770 val |= num_chans - 1; in dsp_allocate_router_ports()
2821 codec_dbg(codec, " dsp_allocate_ports() -- begin\n"); in dsp_allocate_ports()
2825 return -EINVAL; in dsp_allocate_ports()
2831 codec_dbg(codec, " dsp_allocate_ports() -- complete\n"); in dsp_allocate_ports()
2849 return -EINVAL; in dsp_allocate_ports_format()
2866 codec_dbg(codec, " dsp_free_ports() -- begin\n"); in dsp_free_ports()
2873 codec_dbg(codec, " dsp_free_ports() -- complete\n"); in dsp_free_ports()
2915 struct hda_codec *codec = dma->codec; in dma_reset()
2916 struct ca0132_spec *spec = codec->spec; in dma_reset()
2919 if (dma->dmab->area) in dma_reset()
2920 snd_hda_codec_load_dsp_cleanup(codec, dma->dmab); in dma_reset()
2923 dma->m_converter_format, in dma_reset()
2924 dma->buf_size, in dma_reset()
2925 dma->dmab); in dma_reset()
2928 spec->dsp_stream_id = status; in dma_reset()
2947 snd_hda_codec_load_dsp_trigger(dma->codec, cmd); in dma_set_state()
2953 return dma->dmab->bytes; in dma_get_buffer_size()
2958 return dma->dmab->area; in dma_get_buffer_addr()
2965 memcpy(dma->dmab->area, data, count); in dma_xfer()
2974 *format = dma->m_converter_format; in dma_get_converter_format()
2979 struct ca0132_spec *spec = dma->codec->spec; in dma_get_stream_id()
2981 return spec->dsp_stream_id; in dma_get_stream_id()
2996 return p->magic == g_magic_value; in is_valid()
3001 return g_chip_addr_magic_value == p->chip_addr; in is_hci_prog_list_seg()
3006 return p->count == 0; in is_last()
3011 return struct_size(p, data, p->count); in dsp_sizeof()
3037 if (fls == NULL || fls->chip_addr != g_chip_addr_magic_value) { in dspxfr_hci_write()
3039 return -EINVAL; in dspxfr_hci_write()
3042 count = fls->count; in dspxfr_hci_write()
3043 data = (u32 *)(fls->data); in dspxfr_hci_write()
3050 count -= 2; in dspxfr_hci_write()
3057 * Write a block of data into DSP code or data RAM using pre-allocated
3062 * @reloc: Relocation address for loading single-segment overlays, or 0 for
3100 return -EINVAL; in dspxfr_one_seg()
3113 return -EINVAL; in dspxfr_one_seg()
3116 data = fls->data; in dspxfr_one_seg()
3117 chip_addx = fls->chip_addr; in dspxfr_one_seg()
3118 words_to_write = fls->count; in dspxfr_one_seg()
3129 return -EINVAL; in dspxfr_one_seg()
3139 return -EINVAL; in dspxfr_one_seg()
3152 return -EINVAL; in dspxfr_one_seg()
3158 buffer_size_words -= buffer_size_words % hda_frame_size_words; in dspxfr_one_seg()
3167 return -EINVAL; in dspxfr_one_seg()
3176 words_to_write -= remainder_words; in dspxfr_one_seg()
3203 return -EIO; in dspxfr_one_seg()
3243 words_to_write -= run_size_words; in dspxfr_one_seg()
3259 * @reloc: Relocation address for loading single-segment overlays, or 0 for
3274 struct ca0132_spec *spec = codec->spec; in dspxfr_image()
3284 return -EINVAL; in dspxfr_image()
3288 return -ENOMEM; in dspxfr_image()
3290 dma_engine->dmab = kzalloc(sizeof(*dma_engine->dmab), GFP_KERNEL); in dspxfr_image()
3291 if (!dma_engine->dmab) { in dspxfr_image()
3293 return -ENOMEM; in dspxfr_image()
3296 dma_engine->codec = codec; in dspxfr_image()
3298 dma_engine->m_converter_format = hda_format; in dspxfr_image()
3299 dma_engine->buf_size = (ovly ? DSP_DMA_WRITE_BUFLEN_OVLY : in dspxfr_image()
3313 dma_engine->m_converter_format, in dspxfr_image()
3314 dma_engine->buf_size, in dspxfr_image()
3315 dma_engine->dmab); in dspxfr_image()
3318 spec->dsp_stream_id = status; in dspxfr_image()
3348 status = -EINVAL; in dspxfr_image()
3377 if (dma_engine->dmab->area) in dspxfr_image()
3378 snd_hda_codec_load_dsp_cleanup(codec, dma_engine->dmab); in dspxfr_image()
3379 kfree(dma_engine->dmab); in dspxfr_image()
3390 struct ca0132_spec *spec = codec->spec; in dspload_post_setup()
3391 codec_dbg(codec, "---- dspload_post_setup ------\n"); in dspload_post_setup()
3403 * dspload_image - Download DSP from a DSP Image Fast Load structure.
3408 * @reloc: Relocation address for loading single-segment overlays, or 0 for
3415 * linear, non-constant sized element array of structures, each of which
3431 codec_dbg(codec, "---- dspload_image begin ------\n"); in dspload_image()
3507 * ca0113 related functions. The ca0113 acts as the HDA bus for the pci-e
3513 * For cards with PCI-E region2 (Sound Blaster Z/ZxR, Recon3D, and AE-5)
3517 * AE-5 note: The AE-5 seems to use pins 2 and 3 to somehow set the color value
3518 * of the on-card LED. It seems to use pin 2 for data, then toggles 3 to on and
3524 struct ca0132_spec *spec = codec->spec; in ca0113_mmio_gpio_set()
3530 writew(gpio_data, spec->mem_base + 0x320); in ca0113_mmio_gpio_set()
3534 * Special pci region2 commands that are only used by the AE-5. They follow
3539 * target-id, and value.
3544 struct ca0132_spec *spec = codec->spec; in ca0113_mmio_command_set()
3547 writel(0x0000007e, spec->mem_base + 0x210); in ca0113_mmio_command_set()
3548 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set()
3549 writel(0x0000005a, spec->mem_base + 0x210); in ca0113_mmio_command_set()
3550 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set()
3551 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set()
3553 writel(0x00800005, spec->mem_base + 0x20c); in ca0113_mmio_command_set()
3554 writel(group, spec->mem_base + 0x804); in ca0113_mmio_command_set()
3556 writel(0x00800005, spec->mem_base + 0x20c); in ca0113_mmio_command_set()
3561 writel(write_val, spec->mem_base + 0x204); in ca0113_mmio_command_set()
3567 readl(spec->mem_base + 0x860); in ca0113_mmio_command_set()
3568 readl(spec->mem_base + 0x854); in ca0113_mmio_command_set()
3569 readl(spec->mem_base + 0x840); in ca0113_mmio_command_set()
3571 writel(0x00800004, spec->mem_base + 0x20c); in ca0113_mmio_command_set()
3572 writel(0x00000000, spec->mem_base + 0x210); in ca0113_mmio_command_set()
3573 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set()
3574 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set()
3583 struct ca0132_spec *spec = codec->spec; in ca0113_mmio_command_set_type2()
3586 writel(0x0000007e, spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3587 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3588 writel(0x0000005a, spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3589 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3590 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3592 writel(0x00800003, spec->mem_base + 0x20c); in ca0113_mmio_command_set_type2()
3593 writel(group, spec->mem_base + 0x804); in ca0113_mmio_command_set_type2()
3595 writel(0x00800005, spec->mem_base + 0x20c); in ca0113_mmio_command_set_type2()
3600 writel(write_val, spec->mem_base + 0x204); in ca0113_mmio_command_set_type2()
3602 readl(spec->mem_base + 0x860); in ca0113_mmio_command_set_type2()
3603 readl(spec->mem_base + 0x854); in ca0113_mmio_command_set_type2()
3604 readl(spec->mem_base + 0x840); in ca0113_mmio_command_set_type2()
3606 writel(0x00800004, spec->mem_base + 0x20c); in ca0113_mmio_command_set_type2()
3607 writel(0x00000000, spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3608 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3609 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3622 struct ca0132_spec *spec = codec->spec; in ca0132_gpio_init()
3645 struct ca0132_spec *spec = codec->spec; in ca0132_gpio_setup()
3676 /* Bit 1 - Switch between front/rear mic. 0 = rear, 1 = front */
3678 /* Bit 2 - Switch between headphone/line out. 0 = Headphone, 1 = Line */
3729 snd_hda_codec_write(codec, codec->core.afg, 0, in r3di_gpio_mic_set()
3744 snd_hda_codec_write(codec, codec->core.afg, 0, in r3di_gpio_dsp_status_set()
3751 snd_hda_codec_write(codec, codec->core.afg, 0, in r3di_gpio_dsp_status_set()
3758 snd_hda_codec_write(codec, codec->core.afg, 0, in r3di_gpio_dsp_status_set()
3771 struct ca0132_spec *spec = codec->spec; in ca0132_playback_pcm_prepare()
3773 snd_hda_codec_setup_stream(codec, spec->dacs[0], stream_tag, 0, format); in ca0132_playback_pcm_prepare()
3782 struct ca0132_spec *spec = codec->spec; in ca0132_playback_pcm_cleanup()
3784 if (spec->dsp_state == DSP_DOWNLOADING) in ca0132_playback_pcm_cleanup()
3789 if (spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]) in ca0132_playback_pcm_cleanup()
3792 snd_hda_codec_cleanup_stream(codec, spec->dacs[0]); in ca0132_playback_pcm_cleanup()
3801 struct ca0132_spec *spec = codec->spec; in ca0132_playback_pcm_delay()
3803 struct snd_pcm_runtime *runtime = substream->runtime; in ca0132_playback_pcm_delay()
3805 if (spec->dsp_state != DSP_DOWNLOADED) in ca0132_playback_pcm_delay()
3809 if (spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]) { in ca0132_playback_pcm_delay()
3810 if ((spec->effects_switch[SURROUND - EFFECT_START_NID]) || in ca0132_playback_pcm_delay()
3811 (spec->effects_switch[DIALOG_PLUS - EFFECT_START_NID])) in ca0132_playback_pcm_delay()
3816 if (spec->cur_out_type == SPEAKER_OUT) in ca0132_playback_pcm_delay()
3819 return (latency * runtime->rate) / 1000; in ca0132_playback_pcm_delay()
3829 struct ca0132_spec *spec = codec->spec; in ca0132_dig_playback_pcm_open()
3830 return snd_hda_multi_out_dig_open(codec, &spec->multiout); in ca0132_dig_playback_pcm_open()
3839 struct ca0132_spec *spec = codec->spec; in ca0132_dig_playback_pcm_prepare()
3840 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, in ca0132_dig_playback_pcm_prepare()
3848 struct ca0132_spec *spec = codec->spec; in ca0132_dig_playback_pcm_cleanup()
3849 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); in ca0132_dig_playback_pcm_cleanup()
3856 struct ca0132_spec *spec = codec->spec; in ca0132_dig_playback_pcm_close()
3857 return snd_hda_multi_out_dig_close(codec, &spec->multiout); in ca0132_dig_playback_pcm_close()
3869 snd_hda_codec_setup_stream(codec, hinfo->nid, in ca0132_capture_pcm_prepare()
3879 struct ca0132_spec *spec = codec->spec; in ca0132_capture_pcm_cleanup()
3881 if (spec->dsp_state == DSP_DOWNLOADING) in ca0132_capture_pcm_cleanup()
3884 snd_hda_codec_cleanup_stream(codec, hinfo->nid); in ca0132_capture_pcm_cleanup()
3892 struct ca0132_spec *spec = codec->spec; in ca0132_capture_pcm_delay()
3894 struct snd_pcm_runtime *runtime = substream->runtime; in ca0132_capture_pcm_delay()
3896 if (spec->dsp_state != DSP_DOWNLOADED) in ca0132_capture_pcm_delay()
3899 if (spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID]) in ca0132_capture_pcm_delay()
3902 return (latency * runtime->rate) / 1000; in ca0132_capture_pcm_delay()
3966 * values -90 to 9. -90 is the lowest decibel value for both the ADC's and the
4014 * This table counts from float 10 to 1000, which is the range of the x-bass
4124 struct ca0132_spec *spec = codec->spec; in tuning_ctl_get()
4126 long *valp = ucontrol->value.integer.value; in tuning_ctl_get()
4127 int idx = nid - TUNING_CTL_START_NID; in tuning_ctl_get()
4129 *valp = spec->cur_ctl_vals[idx]; in tuning_ctl_get()
4137 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in voice_focus_ctl_info()
4138 uinfo->count = chs == 3 ? 2 : 1; in voice_focus_ctl_info()
4139 uinfo->value.integer.min = 20; in voice_focus_ctl_info()
4140 uinfo->value.integer.max = 180; in voice_focus_ctl_info()
4141 uinfo->value.integer.step = 1; in voice_focus_ctl_info()
4150 struct ca0132_spec *spec = codec->spec; in voice_focus_ctl_put()
4152 long *valp = ucontrol->value.integer.value; in voice_focus_ctl_put()
4155 idx = nid - TUNING_CTL_START_NID; in voice_focus_ctl_put()
4157 if (spec->cur_ctl_vals[idx] == *valp) in voice_focus_ctl_put()
4160 spec->cur_ctl_vals[idx] = *valp; in voice_focus_ctl_put()
4162 idx = *valp - 20; in voice_focus_ctl_put()
4172 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in mic_svm_ctl_info()
4173 uinfo->count = chs == 3 ? 2 : 1; in mic_svm_ctl_info()
4174 uinfo->value.integer.min = 0; in mic_svm_ctl_info()
4175 uinfo->value.integer.max = 100; in mic_svm_ctl_info()
4176 uinfo->value.integer.step = 1; in mic_svm_ctl_info()
4185 struct ca0132_spec *spec = codec->spec; in mic_svm_ctl_put()
4187 long *valp = ucontrol->value.integer.value; in mic_svm_ctl_put()
4190 idx = nid - TUNING_CTL_START_NID; in mic_svm_ctl_put()
4192 if (spec->cur_ctl_vals[idx] == *valp) in mic_svm_ctl_put()
4195 spec->cur_ctl_vals[idx] = *valp; in mic_svm_ctl_put()
4207 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in equalizer_ctl_info()
4208 uinfo->count = chs == 3 ? 2 : 1; in equalizer_ctl_info()
4209 uinfo->value.integer.min = 0; in equalizer_ctl_info()
4210 uinfo->value.integer.max = 48; in equalizer_ctl_info()
4211 uinfo->value.integer.step = 1; in equalizer_ctl_info()
4220 struct ca0132_spec *spec = codec->spec; in equalizer_ctl_put()
4222 long *valp = ucontrol->value.integer.value; in equalizer_ctl_put()
4225 idx = nid - TUNING_CTL_START_NID; in equalizer_ctl_put()
4227 if (spec->cur_ctl_vals[idx] == *valp) in equalizer_ctl_put()
4230 spec->cur_ctl_vals[idx] = *valp; in equalizer_ctl_put()
4239 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(eq_db_scale, -2400, 100, 0);
4301 struct ca0132_spec *spec = codec->spec; in ca0132_init_tuning_defaults()
4304 /* Wedge Angle defaults to 30. 10 below is 30 - 20. 20 is min. */ in ca0132_init_tuning_defaults()
4305 spec->cur_ctl_vals[WEDGE_ANGLE - TUNING_CTL_START_NID] = 10; in ca0132_init_tuning_defaults()
4307 spec->cur_ctl_vals[SVM_LEVEL - TUNING_CTL_START_NID] = 74; in ca0132_init_tuning_defaults()
4311 spec->cur_ctl_vals[i] = 24; in ca0132_init_tuning_defaults()
4318 * If jack inserted, headphone will be selected, else built-in speakers
4323 struct ca0132_spec *spec = codec->spec; in ca0132_select_out()
4334 auto_jack = spec->vnode_lswitch[VNID_HP_ASEL - VNODE_START_NID]; in ca0132_select_out()
4337 jack_present = snd_hda_jack_detect(codec, spec->unsol_tag_hp); in ca0132_select_out()
4340 spec->vnode_lswitch[VNID_HP_SEL - VNODE_START_NID]; in ca0132_select_out()
4343 spec->cur_out_type = HEADPHONE_OUT; in ca0132_select_out()
4345 spec->cur_out_type = SPEAKER_OUT; in ca0132_select_out()
4347 if (spec->cur_out_type == SPEAKER_OUT) { in ca0132_select_out()
4361 snd_hda_codec_write(codec, spec->out_pins[1], 0, in ca0132_select_out()
4363 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4365 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4367 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4371 pin_ctl = snd_hda_codec_read(codec, spec->out_pins[1], 0, in ca0132_select_out()
4373 snd_hda_set_pin_ctl(codec, spec->out_pins[1], in ca0132_select_out()
4376 pin_ctl = snd_hda_codec_read(codec, spec->out_pins[0], 0, in ca0132_select_out()
4378 snd_hda_set_pin_ctl(codec, spec->out_pins[0], in ca0132_select_out()
4394 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4396 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4398 snd_hda_codec_write(codec, spec->out_pins[1], 0, in ca0132_select_out()
4400 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4404 pin_ctl = snd_hda_codec_read(codec, spec->out_pins[0], 0, in ca0132_select_out()
4406 snd_hda_set_pin_ctl(codec, spec->out_pins[0], in ca0132_select_out()
4409 pin_ctl = snd_hda_codec_read(codec, spec->out_pins[1], 0, in ca0132_select_out()
4411 snd_hda_set_pin_ctl(codec, spec->out_pins[1], in ca0132_select_out()
4427 struct ca0132_spec *spec = codec->spec; in ae5_mmio_select_out()
4437 ca0113_mmio_command_set(codec, out_cmds->group[i], in ae5_mmio_select_out()
4438 out_cmds->target[i], in ae5_mmio_select_out()
4439 out_cmds->vals[spec->cur_out_type][i]); in ae5_mmio_select_out()
4444 struct ca0132_spec *spec = codec->spec; in ca0132_alt_set_full_range_speaker()
4449 /* 2.0/4.0 setup has no LFE channel, so setting full-range does nothing. */ in ca0132_alt_set_full_range_speaker()
4450 if (spec->channel_cfg_val == SPEAKER_CHANNELS_4_0 in ca0132_alt_set_full_range_speaker()
4451 || spec->channel_cfg_val == SPEAKER_CHANNELS_2_0) in ca0132_alt_set_full_range_speaker()
4454 /* Set front L/R full range. Zero for full-range, one for redirection. */ in ca0132_alt_set_full_range_speaker()
4455 tmp = spec->speaker_range_val[0] ? FLOAT_ZERO : FLOAT_ONE; in ca0132_alt_set_full_range_speaker()
4461 /* When setting full-range rear, both rear and center/lfe are set. */ in ca0132_alt_set_full_range_speaker()
4462 tmp = spec->speaker_range_val[1] ? FLOAT_ZERO : FLOAT_ONE; in ca0132_alt_set_full_range_speaker()
4474 * Only the AE series cards set this value when setting full-range, in ca0132_alt_set_full_range_speaker()
4490 struct ca0132_spec *spec = codec->spec; in ca0132_alt_surround_set_bass_redirection()
4494 if (val && spec->channel_cfg_val != SPEAKER_CHANNELS_4_0 && in ca0132_alt_surround_set_bass_redirection()
4495 spec->channel_cfg_val != SPEAKER_CHANNELS_2_0) in ca0132_alt_surround_set_bass_redirection()
4506 tmp = float_xbass_xover_lookup[spec->xbass_xover_freq]; in ca0132_alt_surround_set_bass_redirection()
4523 struct ca0132_spec *spec = codec->spec; in ca0132_alt_select_out_get_quirk_data()
4540 struct ca0132_spec *spec = codec->spec; in ca0132_alt_select_out_quirk_set()
4548 out_info = &quirk_data->out_set_info[spec->cur_out_type]; in ca0132_alt_select_out_quirk_set()
4549 if (quirk_data->is_ae_series) in ca0132_alt_select_out_quirk_set()
4552 if (out_info->has_hda_gpio) { in ca0132_alt_select_out_quirk_set()
4553 gpio_data = snd_hda_codec_read(codec, codec->core.afg, 0, in ca0132_alt_select_out_quirk_set()
4556 if (out_info->hda_gpio_set) in ca0132_alt_select_out_quirk_set()
4557 gpio_data |= (1 << out_info->hda_gpio_pin); in ca0132_alt_select_out_quirk_set()
4559 gpio_data &= ~(1 << out_info->hda_gpio_pin); in ca0132_alt_select_out_quirk_set()
4561 snd_hda_codec_write(codec, codec->core.afg, 0, in ca0132_alt_select_out_quirk_set()
4565 if (out_info->mmio_gpio_count) { in ca0132_alt_select_out_quirk_set()
4566 for (i = 0; i < out_info->mmio_gpio_count; i++) { in ca0132_alt_select_out_quirk_set()
4567 ca0113_mmio_gpio_set(codec, out_info->mmio_gpio_pin[i], in ca0132_alt_select_out_quirk_set()
4568 out_info->mmio_gpio_set[i]); in ca0132_alt_select_out_quirk_set()
4572 if (out_info->scp_cmds_count) { in ca0132_alt_select_out_quirk_set()
4573 for (i = 0; i < out_info->scp_cmds_count; i++) { in ca0132_alt_select_out_quirk_set()
4575 out_info->scp_cmd_mid[i], in ca0132_alt_select_out_quirk_set()
4576 out_info->scp_cmd_req[i], in ca0132_alt_select_out_quirk_set()
4577 out_info->scp_cmd_val[i]); in ca0132_alt_select_out_quirk_set()
4583 chipio_set_control_param(codec, 0x0d, out_info->dac2port); in ca0132_alt_select_out_quirk_set()
4585 if (out_info->has_chipio_write) { in ca0132_alt_select_out_quirk_set()
4586 chipio_write(codec, out_info->chipio_write_addr, in ca0132_alt_select_out_quirk_set()
4587 out_info->chipio_write_data); in ca0132_alt_select_out_quirk_set()
4590 if (quirk_data->has_headphone_gain) { in ca0132_alt_select_out_quirk_set()
4591 if (spec->cur_out_type != HEADPHONE_OUT) { in ca0132_alt_select_out_quirk_set()
4592 if (quirk_data->is_ae_series) in ca0132_alt_select_out_quirk_set()
4597 if (quirk_data->is_ae_series) in ca0132_alt_select_out_quirk_set()
4599 spec->ae5_headphone_gain_val); in ca0132_alt_select_out_quirk_set()
4602 spec->zxr_gain_set); in ca0132_alt_select_out_quirk_set()
4628 * It also adds the ability to auto-detect the front headphone port.
4632 struct ca0132_spec *spec = codec->spec; in ca0132_alt_select_out()
4638 hda_nid_t headphone_nid = spec->out_pins[1]; in ca0132_alt_select_out()
4644 auto_jack = spec->vnode_lswitch[VNID_HP_ASEL - VNODE_START_NID]; in ca0132_alt_select_out()
4652 jack_present = snd_hda_jack_detect(codec, spec->unsol_tag_hp) || in ca0132_alt_select_out()
4653 snd_hda_jack_detect(codec, spec->unsol_tag_front_hp); in ca0132_alt_select_out()
4656 spec->cur_out_type = HEADPHONE_OUT; in ca0132_alt_select_out()
4658 spec->cur_out_type = SPEAKER_OUT; in ca0132_alt_select_out()
4660 spec->cur_out_type = spec->out_enum_val; in ca0132_alt_select_out()
4662 outfx_set = spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]; in ca0132_alt_select_out()
4672 switch (spec->cur_out_type) { in ca0132_alt_select_out()
4677 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_alt_select_out()
4681 ca0132_set_out_node_pincfg(codec, spec->out_pins[1], 0, 0); in ca0132_alt_select_out()
4682 /* Set front L-R to output. */ in ca0132_alt_select_out()
4683 ca0132_set_out_node_pincfg(codec, spec->out_pins[0], 1, 0); in ca0132_alt_select_out()
4685 ca0132_set_out_node_pincfg(codec, spec->out_pins[2], 1, 0); in ca0132_alt_select_out()
4687 ca0132_set_out_node_pincfg(codec, spec->out_pins[3], 1, 0); in ca0132_alt_select_out()
4694 if (!outfx_set && spec->channel_cfg_val == SPEAKER_CHANNELS_2_0) in ca0132_alt_select_out()
4697 tmp = speaker_channel_cfgs[spec->channel_cfg_val].val; in ca0132_alt_select_out()
4706 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_alt_select_out()
4710 ca0132_set_out_node_pincfg(codec, spec->out_pins[0], 0, 0); in ca0132_alt_select_out()
4711 ca0132_set_out_node_pincfg(codec, spec->out_pins[2], 0, 0); in ca0132_alt_select_out()
4712 ca0132_set_out_node_pincfg(codec, spec->out_pins[3], 0, 0); in ca0132_alt_select_out()
4715 if (snd_hda_jack_detect(codec, spec->unsol_tag_front_hp)) in ca0132_alt_select_out()
4716 headphone_nid = spec->out_pins[2]; in ca0132_alt_select_out()
4717 else if (snd_hda_jack_detect(codec, spec->unsol_tag_hp)) in ca0132_alt_select_out()
4718 headphone_nid = spec->out_pins[1]; in ca0132_alt_select_out()
4732 * If output effects are enabled, set the X-Bass effect value again to in ca0132_alt_select_out()
4738 spec->effects_switch[X_BASS - EFFECT_START_NID]); in ca0132_alt_select_out()
4754 if (spec->cur_out_type == SPEAKER_OUT) in ca0132_alt_select_out()
4756 spec->bass_redirection_val); in ca0132_alt_select_out()
4766 if (spec->cur_out_type == SPEAKER_OUT) { in ca0132_alt_select_out()
4785 ca0132_alt_select_out(spec->codec); in ca0132_unsol_hp_delayed()
4787 ca0132_select_out(spec->codec); in ca0132_unsol_hp_delayed()
4789 jack = snd_hda_jack_tbl_get(spec->codec, spec->unsol_tag_hp); in ca0132_unsol_hp_delayed()
4791 jack->block_report = 0; in ca0132_unsol_hp_delayed()
4792 snd_hda_jack_report_sync(spec->codec); in ca0132_unsol_hp_delayed()
4808 struct ca0132_spec *spec = codec->spec; in ca0132_set_vipsource()
4811 if (spec->dsp_state != DSP_DOWNLOADED) in ca0132_set_vipsource()
4815 if (!spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID] || in ca0132_set_vipsource()
4820 if (spec->cur_mic_type == DIGITAL_MIC) in ca0132_set_vipsource()
4830 if (spec->cur_mic_type == DIGITAL_MIC) in ca0132_set_vipsource()
4846 struct ca0132_spec *spec = codec->spec; in ca0132_alt_set_vipsource()
4849 if (spec->dsp_state != DSP_DOWNLOADED) in ca0132_alt_set_vipsource()
4858 if (!spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID] || in ca0132_alt_set_vipsource()
4859 (val == 0) || spec->in_enum_val == REAR_LINE_IN) { in ca0132_alt_set_vipsource()
4872 if (spec->in_enum_val == REAR_LINE_IN) in ca0132_alt_set_vipsource()
4890 if (spec->effects_switch[VOICE_FOCUS - EFFECT_START_NID]) in ca0132_alt_set_vipsource()
4912 * If jack inserted, ext.mic will be selected, else built-in mic
4917 struct ca0132_spec *spec = codec->spec; in ca0132_select_mic()
4925 auto_jack = spec->vnode_lswitch[VNID_AMIC1_ASEL - VNODE_START_NID]; in ca0132_select_mic()
4928 jack_present = snd_hda_jack_detect(codec, spec->unsol_tag_amic1); in ca0132_select_mic()
4931 spec->vnode_lswitch[VNID_AMIC1_SEL - VNODE_START_NID]; in ca0132_select_mic()
4934 spec->cur_mic_type = LINE_MIC_IN; in ca0132_select_mic()
4936 spec->cur_mic_type = DIGITAL_MIC; in ca0132_select_mic()
4938 if (spec->cur_mic_type == DIGITAL_MIC) { in ca0132_select_mic()
4945 spec->effects_switch in ca0132_select_mic()
4946 [VOICE_FOCUS - EFFECT_START_NID]); in ca0132_select_mic()
4951 ca0132_mic_boost_set(codec, spec->cur_mic_boost); in ca0132_select_mic()
4964 * The front mic has no jack-detection, so the only way to switch to it
4969 struct ca0132_spec *spec = codec->spec; in ca0132_alt_select_in()
4979 spec->cur_mic_type = spec->in_enum_val; in ca0132_alt_select_in()
4981 switch (spec->cur_mic_type) { in ca0132_alt_select_in()
5039 ca0132_alt_mic_boost_set(codec, spec->mic_boost_enum_val); in ca0132_alt_select_in()
5132 ca0132_alt_mic_boost_set(codec, spec->mic_boost_enum_val); in ca0132_alt_select_in()
5148 struct ca0132_spec *spec = codec->spec; in ca0132_is_vnode_effective()
5153 nid = spec->shared_out_nid; in ca0132_is_vnode_effective()
5156 nid = spec->shared_mic_nid; in ca0132_is_vnode_effective()
5174 struct ca0132_spec *spec = codec->spec; in ca0132_voicefx_set()
5179 tmp = spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID] ? in ca0132_voicefx_set()
5196 struct ca0132_spec *spec = codec->spec; in ca0132_effects_set()
5200 int idx = nid - EFFECT_START_NID; in ca0132_effects_set()
5208 if (!spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]) in ca0132_effects_set()
5210 if (spec->cur_out_type == SPEAKER_OUT && nid == X_BASS) { in ca0132_effects_set()
5211 channel_cfg = spec->channel_cfg_val; in ca0132_effects_set()
5221 if (!spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID]) in ca0132_effects_set()
5224 /* Voice Focus applies to 2-ch Mic, Digital Mic */ in ca0132_effects_set()
5225 if ((nid == VOICE_FOCUS) && (spec->cur_mic_type != DIGITAL_MIC)) in ca0132_effects_set()
5230 && (spec->cur_mic_type != REAR_LINE_IN)) { in ca0132_effects_set()
5231 if (spec->effects_switch[CRYSTAL_VOICE - in ca0132_effects_set()
5234 if (spec->effects_switch[VOICE_FOCUS - in ca0132_effects_set()
5249 && (spec->cur_mic_type != REAR_LINE_IN)) { in ca0132_effects_set()
5250 if (spec->effects_switch[CRYSTAL_VOICE - in ca0132_effects_set()
5252 if (spec->effects_switch[NOISE_REDUCTION - in ca0132_effects_set()
5265 spec->in_enum_val == REAR_LINE_IN) in ca0132_effects_set()
5287 struct ca0132_spec *spec = codec->spec; in ca0132_pe_switch_set()
5292 spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]); in ca0132_pe_switch_set()
5297 i = OUT_EFFECT_START_NID - EFFECT_START_NID; in ca0132_pe_switch_set()
5301 ret |= ca0132_effects_set(codec, nid, spec->effects_switch[i]); in ca0132_pe_switch_set()
5309 struct ca0132_spec *spec = codec->spec; in stop_mic1()
5310 unsigned int oldval = snd_hda_codec_read(codec, spec->adcs[0], 0, in stop_mic1()
5313 snd_hda_codec_write(codec, spec->adcs[0], 0, in stop_mic1()
5322 struct ca0132_spec *spec = codec->spec; in resume_mic1()
5325 snd_hda_codec_write(codec, spec->adcs[0], 0, in resume_mic1()
5335 struct ca0132_spec *spec = codec->spec; in ca0132_cvoice_switch_set()
5341 spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID]); in ca0132_cvoice_switch_set()
5343 i = IN_EFFECT_START_NID - EFFECT_START_NID; in ca0132_cvoice_switch_set()
5347 ret |= ca0132_effects_set(codec, nid, spec->effects_switch[i]); in ca0132_cvoice_switch_set()
5350 ret |= ca0132_voicefx_set(codec, (spec->voicefx_val ? 1 : 0)); in ca0132_cvoice_switch_set()
5364 struct ca0132_spec *spec = codec->spec; in ca0132_mic_boost_set()
5368 ret = snd_hda_codec_amp_update(codec, spec->input_pins[0], 0, in ca0132_mic_boost_set()
5371 ret = snd_hda_codec_amp_update(codec, spec->input_pins[0], 0, in ca0132_mic_boost_set()
5379 struct ca0132_spec *spec = codec->spec; in ca0132_alt_mic_boost_set()
5382 ret = snd_hda_codec_amp_update(codec, spec->input_pins[0], 0, in ca0132_alt_mic_boost_set()
5416 struct ca0132_spec *spec = codec->spec; in ca0132_vnode_switch_set()
5421 spec->vnode_lswitch[VNID_HP_ASEL - VNODE_START_NID]; in ca0132_vnode_switch_set()
5433 spec->vnode_lswitch[VNID_AMIC1_ASEL - VNODE_START_NID]; in ca0132_vnode_switch_set()
5459 mutex_lock(&codec->control_mutex); in ca0132_vnode_switch_set()
5460 pval = kcontrol->private_value; in ca0132_vnode_switch_set()
5461 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(shared_nid, ch, in ca0132_vnode_switch_set()
5464 kcontrol->private_value = pval; in ca0132_vnode_switch_set()
5465 mutex_unlock(&codec->control_mutex); in ca0132_vnode_switch_set()
5514 &(lookup[idx - 1]), sizeof(unsigned int)); in ca0132_alt_slider_ctl_set()
5535 struct ca0132_spec *spec = codec->spec; in ca0132_alt_xbass_xover_slider_ctl_get()
5536 long *valp = ucontrol->value.integer.value; in ca0132_alt_xbass_xover_slider_ctl_get()
5540 *valp = spec->bass_redirect_xover_freq; in ca0132_alt_xbass_xover_slider_ctl_get()
5542 *valp = spec->xbass_xover_freq; in ca0132_alt_xbass_xover_slider_ctl_get()
5551 struct ca0132_spec *spec = codec->spec; in ca0132_alt_slider_ctl_get()
5553 long *valp = ucontrol->value.integer.value; in ca0132_alt_slider_ctl_get()
5554 int idx = nid - OUT_EFFECT_START_NID; in ca0132_alt_slider_ctl_get()
5556 *valp = spec->fx_ctl_val[idx]; in ca0132_alt_slider_ctl_get()
5561 * The X-bass crossover starts at 10hz, so the min is 1. The
5567 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in ca0132_alt_xbass_xover_slider_info()
5568 uinfo->count = 1; in ca0132_alt_xbass_xover_slider_info()
5569 uinfo->value.integer.min = 1; in ca0132_alt_xbass_xover_slider_info()
5570 uinfo->value.integer.max = 100; in ca0132_alt_xbass_xover_slider_info()
5571 uinfo->value.integer.step = 1; in ca0132_alt_xbass_xover_slider_info()
5581 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in ca0132_alt_effect_slider_info()
5582 uinfo->count = chs == 3 ? 2 : 1; in ca0132_alt_effect_slider_info()
5583 uinfo->value.integer.min = 0; in ca0132_alt_effect_slider_info()
5584 uinfo->value.integer.max = 100; in ca0132_alt_effect_slider_info()
5585 uinfo->value.integer.step = 1; in ca0132_alt_effect_slider_info()
5594 struct ca0132_spec *spec = codec->spec; in ca0132_alt_xbass_xover_slider_put()
5596 long *valp = ucontrol->value.integer.value; in ca0132_alt_xbass_xover_slider_put()
5601 cur_val = &spec->bass_redirect_xover_freq; in ca0132_alt_xbass_xover_slider_put()
5603 cur_val = &spec->xbass_xover_freq; in ca0132_alt_xbass_xover_slider_put()
5624 struct ca0132_spec *spec = codec->spec; in ca0132_alt_effect_slider_put()
5626 long *valp = ucontrol->value.integer.value; in ca0132_alt_effect_slider_put()
5629 idx = nid - EFFECT_START_NID; in ca0132_alt_effect_slider_put()
5631 if (spec->fx_ctl_val[idx] == *valp) in ca0132_alt_effect_slider_put()
5634 spec->fx_ctl_val[idx] = *valp; in ca0132_alt_effect_slider_put()
5646 * traditional 0-100 in alsamixer that goes in big steps. I like enum better.
5657 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_mic_boost_info()
5658 uinfo->count = 1; in ca0132_alt_mic_boost_info()
5659 uinfo->value.enumerated.items = MIC_BOOST_NUM_OF_STEPS; in ca0132_alt_mic_boost_info()
5660 if (uinfo->value.enumerated.item >= MIC_BOOST_NUM_OF_STEPS) in ca0132_alt_mic_boost_info()
5661 uinfo->value.enumerated.item = MIC_BOOST_NUM_OF_STEPS - 1; in ca0132_alt_mic_boost_info()
5662 sprintf(namestr, "%d %s", (uinfo->value.enumerated.item * 10), sfx); in ca0132_alt_mic_boost_info()
5663 strcpy(uinfo->value.enumerated.name, namestr); in ca0132_alt_mic_boost_info()
5671 struct ca0132_spec *spec = codec->spec; in ca0132_alt_mic_boost_get()
5673 ucontrol->value.enumerated.item[0] = spec->mic_boost_enum_val; in ca0132_alt_mic_boost_get()
5681 struct ca0132_spec *spec = codec->spec; in ca0132_alt_mic_boost_put()
5682 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_mic_boost_put()
5691 spec->mic_boost_enum_val = sel; in ca0132_alt_mic_boost_put()
5693 if (spec->in_enum_val != REAR_LINE_IN) in ca0132_alt_mic_boost_put()
5694 ca0132_alt_mic_boost_set(codec, spec->mic_boost_enum_val); in ca0132_alt_mic_boost_put()
5700 * Sound BlasterX AE-5 Headphone Gain Controls.
5709 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ae5_headphone_gain_info()
5710 uinfo->count = 1; in ae5_headphone_gain_info()
5711 uinfo->value.enumerated.items = AE5_HEADPHONE_GAIN_MAX; in ae5_headphone_gain_info()
5712 if (uinfo->value.enumerated.item >= AE5_HEADPHONE_GAIN_MAX) in ae5_headphone_gain_info()
5713 uinfo->value.enumerated.item = AE5_HEADPHONE_GAIN_MAX - 1; in ae5_headphone_gain_info()
5715 ae5_headphone_gain_presets[uinfo->value.enumerated.item].name, in ae5_headphone_gain_info()
5717 strcpy(uinfo->value.enumerated.name, namestr); in ae5_headphone_gain_info()
5725 struct ca0132_spec *spec = codec->spec; in ae5_headphone_gain_get()
5727 ucontrol->value.enumerated.item[0] = spec->ae5_headphone_gain_val; in ae5_headphone_gain_get()
5735 struct ca0132_spec *spec = codec->spec; in ae5_headphone_gain_put()
5736 int sel = ucontrol->value.enumerated.item[0]; in ae5_headphone_gain_put()
5745 spec->ae5_headphone_gain_val = sel; in ae5_headphone_gain_put()
5747 if (spec->out_enum_val == HEADPHONE_OUT) in ae5_headphone_gain_put()
5748 ae5_headphone_gain_set(codec, spec->ae5_headphone_gain_val); in ae5_headphone_gain_put()
5754 * Sound BlasterX AE-5 sound filter enumerated control.
5763 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ae5_sound_filter_info()
5764 uinfo->count = 1; in ae5_sound_filter_info()
5765 uinfo->value.enumerated.items = AE5_SOUND_FILTER_MAX; in ae5_sound_filter_info()
5766 if (uinfo->value.enumerated.item >= AE5_SOUND_FILTER_MAX) in ae5_sound_filter_info()
5767 uinfo->value.enumerated.item = AE5_SOUND_FILTER_MAX - 1; in ae5_sound_filter_info()
5769 ae5_filter_presets[uinfo->value.enumerated.item].name); in ae5_sound_filter_info()
5770 strcpy(uinfo->value.enumerated.name, namestr); in ae5_sound_filter_info()
5778 struct ca0132_spec *spec = codec->spec; in ae5_sound_filter_get()
5780 ucontrol->value.enumerated.item[0] = spec->ae5_filter_val; in ae5_sound_filter_get()
5788 struct ca0132_spec *spec = codec->spec; in ae5_sound_filter_put()
5789 int sel = ucontrol->value.enumerated.item[0]; in ae5_sound_filter_put()
5798 spec->ae5_filter_val = sel; in ae5_sound_filter_put()
5808 * front microphone has no auto-detect, and we need a way to set the rear
5809 * as line-in
5814 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_input_source_info()
5815 uinfo->count = 1; in ca0132_alt_input_source_info()
5816 uinfo->value.enumerated.items = IN_SRC_NUM_OF_INPUTS; in ca0132_alt_input_source_info()
5817 if (uinfo->value.enumerated.item >= IN_SRC_NUM_OF_INPUTS) in ca0132_alt_input_source_info()
5818 uinfo->value.enumerated.item = IN_SRC_NUM_OF_INPUTS - 1; in ca0132_alt_input_source_info()
5819 strcpy(uinfo->value.enumerated.name, in ca0132_alt_input_source_info()
5820 in_src_str[uinfo->value.enumerated.item]); in ca0132_alt_input_source_info()
5828 struct ca0132_spec *spec = codec->spec; in ca0132_alt_input_source_get()
5830 ucontrol->value.enumerated.item[0] = spec->in_enum_val; in ca0132_alt_input_source_get()
5838 struct ca0132_spec *spec = codec->spec; in ca0132_alt_input_source_put()
5839 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_input_source_put()
5843 * The AE-7 has no front microphone, so limit items to 2: rear mic and in ca0132_alt_input_source_put()
5844 * line-in. in ca0132_alt_input_source_put()
5855 spec->in_enum_val = sel; in ca0132_alt_input_source_put()
5866 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_output_select_get_info()
5867 uinfo->count = 1; in ca0132_alt_output_select_get_info()
5868 uinfo->value.enumerated.items = NUM_OF_OUTPUTS; in ca0132_alt_output_select_get_info()
5869 if (uinfo->value.enumerated.item >= NUM_OF_OUTPUTS) in ca0132_alt_output_select_get_info()
5870 uinfo->value.enumerated.item = NUM_OF_OUTPUTS - 1; in ca0132_alt_output_select_get_info()
5871 strcpy(uinfo->value.enumerated.name, in ca0132_alt_output_select_get_info()
5872 out_type_str[uinfo->value.enumerated.item]); in ca0132_alt_output_select_get_info()
5880 struct ca0132_spec *spec = codec->spec; in ca0132_alt_output_select_get()
5882 ucontrol->value.enumerated.item[0] = spec->out_enum_val; in ca0132_alt_output_select_get()
5890 struct ca0132_spec *spec = codec->spec; in ca0132_alt_output_select_put()
5891 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_output_select_put()
5901 spec->out_enum_val = sel; in ca0132_alt_output_select_put()
5903 auto_jack = spec->vnode_lswitch[VNID_HP_ASEL - VNODE_START_NID]; in ca0132_alt_output_select_put()
5917 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_speaker_channel_cfg_get_info()
5918 uinfo->count = 1; in ca0132_alt_speaker_channel_cfg_get_info()
5919 uinfo->value.enumerated.items = items; in ca0132_alt_speaker_channel_cfg_get_info()
5920 if (uinfo->value.enumerated.item >= items) in ca0132_alt_speaker_channel_cfg_get_info()
5921 uinfo->value.enumerated.item = items - 1; in ca0132_alt_speaker_channel_cfg_get_info()
5922 strcpy(uinfo->value.enumerated.name, in ca0132_alt_speaker_channel_cfg_get_info()
5923 speaker_channel_cfgs[uinfo->value.enumerated.item].name); in ca0132_alt_speaker_channel_cfg_get_info()
5931 struct ca0132_spec *spec = codec->spec; in ca0132_alt_speaker_channel_cfg_get()
5933 ucontrol->value.enumerated.item[0] = spec->channel_cfg_val; in ca0132_alt_speaker_channel_cfg_get()
5941 struct ca0132_spec *spec = codec->spec; in ca0132_alt_speaker_channel_cfg_put()
5942 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_speaker_channel_cfg_put()
5951 spec->channel_cfg_val = sel; in ca0132_alt_speaker_channel_cfg_put()
5953 if (spec->out_enum_val == SPEAKER_OUT) in ca0132_alt_speaker_channel_cfg_put()
5970 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_svm_setting_info()
5971 uinfo->count = 1; in ca0132_alt_svm_setting_info()
5972 uinfo->value.enumerated.items = NUM_OF_SVM_SETTINGS; in ca0132_alt_svm_setting_info()
5973 if (uinfo->value.enumerated.item >= NUM_OF_SVM_SETTINGS) in ca0132_alt_svm_setting_info()
5974 uinfo->value.enumerated.item = NUM_OF_SVM_SETTINGS - 1; in ca0132_alt_svm_setting_info()
5975 strcpy(uinfo->value.enumerated.name, in ca0132_alt_svm_setting_info()
5976 out_svm_set_enum_str[uinfo->value.enumerated.item]); in ca0132_alt_svm_setting_info()
5984 struct ca0132_spec *spec = codec->spec; in ca0132_alt_svm_setting_get()
5986 ucontrol->value.enumerated.item[0] = spec->smart_volume_setting; in ca0132_alt_svm_setting_get()
5994 struct ca0132_spec *spec = codec->spec; in ca0132_alt_svm_setting_put()
5995 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_svm_setting_put()
5997 unsigned int idx = SMART_VOLUME - EFFECT_START_NID; in ca0132_alt_svm_setting_put()
6006 spec->smart_volume_setting = sel; in ca0132_alt_svm_setting_put()
6034 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_eq_preset_info()
6035 uinfo->count = 1; in ca0132_alt_eq_preset_info()
6036 uinfo->value.enumerated.items = items; in ca0132_alt_eq_preset_info()
6037 if (uinfo->value.enumerated.item >= items) in ca0132_alt_eq_preset_info()
6038 uinfo->value.enumerated.item = items - 1; in ca0132_alt_eq_preset_info()
6039 strcpy(uinfo->value.enumerated.name, in ca0132_alt_eq_preset_info()
6040 ca0132_alt_eq_presets[uinfo->value.enumerated.item].name); in ca0132_alt_eq_preset_info()
6048 struct ca0132_spec *spec = codec->spec; in ca0132_alt_eq_preset_get()
6050 ucontrol->value.enumerated.item[0] = spec->eq_preset_val; in ca0132_alt_eq_preset_get()
6058 struct ca0132_spec *spec = codec->spec; in ca0132_alt_eq_preset_put()
6060 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_eq_preset_put()
6081 spec->eq_preset_val = sel; in ca0132_alt_eq_preset_put()
6091 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_voicefx_info()
6092 uinfo->count = 1; in ca0132_voicefx_info()
6093 uinfo->value.enumerated.items = items; in ca0132_voicefx_info()
6094 if (uinfo->value.enumerated.item >= items) in ca0132_voicefx_info()
6095 uinfo->value.enumerated.item = items - 1; in ca0132_voicefx_info()
6096 strcpy(uinfo->value.enumerated.name, in ca0132_voicefx_info()
6097 ca0132_voicefx_presets[uinfo->value.enumerated.item].name); in ca0132_voicefx_info()
6105 struct ca0132_spec *spec = codec->spec; in ca0132_voicefx_get()
6107 ucontrol->value.enumerated.item[0] = spec->voicefx_val; in ca0132_voicefx_get()
6115 struct ca0132_spec *spec = codec->spec; in ca0132_voicefx_put()
6117 int sel = ucontrol->value.enumerated.item[0]; in ca0132_voicefx_put()
6138 spec->voicefx_val = sel; in ca0132_voicefx_put()
6150 struct ca0132_spec *spec = codec->spec; in ca0132_switch_get()
6153 long *valp = ucontrol->value.integer.value; in ca0132_switch_get()
6158 *valp = spec->vnode_lswitch[nid - VNODE_START_NID]; in ca0132_switch_get()
6162 *valp = spec->vnode_rswitch[nid - VNODE_START_NID]; in ca0132_switch_get()
6170 *valp = spec->effects_switch[nid - EFFECT_START_NID]; in ca0132_switch_get()
6175 if (nid == spec->input_pins[0]) { in ca0132_switch_get()
6176 *valp = spec->cur_mic_boost; in ca0132_switch_get()
6181 *valp = spec->zxr_gain_set; in ca0132_switch_get()
6186 *valp = spec->speaker_range_val[nid - SPEAKER_FULL_RANGE_FRONT]; in ca0132_switch_get()
6191 *valp = spec->bass_redirection_val; in ca0132_switch_get()
6202 struct ca0132_spec *spec = codec->spec; in ca0132_switch_put()
6205 long *valp = ucontrol->value.integer.value; in ca0132_switch_put()
6215 spec->vnode_lswitch[nid - VNODE_START_NID] = *valp; in ca0132_switch_put()
6219 spec->vnode_rswitch[nid - VNODE_START_NID] = *valp; in ca0132_switch_put()
6228 spec->effects_switch[nid - EFFECT_START_NID] = *valp; in ca0132_switch_put()
6235 spec->effects_switch[nid - EFFECT_START_NID] = *valp; in ca0132_switch_put()
6243 spec->effects_switch[nid - EFFECT_START_NID] = *valp; in ca0132_switch_put()
6249 if (nid == spec->input_pins[0]) { in ca0132_switch_put()
6250 spec->cur_mic_boost = *valp; in ca0132_switch_put()
6252 if (spec->in_enum_val != REAR_LINE_IN) in ca0132_switch_put()
6256 if (spec->cur_mic_type != DIGITAL_MIC) in ca0132_switch_put()
6264 spec->zxr_gain_set = *valp; in ca0132_switch_put()
6265 if (spec->cur_out_type == HEADPHONE_OUT) in ca0132_switch_put()
6274 spec->speaker_range_val[nid - SPEAKER_FULL_RANGE_FRONT] = *valp; in ca0132_switch_put()
6275 if (spec->cur_out_type == SPEAKER_OUT) in ca0132_switch_put()
6282 spec->bass_redirection_val = *valp; in ca0132_switch_put()
6283 if (spec->cur_out_type == SPEAKER_OUT) in ca0132_switch_put()
6304 struct ca0132_spec *spec = codec->spec; in ca0132_alt_dsp_volume_put()
6313 lookup_val = spec->vnode_lvol[nid - VNODE_START_NID]; in ca0132_alt_dsp_volume_put()
6320 lookup_val = spec->vnode_rvol[nid - VNODE_START_NID]; in ca0132_alt_dsp_volume_put()
6336 struct ca0132_spec *spec = codec->spec; in ca0132_volume_info()
6346 nid = spec->shared_out_nid; in ca0132_volume_info()
6347 mutex_lock(&codec->control_mutex); in ca0132_volume_info()
6348 pval = kcontrol->private_value; in ca0132_volume_info()
6349 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(nid, ch, 0, dir); in ca0132_volume_info()
6351 kcontrol->private_value = pval; in ca0132_volume_info()
6352 mutex_unlock(&codec->control_mutex); in ca0132_volume_info()
6356 nid = spec->shared_mic_nid; in ca0132_volume_info()
6357 mutex_lock(&codec->control_mutex); in ca0132_volume_info()
6358 pval = kcontrol->private_value; in ca0132_volume_info()
6359 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(nid, ch, 0, dir); in ca0132_volume_info()
6361 kcontrol->private_value = pval; in ca0132_volume_info()
6362 mutex_unlock(&codec->control_mutex); in ca0132_volume_info()
6374 struct ca0132_spec *spec = codec->spec; in ca0132_volume_get()
6377 long *valp = ucontrol->value.integer.value; in ca0132_volume_get()
6381 *valp = spec->vnode_lvol[nid - VNODE_START_NID]; in ca0132_volume_get()
6385 *valp = spec->vnode_rvol[nid - VNODE_START_NID]; in ca0132_volume_get()
6395 struct ca0132_spec *spec = codec->spec; in ca0132_volume_put()
6398 long *valp = ucontrol->value.integer.value; in ca0132_volume_put()
6405 spec->vnode_lvol[nid - VNODE_START_NID] = *valp; in ca0132_volume_put()
6409 spec->vnode_rvol[nid - VNODE_START_NID] = *valp; in ca0132_volume_put()
6420 mutex_lock(&codec->control_mutex); in ca0132_volume_put()
6421 pval = kcontrol->private_value; in ca0132_volume_put()
6422 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(shared_nid, ch, in ca0132_volume_put()
6425 kcontrol->private_value = pval; in ca0132_volume_put()
6426 mutex_unlock(&codec->control_mutex); in ca0132_volume_put()
6442 struct ca0132_spec *spec = codec->spec; in ca0132_alt_volume_put()
6445 long *valp = ucontrol->value.integer.value; in ca0132_alt_volume_put()
6460 spec->vnode_lvol[vnid - VNODE_START_NID] = *valp; in ca0132_alt_volume_put()
6464 spec->vnode_rvol[vnid - VNODE_START_NID] = *valp; in ca0132_alt_volume_put()
6470 mutex_lock(&codec->control_mutex); in ca0132_alt_volume_put()
6472 mutex_unlock(&codec->control_mutex); in ca0132_alt_volume_put()
6482 struct ca0132_spec *spec = codec->spec; in ca0132_volume_tlv()
6492 nid = spec->shared_out_nid; in ca0132_volume_tlv()
6493 mutex_lock(&codec->control_mutex); in ca0132_volume_tlv()
6494 pval = kcontrol->private_value; in ca0132_volume_tlv()
6495 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(nid, ch, 0, dir); in ca0132_volume_tlv()
6497 kcontrol->private_value = pval; in ca0132_volume_tlv()
6498 mutex_unlock(&codec->control_mutex); in ca0132_volume_tlv()
6502 nid = spec->shared_mic_nid; in ca0132_volume_tlv()
6503 mutex_lock(&codec->control_mutex); in ca0132_volume_tlv()
6504 pval = kcontrol->private_value; in ca0132_volume_tlv()
6505 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(nid, ch, 0, dir); in ca0132_volume_tlv()
6507 kcontrol->private_value = pval; in ca0132_volume_tlv()
6508 mutex_unlock(&codec->control_mutex); in ca0132_volume_tlv()
6555 struct ca0132_spec *spec = codec->spec; in add_fx_switch()
6654 CA0132_CODEC_MUTE_MONO("Full-Range Front Speakers", in ca0132_alt_add_front_full_range_switch()
6664 CA0132_CODEC_MUTE_MONO("Full-Range Rear Speakers", in ca0132_alt_add_rear_full_range_switch()
6673 * channel on speakers that are set as not being full-range. On configurations
6675 * replacement for X-Bass on configurations with an LFE channel.
6706 * because the front microphone has no auto-detect, and Line-in has to be set
6739 * Add headphone gain enumerated control for the AE-5. This switches between
6740 * three modes, low, medium, and high. When non-headphone outputs are selected,
6746 HDA_CODEC_MUTE_MONO("AE-5: Headphone Gain", in ae5_add_headphone_gain_enum()
6756 * Add sound filter enumerated control for the AE-5. This adds three different
6758 * read into it, it changes the DAC's interpolation filter.
6763 HDA_CODEC_MUTE_MONO("AE-5: Sound Filter", in ae5_add_sound_filter_enum()
6814 list_for_each_entry(pcm, &codec->pcm_list_head, list) { in ca0132_alt_add_chmap_ctls()
6816 &pcm->stream[SNDRV_PCM_STREAM_PLAYBACK]; in ca0132_alt_add_chmap_ctls()
6821 if (hinfo->channels_max == 6) { in ca0132_alt_add_chmap_ctls()
6822 err = snd_pcm_add_chmap_ctls(pcm->pcm, in ca0132_alt_add_chmap_ctls()
6824 elem, hinfo->channels_max, 0, &chmap); in ca0132_alt_add_chmap_ctls()
6840 HDA_CODEC_VOLUME("Analog-Mic2 Capture Volume", 0x08, 0, HDA_INPUT),
6841 HDA_CODEC_MUTE("Analog-Mic2 Capture Switch", 0x08, 0, HDA_INPUT),
6844 CA0132_CODEC_MUTE_MONO("Mic1-Boost (30dB) Capture Switch",
6858 * Desktop specific control mixer. Removes auto-detect for mic, and adds
6904 struct ca0132_spec *spec = codec->spec; in ca0132_build_controls()
6909 for (i = 0; i < spec->num_mixers; i++) { in ca0132_build_controls()
6910 err = snd_hda_add_new_ctls(codec, spec->mixers[i]); in ca0132_build_controls()
6916 snd_hda_set_vmaster_tlv(codec, spec->dacs[0], HDA_OUTPUT, in ca0132_build_controls()
6917 spec->tlv); in ca0132_build_controls()
6919 spec->tlv, ca0132_alt_follower_pfxs, in ca0132_build_controls()
6924 true, &spec->vmaster_mute.sw_kctl); in ca0132_build_controls()
6936 if (i == (ECHO_CANCELLATION - IN_EFFECT_START_NID + in ca0132_build_controls()
6971 num_sliders = OUT_EFFECTS_COUNT - 1; in ca0132_build_controls()
6982 "X-Bass Crossover", EFX_DIR_OUT); in ca0132_build_controls()
7030 * header on the card, and aux-in is handled by the DBPro board. in ca0132_build_controls()
7062 err = snd_hda_jack_add_kctls(codec, &spec->autocfg); in ca0132_build_controls()
7066 if (spec->dig_out) { in ca0132_build_controls()
7067 err = snd_hda_create_spdif_out_ctls(codec, spec->dig_out, in ca0132_build_controls()
7068 spec->dig_out); in ca0132_build_controls()
7071 err = snd_hda_create_spdif_share_sw(codec, &spec->multiout); in ca0132_build_controls()
7074 /* spec->multiout.share_spdif = 1; */ in ca0132_build_controls()
7077 if (spec->dig_in) { in ca0132_build_controls()
7078 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in); in ca0132_build_controls()
7091 struct ca0132_spec *spec = codec->spec; in dbpro_build_controls()
7094 if (spec->dig_out) { in dbpro_build_controls()
7095 err = snd_hda_create_spdif_out_ctls(codec, spec->dig_out, in dbpro_build_controls()
7096 spec->dig_out); in dbpro_build_controls()
7101 if (spec->dig_in) { in dbpro_build_controls()
7102 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in); in dbpro_build_controls()
7155 struct ca0132_spec *spec = codec->spec; in ca0132_build_pcms()
7160 return -ENOMEM; in ca0132_build_pcms()
7162 info->own_chmap = true; in ca0132_build_pcms()
7163 info->stream[SNDRV_PCM_STREAM_PLAYBACK].chmap in ca0132_build_pcms()
7166 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = ca0132_pcm_analog_playback; in ca0132_build_pcms()
7167 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->dacs[0]; in ca0132_build_pcms()
7168 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = in ca0132_build_pcms()
7169 spec->multiout.max_channels; in ca0132_build_pcms()
7170 info->stream[SNDRV_PCM_STREAM_CAPTURE] = ca0132_pcm_analog_capture; in ca0132_build_pcms()
7171 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = 1; in ca0132_build_pcms()
7172 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adcs[0]; in ca0132_build_pcms()
7176 info = snd_hda_codec_pcm_new(codec, "CA0132 Analog Mic-In2"); in ca0132_build_pcms()
7178 return -ENOMEM; in ca0132_build_pcms()
7179 info->stream[SNDRV_PCM_STREAM_CAPTURE] = in ca0132_build_pcms()
7181 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = 1; in ca0132_build_pcms()
7182 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adcs[1]; in ca0132_build_pcms()
7187 return -ENOMEM; in ca0132_build_pcms()
7188 info->stream[SNDRV_PCM_STREAM_CAPTURE] = ca0132_pcm_analog_capture; in ca0132_build_pcms()
7189 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = 1; in ca0132_build_pcms()
7190 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adcs[2]; in ca0132_build_pcms()
7192 if (!spec->dig_out && !spec->dig_in) in ca0132_build_pcms()
7197 return -ENOMEM; in ca0132_build_pcms()
7198 info->pcm_type = HDA_PCM_TYPE_SPDIF; in ca0132_build_pcms()
7199 if (spec->dig_out) { in ca0132_build_pcms()
7200 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = in ca0132_build_pcms()
7202 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->dig_out; in ca0132_build_pcms()
7204 if (spec->dig_in) { in ca0132_build_pcms()
7205 info->stream[SNDRV_PCM_STREAM_CAPTURE] = in ca0132_build_pcms()
7207 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in; in ca0132_build_pcms()
7215 struct ca0132_spec *spec = codec->spec; in dbpro_build_pcms()
7220 return -ENOMEM; in dbpro_build_pcms()
7221 info->stream[SNDRV_PCM_STREAM_CAPTURE] = ca0132_pcm_analog_capture; in dbpro_build_pcms()
7222 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = 1; in dbpro_build_pcms()
7223 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adcs[0]; in dbpro_build_pcms()
7226 if (!spec->dig_out && !spec->dig_in) in dbpro_build_pcms()
7231 return -ENOMEM; in dbpro_build_pcms()
7232 info->pcm_type = HDA_PCM_TYPE_SPDIF; in dbpro_build_pcms()
7233 if (spec->dig_out) { in dbpro_build_pcms()
7234 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = in dbpro_build_pcms()
7236 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->dig_out; in dbpro_build_pcms()
7238 if (spec->dig_in) { in dbpro_build_pcms()
7239 info->stream[SNDRV_PCM_STREAM_CAPTURE] = in dbpro_build_pcms()
7241 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in; in dbpro_build_pcms()
7292 * Switch between Digital built-in mic and analog mic.
7296 struct ca0132_spec *spec = codec->spec; in ca0132_set_dmic()
7306 /* set DMic input as 2-ch */ in ca0132_set_dmic()
7310 val = spec->dmic_ctl; in ca0132_set_dmic()
7312 snd_hda_codec_write(codec, spec->input_pins[0], 0, in ca0132_set_dmic()
7315 if (!(spec->dmic_ctl & 0x20)) in ca0132_set_dmic()
7322 val = spec->dmic_ctl; in ca0132_set_dmic()
7325 snd_hda_codec_write(codec, spec->input_pins[0], 0, in ca0132_set_dmic()
7328 if (!(spec->dmic_ctl & 0x20)) in ca0132_set_dmic()
7340 struct ca0132_spec *spec = codec->spec; in ca0132_init_dmic()
7348 * Bit 2-0: MPIO select in ca0132_init_dmic()
7350 * Bit 7-4: reserved in ca0132_init_dmic()
7353 snd_hda_codec_write(codec, spec->input_pins[0], 0, in ca0132_init_dmic()
7357 * Bit 2-0: Data1 MPIO select in ca0132_init_dmic()
7359 * Bit 6-4: Data2 MPIO select in ca0132_init_dmic()
7363 snd_hda_codec_write(codec, spec->input_pins[0], 0, in ca0132_init_dmic()
7366 /* Use Ch-0 and Ch-1. Rate is 48K, mode 1. Disable DMic first. in ca0132_init_dmic()
7367 * Bit 3-0: Channel mask in ca0132_init_dmic()
7378 spec->dmic_ctl = val; in ca0132_init_dmic()
7379 snd_hda_codec_write(codec, spec->input_pins[0], 0, in ca0132_init_dmic()
7388 struct ca0132_spec *spec = codec->spec; in ca0132_init_analog_mic2()
7390 mutex_lock(&spec->chipio_mutex); in ca0132_init_analog_mic2()
7403 mutex_unlock(&spec->chipio_mutex); in ca0132_init_analog_mic2()
7408 struct ca0132_spec *spec = codec->spec; in ca0132_refresh_widget_caps()
7414 for (i = 0; i < spec->multiout.num_dacs; i++) in ca0132_refresh_widget_caps()
7415 refresh_amp_caps(codec, spec->dacs[i], HDA_OUTPUT); in ca0132_refresh_widget_caps()
7417 for (i = 0; i < spec->num_outputs; i++) in ca0132_refresh_widget_caps()
7418 refresh_amp_caps(codec, spec->out_pins[i], HDA_OUTPUT); in ca0132_refresh_widget_caps()
7420 for (i = 0; i < spec->num_inputs; i++) { in ca0132_refresh_widget_caps()
7421 refresh_amp_caps(codec, spec->adcs[i], HDA_INPUT); in ca0132_refresh_widget_caps()
7422 refresh_amp_caps(codec, spec->input_pins[i], HDA_INPUT); in ca0132_refresh_widget_caps()
7430 /* Non-zero values are floating point 0.000198. */
7435 /* Non-zero values are floating point 0.000220. */
7440 /* Non-zero values are floating point 0.000100. */
7449 struct ca0132_spec *spec = codec->spec; in ca0132_alt_init_speaker_tuning()
7494 struct ca0132_spec *spec = codec->spec; in ca0132_alt_create_dummy_stream()
7500 snd_hda_codec_setup_stream(codec, spec->dacs[0], spec->dsp_stream_id, in ca0132_alt_create_dummy_stream()
7503 snd_hda_codec_cleanup_stream(codec, spec->dacs[0]); in ca0132_alt_create_dummy_stream()
7507 * Initialize mic for non-chromebook ca0132 implementations.
7511 struct ca0132_spec *spec = codec->spec; in ca0132_alt_init_analog_mics()
7541 struct ca0132_spec *spec = codec->spec; in sbz_connect_streams()
7543 mutex_lock(&spec->chipio_mutex); in sbz_connect_streams()
7562 mutex_unlock(&spec->chipio_mutex); in sbz_connect_streams()
7573 struct ca0132_spec *spec = codec->spec; in sbz_chipio_startup_data()
7575 mutex_lock(&spec->chipio_mutex); in sbz_chipio_startup_data()
7615 mutex_unlock(&spec->chipio_mutex); in sbz_chipio_startup_data()
7624 struct ca0132_spec *spec = codec->spec; in ca0132_alt_dsp_scp_startup()
7671 struct ca0132_spec *spec = codec->spec; in ca0132_alt_dsp_initial_mic_setup()
7702 struct ca0132_spec *spec = codec->spec; in ae5_post_dsp_register_set()
7710 writeb(0xff, spec->mem_base + 0x304); 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(0x00, spec->mem_base + 0x100); in ae5_post_dsp_register_set()
7715 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7716 writeb(0x00, spec->mem_base + 0x100); in ae5_post_dsp_register_set()
7717 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7718 writeb(0x00, spec->mem_base + 0x100); in ae5_post_dsp_register_set()
7719 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7720 writeb(0x00, spec->mem_base + 0x100); in ae5_post_dsp_register_set()
7721 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7733 * AE-5's registry values in Windows. in ae5_post_dsp_param_setup()
7738 * change colors on the external LED strip connected to the AE-5. in ae5_post_dsp_param_setup()
7783 struct ca0132_spec *spec = codec->spec; in ae5_post_dsp_stream_setup()
7785 mutex_lock(&spec->chipio_mutex); in ae5_post_dsp_stream_setup()
7810 mutex_unlock(&spec->chipio_mutex); in ae5_post_dsp_stream_setup()
7815 struct ca0132_spec *spec = codec->spec; in ae5_post_dsp_startup_data()
7817 mutex_lock(&spec->chipio_mutex); in ae5_post_dsp_startup_data()
7842 mutex_unlock(&spec->chipio_mutex); in ae5_post_dsp_startup_data()
7852 struct ca0132_spec *spec = codec->spec; in ae7_post_dsp_setup_ports()
7855 mutex_lock(&spec->chipio_mutex); in ae7_post_dsp_setup_ports()
7865 /* Addresses are incremented by 4-bytes. */ in ae7_post_dsp_setup_ports()
7883 mutex_unlock(&spec->chipio_mutex); in ae7_post_dsp_setup_ports()
7888 struct ca0132_spec *spec = codec->spec; in ae7_post_dsp_asi_stream_setup()
7890 mutex_lock(&spec->chipio_mutex); in ae7_post_dsp_asi_stream_setup()
7908 mutex_unlock(&spec->chipio_mutex); in ae7_post_dsp_asi_stream_setup()
7931 struct ca0132_spec *spec = codec->spec; in ae7_post_dsp_asi_setup_ports()
7940 mutex_lock(&spec->chipio_mutex); in ae7_post_dsp_asi_setup_ports()
7980 * know what data is being sent. Interestingly, the AE-5 seems to go in ae7_post_dsp_asi_setup_ports()
7982 * step, but the AE-7 does. in ae7_post_dsp_asi_setup_ports()
8006 mutex_unlock(&spec->chipio_mutex); in ae7_post_dsp_asi_setup_ports()
8056 struct ca0132_spec *spec = codec->spec; in ca0132_setup_defaults()
8061 if (spec->dsp_state != DSP_DOWNLOADED) in ca0132_setup_defaults()
8101 struct ca0132_spec *spec = codec->spec; in r3d_setup_defaults()
8106 if (spec->dsp_state != DSP_DOWNLOADED) in r3d_setup_defaults()
8151 struct ca0132_spec *spec = codec->spec; in sbz_setup_defaults()
8156 if (spec->dsp_state != DSP_DOWNLOADED) in sbz_setup_defaults()
8206 * Setup default parameters for the Sound BlasterX AE-5 DSP.
8210 struct ca0132_spec *spec = codec->spec; in ae5_setup_defaults()
8215 if (spec->dsp_state != DSP_DOWNLOADED) in ae5_setup_defaults()
8275 * Setup default parameters for the Sound Blaster AE-7 DSP.
8279 struct ca0132_spec *spec = codec->spec; in ae7_setup_defaults()
8284 if (spec->dsp_state != DSP_DOWNLOADED) in ae7_setup_defaults()
8364 struct ca0132_spec *spec = codec->spec; in ca0132_init_flags()
8397 struct ca0132_spec *spec = codec->spec; in ca0132_init_params()
8428 struct ca0132_spec *spec = codec->spec; in ca0132_download_dsp_images()
8441 codec->card->dev) != 0) in ca0132_download_dsp_images()
8448 codec->card->dev) != 0) in ca0132_download_dsp_images()
8463 codec->card->dev) != 0) in ca0132_download_dsp_images()
8467 dsp_os_image = (struct dsp_image_seg *)(fw_entry->data); in ca0132_download_dsp_images()
8483 struct ca0132_spec *spec = codec->spec; in ca0132_download_dsp()
8489 if (spec->dsp_state == DSP_DOWNLOAD_FAILED) in ca0132_download_dsp()
8493 if (spec->dsp_state != DSP_DOWNLOADED) { in ca0132_download_dsp()
8494 spec->dsp_state = DSP_DOWNLOADING; in ca0132_download_dsp()
8497 spec->dsp_state = DSP_DOWNLOAD_FAILED; in ca0132_download_dsp()
8499 spec->dsp_state = DSP_DOWNLOADED; in ca0132_download_dsp()
8503 if (spec->dsp_state == DSP_DOWNLOADED && !ca0132_use_alt_functions(spec)) in ca0132_download_dsp()
8510 struct ca0132_spec *spec = codec->spec; in ca0132_process_dsp_response()
8514 if (spec->wait_scp) { in ca0132_process_dsp_response()
8516 spec->wait_scp = 0; in ca0132_process_dsp_response()
8525 struct ca0132_spec *spec = codec->spec; in hp_callback()
8528 /* Delay enabling the HP amp, to let the mic-detection in hp_callback()
8531 tbl = snd_hda_jack_tbl_get(codec, cb->nid); in hp_callback()
8533 tbl->block_report = 1; in hp_callback()
8534 schedule_delayed_work(&spec->unsol_hp_work, msecs_to_jiffies(500)); in hp_callback()
8539 struct ca0132_spec *spec = codec->spec; in amic_callback()
8549 struct ca0132_spec *spec = codec->spec; in ca0132_init_unsol()
8550 snd_hda_jack_detect_enable_callback(codec, spec->unsol_tag_hp, hp_callback); in ca0132_init_unsol()
8551 snd_hda_jack_detect_enable_callback(codec, spec->unsol_tag_amic1, in ca0132_init_unsol()
8558 spec->unsol_tag_front_hp, hp_callback); in ca0132_init_unsol()
8638 struct ca0132_spec *spec = codec->spec; in ca0132_init_chip()
8643 mutex_init(&spec->chipio_mutex); in ca0132_init_chip()
8645 spec->cur_out_type = SPEAKER_OUT; in ca0132_init_chip()
8647 spec->cur_mic_type = DIGITAL_MIC; in ca0132_init_chip()
8649 spec->cur_mic_type = REAR_MIC; in ca0132_init_chip()
8651 spec->cur_mic_boost = 0; in ca0132_init_chip()
8654 spec->vnode_lvol[i] = 0x5a; in ca0132_init_chip()
8655 spec->vnode_rvol[i] = 0x5a; in ca0132_init_chip()
8656 spec->vnode_lswitch[i] = 0; in ca0132_init_chip()
8657 spec->vnode_rswitch[i] = 0; in ca0132_init_chip()
8666 spec->effects_switch[i] = on ? 1 : 0; in ca0132_init_chip()
8670 * ca0132 codecs. Also sets x-bass crossover frequency to 80hz. in ca0132_init_chip()
8674 spec->speaker_range_val[0] = 1; in ca0132_init_chip()
8675 spec->speaker_range_val[1] = 1; in ca0132_init_chip()
8677 spec->xbass_xover_freq = 8; in ca0132_init_chip()
8679 spec->fx_ctl_val[i] = effect_slider_defaults[i]; in ca0132_init_chip()
8681 spec->bass_redirect_xover_freq = 8; in ca0132_init_chip()
8684 spec->voicefx_val = 0; in ca0132_init_chip()
8685 spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID] = 1; in ca0132_init_chip()
8686 spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID] = 0; in ca0132_init_chip()
8689 * The ZxR doesn't have a front panel header, and it's line-in is on in ca0132_init_chip()
8691 * to make sure that spec->in_enum_val is set properly. in ca0132_init_chip()
8694 spec->in_enum_val = REAR_MIC; in ca0132_init_chip()
8715 struct ca0132_spec *spec = codec->spec; in sbz_region2_exit()
8719 writeb(0x0, spec->mem_base + 0x100); in sbz_region2_exit()
8721 writeb(0xb3, spec->mem_base + 0x304); in sbz_region2_exit()
8786 sbz_gpio_shutdown_commands(codec, 0x07, 0x07, -1); in sbz_exit_chip()
8921 struct ca0132_spec *spec = codec->spec; in sbz_dsp_startup_check()
8928 if (spec->startup_check_entered) in sbz_dsp_startup_check()
8931 spec->startup_check_entered = true; in sbz_dsp_startup_check()
8953 spec->dsp_state = DSP_DOWNLOAD_INIT; in sbz_dsp_startup_check()
8954 codec->patch_ops.init(codec); in sbz_dsp_startup_check()
8964 reload--; in sbz_dsp_startup_check()
9001 struct ca0132_spec *spec = codec->spec; in sbz_pre_dsp_setup()
9003 writel(0x00820680, spec->mem_base + 0x01C); in sbz_pre_dsp_setup()
9004 writel(0x00820680, spec->mem_base + 0x01C); in sbz_pre_dsp_setup()
9093 struct ca0132_spec *spec = codec->spec; in ca0132_mmio_init_sbz()
9099 writel(0x00000000, spec->mem_base + addr[i]); in ca0132_mmio_init_sbz()
9122 writel(tmp[i], spec->mem_base + addr[cur_addr + i]); in ca0132_mmio_init_sbz()
9138 writel(data[i], spec->mem_base + addr[cur_addr + i]); in ca0132_mmio_init_sbz()
9143 struct ca0132_spec *spec = codec->spec; in ca0132_mmio_init_ae5()
9152 writel(0x00000680, spec->mem_base + 0x1c); in ca0132_mmio_init_ae5()
9153 writel(0x00880680, spec->mem_base + 0x1c); in ca0132_mmio_init_ae5()
9158 * AE-7 shares all writes with the AE-5, except that it writes in ca0132_mmio_init_ae5()
9162 writel(0x00800001, spec->mem_base + addr[i]); in ca0132_mmio_init_ae5()
9166 writel(data[i], spec->mem_base + addr[i]); in ca0132_mmio_init_ae5()
9170 writel(0x00880680, spec->mem_base + 0x1c); in ca0132_mmio_init_ae5()
9175 struct ca0132_spec *spec = codec->spec; in ca0132_mmio_init()
9208 struct ca0132_spec *spec = codec->spec; in ae5_register_set()
9239 writeb(tmp[i], spec->mem_base + addr[cur_addr]); in ae5_register_set()
9246 writeb(data[i], spec->mem_base + addr[cur_addr]); in ae5_register_set()
9249 writel(data[i], spec->mem_base + addr[cur_addr]); in ae5_register_set()
9251 writel(0x00800001, spec->mem_base + 0x20c); in ae5_register_set()
9279 struct ca0132_spec *spec = codec->spec; in ca0132_alt_init()
9288 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9289 snd_hda_sequence_write(codec, spec->desktop_init_verbs); in ca0132_alt_init()
9297 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9302 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9303 snd_hda_sequence_write(codec, spec->desktop_init_verbs); in ca0132_alt_init()
9312 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9313 snd_hda_sequence_write(codec, spec->desktop_init_verbs); in ca0132_alt_init()
9322 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9323 snd_hda_sequence_write(codec, spec->desktop_init_verbs); in ca0132_alt_init()
9330 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9331 snd_hda_sequence_write(codec, spec->desktop_init_verbs); in ca0132_alt_init()
9340 struct ca0132_spec *spec = codec->spec; in ca0132_init()
9341 struct auto_pin_cfg *cfg = &spec->autocfg; in ca0132_init()
9355 if (spec->dsp_state == DSP_DOWNLOADED) { in ca0132_init()
9358 spec->dsp_reload = true; in ca0132_init()
9359 spec->dsp_state = DSP_DOWNLOAD_INIT; in ca0132_init()
9367 if (spec->dsp_state != DSP_DOWNLOAD_FAILED) in ca0132_init()
9368 spec->dsp_state = DSP_DOWNLOAD_INIT; in ca0132_init()
9369 spec->curr_chip_addx = INVALID_CHIP_ADDRESS; in ca0132_init()
9383 snd_hda_sequence_write(codec, spec->base_init_verbs); in ca0132_init()
9414 for (i = 0; i < spec->num_outputs; i++) in ca0132_init()
9415 init_output(codec, spec->out_pins[i], spec->dacs[0]); in ca0132_init()
9417 init_output(codec, cfg->dig_out_pins[0], spec->dig_out); in ca0132_init()
9419 for (i = 0; i < spec->num_inputs; i++) in ca0132_init()
9420 init_input(codec, spec->input_pins[i], spec->adcs[i]); in ca0132_init()
9422 init_input(codec, cfg->dig_in_pin, spec->dig_in); in ca0132_init()
9425 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_init()
9435 snd_hda_sequence_write(codec, spec->spec_init_verbs); in ca0132_init()
9450 if (spec->dsp_reload) { in ca0132_init()
9451 spec->dsp_reload = false; in ca0132_init()
9462 struct ca0132_spec *spec = codec->spec; in dbpro_init()
9463 struct auto_pin_cfg *cfg = &spec->autocfg; in dbpro_init()
9466 init_output(codec, cfg->dig_out_pins[0], spec->dig_out); in dbpro_init()
9467 init_input(codec, cfg->dig_in_pin, spec->dig_in); in dbpro_init()
9469 for (i = 0; i < spec->num_inputs; i++) in dbpro_init()
9470 init_input(codec, spec->input_pins[i], spec->adcs[i]); in dbpro_init()
9477 struct ca0132_spec *spec = codec->spec; in ca0132_free()
9479 cancel_delayed_work_sync(&spec->unsol_hp_work); in ca0132_free()
9504 snd_hda_sequence_write(codec, spec->base_exit_verbs); in ca0132_free()
9509 if (spec->mem_base) in ca0132_free()
9510 pci_iounmap(codec->bus->pci, spec->mem_base); in ca0132_free()
9512 kfree(spec->spec_init_verbs); in ca0132_free()
9513 kfree(codec->spec); in ca0132_free()
9518 struct ca0132_spec *spec = codec->spec; in dbpro_free()
9522 kfree(spec->spec_init_verbs); in dbpro_free()
9523 kfree(codec->spec); in dbpro_free()
9528 codec->patch_ops.free(codec); in ca0132_reboot_notify()
9534 struct ca0132_spec *spec = codec->spec; in ca0132_suspend()
9536 cancel_delayed_work_sync(&spec->unsol_hp_work); in ca0132_suspend()
9562 struct ca0132_spec *spec = codec->spec; in ca0132_config()
9564 spec->dacs[0] = 0x2; in ca0132_config()
9565 spec->dacs[1] = 0x3; in ca0132_config()
9566 spec->dacs[2] = 0x4; in ca0132_config()
9568 spec->multiout.dac_nids = spec->dacs; in ca0132_config()
9569 spec->multiout.num_dacs = 3; in ca0132_config()
9572 spec->multiout.max_channels = 2; in ca0132_config()
9574 spec->multiout.max_channels = 6; in ca0132_config()
9611 spec->num_outputs = 2; in ca0132_config()
9612 spec->out_pins[0] = 0x0b; /* speaker out */ in ca0132_config()
9613 spec->out_pins[1] = 0x0f; in ca0132_config()
9614 spec->shared_out_nid = 0x2; in ca0132_config()
9615 spec->unsol_tag_hp = 0x0f; in ca0132_config()
9617 spec->adcs[0] = 0x7; /* digital mic / analog mic1 */ in ca0132_config()
9618 spec->adcs[1] = 0x8; /* analog mic2 */ in ca0132_config()
9619 spec->adcs[2] = 0xa; /* what u hear */ in ca0132_config()
9621 spec->num_inputs = 3; in ca0132_config()
9622 spec->input_pins[0] = 0x12; in ca0132_config()
9623 spec->input_pins[1] = 0x11; in ca0132_config()
9624 spec->input_pins[2] = 0x13; in ca0132_config()
9625 spec->shared_mic_nid = 0x7; in ca0132_config()
9626 spec->unsol_tag_amic1 = 0x11; in ca0132_config()
9630 spec->num_outputs = 2; in ca0132_config()
9631 spec->out_pins[0] = 0x0B; /* Line out */ in ca0132_config()
9632 spec->out_pins[1] = 0x0F; /* Rear headphone out */ in ca0132_config()
9633 spec->out_pins[2] = 0x10; /* Front Headphone / Center/LFE*/ in ca0132_config()
9634 spec->out_pins[3] = 0x11; /* Rear surround */ in ca0132_config()
9635 spec->shared_out_nid = 0x2; in ca0132_config()
9636 spec->unsol_tag_hp = spec->out_pins[1]; in ca0132_config()
9637 spec->unsol_tag_front_hp = spec->out_pins[2]; in ca0132_config()
9639 spec->adcs[0] = 0x7; /* Rear Mic / Line-in */ in ca0132_config()
9640 spec->adcs[1] = 0x8; /* Front Mic, but only if no DSP */ in ca0132_config()
9641 spec->adcs[2] = 0xa; /* what u hear */ in ca0132_config()
9643 spec->num_inputs = 2; in ca0132_config()
9644 spec->input_pins[0] = 0x12; /* Rear Mic / Line-in */ in ca0132_config()
9645 spec->input_pins[1] = 0x13; /* What U Hear */ in ca0132_config()
9646 spec->shared_mic_nid = 0x7; in ca0132_config()
9647 spec->unsol_tag_amic1 = spec->input_pins[0]; in ca0132_config()
9650 spec->dig_out = 0x05; in ca0132_config()
9651 spec->multiout.dig_out_nid = spec->dig_out; in ca0132_config()
9652 spec->dig_in = 0x09; in ca0132_config()
9655 spec->num_outputs = 2; in ca0132_config()
9656 spec->out_pins[0] = 0x0B; /* Line out */ in ca0132_config()
9657 spec->out_pins[1] = 0x0F; /* Rear headphone out */ in ca0132_config()
9658 spec->out_pins[2] = 0x10; /* Center/LFE */ in ca0132_config()
9659 spec->out_pins[3] = 0x11; /* Rear surround */ in ca0132_config()
9660 spec->shared_out_nid = 0x2; in ca0132_config()
9661 spec->unsol_tag_hp = spec->out_pins[1]; in ca0132_config()
9662 spec->unsol_tag_front_hp = spec->out_pins[2]; in ca0132_config()
9664 spec->adcs[0] = 0x7; /* Rear Mic / Line-in */ in ca0132_config()
9665 spec->adcs[1] = 0x8; /* Not connected, no front mic */ in ca0132_config()
9666 spec->adcs[2] = 0xa; /* what u hear */ in ca0132_config()
9668 spec->num_inputs = 2; in ca0132_config()
9669 spec->input_pins[0] = 0x12; /* Rear Mic / Line-in */ in ca0132_config()
9670 spec->input_pins[1] = 0x13; /* What U Hear */ in ca0132_config()
9671 spec->shared_mic_nid = 0x7; in ca0132_config()
9672 spec->unsol_tag_amic1 = spec->input_pins[0]; in ca0132_config()
9675 spec->adcs[0] = 0x8; /* ZxR DBPro Aux In */ in ca0132_config()
9677 spec->num_inputs = 1; in ca0132_config()
9678 spec->input_pins[0] = 0x11; /* RCA Line-in */ in ca0132_config()
9680 spec->dig_out = 0x05; in ca0132_config()
9681 spec->multiout.dig_out_nid = spec->dig_out; in ca0132_config()
9683 spec->dig_in = 0x09; in ca0132_config()
9687 spec->num_outputs = 2; in ca0132_config()
9688 spec->out_pins[0] = 0x0B; /* Line out */ in ca0132_config()
9689 spec->out_pins[1] = 0x11; /* Rear headphone out */ in ca0132_config()
9690 spec->out_pins[2] = 0x10; /* Front Headphone / Center/LFE*/ in ca0132_config()
9691 spec->out_pins[3] = 0x0F; /* Rear surround */ in ca0132_config()
9692 spec->shared_out_nid = 0x2; in ca0132_config()
9693 spec->unsol_tag_hp = spec->out_pins[1]; in ca0132_config()
9694 spec->unsol_tag_front_hp = spec->out_pins[2]; in ca0132_config()
9696 spec->adcs[0] = 0x7; /* Rear Mic / Line-in */ in ca0132_config()
9697 spec->adcs[1] = 0x8; /* Front Mic, but only if no DSP */ in ca0132_config()
9698 spec->adcs[2] = 0xa; /* what u hear */ in ca0132_config()
9700 spec->num_inputs = 2; in ca0132_config()
9701 spec->input_pins[0] = 0x12; /* Rear Mic / Line-in */ in ca0132_config()
9702 spec->input_pins[1] = 0x13; /* What U Hear */ in ca0132_config()
9703 spec->shared_mic_nid = 0x7; in ca0132_config()
9704 spec->unsol_tag_amic1 = spec->input_pins[0]; in ca0132_config()
9707 spec->dig_out = 0x05; in ca0132_config()
9708 spec->multiout.dig_out_nid = spec->dig_out; in ca0132_config()
9711 spec->num_outputs = 2; in ca0132_config()
9712 spec->out_pins[0] = 0x0B; /* Line out */ in ca0132_config()
9713 spec->out_pins[1] = 0x0F; /* Rear headphone out */ in ca0132_config()
9714 spec->out_pins[2] = 0x10; /* Front Headphone / Center/LFE*/ in ca0132_config()
9715 spec->out_pins[3] = 0x11; /* Rear surround */ in ca0132_config()
9716 spec->shared_out_nid = 0x2; in ca0132_config()
9717 spec->unsol_tag_hp = spec->out_pins[1]; in ca0132_config()
9718 spec->unsol_tag_front_hp = spec->out_pins[2]; in ca0132_config()
9720 spec->adcs[0] = 0x07; /* Rear Mic / Line-in */ in ca0132_config()
9721 spec->adcs[1] = 0x08; /* Front Mic, but only if no DSP */ in ca0132_config()
9722 spec->adcs[2] = 0x0a; /* what u hear */ in ca0132_config()
9724 spec->num_inputs = 2; in ca0132_config()
9725 spec->input_pins[0] = 0x12; /* Rear Mic / Line-in */ in ca0132_config()
9726 spec->input_pins[1] = 0x13; /* What U Hear */ in ca0132_config()
9727 spec->shared_mic_nid = 0x7; in ca0132_config()
9728 spec->unsol_tag_amic1 = spec->input_pins[0]; in ca0132_config()
9731 spec->dig_out = 0x05; in ca0132_config()
9732 spec->multiout.dig_out_nid = spec->dig_out; in ca0132_config()
9735 spec->num_outputs = 2; in ca0132_config()
9736 spec->out_pins[0] = 0x0b; /* speaker out */ in ca0132_config()
9737 spec->out_pins[1] = 0x10; /* headphone out */ in ca0132_config()
9738 spec->shared_out_nid = 0x2; in ca0132_config()
9739 spec->unsol_tag_hp = spec->out_pins[1]; in ca0132_config()
9741 spec->adcs[0] = 0x7; /* digital mic / analog mic1 */ in ca0132_config()
9742 spec->adcs[1] = 0x8; /* analog mic2 */ in ca0132_config()
9743 spec->adcs[2] = 0xa; /* what u hear */ in ca0132_config()
9745 spec->num_inputs = 3; in ca0132_config()
9746 spec->input_pins[0] = 0x12; in ca0132_config()
9747 spec->input_pins[1] = 0x11; in ca0132_config()
9748 spec->input_pins[2] = 0x13; in ca0132_config()
9749 spec->shared_mic_nid = 0x7; in ca0132_config()
9750 spec->unsol_tag_amic1 = spec->input_pins[0]; in ca0132_config()
9753 spec->dig_out = 0x05; in ca0132_config()
9754 spec->multiout.dig_out_nid = spec->dig_out; in ca0132_config()
9755 spec->dig_in = 0x09; in ca0132_config()
9764 struct ca0132_spec *spec = codec->spec; in ca0132_prepare_verbs()
9766 spec->chip_init_verbs = ca0132_init_verbs0; in ca0132_prepare_verbs()
9772 spec->desktop_init_verbs = ca0132_init_verbs1; in ca0132_prepare_verbs()
9773 spec->spec_init_verbs = kcalloc(NUM_SPEC_VERBS, in ca0132_prepare_verbs()
9776 if (!spec->spec_init_verbs) in ca0132_prepare_verbs()
9777 return -ENOMEM; in ca0132_prepare_verbs()
9780 spec->spec_init_verbs[0].nid = 0x0b; in ca0132_prepare_verbs()
9781 spec->spec_init_verbs[0].param = 0x78D; in ca0132_prepare_verbs()
9782 spec->spec_init_verbs[0].verb = 0x00; in ca0132_prepare_verbs()
9786 spec->spec_init_verbs[2].nid = 0x0b; in ca0132_prepare_verbs()
9787 spec->spec_init_verbs[2].param = AC_VERB_SET_EAPD_BTLENABLE; in ca0132_prepare_verbs()
9788 spec->spec_init_verbs[2].verb = 0x02; in ca0132_prepare_verbs()
9790 spec->spec_init_verbs[3].nid = 0x10; in ca0132_prepare_verbs()
9791 spec->spec_init_verbs[3].param = 0x78D; in ca0132_prepare_verbs()
9792 spec->spec_init_verbs[3].verb = 0x02; in ca0132_prepare_verbs()
9794 spec->spec_init_verbs[4].nid = 0x10; in ca0132_prepare_verbs()
9795 spec->spec_init_verbs[4].param = AC_VERB_SET_EAPD_BTLENABLE; in ca0132_prepare_verbs()
9796 spec->spec_init_verbs[4].verb = 0x02; in ca0132_prepare_verbs()
9799 /* Terminator: spec->spec_init_verbs[NUM_SPEC_VERBS-1] */ in ca0132_prepare_verbs()
9811 struct ca0132_spec *spec = codec->spec; in sbz_detect_quirk()
9813 switch (codec->core.subsystem_id) { in sbz_detect_quirk()
9815 spec->quirk = QUIRK_ZXR; in sbz_detect_quirk()
9818 spec->quirk = QUIRK_ZXR_DBPRO; in sbz_detect_quirk()
9821 spec->quirk = QUIRK_SBZ; in sbz_detect_quirk()
9836 return -ENOMEM; in patch_ca0132()
9837 codec->spec = spec; in patch_ca0132()
9838 spec->codec = codec; in patch_ca0132()
9841 quirk = snd_pci_quirk_lookup(codec->bus->pci, ca0132_quirks); in patch_ca0132()
9843 spec->quirk = quirk->value; in patch_ca0132()
9845 spec->quirk = QUIRK_NONE; in patch_ca0132()
9850 codec->patch_ops = dbpro_patch_ops; in patch_ca0132()
9852 codec->patch_ops = ca0132_patch_ops; in patch_ca0132()
9854 codec->pcm_format_first = 1; in patch_ca0132()
9855 codec->no_sticky_stream = 1; in patch_ca0132()
9858 spec->dsp_state = DSP_DOWNLOAD_INIT; in patch_ca0132()
9859 spec->num_mixers = 1; in patch_ca0132()
9864 spec->mixers[0] = desktop_mixer; in patch_ca0132()
9868 spec->mixers[0] = desktop_mixer; in patch_ca0132()
9874 spec->mixers[0] = desktop_mixer; in patch_ca0132()
9878 spec->mixers[0] = r3di_mixer; in patch_ca0132()
9882 spec->mixers[0] = desktop_mixer; in patch_ca0132()
9883 snd_hda_codec_set_name(codec, "Sound BlasterX AE-5"); in patch_ca0132()
9886 spec->mixers[0] = desktop_mixer; in patch_ca0132()
9887 snd_hda_codec_set_name(codec, "Sound Blaster AE-7"); in patch_ca0132()
9890 spec->mixers[0] = ca0132_mixer; in patch_ca0132()
9901 spec->use_alt_controls = true; in patch_ca0132()
9902 spec->use_alt_functions = true; in patch_ca0132()
9903 spec->use_pci_mmio = true; in patch_ca0132()
9906 spec->use_alt_controls = true; in patch_ca0132()
9907 spec->use_alt_functions = true; in patch_ca0132()
9908 spec->use_pci_mmio = false; in patch_ca0132()
9911 spec->use_alt_controls = false; in patch_ca0132()
9912 spec->use_alt_functions = false; in patch_ca0132()
9913 spec->use_pci_mmio = false; in patch_ca0132()
9918 if (spec->use_pci_mmio) { in patch_ca0132()
9919 spec->mem_base = pci_iomap(codec->bus->pci, 2, 0xC20); in patch_ca0132()
9920 if (spec->mem_base == NULL) { in patch_ca0132()
9922 spec->quirk = QUIRK_NONE; in patch_ca0132()
9927 spec->base_init_verbs = ca0132_base_init_verbs; in patch_ca0132()
9928 spec->base_exit_verbs = ca0132_base_exit_verbs; in patch_ca0132()
9930 INIT_DELAYED_WORK(&spec->unsol_hp_work, ca0132_unsol_hp_delayed); in patch_ca0132()
9940 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL); in patch_ca0132()