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

1 // SPDX-License-Identifier: GPL-2.0-or-later
74 #define DESKTOP_EFX_FILE "ctefx-desktop.bin"
75 #define R3DI_EFX_FILE "ctefx-r3di.bin"
115 #define VNODES_COUNT (VNODE_END_NID - VNODE_START_NID)
126 #define OUT_EFFECTS_COUNT (OUT_EFFECT_END_NID - OUT_EFFECT_START_NID)
134 #define IN_EFFECTS_COUNT (IN_EFFECT_END_NID - IN_EFFECT_START_NID)
154 #define EFFECTS_COUNT (EFFECT_END_NID - EFFECT_START_NID)
163 * X-bass.
182 int params; /* number of default non-on/off params */
223 { .name = "X-Bass",
304 #define TUNING_CTLS_COUNT (TUNING_CTL_END_NID - TUNING_CTL_START_NID)
600 * DSP reqs for handling full-range speakers/bass redirection. If a speaker is
604 * enabled. X-Bass must be disabled when using these.
609 /* Between 0x16-0x1a are the X-Bass reqs. */
763 { .name = "Low (16-31",
766 { .name = "Medium (32-149",
769 { .name = "High (150-600",
900 /* Tracker for the SPDIF-in path is bypassed/enabled */
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 */
938 /* ASI rate is 48kHz/96kHz */
965 * sense given the fact the AE-5 uses it and has the ASI flag set.
1046 DSP_DOWNLOAD_FAILED = -1,
1052 /* retrieve parameters from hda format */
1129 /* AE-5 Control values */
1144 * AE-5 all use PCI region 2 to toggle GPIO and other currently unknown
1182 #define ca0132_quirk(spec) ((spec)->quirk)
1183 #define ca0132_use_pci_mmio(spec) ((spec)->use_pci_mmio)
1184 #define ca0132_use_alt_functions(spec) ((spec)->use_alt_functions)
1185 #define ca0132_use_alt_controls(spec) ((spec)->use_alt_controls)
1209 { 0x0b, 0x01017010 }, /* Port G -- Lineout FRONT L/R */
1213 { 0x0f, 0x0221701f }, /* Port A -- BackPanel HP */
1214 { 0x10, 0x01017012 }, /* Port D -- Center/LFE or FP Hp */
1215 { 0x11, 0x01017014 }, /* Port B -- LineMicIn2 / Rear L/R */
1216 { 0x12, 0x01a170f0 }, /* Port C -- LineIn1 */
1224 { 0x0b, 0x01047110 }, /* Port G -- Lineout FRONT L/R */
1225 { 0x0c, 0x414510f0 }, /* SPDIF Out 1 - Disabled*/
1227 { 0x0e, 0x41c520f0 }, /* SPDIF In - Disabled*/
1228 { 0x0f, 0x0122711f }, /* Port A -- BackPanel HP */
1229 { 0x10, 0x01017111 }, /* Port D -- Center/LFE */
1230 { 0x11, 0x01017114 }, /* Port B -- LineMicIn2 / Rear L/R */
1231 { 0x12, 0x01a271f0 }, /* Port C -- LineIn1 */
1239 { 0x0b, 0x01014110 }, /* Port G -- Lineout FRONT L/R */
1243 { 0x0f, 0x0221401f }, /* Port A -- BackPanel HP */
1244 { 0x10, 0x01016011 }, /* Port D -- Center/LFE or FP Hp */
1245 { 0x11, 0x01011014 }, /* Port B -- LineMicIn2 / Rear L/R */
1246 { 0x12, 0x02a090f0 }, /* Port C -- LineIn1 */
1252 /* Sound Blaster AE-5 pin configs taken from Windows Driver */
1254 { 0x0b, 0x01017010 }, /* Port G -- Lineout FRONT L/R */
1258 { 0x0f, 0x01017114 }, /* Port A -- Rear L/R. */
1259 { 0x10, 0x01017012 }, /* Port D -- Center/LFE or FP Hp */
1260 { 0x11, 0x012170ff }, /* Port B -- LineMicIn2 / Rear Headphone */
1261 { 0x12, 0x01a170f0 }, /* Port C -- LineIn1 */
1269 { 0x0b, 0x01014110 }, /* Port G -- Lineout FRONT L/R */
1273 { 0x0f, 0x0221401f }, /* Port A -- BackPanel HP */
1274 { 0x10, 0x01016011 }, /* Port D -- Center/LFE or FP Hp */
1275 { 0x11, 0x01011014 }, /* Port B -- LineMicIn2 / Rear L/R */
1276 { 0x12, 0x02a090f0 }, /* Port C -- LineIn1 */
1307 SND_PCI_QUIRK(0x1458, 0xA036, "Gigabyte GA-Z170X-Gaming 7", QUIRK_R3DI),
1313 SND_PCI_QUIRK(0x1102, 0x0051, "Sound Blaster AE-5", QUIRK_AE5),
1314 SND_PCI_QUIRK(0x1102, 0x0191, "Sound Blaster AE-5 Plus", QUIRK_AE5),
1315 SND_PCI_QUIRK(0x1102, 0x0081, "Sound Blaster AE-7", QUIRK_AE7),
1522 return ((response == -1) ? -1 : 0); in codec_send_command()
1560 return -EIO; in chipio_send()
1564 * Write chip address through the vendor widget -- NOT protected by the Mutex!
1569 struct ca0132_spec *spec = codec->spec; in chipio_write_address()
1572 if (spec->curr_chip_addx == chip_addx) in chipio_write_address()
1579 if (res != -EIO) { in chipio_write_address()
1585 spec->curr_chip_addx = (res < 0) ? ~0U : chip_addx; in chipio_write_address()
1591 * Write data through the vendor widget -- NOT protected by the Mutex!
1595 struct ca0132_spec *spec = codec->spec; in chipio_write_data()
1601 if (res != -EIO) { in chipio_write_data()
1609 spec->curr_chip_addx = (res != -EIO) ? in chipio_write_data()
1610 (spec->curr_chip_addx + 4) : ~0U; in chipio_write_data()
1615 * Write multiple data through the vendor widget -- NOT protected by the Mutex!
1625 return -EINVAL; in chipio_write_data_multiple()
1628 while ((count-- != 0) && (status == 0)) in chipio_write_data_multiple()
1636 * Read data through the vendor widget -- NOT protected by the Mutex!
1640 struct ca0132_spec *spec = codec->spec; in chipio_read_data()
1646 if (res != -EIO) { in chipio_read_data()
1651 if (res != -EIO) { in chipio_read_data()
1660 spec->curr_chip_addx = (res != -EIO) ? in chipio_read_data()
1661 (spec->curr_chip_addx + 4) : ~0U; in chipio_read_data()
1672 struct ca0132_spec *spec = codec->spec; in chipio_write()
1675 mutex_lock(&spec->chipio_mutex); in chipio_write()
1687 mutex_unlock(&spec->chipio_mutex); in chipio_write()
1723 struct ca0132_spec *spec = codec->spec; in chipio_write_multiple()
1726 mutex_lock(&spec->chipio_mutex); in chipio_write_multiple()
1733 mutex_unlock(&spec->chipio_mutex); in chipio_write_multiple()
1745 struct ca0132_spec *spec = codec->spec; in chipio_read()
1748 mutex_lock(&spec->chipio_mutex); in chipio_read()
1760 mutex_unlock(&spec->chipio_mutex); in chipio_read()
1786 struct ca0132_spec *spec = codec->spec; in chipio_set_control_param()
1794 mutex_lock(&spec->chipio_mutex); in chipio_set_control_param()
1803 mutex_unlock(&spec->chipio_mutex); in chipio_set_control_param()
1908 * 0x80-0xFF.
1920 * Writes to the 8051's exram, which has 16-bits of address space.
1921 * Data at addresses 0x2000-0x7fff is mirrored to 0x8000-0xdfff.
1922 * Data at 0x8000-0xdfff can also be used as program memory for the 8051 by
1924 * 0xe000-0xffff is always mapped as program memory, with only 0xf000-0xffff
1931 /* Lower 8-bits. */ in chipio_8051_set_address()
1936 /* Upper 8-bits. */ in chipio_8051_set_address()
1944 /* 8-bits of data. */ in chipio_8051_set_data()
1958 /* 8-bits of data. */ in chipio_8051_set_data_pll()
1966 struct ca0132_spec *spec = codec->spec; in chipio_8051_write_exram()
1968 mutex_lock(&spec->chipio_mutex); in chipio_8051_write_exram()
1973 mutex_unlock(&spec->chipio_mutex); in chipio_8051_write_exram()
1994 struct ca0132_spec *spec = codec->spec; in chipio_8051_write_pll_pmu()
1996 mutex_lock(&spec->chipio_mutex); in chipio_8051_write_pll_pmu()
2001 mutex_unlock(&spec->chipio_mutex); in chipio_8051_write_pll_pmu()
2016 struct ca0132_spec *spec = codec->spec; in chipio_enable_clocks()
2018 mutex_lock(&spec->chipio_mutex); in chipio_enable_clocks()
2024 mutex_unlock(&spec->chipio_mutex); in chipio_enable_clocks()
2044 return -EIO; in dspio_send()
2070 struct ca0132_spec *spec = codec->spec; in dspio_write()
2075 mutex_lock(&spec->chipio_mutex); in dspio_write()
2090 mutex_unlock(&spec->chipio_mutex); in dspio_write()
2093 -EIO : 0; in dspio_write()
2106 return -EINVAL; in dspio_write_multiple()
2124 if (status == -EIO) in dspio_read()
2128 if (status == -EIO || in dspio_read()
2130 return -EIO; in dspio_read()
2148 return -1; in dspio_read_multiple()
2245 struct ca0132_spec *spec = codec->spec; in dspio_get_response_data()
2250 return -EIO; in dspio_get_response_data()
2252 if ((data & 0x00ffffff) == spec->wait_scp_header) { in dspio_get_response_data()
2253 spec->scp_resp_header = data; in dspio_get_response_data()
2254 spec->scp_resp_count = data >> 27; in dspio_get_response_data()
2255 count = spec->wait_num_data; in dspio_get_response_data()
2256 dspio_read_multiple(codec, spec->scp_resp_data, in dspio_get_response_data()
2257 &spec->scp_resp_count, count); in dspio_get_response_data()
2261 return -EIO; in dspio_get_response_data()
2274 struct ca0132_spec *spec = codec->spec; in dspio_send_scp_message()
2295 return -EINVAL; in dspio_send_scp_message()
2299 return -EINVAL; in dspio_send_scp_message()
2301 spec->wait_scp_header = *((unsigned int *)send_buf); in dspio_send_scp_message()
2306 spec->wait_scp_header &= 0xffff0000; in dspio_send_scp_message()
2307 spec->wait_scp_header |= (resp_src_id << 8) | (resp_target_id); in dspio_send_scp_message()
2308 spec->wait_num_data = return_buf_size/sizeof(unsigned int) - 1; in dspio_send_scp_message()
2309 spec->wait_scp = 1; in dspio_send_scp_message()
2316 spec->wait_scp = 0; in dspio_send_scp_message()
2325 } while (spec->wait_scp && time_before(jiffies, timeout)); in dspio_send_scp_message()
2327 if (!spec->wait_scp) { in dspio_send_scp_message()
2329 memcpy(&ret_msg->hdr, &spec->scp_resp_header, 4); in dspio_send_scp_message()
2330 memcpy(&ret_msg->data, spec->scp_resp_data, in dspio_send_scp_message()
2331 spec->wait_num_data); in dspio_send_scp_message()
2332 *bytes_returned = (spec->scp_resp_count + 1) * 4; in dspio_send_scp_message()
2335 status = -EIO; in dspio_send_scp_message()
2337 spec->wait_scp = 0; in dspio_send_scp_message()
2344 * dspio_scp - Prepare and send the SCP message to DSP
2371 return -EINVAL; in dspio_scp()
2375 return -EINVAL; in dspio_scp()
2380 return -EINVAL; in dspio_scp()
2412 ret_size = (ret_bytes - sizeof(scp_reply.hdr)) in dspio_scp()
2417 return -EINVAL; in dspio_scp()
2420 return -EINVAL; in dspio_scp()
2423 return -EINVAL; in dspio_scp()
2429 codec_dbg(codec, "reply ill-formed or errflag set\n"); in dspio_scp()
2430 return -EIO; in dspio_scp()
2461 codec_dbg(codec, " dspio_alloc_dma_chan() -- begin\n"); in dspio_alloc_dma_chan()
2473 return -EBUSY; in dspio_alloc_dma_chan()
2477 codec_dbg(codec, " dspio_alloc_dma_chan() -- complete\n"); in dspio_alloc_dma_chan()
2490 codec_dbg(codec, " dspio_free_dma_chan() -- begin\n"); in dspio_free_dma_chan()
2502 codec_dbg(codec, " dspio_free_dma_chan() -- complete\n"); in dspio_free_dma_chan()
2553 retry--; in dsp_reset()
2554 } while (res == -EIO && retry); in dsp_reset()
2558 return -EIO; in dsp_reset()
2610 codec_dbg(codec, "-- dsp_dma_setup_common() -- Begin ---------\n"); in dsp_dma_setup_common()
2614 return -EINVAL; in dsp_dma_setup_common()
2619 return -EBUSY; in dsp_dma_setup_common()
2626 return -ENXIO; in dsp_dma_setup_common()
2703 codec_dbg(codec, "-- dsp_dma_setup_common() -- Complete ------\n"); in dsp_dma_setup_common()
2709 * Setup the DSP DMA per-transfer-specific registers
2726 const unsigned int max_dma_count = 1 << (DSPDMAC_XFRCNT_BCNT_HIBIT - in dsp_dma_setup()
2729 codec_dbg(codec, "-- dsp_dma_setup() -- Begin ---------\n"); in dsp_dma_setup()
2733 return -EINVAL; in dsp_dma_setup()
2739 return -ENXIO; in dsp_dma_setup()
2764 adr_ofs = (count - 1) << (DSPDMAC_DSPADROFS_BOFS_LOBIT + in dsp_dma_setup()
2775 base_cnt = (count - 1) << DSPDMAC_XFRCNT_BCNT_LOBIT; in dsp_dma_setup()
2777 cur_cnt = (count - 1) << DSPDMAC_XFRCNT_CCNT_LOBIT; in dsp_dma_setup()
2794 codec_dbg(codec, "-- dsp_dma_setup() -- Complete ---------\n"); in dsp_dma_setup()
2808 codec_dbg(codec, "-- dsp_dma_start() -- Begin ---------\n"); in dsp_dma_start()
2818 codec_dbg(codec, "-- dsp_dma_start() Read CHNLSTART\n"); in dsp_dma_start()
2830 codec_dbg(codec, "-- dsp_dma_start() -- Complete ---------\n"); in dsp_dma_start()
2844 codec_dbg(codec, "-- dsp_dma_stop() -- Begin ---------\n"); in dsp_dma_stop()
2854 codec_dbg(codec, "-- dsp_dma_stop() Read CHNLSTART\n"); in dsp_dma_stop()
2865 codec_dbg(codec, "-- dsp_dma_stop() -- Complete ---------\n"); in dsp_dma_stop()
2871 * dsp_allocate_router_ports - Allocate router ports
2896 val |= (ports_per_channel - 1) << 4; in dsp_allocate_router_ports()
2897 val |= num_chans - 1; in dsp_allocate_router_ports()
2948 codec_dbg(codec, " dsp_allocate_ports() -- begin\n"); in dsp_allocate_ports()
2952 return -EINVAL; in dsp_allocate_ports()
2958 codec_dbg(codec, " dsp_allocate_ports() -- complete\n"); in dsp_allocate_ports()
2975 return -EINVAL; in dsp_allocate_ports_format()
2990 codec_dbg(codec, " dsp_free_ports() -- begin\n"); in dsp_free_ports()
2997 codec_dbg(codec, " dsp_free_ports() -- complete\n"); in dsp_free_ports()
3039 struct hda_codec *codec = dma->codec; in dma_reset()
3040 struct ca0132_spec *spec = codec->spec; in dma_reset()
3043 if (dma->dmab->area) in dma_reset()
3044 snd_hda_codec_load_dsp_cleanup(codec, dma->dmab); in dma_reset()
3047 dma->m_converter_format, in dma_reset()
3048 dma->buf_size, in dma_reset()
3049 dma->dmab); in dma_reset()
3052 spec->dsp_stream_id = status; in dma_reset()
3071 snd_hda_codec_load_dsp_trigger(dma->codec, cmd); in dma_set_state()
3077 return dma->dmab->bytes; in dma_get_buffer_size()
3082 return dma->dmab->area; in dma_get_buffer_addr()
3089 memcpy(dma->dmab->area, data, count); in dma_xfer()
3095 unsigned short *format) in dma_get_converter_format() argument
3097 if (format) in dma_get_converter_format()
3098 *format = dma->m_converter_format; in dma_get_converter_format()
3103 struct ca0132_spec *spec = dma->codec->spec; in dma_get_stream_id()
3105 return spec->dsp_stream_id; in dma_get_stream_id()
3120 return p->magic == g_magic_value; in is_valid()
3125 return g_chip_addr_magic_value == p->chip_addr; in is_hci_prog_list_seg()
3130 return p->count == 0; in is_last()
3135 return struct_size(p, data, p->count); in dsp_sizeof()
3151 * The segment data is in the format of successive pairs of words.
3161 if (fls == NULL || fls->chip_addr != g_chip_addr_magic_value) { in dspxfr_hci_write()
3163 return -EINVAL; in dspxfr_hci_write()
3166 count = fls->count; in dspxfr_hci_write()
3167 data = (u32 *)(fls->data); in dspxfr_hci_write()
3174 count -= 2; in dspxfr_hci_write()
3181 * dspxfr_one_seg - Write a block of data into DSP code or data RAM using pre-allocated DMA engine.
3185 * @reloc: Relocation address for loading single-segment overlays, or 0 for
3190 * @ovly: TRUE if overlay format is required
3223 return -EINVAL; in dspxfr_one_seg()
3236 return -EINVAL; in dspxfr_one_seg()
3239 data = fls->data; in dspxfr_one_seg()
3240 chip_addx = fls->chip_addr; in dspxfr_one_seg()
3241 words_to_write = fls->count; in dspxfr_one_seg()
3252 return -EINVAL; in dspxfr_one_seg()
3262 return -EINVAL; in dspxfr_one_seg()
3275 return -EINVAL; in dspxfr_one_seg()
3281 buffer_size_words -= buffer_size_words % hda_frame_size_words; in dspxfr_one_seg()
3290 return -EINVAL; in dspxfr_one_seg()
3299 words_to_write -= remainder_words; in dspxfr_one_seg()
3326 return -EIO; in dspxfr_one_seg()
3366 words_to_write -= run_size_words; in dspxfr_one_seg()
3378 * dspxfr_image - Write the entire DSP image of a DSP code/data overlay to DSP memories
3382 * @reloc: Relocation address for loading single-segment overlays, or 0 for
3386 * @ovly: TRUE if overlay format is required
3397 struct ca0132_spec *spec = codec->spec; in dspxfr_image()
3407 return -EINVAL; in dspxfr_image()
3411 return -ENOMEM; in dspxfr_image()
3413 dma_engine->dmab = kzalloc(sizeof(*dma_engine->dmab), GFP_KERNEL); in dspxfr_image()
3414 if (!dma_engine->dmab) { in dspxfr_image()
3416 return -ENOMEM; in dspxfr_image()
3419 dma_engine->codec = codec; in dspxfr_image()
3421 dma_engine->m_converter_format = hda_format; in dspxfr_image()
3422 dma_engine->buf_size = (ovly ? DSP_DMA_WRITE_BUFLEN_OVLY : in dspxfr_image()
3431 codec_dbg(codec, "set converter format fail\n"); in dspxfr_image()
3436 dma_engine->m_converter_format, in dspxfr_image()
3437 dma_engine->buf_size, in dspxfr_image()
3438 dma_engine->dmab); in dspxfr_image()
3441 spec->dsp_stream_id = status; in dspxfr_image()
3471 status = -EINVAL; in dspxfr_image()
3500 if (dma_engine->dmab->area) in dspxfr_image()
3501 snd_hda_codec_load_dsp_cleanup(codec, dma_engine->dmab); in dspxfr_image()
3502 kfree(dma_engine->dmab); in dspxfr_image()
3513 struct ca0132_spec *spec = codec->spec; in dspload_post_setup()
3514 codec_dbg(codec, "---- dspload_post_setup ------\n"); in dspload_post_setup()
3526 * dspload_image - Download DSP from a DSP Image Fast Load structure.
3530 * @ovly: TRUE if overlay format is required
3531 * @reloc: Relocation address for loading single-segment overlays, or 0 for
3538 * linear, non-constant sized element array of structures, each of which
3554 codec_dbg(codec, "---- dspload_image begin ------\n"); in dspload_image()
3630 * ca0113 related functions. The ca0113 acts as the HDA bus for the pci-e
3636 * For cards with PCI-E region2 (Sound Blaster Z/ZxR, Recon3D, and AE-5)
3637 * the mmio address 0x320 is used to set GPIO pins. The format for the data
3640 * AE-5 note: The AE-5 seems to use pins 2 and 3 to somehow set the color value
3641 * of the on-card LED. It seems to use pin 2 for data, then toggles 3 to on and
3647 struct ca0132_spec *spec = codec->spec; in ca0113_mmio_gpio_set()
3653 writew(gpio_data, spec->mem_base + 0x320); in ca0113_mmio_gpio_set()
3657 * Special pci region2 commands that are only used by the AE-5. They follow
3658 * a set format, and require reads at certain points to seemingly 'clear'
3662 * target-id, and value.
3667 struct ca0132_spec *spec = codec->spec; in ca0113_mmio_command_set()
3670 writel(0x0000007e, spec->mem_base + 0x210); in ca0113_mmio_command_set()
3671 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set()
3672 writel(0x0000005a, spec->mem_base + 0x210); in ca0113_mmio_command_set()
3673 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set()
3674 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set()
3676 writel(0x00800005, spec->mem_base + 0x20c); in ca0113_mmio_command_set()
3677 writel(group, spec->mem_base + 0x804); in ca0113_mmio_command_set()
3679 writel(0x00800005, spec->mem_base + 0x20c); in ca0113_mmio_command_set()
3684 writel(write_val, spec->mem_base + 0x204); in ca0113_mmio_command_set()
3690 readl(spec->mem_base + 0x860); in ca0113_mmio_command_set()
3691 readl(spec->mem_base + 0x854); in ca0113_mmio_command_set()
3692 readl(spec->mem_base + 0x840); in ca0113_mmio_command_set()
3694 writel(0x00800004, spec->mem_base + 0x20c); in ca0113_mmio_command_set()
3695 writel(0x00000000, spec->mem_base + 0x210); in ca0113_mmio_command_set()
3696 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set()
3697 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set()
3706 struct ca0132_spec *spec = codec->spec; in ca0113_mmio_command_set_type2()
3709 writel(0x0000007e, spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3710 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3711 writel(0x0000005a, spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3712 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3713 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3715 writel(0x00800003, spec->mem_base + 0x20c); in ca0113_mmio_command_set_type2()
3716 writel(group, spec->mem_base + 0x804); in ca0113_mmio_command_set_type2()
3718 writel(0x00800005, spec->mem_base + 0x20c); in ca0113_mmio_command_set_type2()
3723 writel(write_val, spec->mem_base + 0x204); in ca0113_mmio_command_set_type2()
3725 readl(spec->mem_base + 0x860); in ca0113_mmio_command_set_type2()
3726 readl(spec->mem_base + 0x854); in ca0113_mmio_command_set_type2()
3727 readl(spec->mem_base + 0x840); in ca0113_mmio_command_set_type2()
3729 writel(0x00800004, spec->mem_base + 0x20c); in ca0113_mmio_command_set_type2()
3730 writel(0x00000000, spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3731 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3732 readl(spec->mem_base + 0x210); in ca0113_mmio_command_set_type2()
3745 struct ca0132_spec *spec = codec->spec; in ca0132_gpio_init()
3768 struct ca0132_spec *spec = codec->spec; in ca0132_gpio_setup()
3799 /* Bit 1 - Switch between front/rear mic. 0 = rear, 1 = front */
3801 /* Bit 2 - Switch between headphone/line out. 0 = Headphone, 1 = Line */
3852 snd_hda_codec_write(codec, codec->core.afg, 0, in r3di_gpio_mic_set()
3867 snd_hda_codec_write(codec, codec->core.afg, 0, in r3di_gpio_dsp_status_set()
3874 snd_hda_codec_write(codec, codec->core.afg, 0, in r3di_gpio_dsp_status_set()
3881 snd_hda_codec_write(codec, codec->core.afg, 0, in r3di_gpio_dsp_status_set()
3891 unsigned int format, in ca0132_playback_pcm_prepare() argument
3894 struct ca0132_spec *spec = codec->spec; in ca0132_playback_pcm_prepare()
3896 snd_hda_codec_setup_stream(codec, spec->dacs[0], stream_tag, 0, format); in ca0132_playback_pcm_prepare()
3905 struct ca0132_spec *spec = codec->spec; in ca0132_playback_pcm_cleanup()
3907 if (spec->dsp_state == DSP_DOWNLOADING) in ca0132_playback_pcm_cleanup()
3912 if (spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]) in ca0132_playback_pcm_cleanup()
3915 snd_hda_codec_cleanup_stream(codec, spec->dacs[0]); in ca0132_playback_pcm_cleanup()
3924 struct ca0132_spec *spec = codec->spec; in ca0132_playback_pcm_delay()
3926 struct snd_pcm_runtime *runtime = substream->runtime; in ca0132_playback_pcm_delay()
3928 if (spec->dsp_state != DSP_DOWNLOADED) in ca0132_playback_pcm_delay()
3932 if (spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]) { in ca0132_playback_pcm_delay()
3933 if ((spec->effects_switch[SURROUND - EFFECT_START_NID]) || in ca0132_playback_pcm_delay()
3934 (spec->effects_switch[DIALOG_PLUS - EFFECT_START_NID])) in ca0132_playback_pcm_delay()
3939 if (spec->cur_out_type == SPEAKER_OUT) in ca0132_playback_pcm_delay()
3942 return (latency * runtime->rate) / 1000; in ca0132_playback_pcm_delay()
3952 struct ca0132_spec *spec = codec->spec; in ca0132_dig_playback_pcm_open()
3953 return snd_hda_multi_out_dig_open(codec, &spec->multiout); in ca0132_dig_playback_pcm_open()
3959 unsigned int format, in ca0132_dig_playback_pcm_prepare() argument
3962 struct ca0132_spec *spec = codec->spec; in ca0132_dig_playback_pcm_prepare()
3963 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, in ca0132_dig_playback_pcm_prepare()
3964 stream_tag, format, substream); in ca0132_dig_playback_pcm_prepare()
3971 struct ca0132_spec *spec = codec->spec; in ca0132_dig_playback_pcm_cleanup()
3972 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); in ca0132_dig_playback_pcm_cleanup()
3979 struct ca0132_spec *spec = codec->spec; in ca0132_dig_playback_pcm_close()
3980 return snd_hda_multi_out_dig_close(codec, &spec->multiout); in ca0132_dig_playback_pcm_close()
3989 unsigned int format, in ca0132_capture_pcm_prepare() argument
3992 snd_hda_codec_setup_stream(codec, hinfo->nid, in ca0132_capture_pcm_prepare()
3993 stream_tag, 0, format); in ca0132_capture_pcm_prepare()
4002 struct ca0132_spec *spec = codec->spec; in ca0132_capture_pcm_cleanup()
4004 if (spec->dsp_state == DSP_DOWNLOADING) in ca0132_capture_pcm_cleanup()
4007 snd_hda_codec_cleanup_stream(codec, hinfo->nid); in ca0132_capture_pcm_cleanup()
4015 struct ca0132_spec *spec = codec->spec; in ca0132_capture_pcm_delay()
4017 struct snd_pcm_runtime *runtime = substream->runtime; in ca0132_capture_pcm_delay()
4019 if (spec->dsp_state != DSP_DOWNLOADED) in ca0132_capture_pcm_delay()
4022 if (spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID]) in ca0132_capture_pcm_delay()
4025 return (latency * runtime->rate) / 1000; in ca0132_capture_pcm_delay()
4089 * values -90 to 9. -90 is the lowest decibel value for both the ADC's and the
4137 * This table counts from float 10 to 1000, which is the range of the x-bass
4234 return -EINVAL; in tuning_ctl_set()
4249 struct ca0132_spec *spec = codec->spec; in tuning_ctl_get()
4251 long *valp = ucontrol->value.integer.value; in tuning_ctl_get()
4252 int idx = nid - TUNING_CTL_START_NID; in tuning_ctl_get()
4254 *valp = spec->cur_ctl_vals[idx]; in tuning_ctl_get()
4262 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in voice_focus_ctl_info()
4263 uinfo->count = chs == 3 ? 2 : 1; in voice_focus_ctl_info()
4264 uinfo->value.integer.min = 20; in voice_focus_ctl_info()
4265 uinfo->value.integer.max = 180; in voice_focus_ctl_info()
4266 uinfo->value.integer.step = 1; in voice_focus_ctl_info()
4275 struct ca0132_spec *spec = codec->spec; in voice_focus_ctl_put()
4277 long *valp = ucontrol->value.integer.value; in voice_focus_ctl_put()
4280 idx = nid - TUNING_CTL_START_NID; in voice_focus_ctl_put()
4282 if (spec->cur_ctl_vals[idx] == *valp) in voice_focus_ctl_put()
4285 spec->cur_ctl_vals[idx] = *valp; in voice_focus_ctl_put()
4287 idx = *valp - 20; in voice_focus_ctl_put()
4297 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in mic_svm_ctl_info()
4298 uinfo->count = chs == 3 ? 2 : 1; in mic_svm_ctl_info()
4299 uinfo->value.integer.min = 0; in mic_svm_ctl_info()
4300 uinfo->value.integer.max = 100; in mic_svm_ctl_info()
4301 uinfo->value.integer.step = 1; in mic_svm_ctl_info()
4310 struct ca0132_spec *spec = codec->spec; in mic_svm_ctl_put()
4312 long *valp = ucontrol->value.integer.value; in mic_svm_ctl_put()
4315 idx = nid - TUNING_CTL_START_NID; in mic_svm_ctl_put()
4317 if (spec->cur_ctl_vals[idx] == *valp) in mic_svm_ctl_put()
4320 spec->cur_ctl_vals[idx] = *valp; in mic_svm_ctl_put()
4332 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in equalizer_ctl_info()
4333 uinfo->count = chs == 3 ? 2 : 1; in equalizer_ctl_info()
4334 uinfo->value.integer.min = 0; in equalizer_ctl_info()
4335 uinfo->value.integer.max = 48; in equalizer_ctl_info()
4336 uinfo->value.integer.step = 1; in equalizer_ctl_info()
4345 struct ca0132_spec *spec = codec->spec; in equalizer_ctl_put()
4347 long *valp = ucontrol->value.integer.value; in equalizer_ctl_put()
4350 idx = nid - TUNING_CTL_START_NID; in equalizer_ctl_put()
4352 if (spec->cur_ctl_vals[idx] == *valp) in equalizer_ctl_put()
4355 spec->cur_ctl_vals[idx] = *valp; in equalizer_ctl_put()
4364 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(eq_db_scale, -2400, 100, 0);
4426 struct ca0132_spec *spec = codec->spec; in ca0132_init_tuning_defaults()
4429 /* Wedge Angle defaults to 30. 10 below is 30 - 20. 20 is min. */ in ca0132_init_tuning_defaults()
4430 spec->cur_ctl_vals[WEDGE_ANGLE - TUNING_CTL_START_NID] = 10; in ca0132_init_tuning_defaults()
4432 spec->cur_ctl_vals[SVM_LEVEL - TUNING_CTL_START_NID] = 74; in ca0132_init_tuning_defaults()
4436 spec->cur_ctl_vals[i] = 24; in ca0132_init_tuning_defaults()
4443 * If jack inserted, headphone will be selected, else built-in speakers
4448 struct ca0132_spec *spec = codec->spec; in ca0132_select_out()
4459 auto_jack = spec->vnode_lswitch[VNID_HP_ASEL - VNODE_START_NID]; in ca0132_select_out()
4462 jack_present = snd_hda_jack_detect(codec, spec->unsol_tag_hp); in ca0132_select_out()
4465 spec->vnode_lswitch[VNID_HP_SEL - VNODE_START_NID]; in ca0132_select_out()
4468 spec->cur_out_type = HEADPHONE_OUT; in ca0132_select_out()
4470 spec->cur_out_type = SPEAKER_OUT; in ca0132_select_out()
4472 if (spec->cur_out_type == SPEAKER_OUT) { in ca0132_select_out()
4486 snd_hda_codec_write(codec, spec->out_pins[1], 0, in ca0132_select_out()
4488 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4490 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4492 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4496 pin_ctl = snd_hda_codec_read(codec, spec->out_pins[1], 0, in ca0132_select_out()
4498 snd_hda_set_pin_ctl(codec, spec->out_pins[1], in ca0132_select_out()
4501 pin_ctl = snd_hda_codec_read(codec, spec->out_pins[0], 0, in ca0132_select_out()
4503 snd_hda_set_pin_ctl(codec, spec->out_pins[0], in ca0132_select_out()
4519 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4521 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4523 snd_hda_codec_write(codec, spec->out_pins[1], 0, in ca0132_select_out()
4525 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_select_out()
4529 pin_ctl = snd_hda_codec_read(codec, spec->out_pins[0], 0, in ca0132_select_out()
4531 snd_hda_set_pin_ctl(codec, spec->out_pins[0], in ca0132_select_out()
4534 pin_ctl = snd_hda_codec_read(codec, spec->out_pins[1], 0, in ca0132_select_out()
4536 snd_hda_set_pin_ctl(codec, spec->out_pins[1], in ca0132_select_out()
4552 struct ca0132_spec *spec = codec->spec; in ae5_mmio_select_out()
4562 ca0113_mmio_command_set(codec, out_cmds->group[i], in ae5_mmio_select_out()
4563 out_cmds->target[i], in ae5_mmio_select_out()
4564 out_cmds->vals[spec->cur_out_type][i]); in ae5_mmio_select_out()
4569 struct ca0132_spec *spec = codec->spec; in ca0132_alt_set_full_range_speaker()
4574 /* 2.0/4.0 setup has no LFE channel, so setting full-range does nothing. */ in ca0132_alt_set_full_range_speaker()
4575 if (spec->channel_cfg_val == SPEAKER_CHANNELS_4_0 in ca0132_alt_set_full_range_speaker()
4576 || spec->channel_cfg_val == SPEAKER_CHANNELS_2_0) in ca0132_alt_set_full_range_speaker()
4579 /* Set front L/R full range. Zero for full-range, one for redirection. */ in ca0132_alt_set_full_range_speaker()
4580 tmp = spec->speaker_range_val[0] ? FLOAT_ZERO : FLOAT_ONE; in ca0132_alt_set_full_range_speaker()
4586 /* When setting full-range rear, both rear and center/lfe are set. */ in ca0132_alt_set_full_range_speaker()
4587 tmp = spec->speaker_range_val[1] ? FLOAT_ZERO : FLOAT_ONE; in ca0132_alt_set_full_range_speaker()
4599 * Only the AE series cards set this value when setting full-range, in ca0132_alt_set_full_range_speaker()
4615 struct ca0132_spec *spec = codec->spec; in ca0132_alt_surround_set_bass_redirection()
4619 if (val && spec->channel_cfg_val != SPEAKER_CHANNELS_4_0 && in ca0132_alt_surround_set_bass_redirection()
4620 spec->channel_cfg_val != SPEAKER_CHANNELS_2_0) in ca0132_alt_surround_set_bass_redirection()
4631 tmp = float_xbass_xover_lookup[spec->xbass_xover_freq]; in ca0132_alt_surround_set_bass_redirection()
4648 struct ca0132_spec *spec = codec->spec; in ca0132_alt_select_out_get_quirk_data()
4665 struct ca0132_spec *spec = codec->spec; in ca0132_alt_select_out_quirk_set()
4673 out_info = &quirk_data->out_set_info[spec->cur_out_type]; in ca0132_alt_select_out_quirk_set()
4674 if (quirk_data->is_ae_series) in ca0132_alt_select_out_quirk_set()
4677 if (out_info->has_hda_gpio) { in ca0132_alt_select_out_quirk_set()
4678 gpio_data = snd_hda_codec_read(codec, codec->core.afg, 0, in ca0132_alt_select_out_quirk_set()
4681 if (out_info->hda_gpio_set) in ca0132_alt_select_out_quirk_set()
4682 gpio_data |= (1 << out_info->hda_gpio_pin); in ca0132_alt_select_out_quirk_set()
4684 gpio_data &= ~(1 << out_info->hda_gpio_pin); in ca0132_alt_select_out_quirk_set()
4686 snd_hda_codec_write(codec, codec->core.afg, 0, in ca0132_alt_select_out_quirk_set()
4690 if (out_info->mmio_gpio_count) { in ca0132_alt_select_out_quirk_set()
4691 for (i = 0; i < out_info->mmio_gpio_count; i++) { in ca0132_alt_select_out_quirk_set()
4692 ca0113_mmio_gpio_set(codec, out_info->mmio_gpio_pin[i], in ca0132_alt_select_out_quirk_set()
4693 out_info->mmio_gpio_set[i]); in ca0132_alt_select_out_quirk_set()
4697 if (out_info->scp_cmds_count) { in ca0132_alt_select_out_quirk_set()
4698 for (i = 0; i < out_info->scp_cmds_count; i++) { in ca0132_alt_select_out_quirk_set()
4700 out_info->scp_cmd_mid[i], in ca0132_alt_select_out_quirk_set()
4701 out_info->scp_cmd_req[i], in ca0132_alt_select_out_quirk_set()
4702 out_info->scp_cmd_val[i]); in ca0132_alt_select_out_quirk_set()
4708 chipio_set_control_param(codec, 0x0d, out_info->dac2port); in ca0132_alt_select_out_quirk_set()
4710 if (out_info->has_chipio_write) { in ca0132_alt_select_out_quirk_set()
4711 chipio_write(codec, out_info->chipio_write_addr, in ca0132_alt_select_out_quirk_set()
4712 out_info->chipio_write_data); in ca0132_alt_select_out_quirk_set()
4715 if (quirk_data->has_headphone_gain) { in ca0132_alt_select_out_quirk_set()
4716 if (spec->cur_out_type != HEADPHONE_OUT) { in ca0132_alt_select_out_quirk_set()
4717 if (quirk_data->is_ae_series) in ca0132_alt_select_out_quirk_set()
4722 if (quirk_data->is_ae_series) in ca0132_alt_select_out_quirk_set()
4724 spec->ae5_headphone_gain_val); in ca0132_alt_select_out_quirk_set()
4727 spec->zxr_gain_set); in ca0132_alt_select_out_quirk_set()
4753 * It also adds the ability to auto-detect the front headphone port.
4757 struct ca0132_spec *spec = codec->spec; in ca0132_alt_select_out()
4763 hda_nid_t headphone_nid = spec->out_pins[1]; in ca0132_alt_select_out()
4769 auto_jack = spec->vnode_lswitch[VNID_HP_ASEL - VNODE_START_NID]; in ca0132_alt_select_out()
4777 jack_present = snd_hda_jack_detect(codec, spec->unsol_tag_hp) || in ca0132_alt_select_out()
4778 snd_hda_jack_detect(codec, spec->unsol_tag_front_hp); in ca0132_alt_select_out()
4781 spec->cur_out_type = HEADPHONE_OUT; in ca0132_alt_select_out()
4783 spec->cur_out_type = SPEAKER_OUT; in ca0132_alt_select_out()
4785 spec->cur_out_type = spec->out_enum_val; in ca0132_alt_select_out()
4787 outfx_set = spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]; in ca0132_alt_select_out()
4797 switch (spec->cur_out_type) { in ca0132_alt_select_out()
4802 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_alt_select_out()
4806 ca0132_set_out_node_pincfg(codec, spec->out_pins[1], 0, 0); in ca0132_alt_select_out()
4807 /* Set front L-R to output. */ in ca0132_alt_select_out()
4808 ca0132_set_out_node_pincfg(codec, spec->out_pins[0], 1, 0); in ca0132_alt_select_out()
4810 ca0132_set_out_node_pincfg(codec, spec->out_pins[2], 1, 0); in ca0132_alt_select_out()
4812 ca0132_set_out_node_pincfg(codec, spec->out_pins[3], 1, 0); in ca0132_alt_select_out()
4819 if (!outfx_set && spec->channel_cfg_val == SPEAKER_CHANNELS_2_0) in ca0132_alt_select_out()
4822 tmp = speaker_channel_cfgs[spec->channel_cfg_val].val; in ca0132_alt_select_out()
4831 snd_hda_codec_write(codec, spec->out_pins[0], 0, in ca0132_alt_select_out()
4835 ca0132_set_out_node_pincfg(codec, spec->out_pins[0], 0, 0); in ca0132_alt_select_out()
4836 ca0132_set_out_node_pincfg(codec, spec->out_pins[2], 0, 0); in ca0132_alt_select_out()
4837 ca0132_set_out_node_pincfg(codec, spec->out_pins[3], 0, 0); in ca0132_alt_select_out()
4840 if (snd_hda_jack_detect(codec, spec->unsol_tag_front_hp)) in ca0132_alt_select_out()
4841 headphone_nid = spec->out_pins[2]; in ca0132_alt_select_out()
4842 else if (snd_hda_jack_detect(codec, spec->unsol_tag_hp)) in ca0132_alt_select_out()
4843 headphone_nid = spec->out_pins[1]; in ca0132_alt_select_out()
4857 * If output effects are enabled, set the X-Bass effect value again to in ca0132_alt_select_out()
4863 spec->effects_switch[X_BASS - EFFECT_START_NID]); in ca0132_alt_select_out()
4879 if (spec->cur_out_type == SPEAKER_OUT) in ca0132_alt_select_out()
4881 spec->bass_redirection_val); in ca0132_alt_select_out()
4891 if (spec->cur_out_type == SPEAKER_OUT) { in ca0132_alt_select_out()
4910 ca0132_alt_select_out(spec->codec); in ca0132_unsol_hp_delayed()
4912 ca0132_select_out(spec->codec); in ca0132_unsol_hp_delayed()
4914 jack = snd_hda_jack_tbl_get(spec->codec, spec->unsol_tag_hp); in ca0132_unsol_hp_delayed()
4916 jack->block_report = 0; in ca0132_unsol_hp_delayed()
4917 snd_hda_jack_report_sync(spec->codec); in ca0132_unsol_hp_delayed()
4933 struct ca0132_spec *spec = codec->spec; in ca0132_set_vipsource()
4936 if (spec->dsp_state != DSP_DOWNLOADED) in ca0132_set_vipsource()
4940 if (!spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID] || in ca0132_set_vipsource()
4945 if (spec->cur_mic_type == DIGITAL_MIC) in ca0132_set_vipsource()
4955 if (spec->cur_mic_type == DIGITAL_MIC) in ca0132_set_vipsource()
4971 struct ca0132_spec *spec = codec->spec; in ca0132_alt_set_vipsource()
4974 if (spec->dsp_state != DSP_DOWNLOADED) in ca0132_alt_set_vipsource()
4983 if (!spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID] || in ca0132_alt_set_vipsource()
4984 (val == 0) || spec->in_enum_val == REAR_LINE_IN) { in ca0132_alt_set_vipsource()
4997 if (spec->in_enum_val == REAR_LINE_IN) in ca0132_alt_set_vipsource()
5015 if (spec->effects_switch[VOICE_FOCUS - EFFECT_START_NID]) in ca0132_alt_set_vipsource()
5037 * If jack inserted, ext.mic will be selected, else built-in mic
5042 struct ca0132_spec *spec = codec->spec; in ca0132_select_mic()
5050 auto_jack = spec->vnode_lswitch[VNID_AMIC1_ASEL - VNODE_START_NID]; in ca0132_select_mic()
5053 jack_present = snd_hda_jack_detect(codec, spec->unsol_tag_amic1); in ca0132_select_mic()
5056 spec->vnode_lswitch[VNID_AMIC1_SEL - VNODE_START_NID]; in ca0132_select_mic()
5059 spec->cur_mic_type = LINE_MIC_IN; in ca0132_select_mic()
5061 spec->cur_mic_type = DIGITAL_MIC; in ca0132_select_mic()
5063 if (spec->cur_mic_type == DIGITAL_MIC) { in ca0132_select_mic()
5070 spec->effects_switch in ca0132_select_mic()
5071 [VOICE_FOCUS - EFFECT_START_NID]); in ca0132_select_mic()
5076 ca0132_mic_boost_set(codec, spec->cur_mic_boost); in ca0132_select_mic()
5089 * The front mic has no jack-detection, so the only way to switch to it
5094 struct ca0132_spec *spec = codec->spec; in ca0132_alt_select_in()
5104 spec->cur_mic_type = spec->in_enum_val; in ca0132_alt_select_in()
5106 switch (spec->cur_mic_type) { in ca0132_alt_select_in()
5164 ca0132_alt_mic_boost_set(codec, spec->mic_boost_enum_val); in ca0132_alt_select_in()
5257 ca0132_alt_mic_boost_set(codec, spec->mic_boost_enum_val); in ca0132_alt_select_in()
5273 struct ca0132_spec *spec = codec->spec; in ca0132_is_vnode_effective()
5278 nid = spec->shared_out_nid; in ca0132_is_vnode_effective()
5281 nid = spec->shared_mic_nid; in ca0132_is_vnode_effective()
5299 struct ca0132_spec *spec = codec->spec; in ca0132_voicefx_set()
5304 tmp = spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID] ? in ca0132_voicefx_set()
5321 struct ca0132_spec *spec = codec->spec; in ca0132_effects_set()
5325 int idx = nid - EFFECT_START_NID; in ca0132_effects_set()
5333 if (!spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]) in ca0132_effects_set()
5335 if (spec->cur_out_type == SPEAKER_OUT && nid == X_BASS) { in ca0132_effects_set()
5336 channel_cfg = spec->channel_cfg_val; in ca0132_effects_set()
5346 if (!spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID]) in ca0132_effects_set()
5349 /* Voice Focus applies to 2-ch Mic, Digital Mic */ in ca0132_effects_set()
5350 if ((nid == VOICE_FOCUS) && (spec->cur_mic_type != DIGITAL_MIC)) in ca0132_effects_set()
5355 && (spec->cur_mic_type != REAR_LINE_IN)) { in ca0132_effects_set()
5356 if (spec->effects_switch[CRYSTAL_VOICE - in ca0132_effects_set()
5359 if (spec->effects_switch[VOICE_FOCUS - in ca0132_effects_set()
5374 && (spec->cur_mic_type != REAR_LINE_IN)) { in ca0132_effects_set()
5375 if (spec->effects_switch[CRYSTAL_VOICE - in ca0132_effects_set()
5377 if (spec->effects_switch[NOISE_REDUCTION - in ca0132_effects_set()
5390 spec->in_enum_val == REAR_LINE_IN) in ca0132_effects_set()
5412 struct ca0132_spec *spec = codec->spec; in ca0132_pe_switch_set()
5417 spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]); in ca0132_pe_switch_set()
5422 i = OUT_EFFECT_START_NID - EFFECT_START_NID; in ca0132_pe_switch_set()
5426 ret |= ca0132_effects_set(codec, nid, spec->effects_switch[i]); in ca0132_pe_switch_set()
5434 struct ca0132_spec *spec = codec->spec; in stop_mic1()
5435 unsigned int oldval = snd_hda_codec_read(codec, spec->adcs[0], 0, in stop_mic1()
5438 snd_hda_codec_write(codec, spec->adcs[0], 0, in stop_mic1()
5447 struct ca0132_spec *spec = codec->spec; in resume_mic1()
5450 snd_hda_codec_write(codec, spec->adcs[0], 0, in resume_mic1()
5460 struct ca0132_spec *spec = codec->spec; in ca0132_cvoice_switch_set()
5466 spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID]); in ca0132_cvoice_switch_set()
5468 i = IN_EFFECT_START_NID - EFFECT_START_NID; in ca0132_cvoice_switch_set()
5472 ret |= ca0132_effects_set(codec, nid, spec->effects_switch[i]); in ca0132_cvoice_switch_set()
5475 ret |= ca0132_voicefx_set(codec, (spec->voicefx_val ? 1 : 0)); in ca0132_cvoice_switch_set()
5489 struct ca0132_spec *spec = codec->spec; in ca0132_mic_boost_set()
5493 ret = snd_hda_codec_amp_update(codec, spec->input_pins[0], 0, in ca0132_mic_boost_set()
5496 ret = snd_hda_codec_amp_update(codec, spec->input_pins[0], 0, in ca0132_mic_boost_set()
5504 struct ca0132_spec *spec = codec->spec; in ca0132_alt_mic_boost_set()
5507 ret = snd_hda_codec_amp_update(codec, spec->input_pins[0], 0, in ca0132_alt_mic_boost_set()
5541 struct ca0132_spec *spec = codec->spec; in ca0132_vnode_switch_set()
5546 spec->vnode_lswitch[VNID_HP_ASEL - VNODE_START_NID]; in ca0132_vnode_switch_set()
5558 spec->vnode_lswitch[VNID_AMIC1_ASEL - VNODE_START_NID]; in ca0132_vnode_switch_set()
5584 mutex_lock(&codec->control_mutex); in ca0132_vnode_switch_set()
5585 pval = kcontrol->private_value; in ca0132_vnode_switch_set()
5586 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(shared_nid, ch, in ca0132_vnode_switch_set()
5589 kcontrol->private_value = pval; in ca0132_vnode_switch_set()
5590 mutex_unlock(&codec->control_mutex); in ca0132_vnode_switch_set()
5639 &(lookup[idx - 1]), sizeof(unsigned int)); in ca0132_alt_slider_ctl_set()
5660 struct ca0132_spec *spec = codec->spec; in ca0132_alt_xbass_xover_slider_ctl_get()
5661 long *valp = ucontrol->value.integer.value; in ca0132_alt_xbass_xover_slider_ctl_get()
5665 *valp = spec->bass_redirect_xover_freq; in ca0132_alt_xbass_xover_slider_ctl_get()
5667 *valp = spec->xbass_xover_freq; in ca0132_alt_xbass_xover_slider_ctl_get()
5676 struct ca0132_spec *spec = codec->spec; in ca0132_alt_slider_ctl_get()
5678 long *valp = ucontrol->value.integer.value; in ca0132_alt_slider_ctl_get()
5679 int idx = nid - OUT_EFFECT_START_NID; in ca0132_alt_slider_ctl_get()
5681 *valp = spec->fx_ctl_val[idx]; in ca0132_alt_slider_ctl_get()
5686 * The X-bass crossover starts at 10hz, so the min is 1. The
5692 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in ca0132_alt_xbass_xover_slider_info()
5693 uinfo->count = 1; in ca0132_alt_xbass_xover_slider_info()
5694 uinfo->value.integer.min = 1; in ca0132_alt_xbass_xover_slider_info()
5695 uinfo->value.integer.max = 100; in ca0132_alt_xbass_xover_slider_info()
5696 uinfo->value.integer.step = 1; in ca0132_alt_xbass_xover_slider_info()
5706 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in ca0132_alt_effect_slider_info()
5707 uinfo->count = chs == 3 ? 2 : 1; in ca0132_alt_effect_slider_info()
5708 uinfo->value.integer.min = 0; in ca0132_alt_effect_slider_info()
5709 uinfo->value.integer.max = 100; in ca0132_alt_effect_slider_info()
5710 uinfo->value.integer.step = 1; in ca0132_alt_effect_slider_info()
5719 struct ca0132_spec *spec = codec->spec; in ca0132_alt_xbass_xover_slider_put()
5721 long *valp = ucontrol->value.integer.value; in ca0132_alt_xbass_xover_slider_put()
5726 cur_val = &spec->bass_redirect_xover_freq; in ca0132_alt_xbass_xover_slider_put()
5728 cur_val = &spec->xbass_xover_freq; in ca0132_alt_xbass_xover_slider_put()
5749 struct ca0132_spec *spec = codec->spec; in ca0132_alt_effect_slider_put()
5751 long *valp = ucontrol->value.integer.value; in ca0132_alt_effect_slider_put()
5754 idx = nid - EFFECT_START_NID; in ca0132_alt_effect_slider_put()
5756 if (spec->fx_ctl_val[idx] == *valp) in ca0132_alt_effect_slider_put()
5759 spec->fx_ctl_val[idx] = *valp; in ca0132_alt_effect_slider_put()
5771 * traditional 0-100 in alsamixer that goes in big steps. I like enum better.
5782 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_mic_boost_info()
5783 uinfo->count = 1; in ca0132_alt_mic_boost_info()
5784 uinfo->value.enumerated.items = MIC_BOOST_NUM_OF_STEPS; in ca0132_alt_mic_boost_info()
5785 if (uinfo->value.enumerated.item >= MIC_BOOST_NUM_OF_STEPS) in ca0132_alt_mic_boost_info()
5786 uinfo->value.enumerated.item = MIC_BOOST_NUM_OF_STEPS - 1; in ca0132_alt_mic_boost_info()
5787 sprintf(namestr, "%d %s", (uinfo->value.enumerated.item * 10), sfx); in ca0132_alt_mic_boost_info()
5788 strcpy(uinfo->value.enumerated.name, namestr); in ca0132_alt_mic_boost_info()
5796 struct ca0132_spec *spec = codec->spec; in ca0132_alt_mic_boost_get()
5798 ucontrol->value.enumerated.item[0] = spec->mic_boost_enum_val; in ca0132_alt_mic_boost_get()
5806 struct ca0132_spec *spec = codec->spec; in ca0132_alt_mic_boost_put()
5807 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_mic_boost_put()
5816 spec->mic_boost_enum_val = sel; in ca0132_alt_mic_boost_put()
5818 if (spec->in_enum_val != REAR_LINE_IN) in ca0132_alt_mic_boost_put()
5819 ca0132_alt_mic_boost_set(codec, spec->mic_boost_enum_val); in ca0132_alt_mic_boost_put()
5825 * Sound BlasterX AE-5 Headphone Gain Controls.
5834 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ae5_headphone_gain_info()
5835 uinfo->count = 1; in ae5_headphone_gain_info()
5836 uinfo->value.enumerated.items = AE5_HEADPHONE_GAIN_MAX; in ae5_headphone_gain_info()
5837 if (uinfo->value.enumerated.item >= AE5_HEADPHONE_GAIN_MAX) in ae5_headphone_gain_info()
5838 uinfo->value.enumerated.item = AE5_HEADPHONE_GAIN_MAX - 1; in ae5_headphone_gain_info()
5840 ae5_headphone_gain_presets[uinfo->value.enumerated.item].name, in ae5_headphone_gain_info()
5842 strcpy(uinfo->value.enumerated.name, namestr); in ae5_headphone_gain_info()
5850 struct ca0132_spec *spec = codec->spec; in ae5_headphone_gain_get()
5852 ucontrol->value.enumerated.item[0] = spec->ae5_headphone_gain_val; in ae5_headphone_gain_get()
5860 struct ca0132_spec *spec = codec->spec; in ae5_headphone_gain_put()
5861 int sel = ucontrol->value.enumerated.item[0]; in ae5_headphone_gain_put()
5870 spec->ae5_headphone_gain_val = sel; in ae5_headphone_gain_put()
5872 if (spec->out_enum_val == HEADPHONE_OUT) in ae5_headphone_gain_put()
5873 ae5_headphone_gain_set(codec, spec->ae5_headphone_gain_val); in ae5_headphone_gain_put()
5879 * Sound BlasterX AE-5 sound filter enumerated control.
5888 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ae5_sound_filter_info()
5889 uinfo->count = 1; in ae5_sound_filter_info()
5890 uinfo->value.enumerated.items = AE5_SOUND_FILTER_MAX; in ae5_sound_filter_info()
5891 if (uinfo->value.enumerated.item >= AE5_SOUND_FILTER_MAX) in ae5_sound_filter_info()
5892 uinfo->value.enumerated.item = AE5_SOUND_FILTER_MAX - 1; in ae5_sound_filter_info()
5894 ae5_filter_presets[uinfo->value.enumerated.item].name); in ae5_sound_filter_info()
5895 strcpy(uinfo->value.enumerated.name, namestr); in ae5_sound_filter_info()
5903 struct ca0132_spec *spec = codec->spec; in ae5_sound_filter_get()
5905 ucontrol->value.enumerated.item[0] = spec->ae5_filter_val; in ae5_sound_filter_get()
5913 struct ca0132_spec *spec = codec->spec; in ae5_sound_filter_put()
5914 int sel = ucontrol->value.enumerated.item[0]; in ae5_sound_filter_put()
5923 spec->ae5_filter_val = sel; in ae5_sound_filter_put()
5933 * front microphone has no auto-detect, and we need a way to set the rear
5934 * as line-in
5939 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_input_source_info()
5940 uinfo->count = 1; in ca0132_alt_input_source_info()
5941 uinfo->value.enumerated.items = IN_SRC_NUM_OF_INPUTS; in ca0132_alt_input_source_info()
5942 if (uinfo->value.enumerated.item >= IN_SRC_NUM_OF_INPUTS) in ca0132_alt_input_source_info()
5943 uinfo->value.enumerated.item = IN_SRC_NUM_OF_INPUTS - 1; in ca0132_alt_input_source_info()
5944 strcpy(uinfo->value.enumerated.name, in ca0132_alt_input_source_info()
5945 in_src_str[uinfo->value.enumerated.item]); in ca0132_alt_input_source_info()
5953 struct ca0132_spec *spec = codec->spec; in ca0132_alt_input_source_get()
5955 ucontrol->value.enumerated.item[0] = spec->in_enum_val; in ca0132_alt_input_source_get()
5963 struct ca0132_spec *spec = codec->spec; in ca0132_alt_input_source_put()
5964 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_input_source_put()
5968 * The AE-7 has no front microphone, so limit items to 2: rear mic and in ca0132_alt_input_source_put()
5969 * line-in. in ca0132_alt_input_source_put()
5980 spec->in_enum_val = sel; in ca0132_alt_input_source_put()
5991 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_output_select_get_info()
5992 uinfo->count = 1; in ca0132_alt_output_select_get_info()
5993 uinfo->value.enumerated.items = NUM_OF_OUTPUTS; in ca0132_alt_output_select_get_info()
5994 if (uinfo->value.enumerated.item >= NUM_OF_OUTPUTS) in ca0132_alt_output_select_get_info()
5995 uinfo->value.enumerated.item = NUM_OF_OUTPUTS - 1; in ca0132_alt_output_select_get_info()
5996 strcpy(uinfo->value.enumerated.name, in ca0132_alt_output_select_get_info()
5997 out_type_str[uinfo->value.enumerated.item]); in ca0132_alt_output_select_get_info()
6005 struct ca0132_spec *spec = codec->spec; in ca0132_alt_output_select_get()
6007 ucontrol->value.enumerated.item[0] = spec->out_enum_val; in ca0132_alt_output_select_get()
6015 struct ca0132_spec *spec = codec->spec; in ca0132_alt_output_select_put()
6016 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_output_select_put()
6026 spec->out_enum_val = sel; in ca0132_alt_output_select_put()
6028 auto_jack = spec->vnode_lswitch[VNID_HP_ASEL - VNODE_START_NID]; in ca0132_alt_output_select_put()
6042 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_speaker_channel_cfg_get_info()
6043 uinfo->count = 1; in ca0132_alt_speaker_channel_cfg_get_info()
6044 uinfo->value.enumerated.items = items; in ca0132_alt_speaker_channel_cfg_get_info()
6045 if (uinfo->value.enumerated.item >= items) in ca0132_alt_speaker_channel_cfg_get_info()
6046 uinfo->value.enumerated.item = items - 1; in ca0132_alt_speaker_channel_cfg_get_info()
6047 strcpy(uinfo->value.enumerated.name, in ca0132_alt_speaker_channel_cfg_get_info()
6048 speaker_channel_cfgs[uinfo->value.enumerated.item].name); in ca0132_alt_speaker_channel_cfg_get_info()
6056 struct ca0132_spec *spec = codec->spec; in ca0132_alt_speaker_channel_cfg_get()
6058 ucontrol->value.enumerated.item[0] = spec->channel_cfg_val; in ca0132_alt_speaker_channel_cfg_get()
6066 struct ca0132_spec *spec = codec->spec; in ca0132_alt_speaker_channel_cfg_put()
6067 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_speaker_channel_cfg_put()
6076 spec->channel_cfg_val = sel; in ca0132_alt_speaker_channel_cfg_put()
6078 if (spec->out_enum_val == SPEAKER_OUT) in ca0132_alt_speaker_channel_cfg_put()
6095 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_svm_setting_info()
6096 uinfo->count = 1; in ca0132_alt_svm_setting_info()
6097 uinfo->value.enumerated.items = NUM_OF_SVM_SETTINGS; in ca0132_alt_svm_setting_info()
6098 if (uinfo->value.enumerated.item >= NUM_OF_SVM_SETTINGS) in ca0132_alt_svm_setting_info()
6099 uinfo->value.enumerated.item = NUM_OF_SVM_SETTINGS - 1; in ca0132_alt_svm_setting_info()
6100 strcpy(uinfo->value.enumerated.name, in ca0132_alt_svm_setting_info()
6101 out_svm_set_enum_str[uinfo->value.enumerated.item]); in ca0132_alt_svm_setting_info()
6109 struct ca0132_spec *spec = codec->spec; in ca0132_alt_svm_setting_get()
6111 ucontrol->value.enumerated.item[0] = spec->smart_volume_setting; in ca0132_alt_svm_setting_get()
6119 struct ca0132_spec *spec = codec->spec; in ca0132_alt_svm_setting_put()
6120 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_svm_setting_put()
6122 unsigned int idx = SMART_VOLUME - EFFECT_START_NID; in ca0132_alt_svm_setting_put()
6131 spec->smart_volume_setting = sel; in ca0132_alt_svm_setting_put()
6159 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_alt_eq_preset_info()
6160 uinfo->count = 1; in ca0132_alt_eq_preset_info()
6161 uinfo->value.enumerated.items = items; in ca0132_alt_eq_preset_info()
6162 if (uinfo->value.enumerated.item >= items) in ca0132_alt_eq_preset_info()
6163 uinfo->value.enumerated.item = items - 1; in ca0132_alt_eq_preset_info()
6164 strcpy(uinfo->value.enumerated.name, in ca0132_alt_eq_preset_info()
6165 ca0132_alt_eq_presets[uinfo->value.enumerated.item].name); in ca0132_alt_eq_preset_info()
6173 struct ca0132_spec *spec = codec->spec; in ca0132_alt_eq_preset_get()
6175 ucontrol->value.enumerated.item[0] = spec->eq_preset_val; in ca0132_alt_eq_preset_get()
6183 struct ca0132_spec *spec = codec->spec; in ca0132_alt_eq_preset_put()
6185 int sel = ucontrol->value.enumerated.item[0]; in ca0132_alt_eq_preset_put()
6206 spec->eq_preset_val = sel; in ca0132_alt_eq_preset_put()
6216 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in ca0132_voicefx_info()
6217 uinfo->count = 1; in ca0132_voicefx_info()
6218 uinfo->value.enumerated.items = items; in ca0132_voicefx_info()
6219 if (uinfo->value.enumerated.item >= items) in ca0132_voicefx_info()
6220 uinfo->value.enumerated.item = items - 1; in ca0132_voicefx_info()
6221 strcpy(uinfo->value.enumerated.name, in ca0132_voicefx_info()
6222 ca0132_voicefx_presets[uinfo->value.enumerated.item].name); in ca0132_voicefx_info()
6230 struct ca0132_spec *spec = codec->spec; in ca0132_voicefx_get()
6232 ucontrol->value.enumerated.item[0] = spec->voicefx_val; in ca0132_voicefx_get()
6240 struct ca0132_spec *spec = codec->spec; in ca0132_voicefx_put()
6242 int sel = ucontrol->value.enumerated.item[0]; in ca0132_voicefx_put()
6263 spec->voicefx_val = sel; in ca0132_voicefx_put()
6275 struct ca0132_spec *spec = codec->spec; in ca0132_switch_get()
6278 long *valp = ucontrol->value.integer.value; in ca0132_switch_get()
6283 *valp = spec->vnode_lswitch[nid - VNODE_START_NID]; in ca0132_switch_get()
6287 *valp = spec->vnode_rswitch[nid - VNODE_START_NID]; in ca0132_switch_get()
6295 *valp = spec->effects_switch[nid - EFFECT_START_NID]; in ca0132_switch_get()
6300 if (nid == spec->input_pins[0]) { in ca0132_switch_get()
6301 *valp = spec->cur_mic_boost; in ca0132_switch_get()
6306 *valp = spec->zxr_gain_set; in ca0132_switch_get()
6311 *valp = spec->speaker_range_val[nid - SPEAKER_FULL_RANGE_FRONT]; in ca0132_switch_get()
6316 *valp = spec->bass_redirection_val; in ca0132_switch_get()
6327 struct ca0132_spec *spec = codec->spec; in ca0132_switch_put()
6330 long *valp = ucontrol->value.integer.value; in ca0132_switch_put()
6340 spec->vnode_lswitch[nid - VNODE_START_NID] = *valp; in ca0132_switch_put()
6344 spec->vnode_rswitch[nid - VNODE_START_NID] = *valp; in ca0132_switch_put()
6353 spec->effects_switch[nid - EFFECT_START_NID] = *valp; in ca0132_switch_put()
6360 spec->effects_switch[nid - EFFECT_START_NID] = *valp; in ca0132_switch_put()
6368 spec->effects_switch[nid - EFFECT_START_NID] = *valp; in ca0132_switch_put()
6374 if (nid == spec->input_pins[0]) { in ca0132_switch_put()
6375 spec->cur_mic_boost = *valp; in ca0132_switch_put()
6377 if (spec->in_enum_val != REAR_LINE_IN) in ca0132_switch_put()
6381 if (spec->cur_mic_type != DIGITAL_MIC) in ca0132_switch_put()
6389 spec->zxr_gain_set = *valp; in ca0132_switch_put()
6390 if (spec->cur_out_type == HEADPHONE_OUT) in ca0132_switch_put()
6399 spec->speaker_range_val[nid - SPEAKER_FULL_RANGE_FRONT] = *valp; in ca0132_switch_put()
6400 if (spec->cur_out_type == SPEAKER_OUT) in ca0132_switch_put()
6407 spec->bass_redirection_val = *valp; in ca0132_switch_put()
6408 if (spec->cur_out_type == SPEAKER_OUT) in ca0132_switch_put()
6429 struct ca0132_spec *spec = codec->spec; in ca0132_alt_dsp_volume_put()
6438 lookup_val = spec->vnode_lvol[nid - VNODE_START_NID]; in ca0132_alt_dsp_volume_put()
6445 lookup_val = spec->vnode_rvol[nid - VNODE_START_NID]; in ca0132_alt_dsp_volume_put()
6461 struct ca0132_spec *spec = codec->spec; in ca0132_volume_info()
6471 nid = spec->shared_out_nid; in ca0132_volume_info()
6472 mutex_lock(&codec->control_mutex); in ca0132_volume_info()
6473 pval = kcontrol->private_value; in ca0132_volume_info()
6474 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(nid, ch, 0, dir); in ca0132_volume_info()
6476 kcontrol->private_value = pval; in ca0132_volume_info()
6477 mutex_unlock(&codec->control_mutex); in ca0132_volume_info()
6481 nid = spec->shared_mic_nid; in ca0132_volume_info()
6482 mutex_lock(&codec->control_mutex); in ca0132_volume_info()
6483 pval = kcontrol->private_value; in ca0132_volume_info()
6484 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(nid, ch, 0, dir); in ca0132_volume_info()
6486 kcontrol->private_value = pval; in ca0132_volume_info()
6487 mutex_unlock(&codec->control_mutex); in ca0132_volume_info()
6499 struct ca0132_spec *spec = codec->spec; in ca0132_volume_get()
6502 long *valp = ucontrol->value.integer.value; in ca0132_volume_get()
6506 *valp = spec->vnode_lvol[nid - VNODE_START_NID]; in ca0132_volume_get()
6510 *valp = spec->vnode_rvol[nid - VNODE_START_NID]; in ca0132_volume_get()
6520 struct ca0132_spec *spec = codec->spec; in ca0132_volume_put()
6523 long *valp = ucontrol->value.integer.value; in ca0132_volume_put()
6530 spec->vnode_lvol[nid - VNODE_START_NID] = *valp; in ca0132_volume_put()
6534 spec->vnode_rvol[nid - VNODE_START_NID] = *valp; in ca0132_volume_put()
6545 mutex_lock(&codec->control_mutex); in ca0132_volume_put()
6546 pval = kcontrol->private_value; in ca0132_volume_put()
6547 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(shared_nid, ch, in ca0132_volume_put()
6550 kcontrol->private_value = pval; in ca0132_volume_put()
6551 mutex_unlock(&codec->control_mutex); in ca0132_volume_put()
6567 struct ca0132_spec *spec = codec->spec; in ca0132_alt_volume_put()
6570 long *valp = ucontrol->value.integer.value; in ca0132_alt_volume_put()
6585 spec->vnode_lvol[vnid - VNODE_START_NID] = *valp; in ca0132_alt_volume_put()
6589 spec->vnode_rvol[vnid - VNODE_START_NID] = *valp; in ca0132_alt_volume_put()
6595 mutex_lock(&codec->control_mutex); in ca0132_alt_volume_put()
6597 mutex_unlock(&codec->control_mutex); in ca0132_alt_volume_put()
6607 struct ca0132_spec *spec = codec->spec; in ca0132_volume_tlv()
6617 nid = spec->shared_out_nid; in ca0132_volume_tlv()
6618 mutex_lock(&codec->control_mutex); in ca0132_volume_tlv()
6619 pval = kcontrol->private_value; in ca0132_volume_tlv()
6620 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(nid, ch, 0, dir); in ca0132_volume_tlv()
6622 kcontrol->private_value = pval; in ca0132_volume_tlv()
6623 mutex_unlock(&codec->control_mutex); in ca0132_volume_tlv()
6627 nid = spec->shared_mic_nid; in ca0132_volume_tlv()
6628 mutex_lock(&codec->control_mutex); in ca0132_volume_tlv()
6629 pval = kcontrol->private_value; in ca0132_volume_tlv()
6630 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(nid, ch, 0, dir); in ca0132_volume_tlv()
6632 kcontrol->private_value = pval; in ca0132_volume_tlv()
6633 mutex_unlock(&codec->control_mutex); in ca0132_volume_tlv()
6680 struct ca0132_spec *spec = codec->spec; in add_fx_switch()
6779 CA0132_CODEC_MUTE_MONO("Full-Range Front Speakers", in ca0132_alt_add_front_full_range_switch()
6789 CA0132_CODEC_MUTE_MONO("Full-Range Rear Speakers", in ca0132_alt_add_rear_full_range_switch()
6798 * channel on speakers that are set as not being full-range. On configurations
6800 * replacement for X-Bass on configurations with an LFE channel.
6831 * because the front microphone has no auto-detect, and Line-in has to be set
6864 * Add headphone gain enumerated control for the AE-5. This switches between
6865 * three modes, low, medium, and high. When non-headphone outputs are selected,
6871 HDA_CODEC_MUTE_MONO("AE-5: Headphone Gain", in ae5_add_headphone_gain_enum()
6881 * Add sound filter enumerated control for the AE-5. This adds three different
6888 HDA_CODEC_MUTE_MONO("AE-5: Sound Filter", in ae5_add_sound_filter_enum()
6939 list_for_each_entry(pcm, &codec->pcm_list_head, list) { in ca0132_alt_add_chmap_ctls()
6941 &pcm->stream[SNDRV_PCM_STREAM_PLAYBACK]; in ca0132_alt_add_chmap_ctls()
6946 if (hinfo->channels_max == 6) { in ca0132_alt_add_chmap_ctls()
6947 err = snd_pcm_add_chmap_ctls(pcm->pcm, in ca0132_alt_add_chmap_ctls()
6949 elem, hinfo->channels_max, 0, &chmap); in ca0132_alt_add_chmap_ctls()
6965 HDA_CODEC_VOLUME("Analog-Mic2 Capture Volume", 0x08, 0, HDA_INPUT),
6966 HDA_CODEC_MUTE("Analog-Mic2 Capture Switch", 0x08, 0, HDA_INPUT),
6969 CA0132_CODEC_MUTE_MONO("Mic1-Boost (30dB) Capture Switch",
6983 * Desktop specific control mixer. Removes auto-detect for mic, and adds
7029 struct ca0132_spec *spec = codec->spec; in ca0132_build_controls()
7034 for (i = 0; i < spec->num_mixers; i++) { in ca0132_build_controls()
7035 err = snd_hda_add_new_ctls(codec, spec->mixers[i]); in ca0132_build_controls()
7041 snd_hda_set_vmaster_tlv(codec, spec->dacs[0], HDA_OUTPUT, in ca0132_build_controls()
7042 spec->tlv); in ca0132_build_controls()
7044 spec->tlv, ca0132_alt_follower_pfxs, in ca0132_build_controls()
7049 true, 0, &spec->vmaster_mute.sw_kctl); in ca0132_build_controls()
7061 if (i == (ECHO_CANCELLATION - IN_EFFECT_START_NID + in ca0132_build_controls()
7096 num_sliders = OUT_EFFECTS_COUNT - 1; in ca0132_build_controls()
7107 "X-Bass Crossover", EFX_DIR_OUT); in ca0132_build_controls()
7155 * header on the card, and aux-in is handled by the DBPro board. in ca0132_build_controls()
7187 err = snd_hda_jack_add_kctls(codec, &spec->autocfg); in ca0132_build_controls()
7191 if (spec->dig_out) { in ca0132_build_controls()
7192 err = snd_hda_create_spdif_out_ctls(codec, spec->dig_out, in ca0132_build_controls()
7193 spec->dig_out); in ca0132_build_controls()
7196 err = snd_hda_create_spdif_share_sw(codec, &spec->multiout); in ca0132_build_controls()
7199 /* spec->multiout.share_spdif = 1; */ in ca0132_build_controls()
7202 if (spec->dig_in) { in ca0132_build_controls()
7203 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in); in ca0132_build_controls()
7216 struct ca0132_spec *spec = codec->spec; in dbpro_build_controls()
7219 if (spec->dig_out) { in dbpro_build_controls()
7220 err = snd_hda_create_spdif_out_ctls(codec, spec->dig_out, in dbpro_build_controls()
7221 spec->dig_out); in dbpro_build_controls()
7226 if (spec->dig_in) { in dbpro_build_controls()
7227 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in); in dbpro_build_controls()
7280 struct ca0132_spec *spec = codec->spec; in ca0132_build_pcms()
7285 return -ENOMEM; in ca0132_build_pcms()
7287 info->own_chmap = true; in ca0132_build_pcms()
7288 info->stream[SNDRV_PCM_STREAM_PLAYBACK].chmap in ca0132_build_pcms()
7291 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = ca0132_pcm_analog_playback; in ca0132_build_pcms()
7292 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->dacs[0]; in ca0132_build_pcms()
7293 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = in ca0132_build_pcms()
7294 spec->multiout.max_channels; in ca0132_build_pcms()
7295 info->stream[SNDRV_PCM_STREAM_CAPTURE] = ca0132_pcm_analog_capture; in ca0132_build_pcms()
7296 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = 1; in ca0132_build_pcms()
7297 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adcs[0]; in ca0132_build_pcms()
7301 info = snd_hda_codec_pcm_new(codec, "CA0132 Analog Mic-In2"); in ca0132_build_pcms()
7303 return -ENOMEM; in ca0132_build_pcms()
7304 info->stream[SNDRV_PCM_STREAM_CAPTURE] = in ca0132_build_pcms()
7306 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = 1; in ca0132_build_pcms()
7307 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adcs[1]; in ca0132_build_pcms()
7312 return -ENOMEM; in ca0132_build_pcms()
7313 info->stream[SNDRV_PCM_STREAM_CAPTURE] = ca0132_pcm_analog_capture; in ca0132_build_pcms()
7314 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = 1; in ca0132_build_pcms()
7315 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adcs[2]; in ca0132_build_pcms()
7317 if (!spec->dig_out && !spec->dig_in) in ca0132_build_pcms()
7322 return -ENOMEM; in ca0132_build_pcms()
7323 info->pcm_type = HDA_PCM_TYPE_SPDIF; in ca0132_build_pcms()
7324 if (spec->dig_out) { in ca0132_build_pcms()
7325 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = in ca0132_build_pcms()
7327 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->dig_out; in ca0132_build_pcms()
7329 if (spec->dig_in) { in ca0132_build_pcms()
7330 info->stream[SNDRV_PCM_STREAM_CAPTURE] = in ca0132_build_pcms()
7332 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in; in ca0132_build_pcms()
7340 struct ca0132_spec *spec = codec->spec; in dbpro_build_pcms()
7345 return -ENOMEM; in dbpro_build_pcms()
7346 info->stream[SNDRV_PCM_STREAM_CAPTURE] = ca0132_pcm_analog_capture; in dbpro_build_pcms()
7347 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = 1; in dbpro_build_pcms()
7348 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adcs[0]; in dbpro_build_pcms()
7351 if (!spec->dig_out && !spec->dig_in) in dbpro_build_pcms()
7356 return -ENOMEM; in dbpro_build_pcms()
7357 info->pcm_type = HDA_PCM_TYPE_SPDIF; in dbpro_build_pcms()
7358 if (spec->dig_out) { in dbpro_build_pcms()
7359 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = in dbpro_build_pcms()
7361 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->dig_out; in dbpro_build_pcms()
7363 if (spec->dig_in) { in dbpro_build_pcms()
7364 info->stream[SNDRV_PCM_STREAM_CAPTURE] = in dbpro_build_pcms()
7366 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in; in dbpro_build_pcms()
7417 * Switch between Digital built-in mic and analog mic.
7421 struct ca0132_spec *spec = codec->spec; in ca0132_set_dmic()
7431 /* set DMic input as 2-ch */ in ca0132_set_dmic()
7435 val = spec->dmic_ctl; in ca0132_set_dmic()
7437 snd_hda_codec_write(codec, spec->input_pins[0], 0, in ca0132_set_dmic()
7440 if (!(spec->dmic_ctl & 0x20)) in ca0132_set_dmic()
7447 val = spec->dmic_ctl; in ca0132_set_dmic()
7450 snd_hda_codec_write(codec, spec->input_pins[0], 0, in ca0132_set_dmic()
7453 if (!(spec->dmic_ctl & 0x20)) in ca0132_set_dmic()
7465 struct ca0132_spec *spec = codec->spec; in ca0132_init_dmic()
7473 * Bit 2-0: MPIO select in ca0132_init_dmic()
7475 * Bit 7-4: reserved in ca0132_init_dmic()
7478 snd_hda_codec_write(codec, spec->input_pins[0], 0, in ca0132_init_dmic()
7482 * Bit 2-0: Data1 MPIO select in ca0132_init_dmic()
7484 * Bit 6-4: Data2 MPIO select in ca0132_init_dmic()
7488 snd_hda_codec_write(codec, spec->input_pins[0], 0, in ca0132_init_dmic()
7491 /* Use Ch-0 and Ch-1. Rate is 48K, mode 1. Disable DMic first. in ca0132_init_dmic()
7492 * Bit 3-0: Channel mask in ca0132_init_dmic()
7503 spec->dmic_ctl = val; in ca0132_init_dmic()
7504 snd_hda_codec_write(codec, spec->input_pins[0], 0, in ca0132_init_dmic()
7513 struct ca0132_spec *spec = codec->spec; in ca0132_init_analog_mic2()
7515 mutex_lock(&spec->chipio_mutex); in ca0132_init_analog_mic2()
7520 mutex_unlock(&spec->chipio_mutex); in ca0132_init_analog_mic2()
7525 struct ca0132_spec *spec = codec->spec; in ca0132_refresh_widget_caps()
7531 for (i = 0; i < spec->multiout.num_dacs; i++) in ca0132_refresh_widget_caps()
7532 refresh_amp_caps(codec, spec->dacs[i], HDA_OUTPUT); in ca0132_refresh_widget_caps()
7534 for (i = 0; i < spec->num_outputs; i++) in ca0132_refresh_widget_caps()
7535 refresh_amp_caps(codec, spec->out_pins[i], HDA_OUTPUT); in ca0132_refresh_widget_caps()
7537 for (i = 0; i < spec->num_inputs; i++) { in ca0132_refresh_widget_caps()
7538 refresh_amp_caps(codec, spec->adcs[i], HDA_INPUT); in ca0132_refresh_widget_caps()
7539 refresh_amp_caps(codec, spec->input_pins[i], HDA_INPUT); in ca0132_refresh_widget_caps()
7584 * cause of most of the no-audio on startup issues were due to improperly
7603 struct ca0132_spec *spec = codec->spec; in ca0132_alt_start_dsp_audio_streams()
7610 mutex_lock(&spec->chipio_mutex); in ca0132_alt_start_dsp_audio_streams()
7621 mutex_unlock(&spec->chipio_mutex); in ca0132_alt_start_dsp_audio_streams()
7630 mutex_lock(&spec->chipio_mutex); in ca0132_alt_start_dsp_audio_streams()
7643 mutex_unlock(&spec->chipio_mutex); in ca0132_alt_start_dsp_audio_streams()
7647 * The region of ChipIO memory from 0x190000-0x1903fc is a sort of 'audio
7648 * router', where each entry represents a 48khz audio channel, with a format
7649 * of an 8-bit destination, an 8-bit source, and an unknown 2-bit number
7650 * value. The 2-bit number value is seemingly 0 if inactive, 1 if active,
7657 * the region of exram memory from 0x1477-0x1575 has each byte represent an
7670 * 0x00-0x1f: HDA audio stream input/output ports.
7671 * 0x80-0xbf: Sample rate converter input/outputs. Only valid ports seem to
7672 * have the lower-nibble set to 0x1, 0x2, and 0x9.
7673 * 0xc0-0xdf: DSP DMA input/output ports. Dynamically assigned.
7674 * 0xe0-0xff: DAC/ADC audio input/output ports.
7696 chipio_8051_read_exram(codec, 0x1578 + remap_data->stream_id, in chipio_remap_stream()
7708 chipio_8051_read_exram(codec, 0x1578 + remap_data->stream_id, in chipio_remap_stream()
7718 __func__, remap_data->stream_id); in chipio_remap_stream()
7722 /* Offset isn't in bytes, its in 32-bit words, so multiply it by 4. */ in chipio_remap_stream()
7726 for (i = 0; i < remap_data->count; i++) { in chipio_remap_stream()
7728 stream_offset + remap_data->offset[i], in chipio_remap_stream()
7729 remap_data->value[i]); in chipio_remap_stream()
7740 /* Non-zero values are floating point 0.000198. */
7745 /* Non-zero values are floating point 0.000220. */
7750 /* Non-zero values are floating point 0.000100. */
7759 struct ca0132_spec *spec = codec->spec; in ca0132_alt_init_speaker_tuning()
7799 * Initialize mic for non-chromebook ca0132 implementations.
7803 struct ca0132_spec *spec = codec->spec; in ca0132_alt_init_analog_mics()
7833 struct ca0132_spec *spec = codec->spec; in sbz_connect_streams()
7835 mutex_lock(&spec->chipio_mutex); in sbz_connect_streams()
7851 mutex_unlock(&spec->chipio_mutex); in sbz_connect_streams()
7863 struct ca0132_spec *spec = codec->spec; in sbz_chipio_startup_data()
7865 mutex_lock(&spec->chipio_mutex); in sbz_chipio_startup_data()
7890 mutex_unlock(&spec->chipio_mutex); in sbz_chipio_startup_data()
7895 struct ca0132_spec *spec = codec->spec; in ca0132_alt_dsp_initial_mic_setup()
7926 struct ca0132_spec *spec = codec->spec; in ae5_post_dsp_register_set()
7931 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7932 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7933 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7934 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7935 writeb(0x00, spec->mem_base + 0x100); in ae5_post_dsp_register_set()
7936 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7937 writeb(0x00, spec->mem_base + 0x100); in ae5_post_dsp_register_set()
7938 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7939 writeb(0x00, spec->mem_base + 0x100); in ae5_post_dsp_register_set()
7940 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7941 writeb(0x00, spec->mem_base + 0x100); in ae5_post_dsp_register_set()
7942 writeb(0xff, spec->mem_base + 0x304); in ae5_post_dsp_register_set()
7954 * AE-5's registry values in Windows. in ae5_post_dsp_param_setup()
7958 * I believe ASI is 'audio serial interface' and that it's used to in ae5_post_dsp_param_setup()
7959 * change colors on the external LED strip connected to the AE-5. in ae5_post_dsp_param_setup()
7980 struct ca0132_spec *spec = codec->spec; in ae5_post_dsp_stream_setup()
7982 mutex_lock(&spec->chipio_mutex); in ae5_post_dsp_stream_setup()
8001 mutex_unlock(&spec->chipio_mutex); in ae5_post_dsp_stream_setup()
8006 struct ca0132_spec *spec = codec->spec; in ae5_post_dsp_startup_data()
8008 mutex_lock(&spec->chipio_mutex); in ae5_post_dsp_startup_data()
8033 mutex_unlock(&spec->chipio_mutex); in ae5_post_dsp_startup_data()
8038 struct ca0132_spec *spec = codec->spec; in ae7_post_dsp_setup_ports()
8040 mutex_lock(&spec->chipio_mutex); in ae7_post_dsp_setup_ports()
8054 mutex_unlock(&spec->chipio_mutex); in ae7_post_dsp_setup_ports()
8059 struct ca0132_spec *spec = codec->spec; in ae7_post_dsp_asi_stream_setup()
8061 mutex_lock(&spec->chipio_mutex); in ae7_post_dsp_asi_stream_setup()
8077 mutex_unlock(&spec->chipio_mutex); in ae7_post_dsp_asi_stream_setup()
8096 struct ca0132_spec *spec = codec->spec; in ae7_post_dsp_asi_setup_ports()
8105 mutex_lock(&spec->chipio_mutex); in ae7_post_dsp_asi_setup_ports()
8142 * know what data is being sent. Interestingly, the AE-5 seems to go in ae7_post_dsp_asi_setup_ports()
8144 * step, but the AE-7 does. in ae7_post_dsp_asi_setup_ports()
8168 mutex_unlock(&spec->chipio_mutex); in ae7_post_dsp_asi_setup_ports()
8172 * The Windows driver has commands that seem to setup ASI, which I believe to
8207 struct ca0132_spec *spec = codec->spec; in ca0132_setup_defaults()
8212 if (spec->dsp_state != DSP_DOWNLOADED) in ca0132_setup_defaults()
8252 struct ca0132_spec *spec = codec->spec; in r3d_setup_defaults()
8257 if (spec->dsp_state != DSP_DOWNLOADED) in r3d_setup_defaults()
8302 struct ca0132_spec *spec = codec->spec; in sbz_setup_defaults()
8307 if (spec->dsp_state != DSP_DOWNLOADED) in sbz_setup_defaults()
8352 * Setup default parameters for the Sound BlasterX AE-5 DSP.
8356 struct ca0132_spec *spec = codec->spec; in ae5_setup_defaults()
8361 if (spec->dsp_state != DSP_DOWNLOADED) in ae5_setup_defaults()
8417 * Setup default parameters for the Sound Blaster AE-7 DSP.
8421 struct ca0132_spec *spec = codec->spec; in ae7_setup_defaults()
8426 if (spec->dsp_state != DSP_DOWNLOADED) in ae7_setup_defaults()
8504 struct ca0132_spec *spec = codec->spec; in ca0132_init_flags()
8537 struct ca0132_spec *spec = codec->spec; in ca0132_init_params()
8568 struct ca0132_spec *spec = codec->spec; in ca0132_download_dsp_images()
8581 codec->card->dev) != 0) in ca0132_download_dsp_images()
8588 codec->card->dev) != 0) in ca0132_download_dsp_images()
8603 codec->card->dev) != 0) in ca0132_download_dsp_images()
8607 dsp_os_image = (struct dsp_image_seg *)(fw_entry->data); in ca0132_download_dsp_images()
8623 struct ca0132_spec *spec = codec->spec; in ca0132_download_dsp()
8629 if (spec->dsp_state == DSP_DOWNLOAD_FAILED) in ca0132_download_dsp()
8633 if (spec->dsp_state != DSP_DOWNLOADED) { in ca0132_download_dsp()
8634 spec->dsp_state = DSP_DOWNLOADING; in ca0132_download_dsp()
8637 spec->dsp_state = DSP_DOWNLOAD_FAILED; in ca0132_download_dsp()
8639 spec->dsp_state = DSP_DOWNLOADED; in ca0132_download_dsp()
8643 if (spec->dsp_state == DSP_DOWNLOADED && !ca0132_use_alt_functions(spec)) in ca0132_download_dsp()
8650 struct ca0132_spec *spec = codec->spec; in ca0132_process_dsp_response()
8654 if (spec->wait_scp) { in ca0132_process_dsp_response()
8656 spec->wait_scp = 0; in ca0132_process_dsp_response()
8665 struct ca0132_spec *spec = codec->spec; in hp_callback()
8668 /* Delay enabling the HP amp, to let the mic-detection in hp_callback()
8671 tbl = snd_hda_jack_tbl_get(codec, cb->nid); in hp_callback()
8673 tbl->block_report = 1; in hp_callback()
8674 schedule_delayed_work(&spec->unsol_hp_work, msecs_to_jiffies(500)); in hp_callback()
8679 struct ca0132_spec *spec = codec->spec; in amic_callback()
8689 struct ca0132_spec *spec = codec->spec; in ca0132_setup_unsol()
8690 snd_hda_jack_detect_enable_callback(codec, spec->unsol_tag_hp, hp_callback); in ca0132_setup_unsol()
8691 snd_hda_jack_detect_enable_callback(codec, spec->unsol_tag_amic1, in ca0132_setup_unsol()
8698 spec->unsol_tag_front_hp, hp_callback); in ca0132_setup_unsol()
8778 struct ca0132_spec *spec = codec->spec; in ca0132_init_chip()
8783 mutex_init(&spec->chipio_mutex); in ca0132_init_chip()
8795 snd_hda_codec_write(codec, codec->core.afg, 0, in ca0132_init_chip()
8797 snd_hda_codec_write(codec, codec->core.afg, 0, in ca0132_init_chip()
8801 spec->cur_out_type = SPEAKER_OUT; in ca0132_init_chip()
8803 spec->cur_mic_type = DIGITAL_MIC; in ca0132_init_chip()
8805 spec->cur_mic_type = REAR_MIC; in ca0132_init_chip()
8807 spec->cur_mic_boost = 0; in ca0132_init_chip()
8810 spec->vnode_lvol[i] = 0x5a; in ca0132_init_chip()
8811 spec->vnode_rvol[i] = 0x5a; in ca0132_init_chip()
8812 spec->vnode_lswitch[i] = 0; in ca0132_init_chip()
8813 spec->vnode_rswitch[i] = 0; in ca0132_init_chip()
8822 spec->effects_switch[i] = on ? 1 : 0; in ca0132_init_chip()
8826 * ca0132 codecs. Also sets x-bass crossover frequency to 80hz. in ca0132_init_chip()
8830 spec->speaker_range_val[0] = 1; in ca0132_init_chip()
8831 spec->speaker_range_val[1] = 1; in ca0132_init_chip()
8833 spec->xbass_xover_freq = 8; in ca0132_init_chip()
8835 spec->fx_ctl_val[i] = effect_slider_defaults[i]; in ca0132_init_chip()
8837 spec->bass_redirect_xover_freq = 8; in ca0132_init_chip()
8840 spec->voicefx_val = 0; in ca0132_init_chip()
8841 spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID] = 1; in ca0132_init_chip()
8842 spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID] = 0; in ca0132_init_chip()
8845 * The ZxR doesn't have a front panel header, and it's line-in is on in ca0132_init_chip()
8847 * to make sure that spec->in_enum_val is set properly. in ca0132_init_chip()
8850 spec->in_enum_val = REAR_MIC; in ca0132_init_chip()
8871 struct ca0132_spec *spec = codec->spec; in sbz_region2_exit()
8875 writeb(0x0, spec->mem_base + 0x100); in sbz_region2_exit()
8877 writeb(0xb3, spec->mem_base + 0x304); in sbz_region2_exit()
8942 sbz_gpio_shutdown_commands(codec, 0x07, 0x07, -1); in sbz_exit_chip()
9077 struct ca0132_spec *spec = codec->spec; in sbz_dsp_startup_check()
9084 if (spec->startup_check_entered) in sbz_dsp_startup_check()
9087 spec->startup_check_entered = true; in sbz_dsp_startup_check()
9109 spec->dsp_state = DSP_DOWNLOAD_INIT; in sbz_dsp_startup_check()
9110 codec->patch_ops.init(codec); in sbz_dsp_startup_check()
9120 reload--; in sbz_dsp_startup_check()
9157 struct ca0132_spec *spec = codec->spec; in sbz_pre_dsp_setup()
9159 writel(0x00820680, spec->mem_base + 0x01C); in sbz_pre_dsp_setup()
9160 writel(0x00820680, spec->mem_base + 0x01C); in sbz_pre_dsp_setup()
9209 * ASI. Might be some way to prevent the card from reconfiguring the in zxr_pre_dsp_setup()
9210 * ASI stuff itself. in zxr_pre_dsp_setup()
9270 struct ca0132_spec *spec = codec->spec; in ca0132_mmio_init_sbz()
9276 writel(0x00000000, spec->mem_base + addr[i]); in ca0132_mmio_init_sbz()
9299 writel(tmp[i], spec->mem_base + addr[cur_addr + i]); in ca0132_mmio_init_sbz()
9315 writel(data[i], spec->mem_base + addr[cur_addr + i]); in ca0132_mmio_init_sbz()
9320 struct ca0132_spec *spec = codec->spec; in ca0132_mmio_init_ae5()
9329 writel(0x00000680, spec->mem_base + 0x1c); in ca0132_mmio_init_ae5()
9330 writel(0x00880680, spec->mem_base + 0x1c); in ca0132_mmio_init_ae5()
9335 * AE-7 shares all writes with the AE-5, except that it writes in ca0132_mmio_init_ae5()
9339 writel(0x00800001, spec->mem_base + addr[i]); in ca0132_mmio_init_ae5()
9343 writel(data[i], spec->mem_base + addr[i]); in ca0132_mmio_init_ae5()
9347 writel(0x00880680, spec->mem_base + 0x1c); in ca0132_mmio_init_ae5()
9352 struct ca0132_spec *spec = codec->spec; in ca0132_mmio_init()
9385 struct ca0132_spec *spec = codec->spec; in ae5_register_set()
9409 writeb(tmp[i], spec->mem_base + addr[cur_addr]); in ae5_register_set()
9416 writeb(data[i], spec->mem_base + addr[cur_addr]); in ae5_register_set()
9419 writel(data[i], spec->mem_base + addr[cur_addr]); in ae5_register_set()
9421 writel(0x00800001, spec->mem_base + 0x20c); in ae5_register_set()
9444 struct ca0132_spec *spec = codec->spec; in ca0132_alt_init()
9453 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9454 snd_hda_sequence_write(codec, spec->desktop_init_verbs); in ca0132_alt_init()
9462 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9467 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9468 snd_hda_sequence_write(codec, spec->desktop_init_verbs); in ca0132_alt_init()
9474 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9475 snd_hda_sequence_write(codec, spec->desktop_init_verbs); in ca0132_alt_init()
9481 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9482 snd_hda_sequence_write(codec, spec->desktop_init_verbs); in ca0132_alt_init()
9490 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_alt_init()
9491 snd_hda_sequence_write(codec, spec->desktop_init_verbs); in ca0132_alt_init()
9501 struct ca0132_spec *spec = codec->spec; in ca0132_init()
9502 struct auto_pin_cfg *cfg = &spec->autocfg; in ca0132_init()
9516 if (spec->dsp_state == DSP_DOWNLOADED) { in ca0132_init()
9519 spec->dsp_reload = true; in ca0132_init()
9520 spec->dsp_state = DSP_DOWNLOAD_INIT; in ca0132_init()
9528 if (spec->dsp_state != DSP_DOWNLOAD_FAILED) in ca0132_init()
9529 spec->dsp_state = DSP_DOWNLOAD_INIT; in ca0132_init()
9530 spec->curr_chip_addx = INVALID_CHIP_ADDRESS; in ca0132_init()
9543 snd_hda_sequence_write(codec, spec->base_init_verbs); in ca0132_init()
9574 for (i = 0; i < spec->num_outputs; i++) in ca0132_init()
9575 init_output(codec, spec->out_pins[i], spec->dacs[0]); in ca0132_init()
9577 init_output(codec, cfg->dig_out_pins[0], spec->dig_out); in ca0132_init()
9579 for (i = 0; i < spec->num_inputs; i++) in ca0132_init()
9580 init_input(codec, spec->input_pins[i], spec->adcs[i]); in ca0132_init()
9582 init_input(codec, cfg->dig_in_pin, spec->dig_in); in ca0132_init()
9585 snd_hda_sequence_write(codec, spec->chip_init_verbs); in ca0132_init()
9595 snd_hda_sequence_write(codec, spec->spec_init_verbs); in ca0132_init()
9610 if (spec->dsp_reload) { in ca0132_init()
9611 spec->dsp_reload = false; in ca0132_init()
9622 struct ca0132_spec *spec = codec->spec; in dbpro_init()
9623 struct auto_pin_cfg *cfg = &spec->autocfg; in dbpro_init()
9626 init_output(codec, cfg->dig_out_pins[0], spec->dig_out); in dbpro_init()
9627 init_input(codec, cfg->dig_in_pin, spec->dig_in); in dbpro_init()
9629 for (i = 0; i < spec->num_inputs; i++) in dbpro_init()
9630 init_input(codec, spec->input_pins[i], spec->adcs[i]); in dbpro_init()
9637 struct ca0132_spec *spec = codec->spec; in ca0132_free()
9639 cancel_delayed_work_sync(&spec->unsol_hp_work); in ca0132_free()
9664 snd_hda_sequence_write(codec, spec->base_exit_verbs); in ca0132_free()
9669 if (spec->mem_base) in ca0132_free()
9670 pci_iounmap(codec->bus->pci, spec->mem_base); in ca0132_free()
9672 kfree(spec->spec_init_verbs); in ca0132_free()
9673 kfree(codec->spec); in ca0132_free()
9678 struct ca0132_spec *spec = codec->spec; in dbpro_free()
9682 kfree(spec->spec_init_verbs); in dbpro_free()
9683 kfree(codec->spec); in dbpro_free()
9689 struct ca0132_spec *spec = codec->spec; in ca0132_suspend()
9691 cancel_delayed_work_sync(&spec->unsol_hp_work); in ca0132_suspend()
9716 struct ca0132_spec *spec = codec->spec; in ca0132_config()
9718 spec->dacs[0] = 0x2; in ca0132_config()
9719 spec->dacs[1] = 0x3; in ca0132_config()
9720 spec->dacs[2] = 0x4; in ca0132_config()
9722 spec->multiout.dac_nids = spec->dacs; in ca0132_config()
9723 spec->multiout.num_dacs = 3; in ca0132_config()
9726 spec->multiout.max_channels = 2; in ca0132_config()
9728 spec->multiout.max_channels = 6; in ca0132_config()
9765 spec->num_outputs = 2; in ca0132_config()
9766 spec->out_pins[0] = 0x0b; /* speaker out */ in ca0132_config()
9767 spec->out_pins[1] = 0x0f; in ca0132_config()
9768 spec->shared_out_nid = 0x2; in ca0132_config()
9769 spec->unsol_tag_hp = 0x0f; in ca0132_config()
9771 spec->adcs[0] = 0x7; /* digital mic / analog mic1 */ in ca0132_config()
9772 spec->adcs[1] = 0x8; /* analog mic2 */ in ca0132_config()
9773 spec->adcs[2] = 0xa; /* what u hear */ in ca0132_config()
9775 spec->num_inputs = 3; in ca0132_config()
9776 spec->input_pins[0] = 0x12; in ca0132_config()
9777 spec->input_pins[1] = 0x11; in ca0132_config()
9778 spec->input_pins[2] = 0x13; in ca0132_config()
9779 spec->shared_mic_nid = 0x7; in ca0132_config()
9780 spec->unsol_tag_amic1 = 0x11; in ca0132_config()
9784 spec->num_outputs = 2; in ca0132_config()
9785 spec->out_pins[0] = 0x0B; /* Line out */ in ca0132_config()
9786 spec->out_pins[1] = 0x0F; /* Rear headphone out */ in ca0132_config()
9787 spec->out_pins[2] = 0x10; /* Front Headphone / Center/LFE*/ in ca0132_config()
9788 spec->out_pins[3] = 0x11; /* Rear surround */ in ca0132_config()
9789 spec->shared_out_nid = 0x2; in ca0132_config()
9790 spec->unsol_tag_hp = spec->out_pins[1]; in ca0132_config()
9791 spec->unsol_tag_front_hp = spec->out_pins[2]; in ca0132_config()
9793 spec->adcs[0] = 0x7; /* Rear Mic / Line-in */ in ca0132_config()
9794 spec->adcs[1] = 0x8; /* Front Mic, but only if no DSP */ in ca0132_config()
9795 spec->adcs[2] = 0xa; /* what u hear */ in ca0132_config()
9797 spec->num_inputs = 2; in ca0132_config()
9798 spec->input_pins[0] = 0x12; /* Rear Mic / Line-in */ in ca0132_config()
9799 spec->input_pins[1] = 0x13; /* What U Hear */ in ca0132_config()
9800 spec->shared_mic_nid = 0x7; in ca0132_config()
9801 spec->unsol_tag_amic1 = spec->input_pins[0]; in ca0132_config()
9804 spec->dig_out = 0x05; in ca0132_config()
9805 spec->multiout.dig_out_nid = spec->dig_out; in ca0132_config()
9806 spec->dig_in = 0x09; in ca0132_config()
9809 spec->num_outputs = 2; in ca0132_config()
9810 spec->out_pins[0] = 0x0B; /* Line out */ in ca0132_config()
9811 spec->out_pins[1] = 0x0F; /* Rear headphone out */ in ca0132_config()
9812 spec->out_pins[2] = 0x10; /* Center/LFE */ in ca0132_config()
9813 spec->out_pins[3] = 0x11; /* Rear surround */ in ca0132_config()
9814 spec->shared_out_nid = 0x2; in ca0132_config()
9815 spec->unsol_tag_hp = spec->out_pins[1]; in ca0132_config()
9816 spec->unsol_tag_front_hp = spec->out_pins[2]; in ca0132_config()
9818 spec->adcs[0] = 0x7; /* Rear Mic / Line-in */ in ca0132_config()
9819 spec->adcs[1] = 0x8; /* Not connected, no front mic */ in ca0132_config()
9820 spec->adcs[2] = 0xa; /* what u hear */ in ca0132_config()
9822 spec->num_inputs = 2; in ca0132_config()
9823 spec->input_pins[0] = 0x12; /* Rear Mic / Line-in */ in ca0132_config()
9824 spec->input_pins[1] = 0x13; /* What U Hear */ in ca0132_config()
9825 spec->shared_mic_nid = 0x7; in ca0132_config()
9826 spec->unsol_tag_amic1 = spec->input_pins[0]; in ca0132_config()
9829 spec->adcs[0] = 0x8; /* ZxR DBPro Aux In */ in ca0132_config()
9831 spec->num_inputs = 1; in ca0132_config()
9832 spec->input_pins[0] = 0x11; /* RCA Line-in */ in ca0132_config()
9834 spec->dig_out = 0x05; in ca0132_config()
9835 spec->multiout.dig_out_nid = spec->dig_out; in ca0132_config()
9837 spec->dig_in = 0x09; in ca0132_config()
9841 spec->num_outputs = 2; in ca0132_config()
9842 spec->out_pins[0] = 0x0B; /* Line out */ in ca0132_config()
9843 spec->out_pins[1] = 0x11; /* Rear headphone out */ in ca0132_config()
9844 spec->out_pins[2] = 0x10; /* Front Headphone / Center/LFE*/ in ca0132_config()
9845 spec->out_pins[3] = 0x0F; /* Rear surround */ in ca0132_config()
9846 spec->shared_out_nid = 0x2; in ca0132_config()
9847 spec->unsol_tag_hp = spec->out_pins[1]; in ca0132_config()
9848 spec->unsol_tag_front_hp = spec->out_pins[2]; in ca0132_config()
9850 spec->adcs[0] = 0x7; /* Rear Mic / Line-in */ in ca0132_config()
9851 spec->adcs[1] = 0x8; /* Front Mic, but only if no DSP */ in ca0132_config()
9852 spec->adcs[2] = 0xa; /* what u hear */ in ca0132_config()
9854 spec->num_inputs = 2; in ca0132_config()
9855 spec->input_pins[0] = 0x12; /* Rear Mic / Line-in */ in ca0132_config()
9856 spec->input_pins[1] = 0x13; /* What U Hear */ in ca0132_config()
9857 spec->shared_mic_nid = 0x7; in ca0132_config()
9858 spec->unsol_tag_amic1 = spec->input_pins[0]; in ca0132_config()
9861 spec->dig_out = 0x05; in ca0132_config()
9862 spec->multiout.dig_out_nid = spec->dig_out; in ca0132_config()
9865 spec->num_outputs = 2; in ca0132_config()
9866 spec->out_pins[0] = 0x0B; /* Line out */ in ca0132_config()
9867 spec->out_pins[1] = 0x0F; /* Rear headphone out */ in ca0132_config()
9868 spec->out_pins[2] = 0x10; /* Front Headphone / Center/LFE*/ in ca0132_config()
9869 spec->out_pins[3] = 0x11; /* Rear surround */ in ca0132_config()
9870 spec->shared_out_nid = 0x2; in ca0132_config()
9871 spec->unsol_tag_hp = spec->out_pins[1]; in ca0132_config()
9872 spec->unsol_tag_front_hp = spec->out_pins[2]; in ca0132_config()
9874 spec->adcs[0] = 0x07; /* Rear Mic / Line-in */ in ca0132_config()
9875 spec->adcs[1] = 0x08; /* Front Mic, but only if no DSP */ in ca0132_config()
9876 spec->adcs[2] = 0x0a; /* what u hear */ in ca0132_config()
9878 spec->num_inputs = 2; in ca0132_config()
9879 spec->input_pins[0] = 0x12; /* Rear Mic / Line-in */ in ca0132_config()
9880 spec->input_pins[1] = 0x13; /* What U Hear */ in ca0132_config()
9881 spec->shared_mic_nid = 0x7; in ca0132_config()
9882 spec->unsol_tag_amic1 = spec->input_pins[0]; in ca0132_config()
9885 spec->dig_out = 0x05; in ca0132_config()
9886 spec->multiout.dig_out_nid = spec->dig_out; in ca0132_config()
9889 spec->num_outputs = 2; in ca0132_config()
9890 spec->out_pins[0] = 0x0b; /* speaker out */ in ca0132_config()
9891 spec->out_pins[1] = 0x10; /* headphone out */ in ca0132_config()
9892 spec->shared_out_nid = 0x2; in ca0132_config()
9893 spec->unsol_tag_hp = spec->out_pins[1]; in ca0132_config()
9895 spec->adcs[0] = 0x7; /* digital mic / analog mic1 */ in ca0132_config()
9896 spec->adcs[1] = 0x8; /* analog mic2 */ in ca0132_config()
9897 spec->adcs[2] = 0xa; /* what u hear */ in ca0132_config()
9899 spec->num_inputs = 3; in ca0132_config()
9900 spec->input_pins[0] = 0x12; in ca0132_config()
9901 spec->input_pins[1] = 0x11; in ca0132_config()
9902 spec->input_pins[2] = 0x13; in ca0132_config()
9903 spec->shared_mic_nid = 0x7; in ca0132_config()
9904 spec->unsol_tag_amic1 = spec->input_pins[0]; in ca0132_config()
9907 spec->dig_out = 0x05; in ca0132_config()
9908 spec->multiout.dig_out_nid = spec->dig_out; in ca0132_config()
9909 spec->dig_in = 0x09; in ca0132_config()
9918 struct ca0132_spec *spec = codec->spec; in ca0132_prepare_verbs()
9920 spec->chip_init_verbs = ca0132_init_verbs0; in ca0132_prepare_verbs()
9926 spec->desktop_init_verbs = ca0132_init_verbs1; in ca0132_prepare_verbs()
9927 spec->spec_init_verbs = kcalloc(NUM_SPEC_VERBS, in ca0132_prepare_verbs()
9930 if (!spec->spec_init_verbs) in ca0132_prepare_verbs()
9931 return -ENOMEM; in ca0132_prepare_verbs()
9934 spec->spec_init_verbs[0].nid = 0x0b; in ca0132_prepare_verbs()
9935 spec->spec_init_verbs[0].param = 0x78D; in ca0132_prepare_verbs()
9936 spec->spec_init_verbs[0].verb = 0x00; in ca0132_prepare_verbs()
9940 spec->spec_init_verbs[2].nid = 0x0b; in ca0132_prepare_verbs()
9941 spec->spec_init_verbs[2].param = AC_VERB_SET_EAPD_BTLENABLE; in ca0132_prepare_verbs()
9942 spec->spec_init_verbs[2].verb = 0x02; in ca0132_prepare_verbs()
9944 spec->spec_init_verbs[3].nid = 0x10; in ca0132_prepare_verbs()
9945 spec->spec_init_verbs[3].param = 0x78D; in ca0132_prepare_verbs()
9946 spec->spec_init_verbs[3].verb = 0x02; in ca0132_prepare_verbs()
9948 spec->spec_init_verbs[4].nid = 0x10; in ca0132_prepare_verbs()
9949 spec->spec_init_verbs[4].param = AC_VERB_SET_EAPD_BTLENABLE; in ca0132_prepare_verbs()
9950 spec->spec_init_verbs[4].verb = 0x02; in ca0132_prepare_verbs()
9953 /* Terminator: spec->spec_init_verbs[NUM_SPEC_VERBS-1] */ in ca0132_prepare_verbs()
9965 struct ca0132_spec *spec = codec->spec; in sbz_detect_quirk()
9967 switch (codec->core.subsystem_id) { in sbz_detect_quirk()
9969 spec->quirk = QUIRK_ZXR; in sbz_detect_quirk()
9972 spec->quirk = QUIRK_ZXR_DBPRO; in sbz_detect_quirk()
9975 spec->quirk = QUIRK_SBZ; in sbz_detect_quirk()
9990 return -ENOMEM; in patch_ca0132()
9991 codec->spec = spec; in patch_ca0132()
9992 spec->codec = codec; in patch_ca0132()
9995 quirk = snd_pci_quirk_lookup(codec->bus->pci, ca0132_quirks); in patch_ca0132()
9997 spec->quirk = quirk->value; in patch_ca0132()
9999 spec->quirk = QUIRK_NONE; 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 spec->quirk = 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()