Lines Matching +full:led +full:- +full:7 +full:seg

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