Lines Matching +full:mic1 +full:- +full:src
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",
900 /* Tracker for the SPDIF-in path is bypassed/enabled */
914 /* SRC clock is 98 MHz/196 MHz (196 MHz forces rate to 96 KHz) */
916 /* SRC rate is 48 kHz/96 kHz (48 kHz disabled when clock is 196 MHz) */
918 /* Decode Loop (DSP->SRC->DSP) is disabled/enabled */
920 /* De-emphasis filter on DAC-1 disabled/enabled */
922 /* De-emphasis filter on DAC-2 disabled/enabled */
924 /* De-emphasis filter on DAC-3 disabled/enabled */
926 /* High-pass filter on ADC_B disabled/enabled */
928 /* High-pass filter on ADC_C disabled/enabled */
965 * sense given the fact the AE-5 uses it and has the ASI flag set.
1046 DSP_DOWNLOAD_FAILED = -1,
1129 /* AE-5 Control values */
1143 * AE-5 all use PCI region 2 to toggle GPIO and other currently unknown
1181 #define ca0132_quirk(spec) ((spec)->codec->fixup_id)
1182 #define ca0132_use_pci_mmio(spec) ((spec)->use_pci_mmio)
1183 #define ca0132_use_alt_functions(spec) ((spec)->use_alt_functions)
1184 #define ca0132_use_alt_controls(spec) ((spec)->use_alt_controls)
1208 { 0x0b, 0x01017010 }, /* Port G -- Lineout FRONT L/R */
1212 { 0x0f, 0x0221701f }, /* Port A -- BackPanel HP */
1213 { 0x10, 0x01017012 }, /* Port D -- Center/LFE or FP Hp */
1214 { 0x11, 0x01017014 }, /* Port B -- LineMicIn2 / Rear L/R */
1215 { 0x12, 0x01a170f0 }, /* Port C -- LineIn1 */
1223 { 0x0b, 0x01047110 }, /* Port G -- Lineout FRONT L/R */
1224 { 0x0c, 0x414510f0 }, /* SPDIF Out 1 - Disabled*/
1226 { 0x0e, 0x41c520f0 }, /* SPDIF In - Disabled*/
1227 { 0x0f, 0x0122711f }, /* Port A -- BackPanel HP */
1228 { 0x10, 0x01017111 }, /* Port D -- Center/LFE */
1229 { 0x11, 0x01017114 }, /* Port B -- LineMicIn2 / Rear L/R */
1230 { 0x12, 0x01a271f0 }, /* Port C -- LineIn1 */
1238 { 0x0b, 0x01014110 }, /* Port G -- Lineout FRONT L/R */
1242 { 0x0f, 0x0221401f }, /* Port A -- BackPanel HP */
1243 { 0x10, 0x01016011 }, /* Port D -- Center/LFE or FP Hp */
1244 { 0x11, 0x01011014 }, /* Port B -- LineMicIn2 / Rear L/R */
1245 { 0x12, 0x02a090f0 }, /* Port C -- LineIn1 */
1251 /* Sound Blaster AE-5 pin configs taken from Windows Driver */
1253 { 0x0b, 0x01017010 }, /* Port G -- Lineout FRONT L/R */
1257 { 0x0f, 0x01017114 }, /* Port A -- Rear L/R. */
1258 { 0x10, 0x01017012 }, /* Port D -- Center/LFE or FP Hp */
1259 { 0x11, 0x012170ff }, /* Port B -- LineMicIn2 / Rear Headphone */
1260 { 0x12, 0x01a170f0 }, /* Port C -- LineIn1 */
1268 { 0x0b, 0x01014110 }, /* Port G -- Lineout FRONT L/R */
1272 { 0x0f, 0x0221401f }, /* Port A -- BackPanel HP */
1273 { 0x10, 0x01016011 }, /* Port D -- Center/LFE or FP Hp */
1274 { 0x11, 0x01011014 }, /* Port B -- LineMicIn2 / Rear L/R */
1275 { 0x12, 0x02a090f0 }, /* Port C -- LineIn1 */
1306 SND_PCI_QUIRK(0x1458, 0xA036, "Gigabyte GA-Z170X-Gaming 7", QUIRK_R3DI),
1312 SND_PCI_QUIRK(0x1102, 0x0051, "Sound Blaster AE-5", QUIRK_AE5),
1313 SND_PCI_QUIRK(0x1102, 0x0191, "Sound Blaster AE-5 Plus", QUIRK_AE5),
1314 SND_PCI_QUIRK(0x1102, 0x0081, "Sound Blaster AE-7", QUIRK_AE7),
1320 { .id = QUIRK_ALIENWARE_M17XR4, .name = "alienware-m17xr4" },
1323 { .id = QUIRK_ZXR_DBPRO, .name = "zxr-dbpro" },
1534 return ((response == -1) ? -1 : 0); in codec_send_command()
1572 return -EIO; in chipio_send()
1576 * Write chip address through the vendor widget -- NOT protected by the Mutex!
1581 struct ca0132_spec *spec = codec->spec; in chipio_write_address()
1584 if (spec->curr_chip_addx == chip_addx) in chipio_write_address()
1591 if (res != -EIO) { in chipio_write_address()
1597 spec->curr_chip_addx = (res < 0) ? ~0U : chip_addx; in chipio_write_address()
1603 * Write data through the vendor widget -- NOT protected by the Mutex!
1607 struct ca0132_spec *spec = codec->spec; in chipio_write_data()
1613 if (res != -EIO) { in chipio_write_data()
1621 spec->curr_chip_addx = (res != -EIO) ? in chipio_write_data()
1622 (spec->curr_chip_addx + 4) : ~0U; in chipio_write_data()
1627 * Write multiple data through the vendor widget -- NOT protected by the Mutex!
1637 return -EINVAL; in chipio_write_data_multiple()
1640 while ((count-- != 0) && (status == 0)) in chipio_write_data_multiple()
1648 * Read data through the vendor widget -- NOT protected by the Mutex!
1652 struct ca0132_spec *spec = codec->spec; in chipio_read_data()
1658 if (res != -EIO) { in chipio_read_data()
1663 if (res != -EIO) { in chipio_read_data()
1672 spec->curr_chip_addx = (res != -EIO) ? in chipio_read_data()
1673 (spec->curr_chip_addx + 4) : ~0U; in chipio_read_data()
1684 struct ca0132_spec *spec = codec->spec; in chipio_write()
1687 mutex_lock(&spec->chipio_mutex); in chipio_write()
1699 mutex_unlock(&spec->chipio_mutex); in chipio_write()
1735 struct ca0132_spec *spec = codec->spec; in chipio_write_multiple()
1738 mutex_lock(&spec->chipio_mutex); in chipio_write_multiple()
1745 mutex_unlock(&spec->chipio_mutex); in chipio_write_multiple()
1757 struct ca0132_spec *spec = codec->spec; in chipio_read()
1760 mutex_lock(&spec->chipio_mutex); in chipio_read()
1772 mutex_unlock(&spec->chipio_mutex); in chipio_read()
1798 struct ca0132_spec *spec = codec->spec; in chipio_set_control_param()
1806 mutex_lock(&spec->chipio_mutex); in chipio_set_control_param()
1815 mutex_unlock(&spec->chipio_mutex); in chipio_set_control_param()
1920 * 0x80-0xFF.
1932 * Writes to the 8051's exram, which has 16-bits of address space.
1933 * Data at addresses 0x2000-0x7fff is mirrored to 0x8000-0xdfff.
1934 * Data at 0x8000-0xdfff can also be used as program memory for the 8051 by
1936 * 0xe000-0xffff is always mapped as program memory, with only 0xf000-0xffff
1943 /* Lower 8-bits. */ in chipio_8051_set_address()
1948 /* Upper 8-bits. */ in chipio_8051_set_address()
1956 /* 8-bits of data. */ in chipio_8051_set_data()
1970 /* 8-bits of data. */ in chipio_8051_set_data_pll()
1978 struct ca0132_spec *spec = codec->spec; in chipio_8051_write_exram()
1980 mutex_lock(&spec->chipio_mutex); in chipio_8051_write_exram()
1985 mutex_unlock(&spec->chipio_mutex); in chipio_8051_write_exram()
2006 struct ca0132_spec *spec = codec->spec; in chipio_8051_write_pll_pmu()
2008 mutex_lock(&spec->chipio_mutex); in chipio_8051_write_pll_pmu()
2013 mutex_unlock(&spec->chipio_mutex); in chipio_8051_write_pll_pmu()
2028 struct ca0132_spec *spec = codec->spec; in chipio_enable_clocks()
2030 mutex_lock(&spec->chipio_mutex); in chipio_enable_clocks()
2036 mutex_unlock(&spec->chipio_mutex); in chipio_enable_clocks()
2056 return -EIO; in dspio_send()
2082 struct ca0132_spec *spec = codec->spec; in dspio_write()
2087 mutex_lock(&spec->chipio_mutex); in dspio_write()
2102 mutex_unlock(&spec->chipio_mutex); in dspio_write()
2105 -EIO : 0; in dspio_write()
2118 return -EINVAL; in dspio_write_multiple()
2136 if (status == -EIO) in dspio_read()
2140 if (status == -EIO || in dspio_read()
2142 return -EIO; in dspio_read()
2160 return -1; in dspio_read_multiple()
2257 struct ca0132_spec *spec = codec->spec; in dspio_get_response_data()
2262 return -EIO; in dspio_get_response_data()
2264 if ((data & 0x00ffffff) == spec->wait_scp_header) { in dspio_get_response_data()
2265 spec->scp_resp_header = data; in dspio_get_response_data()
2266 spec->scp_resp_count = data >> 27; in dspio_get_response_data()
2267 count = spec->wait_num_data; in dspio_get_response_data()
2268 dspio_read_multiple(codec, spec->scp_resp_data, in dspio_get_response_data()
2269 &spec->scp_resp_count, count); in dspio_get_response_data()
2273 return -EIO; in dspio_get_response_data()
2286 struct ca0132_spec *spec = codec->spec; in dspio_send_scp_message()
2307 return -EINVAL; in dspio_send_scp_message()
2311 return -EINVAL; in dspio_send_scp_message()
2313 spec->wait_scp_header = *((unsigned int *)send_buf); in dspio_send_scp_message()
2318 spec->wait_scp_header &= 0xffff0000; in dspio_send_scp_message()
2319 spec->wait_scp_header |= (resp_src_id << 8) | (resp_target_id); in dspio_send_scp_message()
2320 spec->wait_num_data = return_buf_size/sizeof(unsigned int) - 1; in dspio_send_scp_message()
2321 spec->wait_scp = 1; in dspio_send_scp_message()
2328 spec->wait_scp = 0; in dspio_send_scp_message()
2337 } while (spec->wait_scp && time_before(jiffies, timeout)); in dspio_send_scp_message()
2339 if (!spec->wait_scp) { in dspio_send_scp_message()
2341 memcpy(&ret_msg->hdr, &spec->scp_resp_header, 4); in dspio_send_scp_message()
2342 memcpy(&ret_msg->data, spec->scp_resp_data, in dspio_send_scp_message()
2343 spec->wait_num_data); in dspio_send_scp_message()
2344 *bytes_returned = (spec->scp_resp_count + 1) * 4; in dspio_send_scp_message()
2347 status = -EIO; in dspio_send_scp_message()
2349 spec->wait_scp = 0; in dspio_send_scp_message()
2356 * dspio_scp - Prepare and send the SCP message to DSP
2383 return -EINVAL; in dspio_scp()
2387 return -EINVAL; in dspio_scp()
2392 return -EINVAL; in dspio_scp()
2424 ret_size = (ret_bytes - sizeof(scp_reply.hdr)) in dspio_scp()
2429 return -EINVAL; in dspio_scp()
2432 return -EINVAL; in dspio_scp()
2435 return -EINVAL; in dspio_scp()
2441 codec_dbg(codec, "reply ill-formed or errflag set\n"); in dspio_scp()
2442 return -EIO; in dspio_scp()
2473 codec_dbg(codec, " dspio_alloc_dma_chan() -- begin\n"); in dspio_alloc_dma_chan()
2485 return -EBUSY; in dspio_alloc_dma_chan()
2489 codec_dbg(codec, " dspio_alloc_dma_chan() -- complete\n"); in dspio_alloc_dma_chan()
2502 codec_dbg(codec, " dspio_free_dma_chan() -- begin\n"); in dspio_free_dma_chan()
2514 codec_dbg(codec, " dspio_free_dma_chan() -- complete\n"); in dspio_free_dma_chan()
2565 retry--; in dsp_reset()
2566 } while (res == -EIO && retry); in dsp_reset()
2570 return -EIO; in dsp_reset()
2622 codec_dbg(codec, "-- dsp_dma_setup_common() -- Begin ---------\n"); in dsp_dma_setup_common()
2626 return -EINVAL; in dsp_dma_setup_common()
2631 return -EBUSY; in dsp_dma_setup_common()
2638 return -ENXIO; in dsp_dma_setup_common()
2715 codec_dbg(codec, "-- dsp_dma_setup_common() -- Complete ------\n"); in dsp_dma_setup_common()
2721 * Setup the DSP DMA per-transfer-specific registers
2738 const unsigned int max_dma_count = 1 << (DSPDMAC_XFRCNT_BCNT_HIBIT - in dsp_dma_setup()
2741 codec_dbg(codec, "-- dsp_dma_setup() -- Begin ---------\n"); in dsp_dma_setup()
2745 return -EINVAL; in dsp_dma_setup()
2751 return -ENXIO; in dsp_dma_setup()
2776 adr_ofs = (count - 1) << (DSPDMAC_DSPADROFS_BOFS_LOBIT + in dsp_dma_setup()
2787 base_cnt = (count - 1) << DSPDMAC_XFRCNT_BCNT_LOBIT; in dsp_dma_setup()
2789 cur_cnt = (count - 1) << DSPDMAC_XFRCNT_CCNT_LOBIT; in dsp_dma_setup()
2806 codec_dbg(codec, "-- dsp_dma_setup() -- Complete ---------\n"); in dsp_dma_setup()
2820 codec_dbg(codec, "-- dsp_dma_start() -- Begin ---------\n"); in dsp_dma_start()
2830 codec_dbg(codec, "-- dsp_dma_start() Read CHNLSTART\n"); in dsp_dma_start()
2842 codec_dbg(codec, "-- dsp_dma_start() -- Complete ---------\n"); in dsp_dma_start()
2856 codec_dbg(codec, "-- dsp_dma_stop() -- Begin ---------\n"); in dsp_dma_stop()
2866 codec_dbg(codec, "-- dsp_dma_stop() Read CHNLSTART\n"); in dsp_dma_stop()
2877 codec_dbg(codec, "-- dsp_dma_stop() -- Complete ---------\n"); in dsp_dma_stop()
2883 * dsp_allocate_router_ports - Allocate router ports
2908 val |= (ports_per_channel - 1) << 4; in dsp_allocate_router_ports()
2909 val |= num_chans - 1; in dsp_allocate_router_ports()
2960 codec_dbg(codec, " dsp_allocate_ports() -- begin\n"); in dsp_allocate_ports()
2964 return -EINVAL; in dsp_allocate_ports()
2970 codec_dbg(codec, " dsp_allocate_ports() -- complete\n"); in dsp_allocate_ports()
2987 return -EINVAL; in dsp_allocate_ports_format()
3002 codec_dbg(codec, " dsp_free_ports() -- begin\n"); in dsp_free_ports()
3009 codec_dbg(codec, " dsp_free_ports() -- complete\n"); in dsp_free_ports()
3050 struct hda_codec *codec = dma->codec; in dma_reset()
3051 struct ca0132_spec *spec = codec->spec; in dma_reset()
3054 if (dma->dmab->area) in dma_reset()
3055 snd_hda_codec_load_dsp_cleanup(codec, dma->dmab); in dma_reset()
3058 dma->m_converter_format, in dma_reset()
3059 dma->buf_size, in dma_reset()
3060 dma->dmab); in dma_reset()
3063 spec->dsp_stream_id = status; in dma_reset()
3082 snd_hda_codec_load_dsp_trigger(dma->codec, cmd); in dma_set_state()
3088 return dma->dmab->bytes; in dma_get_buffer_size()
3093 return dma->dmab->area; in dma_get_buffer_addr()
3100 memcpy(dma->dmab->area, data, count); in dma_xfer()
3109 *format = dma->m_converter_format; in dma_get_converter_format()
3114 struct ca0132_spec *spec = dma->codec->spec; in dma_get_stream_id()
3116 return spec->dsp_stream_id; in dma_get_stream_id()
3131 return p->magic == g_magic_value; in is_valid()
3136 return g_chip_addr_magic_value == p->chip_addr; in is_hci_prog_list_seg()
3141 return p->count == 0; in is_last()
3146 return struct_size(p, data, p->count); in dsp_sizeof()
3172 if (fls == NULL || fls->chip_addr != g_chip_addr_magic_value) { in dspxfr_hci_write()
3174 return -EINVAL; in dspxfr_hci_write()
3177 count = fls->count; in dspxfr_hci_write()
3178 data = (u32 *)(fls->data); in dspxfr_hci_write()
3185 count -= 2; in dspxfr_hci_write()
3192 * dspxfr_one_seg - Write a block of data into DSP code or data RAM using pre-allocated DMA engine.
3196 * @reloc: Relocation address for loading single-segment overlays, or 0 for
3234 return -EINVAL; in dspxfr_one_seg()
3247 return -EINVAL; in dspxfr_one_seg()
3250 data = fls->data; in dspxfr_one_seg()
3251 chip_addx = fls->chip_addr; in dspxfr_one_seg()
3252 words_to_write = fls->count; in dspxfr_one_seg()
3263 return -EINVAL; in dspxfr_one_seg()
3273 return -EINVAL; in dspxfr_one_seg()
3286 return -EINVAL; in dspxfr_one_seg()
3292 buffer_size_words -= buffer_size_words % hda_frame_size_words; in dspxfr_one_seg()
3301 return -EINVAL; in dspxfr_one_seg()
3310 words_to_write -= remainder_words; in dspxfr_one_seg()
3337 return -EIO; in dspxfr_one_seg()
3377 words_to_write -= run_size_words; in dspxfr_one_seg()
3389 * dspxfr_image - Write the entire DSP image of a DSP code/data overlay to DSP memories
3393 * @reloc: Relocation address for loading single-segment overlays, or 0 for
3408 struct ca0132_spec *spec = codec->spec; in dspxfr_image()
3418 return -EINVAL; in dspxfr_image()
3422 return -ENOMEM; in dspxfr_image()
3424 dma_engine->dmab = kzalloc(sizeof(*dma_engine->dmab), GFP_KERNEL); in dspxfr_image()
3425 if (!dma_engine->dmab) { in dspxfr_image()
3427 return -ENOMEM; in dspxfr_image()
3430 dma_engine->codec = codec; in dspxfr_image()
3432 dma_engine->m_converter_format = hda_format; in dspxfr_image()
3433 dma_engine->buf_size = (ovly ? DSP_DMA_WRITE_BUFLEN_OVLY : in dspxfr_image()
3447 dma_engine->m_converter_format, in dspxfr_image()
3448 dma_engine->buf_size, in dspxfr_image()
3449 dma_engine->dmab); in dspxfr_image()
3452 spec->dsp_stream_id = status; in dspxfr_image()
3482 status = -EINVAL; in dspxfr_image()
3511 if (dma_engine->dmab->area) in dspxfr_image()
3512 snd_hda_codec_load_dsp_cleanup(codec, dma_engine->dmab); in dspxfr_image()
3513 kfree(dma_engine->dmab); in dspxfr_image()
3524 struct ca0132_spec *spec = codec->spec; in dspload_post_setup()
3525 codec_dbg(codec, "---- dspload_post_setup ------\n"); in dspload_post_setup()
3537 * dspload_image - Download DSP from a DSP Image Fast Load structure.
3542 * @reloc: Relocation address for loading single-segment overlays, or 0 for
3549 * linear, non-constant sized element array of structures, each of which
3565 codec_dbg(codec, "---- dspload_image begin ------\n"); in dspload_image()
3641 * ca0113 related functions. The ca0113 acts as the HDA bus for the pci-e
3647 * For cards with PCI-E region2 (Sound Blaster Z/ZxR, Recon3D, and AE-5)
3651 * AE-5 note: The AE-5 seems to use pins 2 and 3 to somehow set the color value
3652 * of the on-card LED. It seems to use pin 2 for data, then toggles 3 to on and
3658 struct ca0132_spec *spec = codec->spec; in ca0113_mmio_gpio_set()
3664 writew(gpio_data, spec->mem_base + 0x320); in ca0113_mmio_gpio_set()
3668 * Special pci region2 commands that are only used by the AE-5. They follow
3673 * target-id, and value.
3678 struct ca0132_spec *spec = codec->spec; in ca0113_mmio_command_set()
3681 writel(0x0000007e, spec->mem_base + 0x210); in ca0113_mmio_command_set()
3682 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set()
3683 writel(0x0000005a, spec->mem_base + 0x210); in ca0113_mmio_command_set()
3684 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set()
3685 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set()
3687 writel(0x00800005, spec->mem_base + 0x20c); in ca0113_mmio_command_set()
3688 writel(group, spec->mem_base + 0x804); in ca0113_mmio_command_set()
3690 writel(0x00800005, spec->mem_base + 0x20c); in ca0113_mmio_command_set()
3695 writel(write_val, spec->mem_base + 0x204); in ca0113_mmio_command_set()
3701 readl(spec->mem_base + 0x860); in ca0113_mmio_command_set()
3702 readl(spec->mem_base + 0x854); in ca0113_mmio_command_set()
3703 readl(spec->mem_base + 0x840); in ca0113_mmio_command_set()
3705 writel(0x00800004, spec->mem_base + 0x20c); in ca0113_mmio_command_set()
3706 writel(0x00000000, spec->mem_base + 0x210); in ca0113_mmio_command_set()
3707 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set()
3708 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set()
3717 struct ca0132_spec *spec = codec->spec; in ca0113_mmio_command_set_type2()
3720 writel(0x0000007e, spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3721 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3722 writel(0x0000005a, spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3723 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3724 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3726 writel(0x00800003, spec->mem_base + 0x20c); in ca0113_mmio_command_set_type2()
3727 writel(group, spec->mem_base + 0x804); in ca0113_mmio_command_set_type2()
3729 writel(0x00800005, spec->mem_base + 0x20c); in ca0113_mmio_command_set_type2()
3734 writel(write_val, spec->mem_base + 0x204); in ca0113_mmio_command_set_type2()
3736 readl(spec->mem_base + 0x860); in ca0113_mmio_command_set_type2()
3737 readl(spec->mem_base + 0x854); in ca0113_mmio_command_set_type2()
3738 readl(spec->mem_base + 0x840); in ca0113_mmio_command_set_type2()
3740 writel(0x00800004, spec->mem_base + 0x20c); in ca0113_mmio_command_set_type2()
3741 writel(0x00000000, spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3742 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3743 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3756 struct ca0132_spec *spec = codec->spec; in ca0132_gpio_init()
3779 struct ca0132_spec *spec = codec->spec; in ca0132_gpio_setup()
3810 /* Bit 1 - Switch between front/rear mic. 0 = rear, 1 = front */
3812 /* Bit 2 - Switch between headphone/line out. 0 = Headphone, 1 = Line */
3863 snd_hda_codec_write(codec, codec->core.afg, 0, in r3di_gpio_mic_set()
3878 snd_hda_codec_write(codec, codec->core.afg, 0, in r3di_gpio_dsp_status_set()
3885 snd_hda_codec_write(codec, codec->core.afg, 0, in r3di_gpio_dsp_status_set()
3892 snd_hda_codec_write(codec, codec->core.afg, 0, in r3di_gpio_dsp_status_set()
3905 struct ca0132_spec *spec = codec->spec; in ca0132_playback_pcm_prepare()
3907 snd_hda_codec_setup_stream(codec, spec->dacs[0], stream_tag, 0, format); in ca0132_playback_pcm_prepare()
3916 struct ca0132_spec *spec = codec->spec; in ca0132_playback_pcm_cleanup()
3918 if (spec->dsp_state == DSP_DOWNLOADING) in ca0132_playback_pcm_cleanup()
3923 if (spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]) in ca0132_playback_pcm_cleanup()
3926 snd_hda_codec_cleanup_stream(codec, spec->dacs[0]); in ca0132_playback_pcm_cleanup()
3935 struct ca0132_spec *spec = codec->spec; in ca0132_playback_pcm_delay()
3937 struct snd_pcm_runtime *runtime = substream->runtime; in ca0132_playback_pcm_delay()
3939 if (spec->dsp_state != DSP_DOWNLOADED) in ca0132_playback_pcm_delay()
3943 if (spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]) { in ca0132_playback_pcm_delay()
3944 if ((spec->effects_switch[SURROUND - EFFECT_START_NID]) || in ca0132_playback_pcm_delay()
3945 (spec->effects_switch[DIALOG_PLUS - EFFECT_START_NID])) in ca0132_playback_pcm_delay()
3950 if (spec->cur_out_type == SPEAKER_OUT) in ca0132_playback_pcm_delay()
3953 return (latency * runtime->rate) / 1000; in ca0132_playback_pcm_delay()
3963 struct ca0132_spec *spec = codec->spec; in ca0132_dig_playback_pcm_open()
3964 return snd_hda_multi_out_dig_open(codec, &spec->multiout); in ca0132_dig_playback_pcm_open()
3973 struct ca0132_spec *spec = codec->spec; in ca0132_dig_playback_pcm_prepare()
3974 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, in ca0132_dig_playback_pcm_prepare()
3982 struct ca0132_spec *spec = codec->spec; in ca0132_dig_playback_pcm_cleanup()
3983 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); in ca0132_dig_playback_pcm_cleanup()
3990 struct ca0132_spec *spec = codec->spec; in ca0132_dig_playback_pcm_close()
3991 return snd_hda_multi_out_dig_close(codec, &spec->multiout); in ca0132_dig_playback_pcm_close()
4003 snd_hda_codec_setup_stream(codec, hinfo->nid, in ca0132_capture_pcm_prepare()
4013 struct ca0132_spec *spec = codec->spec; in ca0132_capture_pcm_cleanup()
4015 if (spec->dsp_state == DSP_DOWNLOADING) in ca0132_capture_pcm_cleanup()
4018 snd_hda_codec_cleanup_stream(codec, hinfo->nid); in ca0132_capture_pcm_cleanup()
4026 struct ca0132_spec *spec = codec->spec; in ca0132_capture_pcm_delay()
4028 struct snd_pcm_runtime *runtime = substream->runtime; in ca0132_capture_pcm_delay()
4030 if (spec->dsp_state != DSP_DOWNLOADED) in ca0132_capture_pcm_delay()
4033 if (spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID]) in ca0132_capture_pcm_delay()
4036 return (latency * runtime->rate) / 1000; in ca0132_capture_pcm_delay()
4100 * values -90 to 9. -90 is the lowest decibel value for both the ADC's and the
4148 * This table counts from float 10 to 1000, which is the range of the x-bass
4245 return -EINVAL; in tuning_ctl_set()
4260 struct ca0132_spec *spec = codec->spec; in tuning_ctl_get()
4262 long *valp = ucontrol->value.integer.value; in tuning_ctl_get()
4263 int idx = nid - TUNING_CTL_START_NID; in tuning_ctl_get()
4265 *valp = spec->cur_ctl_vals[idx]; in tuning_ctl_get()
4273 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in voice_focus_ctl_info()
4274 uinfo->count = chs == 3 ? 2 : 1; in voice_focus_ctl_info()
4275 uinfo->value.integer.min = 20; in voice_focus_ctl_info()
4276 uinfo->value.integer.max = 180; in voice_focus_ctl_info()
4277 uinfo->value.integer.step = 1; in voice_focus_ctl_info()
4286 struct ca0132_spec *spec = codec->spec; in voice_focus_ctl_put()
4288 long *valp = ucontrol->value.integer.value; in voice_focus_ctl_put()
4291 idx = nid - TUNING_CTL_START_NID; in voice_focus_ctl_put()
4293 if (spec->cur_ctl_vals[idx] == *valp) in voice_focus_ctl_put()
4296 spec->cur_ctl_vals[idx] = *valp; in voice_focus_ctl_put()
4298 idx = *valp - 20; in voice_focus_ctl_put()
4308 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in mic_svm_ctl_info()
4309 uinfo->count = chs == 3 ? 2 : 1; in mic_svm_ctl_info()
4310 uinfo->value.integer.min = 0; in mic_svm_ctl_info()
4311 uinfo->value.integer.max = 100; in mic_svm_ctl_info()
4312 uinfo->value.integer.step = 1; in mic_svm_ctl_info()
4321 struct ca0132_spec *spec = codec->spec; in mic_svm_ctl_put()
4323 long *valp = ucontrol->value.integer.value; in mic_svm_ctl_put()
4326 idx = nid - TUNING_CTL_START_NID; in mic_svm_ctl_put()
4328 if (spec->cur_ctl_vals[idx] == *valp) in mic_svm_ctl_put()
4331 spec->cur_ctl_vals[idx] = *valp; in mic_svm_ctl_put()
4343 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in equalizer_ctl_info()
4344 uinfo->count = chs == 3 ? 2 : 1; in equalizer_ctl_info()
4345 uinfo->value.integer.min = 0; in equalizer_ctl_info()
4346 uinfo->value.integer.max = 48; in equalizer_ctl_info()
4347 uinfo->value.integer.step = 1; in equalizer_ctl_info()
4356 struct ca0132_spec *spec = codec->spec; in equalizer_ctl_put()
4358 long *valp = ucontrol->value.integer.value; in equalizer_ctl_put()
4361 idx = nid - TUNING_CTL_START_NID; in equalizer_ctl_put()
4363 if (spec->cur_ctl_vals[idx] == *valp) in equalizer_ctl_put()
4366 spec->cur_ctl_vals[idx] = *valp; in equalizer_ctl_put()
4375 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(eq_db_scale, -2400, 100, 0);
4437 struct ca0132_spec *spec = codec->spec; in ca0132_init_tuning_defaults()
4440 /* Wedge Angle defaults to 30. 10 below is 30 - 20. 20 is min. */ in ca0132_init_tuning_defaults()
4441 spec->cur_ctl_vals[WEDGE_ANGLE - TUNING_CTL_START_NID] = 10; in ca0132_init_tuning_defaults()
4443 spec->cur_ctl_vals[SVM_LEVEL - TUNING_CTL_START_NID] = 74; in ca0132_init_tuning_defaults()
4447 spec->cur_ctl_vals[i] = 24; in ca0132_init_tuning_defaults()
4454 * If jack inserted, headphone will be selected, else built-in speakers
4459 struct ca0132_spec *spec = codec->spec; in ca0132_select_out()
4470 auto_jack = spec->vnode_lswitch[VNID_HP_ASEL - VNODE_START_NID]; in ca0132_select_out()
4473 jack_present = snd_hda_jack_detect(codec, spec->unsol_tag_hp); in ca0132_select_out()
4476 spec->vnode_lswitch[VNID_HP_SEL - VNODE_START_NID]; in ca0132_select_out()
4479 spec->cur_out_type = HEADPHONE_OUT; in ca0132_select_out()
4481 spec->cur_out_type = SPEAKER_OUT; in ca0132_select_out()
4483 if (spec->cur_out_type == SPEAKER_OUT) { in ca0132_select_out()
4497 snd_hda_codec_write(codec, spec->out_pins[1], 0, in ca0132_select_out()
4499 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4501 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4503 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4507 pin_ctl = snd_hda_codec_read(codec, spec->out_pins[1], 0, in ca0132_select_out()
4509 snd_hda_set_pin_ctl(codec, spec->out_pins[1], in ca0132_select_out()
4512 pin_ctl = snd_hda_codec_read(codec, spec->out_pins[0], 0, in ca0132_select_out()
4514 snd_hda_set_pin_ctl(codec, spec->out_pins[0], in ca0132_select_out()
4530 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4532 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4534 snd_hda_codec_write(codec, spec->out_pins[1], 0, in ca0132_select_out()
4536 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4540 pin_ctl = snd_hda_codec_read(codec, spec->out_pins[0], 0, in ca0132_select_out()
4542 snd_hda_set_pin_ctl(codec, spec->out_pins[0], in ca0132_select_out()
4545 pin_ctl = snd_hda_codec_read(codec, spec->out_pins[1], 0, in ca0132_select_out()
4547 snd_hda_set_pin_ctl(codec, spec->out_pins[1], in ca0132_select_out()
4563 struct ca0132_spec *spec = codec->spec; in ae5_mmio_select_out()
4573 ca0113_mmio_command_set(codec, out_cmds->group[i], in ae5_mmio_select_out()
4574 out_cmds->target[i], in ae5_mmio_select_out()
4575 out_cmds->vals[spec->cur_out_type][i]); in ae5_mmio_select_out()
4580 struct ca0132_spec *spec = codec->spec; in ca0132_alt_set_full_range_speaker()
4585 /* 2.0/4.0 setup has no LFE channel, so setting full-range does nothing. */ in ca0132_alt_set_full_range_speaker()
4586 if (spec->channel_cfg_val == SPEAKER_CHANNELS_4_0 in ca0132_alt_set_full_range_speaker()
4587 || spec->channel_cfg_val == SPEAKER_CHANNELS_2_0) in ca0132_alt_set_full_range_speaker()
4590 /* Set front L/R full range. Zero for full-range, one for redirection. */ in ca0132_alt_set_full_range_speaker()
4591 tmp = spec->speaker_range_val[0] ? FLOAT_ZERO : FLOAT_ONE; in ca0132_alt_set_full_range_speaker()
4597 /* When setting full-range rear, both rear and center/lfe are set. */ in ca0132_alt_set_full_range_speaker()
4598 tmp = spec->speaker_range_val[1] ? FLOAT_ZERO : FLOAT_ONE; in ca0132_alt_set_full_range_speaker()
4610 * Only the AE series cards set this value when setting full-range, in ca0132_alt_set_full_range_speaker()
4626 struct ca0132_spec *spec = codec->spec; in ca0132_alt_surround_set_bass_redirection()
4630 if (val && spec->channel_cfg_val != SPEAKER_CHANNELS_4_0 && in ca0132_alt_surround_set_bass_redirection()
4631 spec->channel_cfg_val != SPEAKER_CHANNELS_2_0) in ca0132_alt_surround_set_bass_redirection()
4642 tmp = float_xbass_xover_lookup[spec->xbass_xover_freq]; in ca0132_alt_surround_set_bass_redirection()
4659 struct ca0132_spec *spec = codec->spec; in ca0132_alt_select_out_get_quirk_data()
4676 struct ca0132_spec *spec = codec->spec; in ca0132_alt_select_out_quirk_set()
4684 out_info = &quirk_data->out_set_info[spec->cur_out_type]; in ca0132_alt_select_out_quirk_set()
4685 if (quirk_data->is_ae_series) in ca0132_alt_select_out_quirk_set()
4688 if (out_info->has_hda_gpio) { in ca0132_alt_select_out_quirk_set()
4689 gpio_data = snd_hda_codec_read(codec, codec->core.afg, 0, in ca0132_alt_select_out_quirk_set()
4692 if (out_info->hda_gpio_set) in ca0132_alt_select_out_quirk_set()
4693 gpio_data |= (1 << out_info->hda_gpio_pin); in ca0132_alt_select_out_quirk_set()
4695 gpio_data &= ~(1 << out_info->hda_gpio_pin); in ca0132_alt_select_out_quirk_set()
4697 snd_hda_codec_write(codec, codec->core.afg, 0, in ca0132_alt_select_out_quirk_set()
4701 if (out_info->mmio_gpio_count) { in ca0132_alt_select_out_quirk_set()
4702 for (i = 0; i < out_info->mmio_gpio_count; i++) { in ca0132_alt_select_out_quirk_set()
4703 ca0113_mmio_gpio_set(codec, out_info->mmio_gpio_pin[i], in ca0132_alt_select_out_quirk_set()
4704 out_info->mmio_gpio_set[i]); in ca0132_alt_select_out_quirk_set()
4708 if (out_info->scp_cmds_count) { in ca0132_alt_select_out_quirk_set()
4709 for (i = 0; i < out_info->scp_cmds_count; i++) { in ca0132_alt_select_out_quirk_set()
4711 out_info->scp_cmd_mid[i], in ca0132_alt_select_out_quirk_set()
4712 out_info->scp_cmd_req[i], in ca0132_alt_select_out_quirk_set()
4713 out_info->scp_cmd_val[i]); in ca0132_alt_select_out_quirk_set()
4719 chipio_set_control_param(codec, 0x0d, out_info->dac2port); in ca0132_alt_select_out_quirk_set()
4721 if (out_info->has_chipio_write) { in ca0132_alt_select_out_quirk_set()
4722 chipio_write(codec, out_info->chipio_write_addr, in ca0132_alt_select_out_quirk_set()
4723 out_info->chipio_write_data); in ca0132_alt_select_out_quirk_set()
4726 if (quirk_data->has_headphone_gain) { in ca0132_alt_select_out_quirk_set()
4727 if (spec->cur_out_type != HEADPHONE_OUT) { in ca0132_alt_select_out_quirk_set()
4728 if (quirk_data->is_ae_series) in ca0132_alt_select_out_quirk_set()
4733 if (quirk_data->is_ae_series) in ca0132_alt_select_out_quirk_set()
4735 spec->ae5_headphone_gain_val); in ca0132_alt_select_out_quirk_set()
4738 spec->zxr_gain_set); in ca0132_alt_select_out_quirk_set()
4764 * It also adds the ability to auto-detect the front headphone port.
4768 struct ca0132_spec *spec = codec->spec; in ca0132_alt_select_out()
4774 hda_nid_t headphone_nid = spec->out_pins[1]; in ca0132_alt_select_out()
4780 auto_jack = spec->vnode_lswitch[VNID_HP_ASEL - VNODE_START_NID]; in ca0132_alt_select_out()
4788 jack_present = snd_hda_jack_detect(codec, spec->unsol_tag_hp) || in ca0132_alt_select_out()
4789 snd_hda_jack_detect(codec, spec->unsol_tag_front_hp); in ca0132_alt_select_out()
4792 spec->cur_out_type = HEADPHONE_OUT; in ca0132_alt_select_out()
4794 spec->cur_out_type = SPEAKER_OUT; in ca0132_alt_select_out()
4796 spec->cur_out_type = spec->out_enum_val; in ca0132_alt_select_out()
4798 outfx_set = spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]; in ca0132_alt_select_out()
4808 switch (spec->cur_out_type) { in ca0132_alt_select_out()
4813 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_alt_select_out()
4817 ca0132_set_out_node_pincfg(codec, spec->out_pins[1], 0, 0); in ca0132_alt_select_out()
4818 /* Set front L-R to output. */ in ca0132_alt_select_out()
4819 ca0132_set_out_node_pincfg(codec, spec->out_pins[0], 1, 0); in ca0132_alt_select_out()
4821 ca0132_set_out_node_pincfg(codec, spec->out_pins[2], 1, 0); in ca0132_alt_select_out()
4823 ca0132_set_out_node_pincfg(codec, spec->out_pins[3], 1, 0); in ca0132_alt_select_out()
4830 if (!outfx_set && spec->channel_cfg_val == SPEAKER_CHANNELS_2_0) in ca0132_alt_select_out()
4833 tmp = speaker_channel_cfgs[spec->channel_cfg_val].val; in ca0132_alt_select_out()
4842 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_alt_select_out()
4846 ca0132_set_out_node_pincfg(codec, spec->out_pins[0], 0, 0); in ca0132_alt_select_out()
4847 ca0132_set_out_node_pincfg(codec, spec->out_pins[2], 0, 0); in ca0132_alt_select_out()
4848 ca0132_set_out_node_pincfg(codec, spec->out_pins[3], 0, 0); in ca0132_alt_select_out()
4851 if (snd_hda_jack_detect(codec, spec->unsol_tag_front_hp)) in ca0132_alt_select_out()
4852 headphone_nid = spec->out_pins[2]; in ca0132_alt_select_out()
4853 else if (snd_hda_jack_detect(codec, spec->unsol_tag_hp)) in ca0132_alt_select_out()
4854 headphone_nid = spec->out_pins[1]; in ca0132_alt_select_out()
4868 * If output effects are enabled, set the X-Bass effect value again to in ca0132_alt_select_out()
4874 spec->effects_switch[X_BASS - EFFECT_START_NID]); in ca0132_alt_select_out()
4890 if (spec->cur_out_type == SPEAKER_OUT) in ca0132_alt_select_out()
4892 spec->bass_redirection_val); in ca0132_alt_select_out()
4902 if (spec->cur_out_type == SPEAKER_OUT) { in ca0132_alt_select_out()
4921 ca0132_alt_select_out(spec->codec); in ca0132_unsol_hp_delayed()
4923 ca0132_select_out(spec->codec); in ca0132_unsol_hp_delayed()
4925 jack = snd_hda_jack_tbl_get(spec->codec, spec->unsol_tag_hp); in ca0132_unsol_hp_delayed()
4927 jack->block_report = 0; in ca0132_unsol_hp_delayed()
4928 snd_hda_jack_report_sync(spec->codec); in ca0132_unsol_hp_delayed()
4944 struct ca0132_spec *spec = codec->spec; in ca0132_set_vipsource()
4947 if (spec->dsp_state != DSP_DOWNLOADED) in ca0132_set_vipsource()
4951 if (!spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID] || in ca0132_set_vipsource()
4956 if (spec->cur_mic_type == DIGITAL_MIC) in ca0132_set_vipsource()
4966 if (spec->cur_mic_type == DIGITAL_MIC) in ca0132_set_vipsource()
4982 struct ca0132_spec *spec = codec->spec; in ca0132_alt_set_vipsource()
4985 if (spec->dsp_state != DSP_DOWNLOADED) in ca0132_alt_set_vipsource()
4994 if (!spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID] || in ca0132_alt_set_vipsource()
4995 (val == 0) || spec->in_enum_val == REAR_LINE_IN) { in ca0132_alt_set_vipsource()
5008 if (spec->in_enum_val == REAR_LINE_IN) in ca0132_alt_set_vipsource()
5026 if (spec->effects_switch[VOICE_FOCUS - EFFECT_START_NID]) in ca0132_alt_set_vipsource()
5048 * If jack inserted, ext.mic will be selected, else built-in mic
5053 struct ca0132_spec *spec = codec->spec; in ca0132_select_mic()
5061 auto_jack = spec->vnode_lswitch[VNID_AMIC1_ASEL - VNODE_START_NID]; in ca0132_select_mic()
5064 jack_present = snd_hda_jack_detect(codec, spec->unsol_tag_amic1); in ca0132_select_mic()
5067 spec->vnode_lswitch[VNID_AMIC1_SEL - VNODE_START_NID]; in ca0132_select_mic()
5070 spec->cur_mic_type = LINE_MIC_IN; in ca0132_select_mic()
5072 spec->cur_mic_type = DIGITAL_MIC; in ca0132_select_mic()
5074 if (spec->cur_mic_type == DIGITAL_MIC) { in ca0132_select_mic()
5081 spec->effects_switch in ca0132_select_mic()
5082 [VOICE_FOCUS - EFFECT_START_NID]); in ca0132_select_mic()
5087 ca0132_mic_boost_set(codec, spec->cur_mic_boost); in ca0132_select_mic()
5100 * The front mic has no jack-detection, so the only way to switch to it
5105 struct ca0132_spec *spec = codec->spec; in ca0132_alt_select_in()
5115 spec->cur_mic_type = spec->in_enum_val; in ca0132_alt_select_in()
5117 switch (spec->cur_mic_type) { in ca0132_alt_select_in()
5175 ca0132_alt_mic_boost_set(codec, spec->mic_boost_enum_val); in ca0132_alt_select_in()
5268 ca0132_alt_mic_boost_set(codec, spec->mic_boost_enum_val); in ca0132_alt_select_in()
5284 struct ca0132_spec *spec = codec->spec; in ca0132_is_vnode_effective()
5289 nid = spec->shared_out_nid; in ca0132_is_vnode_effective()
5292 nid = spec->shared_mic_nid; in ca0132_is_vnode_effective()
5310 struct ca0132_spec *spec = codec->spec; in ca0132_voicefx_set()
5315 tmp = spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID] ? in ca0132_voicefx_set()
5332 struct ca0132_spec *spec = codec->spec; in ca0132_effects_set()
5336 int idx = nid - EFFECT_START_NID; in ca0132_effects_set()
5344 if (!spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]) in ca0132_effects_set()
5346 if (spec->cur_out_type == SPEAKER_OUT && nid == X_BASS) { in ca0132_effects_set()
5347 channel_cfg = spec->channel_cfg_val; in ca0132_effects_set()
5357 if (!spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID]) in ca0132_effects_set()
5360 /* Voice Focus applies to 2-ch Mic, Digital Mic */ in ca0132_effects_set()
5361 if ((nid == VOICE_FOCUS) && (spec->cur_mic_type != DIGITAL_MIC)) in ca0132_effects_set()
5366 && (spec->cur_mic_type != REAR_LINE_IN)) { in ca0132_effects_set()
5367 if (spec->effects_switch[CRYSTAL_VOICE - in ca0132_effects_set()
5370 if (spec->effects_switch[VOICE_FOCUS - in ca0132_effects_set()
5385 && (spec->cur_mic_type != REAR_LINE_IN)) { in ca0132_effects_set()
5386 if (spec->effects_switch[CRYSTAL_VOICE - in ca0132_effects_set()
5388 if (spec->effects_switch[NOISE_REDUCTION - in ca0132_effects_set()
5401 spec->in_enum_val == REAR_LINE_IN) in ca0132_effects_set()
5423 struct ca0132_spec *spec = codec->spec; in ca0132_pe_switch_set()
5428 spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]); in ca0132_pe_switch_set()
5433 i = OUT_EFFECT_START_NID - EFFECT_START_NID; in ca0132_pe_switch_set()
5437 ret |= ca0132_effects_set(codec, nid, spec->effects_switch[i]); in ca0132_pe_switch_set()
5442 /* Check if Mic1 is streaming, if so, stop streaming */
5445 struct ca0132_spec *spec = codec->spec; in stop_mic1()
5446 unsigned int oldval = snd_hda_codec_read(codec, spec->adcs[0], 0, in stop_mic1()
5449 snd_hda_codec_write(codec, spec->adcs[0], 0, in stop_mic1()
5455 /* Resume Mic1 streaming if it was stopped. */
5458 struct ca0132_spec *spec = codec->spec; in resume_mic1()
5461 snd_hda_codec_write(codec, spec->adcs[0], 0, in resume_mic1()
5471 struct ca0132_spec *spec = codec->spec; in ca0132_cvoice_switch_set()
5477 spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID]); in ca0132_cvoice_switch_set()
5479 i = IN_EFFECT_START_NID - EFFECT_START_NID; in ca0132_cvoice_switch_set()
5483 ret |= ca0132_effects_set(codec, nid, spec->effects_switch[i]); in ca0132_cvoice_switch_set()
5486 ret |= ca0132_voicefx_set(codec, (spec->voicefx_val ? 1 : 0)); in ca0132_cvoice_switch_set()
5500 struct ca0132_spec *spec = codec->spec; in ca0132_mic_boost_set()
5504 ret = snd_hda_codec_amp_update(codec, spec->input_pins[0], 0, in ca0132_mic_boost_set()
5507 ret = snd_hda_codec_amp_update(codec, spec->input_pins[0], 0, in ca0132_mic_boost_set()
5515 struct ca0132_spec *spec = codec->spec; in ca0132_alt_mic_boost_set()
5518 ret = snd_hda_codec_amp_update(codec, spec->input_pins[0], 0, in ca0132_alt_mic_boost_set()
5552 struct ca0132_spec *spec = codec->spec; in ca0132_vnode_switch_set()
5557 spec->vnode_lswitch[VNID_HP_ASEL - VNODE_START_NID]; in ca0132_vnode_switch_set()
5569 spec->vnode_lswitch[VNID_AMIC1_ASEL - VNODE_START_NID]; in ca0132_vnode_switch_set()
5595 mutex_lock(&codec->control_mutex); in ca0132_vnode_switch_set()
5596 pval = kcontrol->private_value; in ca0132_vnode_switch_set()
5597 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(shared_nid, ch, in ca0132_vnode_switch_set()
5600 kcontrol->private_value = pval; in ca0132_vnode_switch_set()
5601 mutex_unlock(&codec->control_mutex); in ca0132_vnode_switch_set()
5650 &(lookup[idx - 1]), sizeof(unsigned int)); in ca0132_alt_slider_ctl_set()
5671 struct ca0132_spec *spec = codec->spec; in ca0132_alt_xbass_xover_slider_ctl_get()
5672 long *valp = ucontrol->value.integer.value; in ca0132_alt_xbass_xover_slider_ctl_get()
5676 *valp = spec->bass_redirect_xover_freq; in ca0132_alt_xbass_xover_slider_ctl_get()
5678 *valp = spec->xbass_xover_freq; in ca0132_alt_xbass_xover_slider_ctl_get()
5687 struct ca0132_spec *spec = codec->spec; in ca0132_alt_slider_ctl_get()
5689 long *valp = ucontrol->value.integer.value; in ca0132_alt_slider_ctl_get()
5690 int idx = nid - OUT_EFFECT_START_NID; in ca0132_alt_slider_ctl_get()
5692 *valp = spec->fx_ctl_val[idx]; in ca0132_alt_slider_ctl_get()
5697 * The X-bass crossover starts at 10hz, so the min is 1. The
5703 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in ca0132_alt_xbass_xover_slider_info()
5704 uinfo->count = 1; in ca0132_alt_xbass_xover_slider_info()
5705 uinfo->value.integer.min = 1; in ca0132_alt_xbass_xover_slider_info()
5706 uinfo->value.integer.max = 100; in ca0132_alt_xbass_xover_slider_info()
5707 uinfo->value.integer.step = 1; in ca0132_alt_xbass_xover_slider_info()
5717 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in ca0132_alt_effect_slider_info()
5718 uinfo->count = chs == 3 ? 2 : 1; in ca0132_alt_effect_slider_info()
5719 uinfo->value.integer.min = 0; in ca0132_alt_effect_slider_info()
5720 uinfo->value.integer.max = 100; in ca0132_alt_effect_slider_info()
5721 uinfo->value.integer.step = 1; in ca0132_alt_effect_slider_info()
5730 struct ca0132_spec *spec = codec->spec; in ca0132_alt_xbass_xover_slider_put()
5732 long *valp = ucontrol->value.integer.value; in ca0132_alt_xbass_xover_slider_put()
5737 cur_val = &spec->bass_redirect_xover_freq; in ca0132_alt_xbass_xover_slider_put()
5739 cur_val = &spec->xbass_xover_freq; in ca0132_alt_xbass_xover_slider_put()
5760 struct ca0132_spec *spec = codec->spec; in ca0132_alt_effect_slider_put()
5762 long *valp = ucontrol->value.integer.value; in ca0132_alt_effect_slider_put()
5765 idx = nid - EFFECT_START_NID; in ca0132_alt_effect_slider_put()
5767 if (spec->fx_ctl_val[idx] == *valp) in ca0132_alt_effect_slider_put()
5770 spec->fx_ctl_val[idx] = *valp; in ca0132_alt_effect_slider_put()
5782 * traditional 0-100 in alsamixer that goes in big steps. I like enum better.
5793 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_mic_boost_info()
5794 uinfo->count = 1; in ca0132_alt_mic_boost_info()
5795 uinfo->value.enumerated.items = MIC_BOOST_NUM_OF_STEPS; in ca0132_alt_mic_boost_info()
5796 if (uinfo->value.enumerated.item >= MIC_BOOST_NUM_OF_STEPS) in ca0132_alt_mic_boost_info()
5797 uinfo->value.enumerated.item = MIC_BOOST_NUM_OF_STEPS - 1; in ca0132_alt_mic_boost_info()
5798 sprintf(namestr, "%d %s", (uinfo->value.enumerated.item * 10), sfx); in ca0132_alt_mic_boost_info()
5799 strcpy(uinfo->value.enumerated.name, namestr); in ca0132_alt_mic_boost_info()
5807 struct ca0132_spec *spec = codec->spec; in ca0132_alt_mic_boost_get()
5809 ucontrol->value.enumerated.item[0] = spec->mic_boost_enum_val; in ca0132_alt_mic_boost_get()
5817 struct ca0132_spec *spec = codec->spec; in ca0132_alt_mic_boost_put()
5818 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_mic_boost_put()
5827 spec->mic_boost_enum_val = sel; in ca0132_alt_mic_boost_put()
5829 if (spec->in_enum_val != REAR_LINE_IN) in ca0132_alt_mic_boost_put()
5830 ca0132_alt_mic_boost_set(codec, spec->mic_boost_enum_val); in ca0132_alt_mic_boost_put()
5836 * Sound BlasterX AE-5 Headphone Gain Controls.
5845 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ae5_headphone_gain_info()
5846 uinfo->count = 1; in ae5_headphone_gain_info()
5847 uinfo->value.enumerated.items = AE5_HEADPHONE_GAIN_MAX; in ae5_headphone_gain_info()
5848 if (uinfo->value.enumerated.item >= AE5_HEADPHONE_GAIN_MAX) in ae5_headphone_gain_info()
5849 uinfo->value.enumerated.item = AE5_HEADPHONE_GAIN_MAX - 1; in ae5_headphone_gain_info()
5851 ae5_headphone_gain_presets[uinfo->value.enumerated.item].name, in ae5_headphone_gain_info()
5853 strcpy(uinfo->value.enumerated.name, namestr); in ae5_headphone_gain_info()
5861 struct ca0132_spec *spec = codec->spec; in ae5_headphone_gain_get()
5863 ucontrol->value.enumerated.item[0] = spec->ae5_headphone_gain_val; in ae5_headphone_gain_get()
5871 struct ca0132_spec *spec = codec->spec; in ae5_headphone_gain_put()
5872 int sel = ucontrol->value.enumerated.item[0]; in ae5_headphone_gain_put()
5881 spec->ae5_headphone_gain_val = sel; in ae5_headphone_gain_put()
5883 if (spec->out_enum_val == HEADPHONE_OUT) in ae5_headphone_gain_put()
5884 ae5_headphone_gain_set(codec, spec->ae5_headphone_gain_val); in ae5_headphone_gain_put()
5890 * Sound BlasterX AE-5 sound filter enumerated control.
5899 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ae5_sound_filter_info()
5900 uinfo->count = 1; in ae5_sound_filter_info()
5901 uinfo->value.enumerated.items = AE5_SOUND_FILTER_MAX; in ae5_sound_filter_info()
5902 if (uinfo->value.enumerated.item >= AE5_SOUND_FILTER_MAX) in ae5_sound_filter_info()
5903 uinfo->value.enumerated.item = AE5_SOUND_FILTER_MAX - 1; in ae5_sound_filter_info()
5905 ae5_filter_presets[uinfo->value.enumerated.item].name); in ae5_sound_filter_info()
5906 strcpy(uinfo->value.enumerated.name, namestr); in ae5_sound_filter_info()
5914 struct ca0132_spec *spec = codec->spec; in ae5_sound_filter_get()
5916 ucontrol->value.enumerated.item[0] = spec->ae5_filter_val; in ae5_sound_filter_get()
5924 struct ca0132_spec *spec = codec->spec; in ae5_sound_filter_put()
5925 int sel = ucontrol->value.enumerated.item[0]; in ae5_sound_filter_put()
5934 spec->ae5_filter_val = sel; in ae5_sound_filter_put()
5944 * front microphone has no auto-detect, and we need a way to set the rear
5945 * as line-in
5950 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_input_source_info()
5951 uinfo->count = 1; in ca0132_alt_input_source_info()
5952 uinfo->value.enumerated.items = IN_SRC_NUM_OF_INPUTS; in ca0132_alt_input_source_info()
5953 if (uinfo->value.enumerated.item >= IN_SRC_NUM_OF_INPUTS) in ca0132_alt_input_source_info()
5954 uinfo->value.enumerated.item = IN_SRC_NUM_OF_INPUTS - 1; in ca0132_alt_input_source_info()
5955 strcpy(uinfo->value.enumerated.name, in ca0132_alt_input_source_info()
5956 in_src_str[uinfo->value.enumerated.item]); in ca0132_alt_input_source_info()
5964 struct ca0132_spec *spec = codec->spec; in ca0132_alt_input_source_get()
5966 ucontrol->value.enumerated.item[0] = spec->in_enum_val; in ca0132_alt_input_source_get()
5974 struct ca0132_spec *spec = codec->spec; in ca0132_alt_input_source_put()
5975 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_input_source_put()
5979 * The AE-7 has no front microphone, so limit items to 2: rear mic and in ca0132_alt_input_source_put()
5980 * line-in. in ca0132_alt_input_source_put()
5991 spec->in_enum_val = sel; in ca0132_alt_input_source_put()
6002 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_output_select_get_info()
6003 uinfo->count = 1; in ca0132_alt_output_select_get_info()
6004 uinfo->value.enumerated.items = NUM_OF_OUTPUTS; in ca0132_alt_output_select_get_info()
6005 if (uinfo->value.enumerated.item >= NUM_OF_OUTPUTS) in ca0132_alt_output_select_get_info()
6006 uinfo->value.enumerated.item = NUM_OF_OUTPUTS - 1; in ca0132_alt_output_select_get_info()
6007 strcpy(uinfo->value.enumerated.name, in ca0132_alt_output_select_get_info()
6008 out_type_str[uinfo->value.enumerated.item]); in ca0132_alt_output_select_get_info()
6016 struct ca0132_spec *spec = codec->spec; in ca0132_alt_output_select_get()
6018 ucontrol->value.enumerated.item[0] = spec->out_enum_val; in ca0132_alt_output_select_get()
6026 struct ca0132_spec *spec = codec->spec; in ca0132_alt_output_select_put()
6027 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_output_select_put()
6037 spec->out_enum_val = sel; in ca0132_alt_output_select_put()
6039 auto_jack = spec->vnode_lswitch[VNID_HP_ASEL - VNODE_START_NID]; in ca0132_alt_output_select_put()
6053 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_speaker_channel_cfg_get_info()
6054 uinfo->count = 1; in ca0132_alt_speaker_channel_cfg_get_info()
6055 uinfo->value.enumerated.items = items; in ca0132_alt_speaker_channel_cfg_get_info()
6056 if (uinfo->value.enumerated.item >= items) in ca0132_alt_speaker_channel_cfg_get_info()
6057 uinfo->value.enumerated.item = items - 1; in ca0132_alt_speaker_channel_cfg_get_info()
6058 strcpy(uinfo->value.enumerated.name, in ca0132_alt_speaker_channel_cfg_get_info()
6059 speaker_channel_cfgs[uinfo->value.enumerated.item].name); in ca0132_alt_speaker_channel_cfg_get_info()
6067 struct ca0132_spec *spec = codec->spec; in ca0132_alt_speaker_channel_cfg_get()
6069 ucontrol->value.enumerated.item[0] = spec->channel_cfg_val; in ca0132_alt_speaker_channel_cfg_get()
6077 struct ca0132_spec *spec = codec->spec; in ca0132_alt_speaker_channel_cfg_put()
6078 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_speaker_channel_cfg_put()
6087 spec->channel_cfg_val = sel; in ca0132_alt_speaker_channel_cfg_put()
6089 if (spec->out_enum_val == SPEAKER_OUT) in ca0132_alt_speaker_channel_cfg_put()
6106 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_svm_setting_info()
6107 uinfo->count = 1; in ca0132_alt_svm_setting_info()
6108 uinfo->value.enumerated.items = NUM_OF_SVM_SETTINGS; in ca0132_alt_svm_setting_info()
6109 if (uinfo->value.enumerated.item >= NUM_OF_SVM_SETTINGS) in ca0132_alt_svm_setting_info()
6110 uinfo->value.enumerated.item = NUM_OF_SVM_SETTINGS - 1; in ca0132_alt_svm_setting_info()
6111 strcpy(uinfo->value.enumerated.name, in ca0132_alt_svm_setting_info()
6112 out_svm_set_enum_str[uinfo->value.enumerated.item]); in ca0132_alt_svm_setting_info()
6120 struct ca0132_spec *spec = codec->spec; in ca0132_alt_svm_setting_get()
6122 ucontrol->value.enumerated.item[0] = spec->smart_volume_setting; in ca0132_alt_svm_setting_get()
6130 struct ca0132_spec *spec = codec->spec; in ca0132_alt_svm_setting_put()
6131 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_svm_setting_put()
6133 unsigned int idx = SMART_VOLUME - EFFECT_START_NID; in ca0132_alt_svm_setting_put()
6142 spec->smart_volume_setting = sel; in ca0132_alt_svm_setting_put()
6170 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_eq_preset_info()
6171 uinfo->count = 1; in ca0132_alt_eq_preset_info()
6172 uinfo->value.enumerated.items = items; in ca0132_alt_eq_preset_info()
6173 if (uinfo->value.enumerated.item >= items) in ca0132_alt_eq_preset_info()
6174 uinfo->value.enumerated.item = items - 1; in ca0132_alt_eq_preset_info()
6175 strcpy(uinfo->value.enumerated.name, in ca0132_alt_eq_preset_info()
6176 ca0132_alt_eq_presets[uinfo->value.enumerated.item].name); in ca0132_alt_eq_preset_info()
6184 struct ca0132_spec *spec = codec->spec; in ca0132_alt_eq_preset_get()
6186 ucontrol->value.enumerated.item[0] = spec->eq_preset_val; in ca0132_alt_eq_preset_get()
6194 struct ca0132_spec *spec = codec->spec; in ca0132_alt_eq_preset_put()
6196 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_eq_preset_put()
6217 spec->eq_preset_val = sel; in ca0132_alt_eq_preset_put()
6227 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_voicefx_info()
6228 uinfo->count = 1; in ca0132_voicefx_info()
6229 uinfo->value.enumerated.items = items; in ca0132_voicefx_info()
6230 if (uinfo->value.enumerated.item >= items) in ca0132_voicefx_info()
6231 uinfo->value.enumerated.item = items - 1; in ca0132_voicefx_info()
6232 strcpy(uinfo->value.enumerated.name, in ca0132_voicefx_info()
6233 ca0132_voicefx_presets[uinfo->value.enumerated.item].name); in ca0132_voicefx_info()
6241 struct ca0132_spec *spec = codec->spec; in ca0132_voicefx_get()
6243 ucontrol->value.enumerated.item[0] = spec->voicefx_val; in ca0132_voicefx_get()
6251 struct ca0132_spec *spec = codec->spec; in ca0132_voicefx_put()
6253 int sel = ucontrol->value.enumerated.item[0]; in ca0132_voicefx_put()
6274 spec->voicefx_val = sel; in ca0132_voicefx_put()
6286 struct ca0132_spec *spec = codec->spec; in ca0132_switch_get()
6289 long *valp = ucontrol->value.integer.value; in ca0132_switch_get()
6294 *valp = spec->vnode_lswitch[nid - VNODE_START_NID]; in ca0132_switch_get()
6298 *valp = spec->vnode_rswitch[nid - VNODE_START_NID]; in ca0132_switch_get()
6306 *valp = spec->effects_switch[nid - EFFECT_START_NID]; in ca0132_switch_get()
6311 if (nid == spec->input_pins[0]) { in ca0132_switch_get()
6312 *valp = spec->cur_mic_boost; in ca0132_switch_get()
6317 *valp = spec->zxr_gain_set; in ca0132_switch_get()
6322 *valp = spec->speaker_range_val[nid - SPEAKER_FULL_RANGE_FRONT]; in ca0132_switch_get()
6327 *valp = spec->bass_redirection_val; in ca0132_switch_get()
6338 struct ca0132_spec *spec = codec->spec; in ca0132_switch_put()
6341 long *valp = ucontrol->value.integer.value; in ca0132_switch_put()
6351 spec->vnode_lswitch[nid - VNODE_START_NID] = *valp; in ca0132_switch_put()
6355 spec->vnode_rswitch[nid - VNODE_START_NID] = *valp; in ca0132_switch_put()
6364 spec->effects_switch[nid - EFFECT_START_NID] = *valp; in ca0132_switch_put()
6371 spec->effects_switch[nid - EFFECT_START_NID] = *valp; in ca0132_switch_put()
6379 spec->effects_switch[nid - EFFECT_START_NID] = *valp; in ca0132_switch_put()
6385 if (nid == spec->input_pins[0]) { in ca0132_switch_put()
6386 spec->cur_mic_boost = *valp; in ca0132_switch_put()
6388 if (spec->in_enum_val != REAR_LINE_IN) in ca0132_switch_put()
6392 if (spec->cur_mic_type != DIGITAL_MIC) in ca0132_switch_put()
6400 spec->zxr_gain_set = *valp; in ca0132_switch_put()
6401 if (spec->cur_out_type == HEADPHONE_OUT) in ca0132_switch_put()
6410 spec->speaker_range_val[nid - SPEAKER_FULL_RANGE_FRONT] = *valp; in ca0132_switch_put()
6411 if (spec->cur_out_type == SPEAKER_OUT) in ca0132_switch_put()
6418 spec->bass_redirection_val = *valp; in ca0132_switch_put()
6419 if (spec->cur_out_type == SPEAKER_OUT) in ca0132_switch_put()
6440 struct ca0132_spec *spec = codec->spec; in ca0132_alt_dsp_volume_put()
6449 lookup_val = spec->vnode_lvol[nid - VNODE_START_NID]; in ca0132_alt_dsp_volume_put()
6456 lookup_val = spec->vnode_rvol[nid - VNODE_START_NID]; in ca0132_alt_dsp_volume_put()
6472 struct ca0132_spec *spec = codec->spec; in ca0132_volume_info()
6482 nid = spec->shared_out_nid; in ca0132_volume_info()
6483 mutex_lock(&codec->control_mutex); in ca0132_volume_info()
6484 pval = kcontrol->private_value; in ca0132_volume_info()
6485 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(nid, ch, 0, dir); in ca0132_volume_info()
6487 kcontrol->private_value = pval; in ca0132_volume_info()
6488 mutex_unlock(&codec->control_mutex); in ca0132_volume_info()
6492 nid = spec->shared_mic_nid; in ca0132_volume_info()
6493 mutex_lock(&codec->control_mutex); in ca0132_volume_info()
6494 pval = kcontrol->private_value; in ca0132_volume_info()
6495 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(nid, ch, 0, dir); in ca0132_volume_info()
6497 kcontrol->private_value = pval; in ca0132_volume_info()
6498 mutex_unlock(&codec->control_mutex); in ca0132_volume_info()
6510 struct ca0132_spec *spec = codec->spec; in ca0132_volume_get()
6513 long *valp = ucontrol->value.integer.value; in ca0132_volume_get()
6517 *valp = spec->vnode_lvol[nid - VNODE_START_NID]; in ca0132_volume_get()
6521 *valp = spec->vnode_rvol[nid - VNODE_START_NID]; in ca0132_volume_get()
6531 struct ca0132_spec *spec = codec->spec; in ca0132_volume_put()
6534 long *valp = ucontrol->value.integer.value; in ca0132_volume_put()
6541 spec->vnode_lvol[nid - VNODE_START_NID] = *valp; in ca0132_volume_put()
6545 spec->vnode_rvol[nid - VNODE_START_NID] = *valp; in ca0132_volume_put()
6556 mutex_lock(&codec->control_mutex); in ca0132_volume_put()
6557 pval = kcontrol->private_value; in ca0132_volume_put()
6558 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(shared_nid, ch, in ca0132_volume_put()
6561 kcontrol->private_value = pval; in ca0132_volume_put()
6562 mutex_unlock(&codec->control_mutex); in ca0132_volume_put()
6578 struct ca0132_spec *spec = codec->spec; in ca0132_alt_volume_put()
6581 long *valp = ucontrol->value.integer.value; in ca0132_alt_volume_put()
6596 spec->vnode_lvol[vnid - VNODE_START_NID] = *valp; in ca0132_alt_volume_put()
6600 spec->vnode_rvol[vnid - VNODE_START_NID] = *valp; in ca0132_alt_volume_put()
6606 mutex_lock(&codec->control_mutex); in ca0132_alt_volume_put()
6608 mutex_unlock(&codec->control_mutex); in ca0132_alt_volume_put()
6618 struct ca0132_spec *spec = codec->spec; in ca0132_volume_tlv()
6628 nid = spec->shared_out_nid; in ca0132_volume_tlv()
6629 mutex_lock(&codec->control_mutex); in ca0132_volume_tlv()
6630 pval = kcontrol->private_value; in ca0132_volume_tlv()
6631 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(nid, ch, 0, dir); in ca0132_volume_tlv()
6633 kcontrol->private_value = pval; in ca0132_volume_tlv()
6634 mutex_unlock(&codec->control_mutex); in ca0132_volume_tlv()
6638 nid = spec->shared_mic_nid; in ca0132_volume_tlv()
6639 mutex_lock(&codec->control_mutex); in ca0132_volume_tlv()
6640 pval = kcontrol->private_value; in ca0132_volume_tlv()
6641 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(nid, ch, 0, dir); in ca0132_volume_tlv()
6643 kcontrol->private_value = pval; in ca0132_volume_tlv()
6644 mutex_unlock(&codec->control_mutex); in ca0132_volume_tlv()
6691 struct ca0132_spec *spec = codec->spec; in add_fx_switch()
6790 CA0132_CODEC_MUTE_MONO("Full-Range Front Speakers", in ca0132_alt_add_front_full_range_switch()
6800 CA0132_CODEC_MUTE_MONO("Full-Range Rear Speakers", in ca0132_alt_add_rear_full_range_switch()
6809 * channel on speakers that are set as not being full-range. On configurations
6811 * replacement for X-Bass on configurations with an LFE channel.
6842 * because the front microphone has no auto-detect, and Line-in has to be set
6875 * Add headphone gain enumerated control for the AE-5. This switches between
6876 * three modes, low, medium, and high. When non-headphone outputs are selected,
6882 HDA_CODEC_MUTE_MONO("AE-5: Headphone Gain", in ae5_add_headphone_gain_enum()
6892 * Add sound filter enumerated control for the AE-5. This adds three different
6899 HDA_CODEC_MUTE_MONO("AE-5: Sound Filter", in ae5_add_sound_filter_enum()
6950 list_for_each_entry(pcm, &codec->pcm_list_head, list) { in ca0132_alt_add_chmap_ctls()
6952 &pcm->stream[SNDRV_PCM_STREAM_PLAYBACK]; in ca0132_alt_add_chmap_ctls()
6957 if (hinfo->channels_max == 6) { in ca0132_alt_add_chmap_ctls()
6958 err = snd_pcm_add_chmap_ctls(pcm->pcm, in ca0132_alt_add_chmap_ctls()
6960 elem, hinfo->channels_max, 0, &chmap); in ca0132_alt_add_chmap_ctls()
6976 HDA_CODEC_VOLUME("Analog-Mic2 Capture Volume", 0x08, 0, HDA_INPUT),
6977 HDA_CODEC_MUTE("Analog-Mic2 Capture Switch", 0x08, 0, HDA_INPUT),
6980 CA0132_CODEC_MUTE_MONO("Mic1-Boost (30dB) Capture Switch",
6994 * Desktop specific control mixer. Removes auto-detect for mic, and adds
7040 struct ca0132_spec *spec = codec->spec; in ca0132_build_controls()
7045 for (i = 0; i < spec->num_mixers; i++) { in ca0132_build_controls()
7046 err = snd_hda_add_new_ctls(codec, spec->mixers[i]); in ca0132_build_controls()
7052 snd_hda_set_vmaster_tlv(codec, spec->dacs[0], HDA_OUTPUT, in ca0132_build_controls()
7053 spec->tlv); in ca0132_build_controls()
7055 spec->tlv, ca0132_alt_follower_pfxs, in ca0132_build_controls()
7060 true, 0, &spec->vmaster_mute.sw_kctl); in ca0132_build_controls()
7072 if (i == (ECHO_CANCELLATION - IN_EFFECT_START_NID + in ca0132_build_controls()
7107 num_sliders = OUT_EFFECTS_COUNT - 1; in ca0132_build_controls()
7118 "X-Bass Crossover", EFX_DIR_OUT); in ca0132_build_controls()
7166 * header on the card, and aux-in is handled by the DBPro board. in ca0132_build_controls()
7198 err = snd_hda_jack_add_kctls(codec, &spec->autocfg); in ca0132_build_controls()
7202 if (spec->dig_out) { in ca0132_build_controls()
7203 err = snd_hda_create_spdif_out_ctls(codec, spec->dig_out, in ca0132_build_controls()
7204 spec->dig_out); in ca0132_build_controls()
7207 err = snd_hda_create_spdif_share_sw(codec, &spec->multiout); in ca0132_build_controls()
7210 /* spec->multiout.share_spdif = 1; */ in ca0132_build_controls()
7213 if (spec->dig_in) { in ca0132_build_controls()
7214 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in); in ca0132_build_controls()
7227 struct ca0132_spec *spec = codec->spec; in dbpro_build_controls()
7230 if (spec->dig_out) { in dbpro_build_controls()
7231 err = snd_hda_create_spdif_out_ctls(codec, spec->dig_out, in dbpro_build_controls()
7232 spec->dig_out); in dbpro_build_controls()
7237 if (spec->dig_in) { in dbpro_build_controls()
7238 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in); in dbpro_build_controls()
7291 struct ca0132_spec *spec = codec->spec; in ca0132_build_pcms()
7296 return -ENOMEM; in ca0132_build_pcms()
7298 info->own_chmap = true; in ca0132_build_pcms()
7299 info->stream[SNDRV_PCM_STREAM_PLAYBACK].chmap in ca0132_build_pcms()
7302 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = ca0132_pcm_analog_playback; in ca0132_build_pcms()
7303 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->dacs[0]; in ca0132_build_pcms()
7304 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = in ca0132_build_pcms()
7305 spec->multiout.max_channels; in ca0132_build_pcms()
7306 info->stream[SNDRV_PCM_STREAM_CAPTURE] = ca0132_pcm_analog_capture; in ca0132_build_pcms()
7307 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = 1; in ca0132_build_pcms()
7308 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adcs[0]; in ca0132_build_pcms()
7312 info = snd_hda_codec_pcm_new(codec, "CA0132 Analog Mic-In2"); in ca0132_build_pcms()
7314 return -ENOMEM; in ca0132_build_pcms()
7315 info->stream[SNDRV_PCM_STREAM_CAPTURE] = in ca0132_build_pcms()
7317 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = 1; in ca0132_build_pcms()
7318 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adcs[1]; in ca0132_build_pcms()
7323 return -ENOMEM; in ca0132_build_pcms()
7324 info->stream[SNDRV_PCM_STREAM_CAPTURE] = ca0132_pcm_analog_capture; in ca0132_build_pcms()
7325 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = 1; in ca0132_build_pcms()
7326 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adcs[2]; in ca0132_build_pcms()
7328 if (!spec->dig_out && !spec->dig_in) in ca0132_build_pcms()
7333 return -ENOMEM; in ca0132_build_pcms()
7334 info->pcm_type = HDA_PCM_TYPE_SPDIF; in ca0132_build_pcms()
7335 if (spec->dig_out) { in ca0132_build_pcms()
7336 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = in ca0132_build_pcms()
7338 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->dig_out; in ca0132_build_pcms()
7340 if (spec->dig_in) { in ca0132_build_pcms()
7341 info->stream[SNDRV_PCM_STREAM_CAPTURE] = in ca0132_build_pcms()
7343 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in; in ca0132_build_pcms()
7351 struct ca0132_spec *spec = codec->spec; in dbpro_build_pcms()
7356 return -ENOMEM; in dbpro_build_pcms()
7357 info->stream[SNDRV_PCM_STREAM_CAPTURE] = ca0132_pcm_analog_capture; in dbpro_build_pcms()
7358 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = 1; in dbpro_build_pcms()
7359 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adcs[0]; in dbpro_build_pcms()
7362 if (!spec->dig_out && !spec->dig_in) in dbpro_build_pcms()
7367 return -ENOMEM; in dbpro_build_pcms()
7368 info->pcm_type = HDA_PCM_TYPE_SPDIF; in dbpro_build_pcms()
7369 if (spec->dig_out) { in dbpro_build_pcms()
7370 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = in dbpro_build_pcms()
7372 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->dig_out; in dbpro_build_pcms()
7374 if (spec->dig_in) { in dbpro_build_pcms()
7375 info->stream[SNDRV_PCM_STREAM_CAPTURE] = in dbpro_build_pcms()
7377 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in; in dbpro_build_pcms()
7428 * Switch between Digital built-in mic and analog mic.
7432 struct ca0132_spec *spec = codec->spec; in ca0132_set_dmic()
7442 /* set DMic input as 2-ch */ in ca0132_set_dmic()
7446 val = spec->dmic_ctl; in ca0132_set_dmic()
7448 snd_hda_codec_write(codec, spec->input_pins[0], 0, in ca0132_set_dmic()
7451 if (!(spec->dmic_ctl & 0x20)) in ca0132_set_dmic()
7458 val = spec->dmic_ctl; in ca0132_set_dmic()
7461 snd_hda_codec_write(codec, spec->input_pins[0], 0, in ca0132_set_dmic()
7464 if (!(spec->dmic_ctl & 0x20)) in ca0132_set_dmic()
7476 struct ca0132_spec *spec = codec->spec; in ca0132_init_dmic()
7484 * Bit 2-0: MPIO select in ca0132_init_dmic()
7486 * Bit 7-4: reserved in ca0132_init_dmic()
7489 snd_hda_codec_write(codec, spec->input_pins[0], 0, in ca0132_init_dmic()
7493 * Bit 2-0: Data1 MPIO select in ca0132_init_dmic()
7495 * Bit 6-4: Data2 MPIO select in ca0132_init_dmic()
7499 snd_hda_codec_write(codec, spec->input_pins[0], 0, in ca0132_init_dmic()
7502 /* Use Ch-0 and Ch-1. Rate is 48K, mode 1. Disable DMic first. in ca0132_init_dmic()
7503 * Bit 3-0: Channel mask in ca0132_init_dmic()
7514 spec->dmic_ctl = val; in ca0132_init_dmic()
7515 snd_hda_codec_write(codec, spec->input_pins[0], 0, in ca0132_init_dmic()
7524 struct ca0132_spec *spec = codec->spec; in ca0132_init_analog_mic2()
7526 mutex_lock(&spec->chipio_mutex); in ca0132_init_analog_mic2()
7531 mutex_unlock(&spec->chipio_mutex); in ca0132_init_analog_mic2()
7536 struct ca0132_spec *spec = codec->spec; in ca0132_refresh_widget_caps()
7542 for (i = 0; i < spec->multiout.num_dacs; i++) in ca0132_refresh_widget_caps()
7543 refresh_amp_caps(codec, spec->dacs[i], HDA_OUTPUT); in ca0132_refresh_widget_caps()
7545 for (i = 0; i < spec->num_outputs; i++) in ca0132_refresh_widget_caps()
7546 refresh_amp_caps(codec, spec->out_pins[i], HDA_OUTPUT); in ca0132_refresh_widget_caps()
7548 for (i = 0; i < spec->num_inputs; i++) { in ca0132_refresh_widget_caps()
7549 refresh_amp_caps(codec, spec->adcs[i], HDA_INPUT); in ca0132_refresh_widget_caps()
7550 refresh_amp_caps(codec, spec->input_pins[i], HDA_INPUT); in ca0132_refresh_widget_caps()
7595 * cause of most of the no-audio on startup issues were due to improperly
7604 * channel being sandwiched between the mic1 and mic2 dma channels.
7614 struct ca0132_spec *spec = codec->spec; in ca0132_alt_start_dsp_audio_streams()
7621 mutex_lock(&spec->chipio_mutex); in ca0132_alt_start_dsp_audio_streams()
7632 mutex_unlock(&spec->chipio_mutex); in ca0132_alt_start_dsp_audio_streams()
7641 mutex_lock(&spec->chipio_mutex); in ca0132_alt_start_dsp_audio_streams()
7654 mutex_unlock(&spec->chipio_mutex); in ca0132_alt_start_dsp_audio_streams()
7658 * The region of ChipIO memory from 0x190000-0x1903fc is a sort of 'audio
7660 * of an 8-bit destination, an 8-bit source, and an unknown 2-bit number
7661 * value. The 2-bit number value is seemingly 0 if inactive, 1 if active,
7668 * the region of exram memory from 0x1477-0x1575 has each byte represent an
7681 * 0x00-0x1f: HDA audio stream input/output ports.
7682 * 0x80-0xbf: Sample rate converter input/outputs. Only valid ports seem to
7683 * have the lower-nibble set to 0x1, 0x2, and 0x9.
7684 * 0xc0-0xdf: DSP DMA input/output ports. Dynamically assigned.
7685 * 0xe0-0xff: DAC/ADC audio input/output ports.
7688 * 0x03: Mic1 ADC to DSP.
7707 chipio_8051_read_exram(codec, 0x1578 + remap_data->stream_id, in chipio_remap_stream()
7719 chipio_8051_read_exram(codec, 0x1578 + remap_data->stream_id, in chipio_remap_stream()
7729 __func__, remap_data->stream_id); in chipio_remap_stream()
7733 /* Offset isn't in bytes, its in 32-bit words, so multiply it by 4. */ in chipio_remap_stream()
7737 for (i = 0; i < remap_data->count; i++) { in chipio_remap_stream()
7739 stream_offset + remap_data->offset[i], in chipio_remap_stream()
7740 remap_data->value[i]); in chipio_remap_stream()
7751 /* Non-zero values are floating point 0.000198. */
7756 /* Non-zero values are floating point 0.000220. */
7761 /* Non-zero values are floating point 0.000100. */
7770 struct ca0132_spec *spec = codec->spec; in ca0132_alt_init_speaker_tuning()
7810 * Initialize mic for non-chromebook ca0132 implementations.
7814 struct ca0132_spec *spec = codec->spec; in ca0132_alt_init_analog_mics()
7844 struct ca0132_spec *spec = codec->spec; in sbz_connect_streams()
7846 mutex_lock(&spec->chipio_mutex); in sbz_connect_streams()
7862 mutex_unlock(&spec->chipio_mutex); in sbz_connect_streams()
7874 struct ca0132_spec *spec = codec->spec; in sbz_chipio_startup_data()
7876 mutex_lock(&spec->chipio_mutex); in sbz_chipio_startup_data()
7901 mutex_unlock(&spec->chipio_mutex); in sbz_chipio_startup_data()
7906 struct ca0132_spec *spec = codec->spec; in ca0132_alt_dsp_initial_mic_setup()
7937 struct ca0132_spec *spec = codec->spec; in ae5_post_dsp_register_set()
7942 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7943 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7944 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7945 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7946 writeb(0x00, spec->mem_base + 0x100); in ae5_post_dsp_register_set()
7947 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7948 writeb(0x00, spec->mem_base + 0x100); in ae5_post_dsp_register_set()
7949 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7950 writeb(0x00, spec->mem_base + 0x100); in ae5_post_dsp_register_set()
7951 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7952 writeb(0x00, spec->mem_base + 0x100); in ae5_post_dsp_register_set()
7953 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7965 * AE-5's registry values in Windows. in ae5_post_dsp_param_setup()
7970 * change colors on the external LED strip connected to the AE-5. in ae5_post_dsp_param_setup()
7991 struct ca0132_spec *spec = codec->spec; in ae5_post_dsp_stream_setup()
7993 mutex_lock(&spec->chipio_mutex); in ae5_post_dsp_stream_setup()
8012 mutex_unlock(&spec->chipio_mutex); in ae5_post_dsp_stream_setup()
8017 struct ca0132_spec *spec = codec->spec; in ae5_post_dsp_startup_data()
8019 mutex_lock(&spec->chipio_mutex); in ae5_post_dsp_startup_data()
8044 mutex_unlock(&spec->chipio_mutex); in ae5_post_dsp_startup_data()
8049 struct ca0132_spec *spec = codec->spec; in ae7_post_dsp_setup_ports()
8051 mutex_lock(&spec->chipio_mutex); in ae7_post_dsp_setup_ports()
8065 mutex_unlock(&spec->chipio_mutex); in ae7_post_dsp_setup_ports()
8070 struct ca0132_spec *spec = codec->spec; in ae7_post_dsp_asi_stream_setup()
8072 mutex_lock(&spec->chipio_mutex); in ae7_post_dsp_asi_stream_setup()
8088 mutex_unlock(&spec->chipio_mutex); in ae7_post_dsp_asi_stream_setup()
8107 struct ca0132_spec *spec = codec->spec; in ae7_post_dsp_asi_setup_ports()
8116 mutex_lock(&spec->chipio_mutex); in ae7_post_dsp_asi_setup_ports()
8153 * know what data is being sent. Interestingly, the AE-5 seems to go in ae7_post_dsp_asi_setup_ports()
8155 * step, but the AE-7 does. in ae7_post_dsp_asi_setup_ports()
8179 mutex_unlock(&spec->chipio_mutex); in ae7_post_dsp_asi_setup_ports()
8218 struct ca0132_spec *spec = codec->spec; in ca0132_setup_defaults()
8223 if (spec->dsp_state != DSP_DOWNLOADED) in ca0132_setup_defaults()
8263 struct ca0132_spec *spec = codec->spec; in r3d_setup_defaults()
8268 if (spec->dsp_state != DSP_DOWNLOADED) in r3d_setup_defaults()
8313 struct ca0132_spec *spec = codec->spec; in sbz_setup_defaults()
8318 if (spec->dsp_state != DSP_DOWNLOADED) in sbz_setup_defaults()
8363 * Setup default parameters for the Sound BlasterX AE-5 DSP.
8367 struct ca0132_spec *spec = codec->spec; in ae5_setup_defaults()
8372 if (spec->dsp_state != DSP_DOWNLOADED) in ae5_setup_defaults()
8428 * Setup default parameters for the Sound Blaster AE-7 DSP.
8432 struct ca0132_spec *spec = codec->spec; in ae7_setup_defaults()
8437 if (spec->dsp_state != DSP_DOWNLOADED) in ae7_setup_defaults()
8515 struct ca0132_spec *spec = codec->spec; in ca0132_init_flags()
8548 struct ca0132_spec *spec = codec->spec; in ca0132_init_params()
8579 struct ca0132_spec *spec = codec->spec; in ca0132_download_dsp_images()
8592 codec->card->dev) != 0) in ca0132_download_dsp_images()
8599 codec->card->dev) != 0) in ca0132_download_dsp_images()
8614 codec->card->dev) != 0) in ca0132_download_dsp_images()
8618 dsp_os_image = (struct dsp_image_seg *)(fw_entry->data); in ca0132_download_dsp_images()
8634 struct ca0132_spec *spec = codec->spec; in ca0132_download_dsp()
8640 if (spec->dsp_state == DSP_DOWNLOAD_FAILED) in ca0132_download_dsp()
8644 if (spec->dsp_state != DSP_DOWNLOADED) { in ca0132_download_dsp()
8645 spec->dsp_state = DSP_DOWNLOADING; in ca0132_download_dsp()
8648 spec->dsp_state = DSP_DOWNLOAD_FAILED; in ca0132_download_dsp()
8650 spec->dsp_state = DSP_DOWNLOADED; in ca0132_download_dsp()
8654 if (spec->dsp_state == DSP_DOWNLOADED && !ca0132_use_alt_functions(spec)) in ca0132_download_dsp()
8661 struct ca0132_spec *spec = codec->spec; in ca0132_process_dsp_response()
8665 if (spec->wait_scp) { in ca0132_process_dsp_response()
8667 spec->wait_scp = 0; in ca0132_process_dsp_response()
8676 struct ca0132_spec *spec = codec->spec; in hp_callback()
8679 /* Delay enabling the HP amp, to let the mic-detection in hp_callback()
8682 tbl = snd_hda_jack_tbl_get(codec, cb->nid); in hp_callback()
8684 tbl->block_report = 1; in hp_callback()
8685 schedule_delayed_work(&spec->unsol_hp_work, msecs_to_jiffies(500)); in hp_callback()
8690 struct ca0132_spec *spec = codec->spec; in amic_callback()
8700 struct ca0132_spec *spec = codec->spec; in ca0132_setup_unsol()
8701 snd_hda_jack_detect_enable_callback(codec, spec->unsol_tag_hp, hp_callback); in ca0132_setup_unsol()
8702 snd_hda_jack_detect_enable_callback(codec, spec->unsol_tag_amic1, in ca0132_setup_unsol()
8709 spec->unsol_tag_front_hp, hp_callback); in ca0132_setup_unsol()
8789 struct ca0132_spec *spec = codec->spec; in ca0132_init_chip()
8794 mutex_init(&spec->chipio_mutex); in ca0132_init_chip()
8806 snd_hda_codec_write(codec, codec->core.afg, 0, in ca0132_init_chip()
8808 snd_hda_codec_write(codec, codec->core.afg, 0, in ca0132_init_chip()
8812 spec->cur_out_type = SPEAKER_OUT; in ca0132_init_chip()
8814 spec->cur_mic_type = DIGITAL_MIC; in ca0132_init_chip()
8816 spec->cur_mic_type = REAR_MIC; in ca0132_init_chip()
8818 spec->cur_mic_boost = 0; in ca0132_init_chip()
8821 spec->vnode_lvol[i] = 0x5a; in ca0132_init_chip()
8822 spec->vnode_rvol[i] = 0x5a; in ca0132_init_chip()
8823 spec->vnode_lswitch[i] = 0; in ca0132_init_chip()
8824 spec->vnode_rswitch[i] = 0; in ca0132_init_chip()
8833 spec->effects_switch[i] = on ? 1 : 0; in ca0132_init_chip()
8837 * ca0132 codecs. Also sets x-bass crossover frequency to 80hz. in ca0132_init_chip()
8841 spec->speaker_range_val[0] = 1; in ca0132_init_chip()
8842 spec->speaker_range_val[1] = 1; in ca0132_init_chip()
8844 spec->xbass_xover_freq = 8; in ca0132_init_chip()
8846 spec->fx_ctl_val[i] = effect_slider_defaults[i]; in ca0132_init_chip()
8848 spec->bass_redirect_xover_freq = 8; in ca0132_init_chip()
8851 spec->voicefx_val = 0; in ca0132_init_chip()
8852 spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID] = 1; in ca0132_init_chip()
8853 spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID] = 0; in ca0132_init_chip()
8856 * The ZxR doesn't have a front panel header, and it's line-in is on in ca0132_init_chip()
8858 * to make sure that spec->in_enum_val is set properly. in ca0132_init_chip()
8861 spec->in_enum_val = REAR_MIC; in ca0132_init_chip()
8882 struct ca0132_spec *spec = codec->spec; in sbz_region2_exit()
8886 writeb(0x0, spec->mem_base + 0x100); in sbz_region2_exit()
8888 writeb(0xb3, spec->mem_base + 0x304); in sbz_region2_exit()
8953 sbz_gpio_shutdown_commands(codec, 0x07, 0x07, -1); in sbz_exit_chip()
9088 struct ca0132_spec *spec = codec->spec; in sbz_dsp_startup_check()
9095 if (spec->startup_check_entered) in sbz_dsp_startup_check()
9098 spec->startup_check_entered = true; in sbz_dsp_startup_check()
9120 spec->dsp_state = DSP_DOWNLOAD_INIT; in sbz_dsp_startup_check()
9121 codec->patch_ops.init(codec); in sbz_dsp_startup_check()
9131 reload--; in sbz_dsp_startup_check()
9168 struct ca0132_spec *spec = codec->spec; in sbz_pre_dsp_setup()
9170 writel(0x00820680, spec->mem_base + 0x01C); in sbz_pre_dsp_setup()
9171 writel(0x00820680, spec->mem_base + 0x01C); in sbz_pre_dsp_setup()
9281 struct ca0132_spec *spec = codec->spec; in ca0132_mmio_init_sbz()
9287 writel(0x00000000, spec->mem_base + addr[i]); in ca0132_mmio_init_sbz()
9310 writel(tmp[i], spec->mem_base + addr[cur_addr + i]); in ca0132_mmio_init_sbz()
9326 writel(data[i], spec->mem_base + addr[cur_addr + i]); in ca0132_mmio_init_sbz()
9331 struct ca0132_spec *spec = codec->spec; in ca0132_mmio_init_ae5()
9340 writel(0x00000680, spec->mem_base + 0x1c); in ca0132_mmio_init_ae5()
9341 writel(0x00880680, spec->mem_base + 0x1c); in ca0132_mmio_init_ae5()
9346 * AE-7 shares all writes with the AE-5, except that it writes in ca0132_mmio_init_ae5()
9350 writel(0x00800001, spec->mem_base + addr[i]); in ca0132_mmio_init_ae5()
9354 writel(data[i], spec->mem_base + addr[i]); in ca0132_mmio_init_ae5()
9358 writel(0x00880680, spec->mem_base + 0x1c); in ca0132_mmio_init_ae5()
9363 struct ca0132_spec *spec = codec->spec; in ca0132_mmio_init()
9396 struct ca0132_spec *spec = codec->spec; in ae5_register_set()
9420 writeb(tmp[i], spec->mem_base + addr[cur_addr]); in ae5_register_set()
9427 writeb(data[i], spec->mem_base + addr[cur_addr]); in ae5_register_set()
9430 writel(data[i], spec->mem_base + addr[cur_addr]); in ae5_register_set()
9432 writel(0x00800001, spec->mem_base + 0x20c); in ae5_register_set()
9455 struct ca0132_spec *spec = codec->spec; in ca0132_alt_init()
9464 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9465 snd_hda_sequence_write(codec, spec->desktop_init_verbs); in ca0132_alt_init()
9473 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9478 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9479 snd_hda_sequence_write(codec, spec->desktop_init_verbs); in ca0132_alt_init()
9485 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9486 snd_hda_sequence_write(codec, spec->desktop_init_verbs); in ca0132_alt_init()
9492 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9493 snd_hda_sequence_write(codec, spec->desktop_init_verbs); in ca0132_alt_init()
9501 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9502 snd_hda_sequence_write(codec, spec->desktop_init_verbs); in ca0132_alt_init()
9512 struct ca0132_spec *spec = codec->spec; in ca0132_init()
9513 struct auto_pin_cfg *cfg = &spec->autocfg; in ca0132_init()
9527 if (spec->dsp_state == DSP_DOWNLOADED) { in ca0132_init()
9530 spec->dsp_reload = true; in ca0132_init()
9531 spec->dsp_state = DSP_DOWNLOAD_INIT; in ca0132_init()
9539 if (spec->dsp_state != DSP_DOWNLOAD_FAILED) in ca0132_init()
9540 spec->dsp_state = DSP_DOWNLOAD_INIT; in ca0132_init()
9541 spec->curr_chip_addx = INVALID_CHIP_ADDRESS; in ca0132_init()
9554 snd_hda_sequence_write(codec, spec->base_init_verbs); in ca0132_init()
9585 for (i = 0; i < spec->num_outputs; i++) in ca0132_init()
9586 init_output(codec, spec->out_pins[i], spec->dacs[0]); in ca0132_init()
9588 init_output(codec, cfg->dig_out_pins[0], spec->dig_out); in ca0132_init()
9590 for (i = 0; i < spec->num_inputs; i++) in ca0132_init()
9591 init_input(codec, spec->input_pins[i], spec->adcs[i]); in ca0132_init()
9593 init_input(codec, cfg->dig_in_pin, spec->dig_in); in ca0132_init()
9596 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_init()
9606 snd_hda_sequence_write(codec, spec->spec_init_verbs); in ca0132_init()
9621 if (spec->dsp_reload) { in ca0132_init()
9622 spec->dsp_reload = false; in ca0132_init()
9633 struct ca0132_spec *spec = codec->spec; in dbpro_init()
9634 struct auto_pin_cfg *cfg = &spec->autocfg; in dbpro_init()
9637 init_output(codec, cfg->dig_out_pins[0], spec->dig_out); in dbpro_init()
9638 init_input(codec, cfg->dig_in_pin, spec->dig_in); in dbpro_init()
9640 for (i = 0; i < spec->num_inputs; i++) in dbpro_init()
9641 init_input(codec, spec->input_pins[i], spec->adcs[i]); in dbpro_init()
9648 struct ca0132_spec *spec = codec->spec; in ca0132_free()
9650 cancel_delayed_work_sync(&spec->unsol_hp_work); in ca0132_free()
9675 snd_hda_sequence_write(codec, spec->base_exit_verbs); in ca0132_free()
9680 if (spec->mem_base) in ca0132_free()
9681 pci_iounmap(codec->bus->pci, spec->mem_base); in ca0132_free()
9683 kfree(spec->spec_init_verbs); in ca0132_free()
9684 kfree(codec->spec); in ca0132_free()
9689 struct ca0132_spec *spec = codec->spec; in dbpro_free()
9693 kfree(spec->spec_init_verbs); in dbpro_free()
9694 kfree(codec->spec); in dbpro_free()
9699 struct ca0132_spec *spec = codec->spec; in ca0132_suspend()
9701 cancel_delayed_work_sync(&spec->unsol_hp_work); in ca0132_suspend()
9723 struct ca0132_spec *spec = codec->spec; in ca0132_config()
9725 spec->dacs[0] = 0x2; in ca0132_config()
9726 spec->dacs[1] = 0x3; in ca0132_config()
9727 spec->dacs[2] = 0x4; in ca0132_config()
9729 spec->multiout.dac_nids = spec->dacs; in ca0132_config()
9730 spec->multiout.num_dacs = 3; in ca0132_config()
9733 spec->multiout.max_channels = 2; in ca0132_config()
9735 spec->multiout.max_channels = 6; in ca0132_config()
9772 spec->num_outputs = 2; in ca0132_config()
9773 spec->out_pins[0] = 0x0b; /* speaker out */ in ca0132_config()
9774 spec->out_pins[1] = 0x0f; in ca0132_config()
9775 spec->shared_out_nid = 0x2; in ca0132_config()
9776 spec->unsol_tag_hp = 0x0f; in ca0132_config()
9778 spec->adcs[0] = 0x7; /* digital mic / analog mic1 */ in ca0132_config()
9779 spec->adcs[1] = 0x8; /* analog mic2 */ in ca0132_config()
9780 spec->adcs[2] = 0xa; /* what u hear */ in ca0132_config()
9782 spec->num_inputs = 3; in ca0132_config()
9783 spec->input_pins[0] = 0x12; in ca0132_config()
9784 spec->input_pins[1] = 0x11; in ca0132_config()
9785 spec->input_pins[2] = 0x13; in ca0132_config()
9786 spec->shared_mic_nid = 0x7; in ca0132_config()
9787 spec->unsol_tag_amic1 = 0x11; in ca0132_config()
9791 spec->num_outputs = 2; in ca0132_config()
9792 spec->out_pins[0] = 0x0B; /* Line out */ in ca0132_config()
9793 spec->out_pins[1] = 0x0F; /* Rear headphone out */ in ca0132_config()
9794 spec->out_pins[2] = 0x10; /* Front Headphone / Center/LFE*/ in ca0132_config()
9795 spec->out_pins[3] = 0x11; /* Rear surround */ in ca0132_config()
9796 spec->shared_out_nid = 0x2; in ca0132_config()
9797 spec->unsol_tag_hp = spec->out_pins[1]; in ca0132_config()
9798 spec->unsol_tag_front_hp = spec->out_pins[2]; in ca0132_config()
9800 spec->adcs[0] = 0x7; /* Rear Mic / Line-in */ in ca0132_config()
9801 spec->adcs[1] = 0x8; /* Front Mic, but only if no DSP */ in ca0132_config()
9802 spec->adcs[2] = 0xa; /* what u hear */ in ca0132_config()
9804 spec->num_inputs = 2; in ca0132_config()
9805 spec->input_pins[0] = 0x12; /* Rear Mic / Line-in */ in ca0132_config()
9806 spec->input_pins[1] = 0x13; /* What U Hear */ in ca0132_config()
9807 spec->shared_mic_nid = 0x7; in ca0132_config()
9808 spec->unsol_tag_amic1 = spec->input_pins[0]; in ca0132_config()
9811 spec->dig_out = 0x05; in ca0132_config()
9812 spec->multiout.dig_out_nid = spec->dig_out; in ca0132_config()
9813 spec->dig_in = 0x09; in ca0132_config()
9816 spec->num_outputs = 2; in ca0132_config()
9817 spec->out_pins[0] = 0x0B; /* Line out */ in ca0132_config()
9818 spec->out_pins[1] = 0x0F; /* Rear headphone out */ in ca0132_config()
9819 spec->out_pins[2] = 0x10; /* Center/LFE */ in ca0132_config()
9820 spec->out_pins[3] = 0x11; /* Rear surround */ in ca0132_config()
9821 spec->shared_out_nid = 0x2; in ca0132_config()
9822 spec->unsol_tag_hp = spec->out_pins[1]; in ca0132_config()
9823 spec->unsol_tag_front_hp = spec->out_pins[2]; in ca0132_config()
9825 spec->adcs[0] = 0x7; /* Rear Mic / Line-in */ in ca0132_config()
9826 spec->adcs[1] = 0x8; /* Not connected, no front mic */ in ca0132_config()
9827 spec->adcs[2] = 0xa; /* what u hear */ in ca0132_config()
9829 spec->num_inputs = 2; in ca0132_config()
9830 spec->input_pins[0] = 0x12; /* Rear Mic / Line-in */ in ca0132_config()
9831 spec->input_pins[1] = 0x13; /* What U Hear */ in ca0132_config()
9832 spec->shared_mic_nid = 0x7; in ca0132_config()
9833 spec->unsol_tag_amic1 = spec->input_pins[0]; in ca0132_config()
9836 spec->adcs[0] = 0x8; /* ZxR DBPro Aux In */ in ca0132_config()
9838 spec->num_inputs = 1; in ca0132_config()
9839 spec->input_pins[0] = 0x11; /* RCA Line-in */ in ca0132_config()
9841 spec->dig_out = 0x05; in ca0132_config()
9842 spec->multiout.dig_out_nid = spec->dig_out; in ca0132_config()
9844 spec->dig_in = 0x09; in ca0132_config()
9848 spec->num_outputs = 2; in ca0132_config()
9849 spec->out_pins[0] = 0x0B; /* Line out */ in ca0132_config()
9850 spec->out_pins[1] = 0x11; /* Rear headphone out */ in ca0132_config()
9851 spec->out_pins[2] = 0x10; /* Front Headphone / Center/LFE*/ in ca0132_config()
9852 spec->out_pins[3] = 0x0F; /* Rear surround */ in ca0132_config()
9853 spec->shared_out_nid = 0x2; in ca0132_config()
9854 spec->unsol_tag_hp = spec->out_pins[1]; in ca0132_config()
9855 spec->unsol_tag_front_hp = spec->out_pins[2]; in ca0132_config()
9857 spec->adcs[0] = 0x7; /* Rear Mic / Line-in */ in ca0132_config()
9858 spec->adcs[1] = 0x8; /* Front Mic, but only if no DSP */ in ca0132_config()
9859 spec->adcs[2] = 0xa; /* what u hear */ in ca0132_config()
9861 spec->num_inputs = 2; in ca0132_config()
9862 spec->input_pins[0] = 0x12; /* Rear Mic / Line-in */ in ca0132_config()
9863 spec->input_pins[1] = 0x13; /* What U Hear */ in ca0132_config()
9864 spec->shared_mic_nid = 0x7; in ca0132_config()
9865 spec->unsol_tag_amic1 = spec->input_pins[0]; in ca0132_config()
9868 spec->dig_out = 0x05; in ca0132_config()
9869 spec->multiout.dig_out_nid = spec->dig_out; in ca0132_config()
9872 spec->num_outputs = 2; in ca0132_config()
9873 spec->out_pins[0] = 0x0B; /* Line out */ in ca0132_config()
9874 spec->out_pins[1] = 0x0F; /* Rear headphone out */ in ca0132_config()
9875 spec->out_pins[2] = 0x10; /* Front Headphone / Center/LFE*/ in ca0132_config()
9876 spec->out_pins[3] = 0x11; /* Rear surround */ in ca0132_config()
9877 spec->shared_out_nid = 0x2; in ca0132_config()
9878 spec->unsol_tag_hp = spec->out_pins[1]; in ca0132_config()
9879 spec->unsol_tag_front_hp = spec->out_pins[2]; in ca0132_config()
9881 spec->adcs[0] = 0x07; /* Rear Mic / Line-in */ in ca0132_config()
9882 spec->adcs[1] = 0x08; /* Front Mic, but only if no DSP */ in ca0132_config()
9883 spec->adcs[2] = 0x0a; /* what u hear */ in ca0132_config()
9885 spec->num_inputs = 2; in ca0132_config()
9886 spec->input_pins[0] = 0x12; /* Rear Mic / Line-in */ in ca0132_config()
9887 spec->input_pins[1] = 0x13; /* What U Hear */ in ca0132_config()
9888 spec->shared_mic_nid = 0x7; in ca0132_config()
9889 spec->unsol_tag_amic1 = spec->input_pins[0]; in ca0132_config()
9892 spec->dig_out = 0x05; in ca0132_config()
9893 spec->multiout.dig_out_nid = spec->dig_out; in ca0132_config()
9896 spec->num_outputs = 2; in ca0132_config()
9897 spec->out_pins[0] = 0x0b; /* speaker out */ in ca0132_config()
9898 spec->out_pins[1] = 0x10; /* headphone out */ in ca0132_config()
9899 spec->shared_out_nid = 0x2; in ca0132_config()
9900 spec->unsol_tag_hp = spec->out_pins[1]; in ca0132_config()
9902 spec->adcs[0] = 0x7; /* digital mic / analog mic1 */ in ca0132_config()
9903 spec->adcs[1] = 0x8; /* analog mic2 */ in ca0132_config()
9904 spec->adcs[2] = 0xa; /* what u hear */ in ca0132_config()
9906 spec->num_inputs = 3; in ca0132_config()
9907 spec->input_pins[0] = 0x12; in ca0132_config()
9908 spec->input_pins[1] = 0x11; in ca0132_config()
9909 spec->input_pins[2] = 0x13; in ca0132_config()
9910 spec->shared_mic_nid = 0x7; in ca0132_config()
9911 spec->unsol_tag_amic1 = spec->input_pins[0]; in ca0132_config()
9914 spec->dig_out = 0x05; in ca0132_config()
9915 spec->multiout.dig_out_nid = spec->dig_out; in ca0132_config()
9916 spec->dig_in = 0x09; in ca0132_config()
9925 struct ca0132_spec *spec = codec->spec; in ca0132_prepare_verbs()
9927 spec->chip_init_verbs = ca0132_init_verbs0; in ca0132_prepare_verbs()
9933 spec->desktop_init_verbs = ca0132_init_verbs1; in ca0132_prepare_verbs()
9934 spec->spec_init_verbs = kcalloc(NUM_SPEC_VERBS, in ca0132_prepare_verbs()
9937 if (!spec->spec_init_verbs) in ca0132_prepare_verbs()
9938 return -ENOMEM; in ca0132_prepare_verbs()
9941 spec->spec_init_verbs[0].nid = 0x0b; in ca0132_prepare_verbs()
9942 spec->spec_init_verbs[0].param = 0x78D; in ca0132_prepare_verbs()
9943 spec->spec_init_verbs[0].verb = 0x00; in ca0132_prepare_verbs()
9947 spec->spec_init_verbs[2].nid = 0x0b; in ca0132_prepare_verbs()
9948 spec->spec_init_verbs[2].param = AC_VERB_SET_EAPD_BTLENABLE; in ca0132_prepare_verbs()
9949 spec->spec_init_verbs[2].verb = 0x02; in ca0132_prepare_verbs()
9951 spec->spec_init_verbs[3].nid = 0x10; in ca0132_prepare_verbs()
9952 spec->spec_init_verbs[3].param = 0x78D; in ca0132_prepare_verbs()
9953 spec->spec_init_verbs[3].verb = 0x02; in ca0132_prepare_verbs()
9955 spec->spec_init_verbs[4].nid = 0x10; in ca0132_prepare_verbs()
9956 spec->spec_init_verbs[4].param = AC_VERB_SET_EAPD_BTLENABLE; in ca0132_prepare_verbs()
9957 spec->spec_init_verbs[4].verb = 0x02; in ca0132_prepare_verbs()
9960 /* Terminator: spec->spec_init_verbs[NUM_SPEC_VERBS-1] */ in ca0132_prepare_verbs()
9972 switch (codec->core.subsystem_id) { in sbz_detect_quirk()
9974 codec->fixup_id = QUIRK_ZXR; in sbz_detect_quirk()
9977 codec->fixup_id = QUIRK_ZXR_DBPRO; in sbz_detect_quirk()
9980 codec->fixup_id = QUIRK_SBZ; in sbz_detect_quirk()
9994 return -ENOMEM; in patch_ca0132()
9995 codec->spec = spec; in patch_ca0132()
9996 spec->codec = codec; in patch_ca0132()
10004 codec->patch_ops = dbpro_patch_ops; in patch_ca0132()
10006 codec->patch_ops = ca0132_patch_ops; in patch_ca0132()
10008 codec->pcm_format_first = 1; in patch_ca0132()
10009 codec->no_sticky_stream = 1; in patch_ca0132()
10012 spec->dsp_state = DSP_DOWNLOAD_INIT; in patch_ca0132()
10013 spec->num_mixers = 1; in patch_ca0132()
10018 spec->mixers[0] = desktop_mixer; in patch_ca0132()
10022 spec->mixers[0] = desktop_mixer; in patch_ca0132()
10028 spec->mixers[0] = desktop_mixer; in patch_ca0132()
10032 spec->mixers[0] = r3di_mixer; in patch_ca0132()
10036 spec->mixers[0] = desktop_mixer; in patch_ca0132()
10037 snd_hda_codec_set_name(codec, "Sound BlasterX AE-5"); in patch_ca0132()
10040 spec->mixers[0] = desktop_mixer; in patch_ca0132()
10041 snd_hda_codec_set_name(codec, "Sound Blaster AE-7"); in patch_ca0132()
10044 spec->mixers[0] = ca0132_mixer; in patch_ca0132()
10055 spec->use_alt_controls = true; in patch_ca0132()
10056 spec->use_alt_functions = true; in patch_ca0132()
10057 spec->use_pci_mmio = true; in patch_ca0132()
10060 spec->use_alt_controls = true; in patch_ca0132()
10061 spec->use_alt_functions = true; in patch_ca0132()
10062 spec->use_pci_mmio = false; in patch_ca0132()
10065 spec->use_alt_controls = false; in patch_ca0132()
10066 spec->use_alt_functions = false; in patch_ca0132()
10067 spec->use_pci_mmio = false; in patch_ca0132()
10072 if (spec->use_pci_mmio) { in patch_ca0132()
10073 spec->mem_base = pci_iomap(codec->bus->pci, 2, 0xC20); in patch_ca0132()
10074 if (spec->mem_base == NULL) { in patch_ca0132()
10076 codec->fixup_id = QUIRK_NONE; in patch_ca0132()
10081 spec->base_init_verbs = ca0132_base_init_verbs; in patch_ca0132()
10082 spec->base_exit_verbs = ca0132_base_exit_verbs; in patch_ca0132()
10084 INIT_DELAYED_WORK(&spec->unsol_hp_work, ca0132_unsol_hp_delayed); in patch_ca0132()
10094 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL); in patch_ca0132()