Lines Matching +full:gen +full:- +full:2
1 // SPDX-License-Identifier: GPL-2.0-or-later
23 struct hda_gen_spec gen; member
65 /* Vendor-specific processing widget */
78 * 1 = digital immediate, analog zero-cross
79 * 2 = digtail & analog soft-ramp
80 * 3 = digital soft-ramp, analog zero-cross
84 #define CS_COEF_ADC_LI_SZC_MODE (3 << 0) /* SZC setup for line-in */
85 /* PGA mode: 0 = differential, 1 = signle-ended */
87 #define CS_COEF_ADC_LI_PGA_MODE (1 << 6) /* PGA setup for line-in */
91 * 1 = zero-cross
92 * 2 = soft-ramp
93 * 3 = soft-ramp on zero-cross
96 #define CS_COEF_DAC_LO_SZC_MODE (3 << 2) /* nid 0x03 */
100 /* 0x0008 - test reg key */
101 /* 0x0009 - 0x0014 -> 12 test regs */
102 /* 0x0015 - visibility reg */
131 struct cs_spec *spec = codec->spec; in cs_vendor_coef_get()
132 snd_hda_codec_write(codec, spec->vendor_nid, 0, in cs_vendor_coef_get()
134 return snd_hda_codec_read(codec, spec->vendor_nid, 0, in cs_vendor_coef_get()
141 struct cs_spec *spec = codec->spec; in cs_vendor_coef_set()
142 snd_hda_codec_write(codec, spec->vendor_nid, 0, in cs_vendor_coef_set()
144 snd_hda_codec_write(codec, spec->vendor_nid, 0, in cs_vendor_coef_set()
149 * auto-mute and auto-mic switching
150 * CS421x auto-output redirecting
156 struct cs_spec *spec = codec->spec; in cs_automute()
159 spec->gen.master_mute = !!(spec->spdif_present && spec->sense_b); in cs_automute()
163 if (spec->gpio_eapd_hp || spec->gpio_eapd_speaker) { in cs_automute()
164 if (spec->gen.automute_speaker) in cs_automute()
165 spec->gpio_data = spec->gen.hp_jack_present ? in cs_automute()
166 spec->gpio_eapd_hp : spec->gpio_eapd_speaker; in cs_automute()
168 spec->gpio_data = in cs_automute()
169 spec->gpio_eapd_hp | spec->gpio_eapd_speaker; in cs_automute()
171 AC_VERB_SET_GPIO_DATA, spec->gpio_data); in cs_automute()
184 struct cs_spec *spec = codec->spec; in init_input_coef()
188 if (spec->vendor_nid == CS420X_VENDOR_NID) { in init_input_coef()
191 coef |= 1 << 4; /* DMIC2 2 chan on, GPIO1 off */ in init_input_coef()
193 coef |= 1 << 3; /* DMIC1 2 chan on, GPIO0 off in init_input_coef()
206 (0x002a /* DAC1/2/3 SZCMode Soft Ramp */
211 /* ADC1/2 - Digital and Analog Soft Ramp */
216 {0x11, AC_VERB_SET_PROC_COEF, 0x0007}, /* Enable Beep thru DAC1/2/3 */
271 #if 0 /* Don't to set to D3 as we are in power-up sequence */
285 coef = 0x0002; /* SRC_MUTE soft-mute on SPDIF (if no lock) */ in init_digital_coef()
297 struct cs_spec *spec = codec->spec; in cs_init()
299 if (spec->vendor_nid == CS420X_VENDOR_NID) { in cs_init()
303 } else if (spec->vendor_nid == CS4208_VENDOR_NID) { in cs_init()
309 if (spec->gpio_mask) { in cs_init()
311 spec->gpio_mask); in cs_init()
313 spec->gpio_dir); in cs_init()
315 spec->gpio_data); in cs_init()
318 if (spec->vendor_nid == CS420X_VENDOR_NID) { in cs_init()
349 struct cs_spec *spec = codec->spec; in cs_parse_auto_config()
353 err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, 0); in cs_parse_auto_config()
357 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg); in cs_parse_auto_config()
362 if (spec->gen.dyn_adc_switch) { in cs_parse_auto_config()
364 for (i = 0; i < spec->gen.input_mux.num_items; i++) { in cs_parse_auto_config()
365 int idx = spec->gen.dyn_adc_idx[i]; in cs_parse_auto_config()
369 spec->gen.adc_nids[idx]); in cs_parse_auto_config()
391 SND_PCI_QUIRK(0x10de, 0x0d94, "MacBookAir 3,1(2)", CS420X_MBP55),
400 SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122),
402 SND_PCI_QUIRK(0x106b, 0x5600, "MacBookAir 5,2", CS420X_MBP81),
403 SND_PCI_QUIRK(0x106b, 0x5b00, "MacBookAir 4,2", CS420X_MBA42),
498 struct cs_spec *spec = codec->spec; in cs420x_fixup_gpio_13()
499 spec->gpio_eapd_hp = 2; /* GPIO1 = headphones */ in cs420x_fixup_gpio_13()
500 spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ in cs420x_fixup_gpio_13()
501 spec->gpio_mask = spec->gpio_dir = in cs420x_fixup_gpio_13()
502 spec->gpio_eapd_hp | spec->gpio_eapd_speaker; in cs420x_fixup_gpio_13()
510 struct cs_spec *spec = codec->spec; in cs420x_fixup_gpio_23()
511 spec->gpio_eapd_hp = 4; /* GPIO2 = headphones */ in cs420x_fixup_gpio_23()
512 spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ in cs420x_fixup_gpio_23()
513 spec->gpio_mask = spec->gpio_dir = in cs420x_fixup_gpio_23()
514 spec->gpio_eapd_hp | spec->gpio_eapd_speaker; in cs420x_fixup_gpio_23()
577 codec->spec = spec; in cs_alloc_spec()
578 spec->vendor_nid = vendor_nid; in cs_alloc_spec()
579 codec->power_save_node = 1; in cs_alloc_spec()
580 snd_hda_gen_spec_init(&spec->gen); in cs_alloc_spec()
592 return -ENOMEM; in patch_cs420x()
594 codec->patch_ops = cs_patch_ops; in patch_cs420x()
595 spec->gen.automute_hook = cs_automute; in patch_cs420x()
596 codec->single_adc_amp = 1; in patch_cs420x()
642 SND_PCI_QUIRK(0x106b, 0x5e00, "MacBookPro 11,2", CS4208_MBP11),
645 SND_PCI_QUIRK(0x106b, 0x7200, "MacBookAir 6,2", CS4208_MBA6),
654 struct cs_spec *spec = codec->spec; in cs4208_fixup_gpio0()
655 spec->gpio_eapd_hp = 0; in cs4208_fixup_gpio0()
656 spec->gpio_eapd_speaker = 1; in cs4208_fixup_gpio0()
657 spec->gpio_mask = spec->gpio_dir = in cs4208_fixup_gpio0()
658 spec->gpio_eapd_hp | spec->gpio_eapd_speaker; in cs4208_fixup_gpio0()
671 codec->fixup_id = HDA_FIXUP_ID_NOT_SET; in cs4208_fixup_mac()
673 if (codec->fixup_id == HDA_FIXUP_ID_NOT_SET) in cs4208_fixup_mac()
674 codec->fixup_id = CS4208_GPIO0; /* default fixup */ in cs4208_fixup_mac()
683 { 0x18, 0x00ab9150 }, /* mic (audio-in) jack: disable detect */ in cs4208_fixup_macmini()
690 codec->inv_jack_detect = 1; in cs4208_fixup_macmini()
700 struct cs_spec *spec = codec->spec; in cs4208_spdif_sw_put()
701 hda_nid_t pin = spec->gen.autocfg.dig_out_pins[0]; in cs4208_spdif_sw_put()
702 int pinctl = ucontrol->value.integer.value[0] ? PIN_OUT : 0; in cs4208_spdif_sw_put()
705 return spec->spdif_sw_put(kcontrol, ucontrol); in cs4208_spdif_sw_put()
713 struct cs_spec *spec = codec->spec; in cs4208_fixup_spdif_switch()
716 if (!spec->gen.autocfg.dig_out_pins[0]) in cs4208_fixup_spdif_switch()
721 spec->spdif_sw_put = kctl->put; in cs4208_fixup_spdif_switch()
722 kctl->put = cs4208_spdif_sw_put; in cs4208_fixup_spdif_switch()
773 return -ENOMEM; in patch_cs4208()
775 codec->patch_ops = cs_patch_ops; in patch_cs4208()
776 spec->gen.automute_hook = cs_automute; in patch_cs4208()
778 spec->gen.out_vol_mask = 1ULL << 0x10; in patch_cs4208()
851 struct cs_spec *spec = codec->spec; in cs421x_fixup_sense_b()
853 spec->sense_b = 1; in cs421x_fixup_sense_b()
877 Disable Coefficient Index Auto-Increment(DAI)=1,
901 * 2. Speaker output is not completely muted upon HP detect.
937 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in cs421x_boost_vol_info()
938 uinfo->count = 1; in cs421x_boost_vol_info()
939 uinfo->value.integer.min = 0; in cs421x_boost_vol_info()
940 uinfo->value.integer.max = 3; in cs421x_boost_vol_info()
949 ucontrol->value.integer.value[0] = in cs421x_boost_vol_get()
959 unsigned int vol = ucontrol->value.integer.value[0]; in cs421x_boost_vol_put()
988 struct cs_spec *spec = codec->spec; in cs4210_pinmux_init()
994 if (spec->gpio_mask) in cs4210_pinmux_init()
999 if (spec->sense_b) in cs4210_pinmux_init()
1006 if ((spec->gpio_mask || spec->sense_b) && in cs4210_pinmux_init()
1010 GPIO or SENSE_B forced - disconnect the DMIC pin. in cs4210_pinmux_init()
1022 struct cs_spec *spec = codec->spec; in cs4210_spdif_automute()
1024 hda_nid_t spdif_pin = spec->gen.autocfg.dig_out_pins[0]; in cs4210_spdif_automute()
1027 if (!spec->spdif_detect || in cs4210_spdif_automute()
1028 spec->vendor_nid != CS4210_VENDOR_NID) in cs4210_spdif_automute()
1032 if (spdif_present == spec->spdif_present) in cs4210_spdif_automute()
1035 spec->spdif_present = spdif_present; in cs4210_spdif_automute()
1044 struct cs_spec *spec = codec->spec; in parse_cs421x_digital()
1045 struct auto_pin_cfg *cfg = &spec->gen.autocfg; in parse_cs421x_digital()
1048 for (i = 0; i < cfg->dig_outs; i++) { in parse_cs421x_digital()
1049 hda_nid_t nid = cfg->dig_out_pins[i]; in parse_cs421x_digital()
1051 spec->spdif_detect = 1; in parse_cs421x_digital()
1060 struct cs_spec *spec = codec->spec; in cs421x_init()
1062 if (spec->vendor_nid == CS4210_VENDOR_NID) { in cs421x_init()
1070 if (spec->gpio_mask) { in cs421x_init()
1072 spec->gpio_mask); in cs421x_init()
1074 spec->gpio_dir); in cs421x_init()
1076 spec->gpio_data); in cs421x_init()
1090 /* set the upper-limit for mixer amp to 0dB */ in fix_volume_caps()
1100 struct cs_spec *spec = codec->spec; in cs421x_parse_auto_config()
1106 err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, 0); in cs421x_parse_auto_config()
1110 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg); in cs421x_parse_auto_config()
1116 if (spec->gen.autocfg.speaker_outs && in cs421x_parse_auto_config()
1117 spec->vendor_nid == CS4210_VENDOR_NID) { in cs421x_parse_auto_config()
1118 if (!snd_hda_gen_add_kctl(&spec->gen, NULL, in cs421x_parse_auto_config()
1120 return -ENOMEM; in cs421x_parse_auto_config()
1129 (DAC,ADC) -> D3, PDREF=1, AFG->D3
1133 struct cs_spec *spec = codec->spec; in cs421x_suspend()
1143 if (spec->vendor_nid == CS4210_VENDOR_NID) { in cs421x_suspend()
1171 return -ENOMEM; in patch_cs4210()
1173 codec->patch_ops = cs421x_patch_ops; in patch_cs4210()
1174 spec->gen.automute_hook = cs_automute; in patch_cs4210()
1182 is auto-parsed. If GPIO or SENSE_B is forced, DMIC input in patch_cs4210()
1207 return -ENOMEM; in patch_cs4213()
1209 codec->patch_ops = cs421x_patch_ops; in patch_cs4213()
1237 MODULE_DESCRIPTION("Cirrus Logic HD-audio codec");