Lines Matching +full:src +full:- +full:coef
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Cirrus Logic CS420x HD-audio codec
52 /* Vendor-specific processing widget */
59 /* coef indices */
65 * 1 = digital immediate, analog zero-cross
66 * 2 = digtail & analog soft-ramp
67 * 3 = digital soft-ramp, analog zero-cross
71 #define CS_COEF_ADC_LI_SZC_MODE (3 << 0) /* SZC setup for line-in */
72 /* PGA mode: 0 = differential, 1 = signle-ended */
74 #define CS_COEF_ADC_LI_PGA_MODE (1 << 6) /* PGA setup for line-in */
78 * 1 = zero-cross
79 * 2 = soft-ramp
80 * 3 = soft-ramp on zero-cross
87 /* 0x0008 - test reg key */
88 /* 0x0009 - 0x0014 -> 12 test regs */
89 /* 0x0015 - visibility reg */
96 struct cs_spec *spec = codec->spec; in cs_vendor_coef_get()
98 snd_hda_codec_write(codec, spec->vendor_nid, 0, in cs_vendor_coef_get()
100 return snd_hda_codec_read(codec, spec->vendor_nid, 0, in cs_vendor_coef_get()
105 unsigned int coef) in cs_vendor_coef_set() argument
107 struct cs_spec *spec = codec->spec; in cs_vendor_coef_set()
109 snd_hda_codec_write(codec, spec->vendor_nid, 0, in cs_vendor_coef_set()
111 snd_hda_codec_write(codec, spec->vendor_nid, 0, in cs_vendor_coef_set()
112 AC_VERB_SET_PROC_COEF, coef); in cs_vendor_coef_set()
116 * auto-mute and auto-mic switching
117 * CS421x auto-output redirecting
123 struct cs_spec *spec = codec->spec; in cs_automute()
127 if (spec->gpio_eapd_hp || spec->gpio_eapd_speaker) { in cs_automute()
128 if (spec->gen.automute_speaker) in cs_automute()
129 spec->gpio_data = spec->gen.hp_jack_present ? in cs_automute()
130 spec->gpio_eapd_hp : spec->gpio_eapd_speaker; in cs_automute()
132 spec->gpio_data = in cs_automute()
133 spec->gpio_eapd_hp | spec->gpio_eapd_speaker; in cs_automute()
135 AC_VERB_SET_GPIO_DATA, spec->gpio_data); in cs_automute()
149 struct cs_spec *spec = codec->spec; in init_input_coef()
150 unsigned int coef; in init_input_coef() local
153 if (spec->vendor_nid == CS420X_VENDOR_NID) { in init_input_coef()
154 coef = cs_vendor_coef_get(codec, IDX_BEEP_CFG); in init_input_coef()
156 coef |= 1 << 4; /* DMIC2 2 chan on, GPIO1 off */ in init_input_coef()
158 coef |= 1 << 3; /* DMIC1 2 chan on, GPIO0 off in init_input_coef()
163 cs_vendor_coef_set(codec, IDX_BEEP_CFG, coef); in init_input_coef()
176 /* ADC1/2 - Digital and Analog Soft Ramp */
205 * the clock and write enable to the S/PDIF SRC RAMs is not properly
210 * Workaround: The following verb sequence briefly turns on the S/PDIF SRC
241 unsigned int coef; in init_digital_coef() local
243 coef = 0x0002; /* SRC_MUTE soft-mute on SPDIF (if no lock) */ in init_digital_coef()
244 coef |= 0x0008; /* Replace with mute on error */ in init_digital_coef()
246 coef |= 0x4000; /* RX to TX1 or TX2 Loopthru / SPDIF2 in init_digital_coef()
250 cs_vendor_coef_set(codec, IDX_SPDIF_CTL, coef); in init_digital_coef()
255 struct cs_spec *spec = codec->spec; in cs_init()
257 if (spec->vendor_nid == CS420X_VENDOR_NID) { in cs_init()
261 } else if (spec->vendor_nid == CS4208_VENDOR_NID) { in cs_init()
267 if (spec->gpio_mask) { in cs_init()
269 spec->gpio_mask); in cs_init()
271 spec->gpio_dir); in cs_init()
273 spec->gpio_data); in cs_init()
276 if (spec->vendor_nid == CS420X_VENDOR_NID) { in cs_init()
297 struct cs_spec *spec = codec->spec; in cs_parse_auto_config()
301 err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, 0); in cs_parse_auto_config()
305 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg); in cs_parse_auto_config()
310 if (spec->gen.dyn_adc_switch) { in cs_parse_auto_config()
313 for (i = 0; i < spec->gen.input_mux.num_items; i++) { in cs_parse_auto_config()
314 int idx = spec->gen.dyn_adc_idx[i]; in cs_parse_auto_config()
319 spec->gen.adc_nids[idx]); in cs_parse_auto_config()
449 struct cs_spec *spec = codec->spec; in cs420x_fixup_gpio_13()
451 spec->gpio_eapd_hp = 2; /* GPIO1 = headphones */ in cs420x_fixup_gpio_13()
452 spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ in cs420x_fixup_gpio_13()
453 spec->gpio_mask = spec->gpio_dir = in cs420x_fixup_gpio_13()
454 spec->gpio_eapd_hp | spec->gpio_eapd_speaker; in cs420x_fixup_gpio_13()
462 struct cs_spec *spec = codec->spec; in cs420x_fixup_gpio_23()
464 spec->gpio_eapd_hp = 4; /* GPIO2 = headphones */ in cs420x_fixup_gpio_23()
465 spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ in cs420x_fixup_gpio_23()
466 spec->gpio_mask = spec->gpio_dir = in cs420x_fixup_gpio_23()
467 spec->gpio_eapd_hp | spec->gpio_eapd_speaker; in cs420x_fixup_gpio_23()
530 codec->spec = spec; in cs_alloc_spec()
531 spec->vendor_nid = vendor_nid; in cs_alloc_spec()
532 codec->power_save_node = 1; in cs_alloc_spec()
533 snd_hda_gen_spec_init(&spec->gen); in cs_alloc_spec()
542 codec->single_adc_amp = 1; in cs420x_probe()
596 struct cs_spec *spec = codec->spec; in cs4208_fixup_gpio0()
598 spec->gpio_eapd_hp = 0; in cs4208_fixup_gpio0()
599 spec->gpio_eapd_speaker = 1; in cs4208_fixup_gpio0()
600 spec->gpio_mask = spec->gpio_dir = in cs4208_fixup_gpio0()
601 spec->gpio_eapd_hp | spec->gpio_eapd_speaker; in cs4208_fixup_gpio0()
614 codec->fixup_id = HDA_FIXUP_ID_NOT_SET; in cs4208_fixup_mac()
616 if (codec->fixup_id == HDA_FIXUP_ID_NOT_SET) in cs4208_fixup_mac()
617 codec->fixup_id = CS4208_GPIO0; /* default fixup */ in cs4208_fixup_mac()
626 { 0x18, 0x00ab9150 }, /* mic (audio-in) jack: disable detect */ in cs4208_fixup_macmini()
633 codec->inv_jack_detect = 1; in cs4208_fixup_macmini()
643 struct cs_spec *spec = codec->spec; in cs4208_spdif_sw_put()
644 hda_nid_t pin = spec->gen.autocfg.dig_out_pins[0]; in cs4208_spdif_sw_put()
645 int pinctl = ucontrol->value.integer.value[0] ? PIN_OUT : 0; in cs4208_spdif_sw_put()
648 return spec->spdif_sw_put(kcontrol, ucontrol); in cs4208_spdif_sw_put()
656 struct cs_spec *spec = codec->spec; in cs4208_fixup_spdif_switch()
659 if (!spec->gen.autocfg.dig_out_pins[0]) in cs4208_fixup_spdif_switch()
664 spec->spdif_sw_put = kctl->put; in cs4208_fixup_spdif_switch()
665 kctl->put = cs4208_spdif_sw_put; in cs4208_fixup_spdif_switch()
711 struct cs_spec *spec = codec->spec; in cs4208_probe()
715 spec->gen.out_vol_mask = 1ULL << 0x10; in cs4208_probe()
742 spec = cs_alloc_spec(codec, id->driver_data); in cs_codec_probe()
744 return -ENOMEM; in cs_codec_probe()
745 spec->gen.automute_hook = cs_automute; in cs_codec_probe()
747 if (spec->vendor_nid == CS4208_VENDOR_NID) in cs_codec_probe()
778 MODULE_DESCRIPTION("Cirrus Logic CS420x HD-audio codec");