Commit 37c04207 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda/realtek - Allow different pins for shared hp/mic vref check

Add a new field to indicate the possible pin NID for alternative vref
setup for the shared hp/mic.  Although 0x18 is valid for all Realtek
codecs, it'll be different on other vendor's codecs.

Also, drop the sanity check in update_shared_mic_hp() since the
reference pin is set explicitly in the caller side.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent df1d1fb0
...@@ -187,6 +187,7 @@ struct alc_spec { ...@@ -187,6 +187,7 @@ struct alc_spec {
unsigned int dyn_adc_idx[HDA_MAX_NUM_INPUTS]; unsigned int dyn_adc_idx[HDA_MAX_NUM_INPUTS];
int int_mic_idx, ext_mic_idx, dock_mic_idx; /* for auto-mic */ int int_mic_idx, ext_mic_idx, dock_mic_idx; /* for auto-mic */
hda_nid_t inv_dmic_pin; hda_nid_t inv_dmic_pin;
hda_nid_t shared_mic_vref_pin;
/* DAC list */ /* DAC list */
int num_all_dacs; int num_all_dacs;
...@@ -343,16 +344,12 @@ static void update_shared_mic_hp(struct hda_codec *codec, bool set_as_mic) ...@@ -343,16 +344,12 @@ static void update_shared_mic_hp(struct hda_codec *codec, bool set_as_mic)
/* This pin does not have vref caps - let's enable vref on pin 0x18 /* This pin does not have vref caps - let's enable vref on pin 0x18
instead, as suggested by Realtek */ instead, as suggested by Realtek */
if (val == AC_PINCTL_VREF_HIZ) { if (val == AC_PINCTL_VREF_HIZ && spec->shared_mic_vref_pin) {
const hda_nid_t vref_pin = 0x18; const hda_nid_t vref_pin = spec->shared_mic_vref_pin;
/* Sanity check pin 0x18 */
if (get_wcaps_type(get_wcaps(codec, vref_pin)) == AC_WID_PIN &&
get_defcfg_connect(snd_hda_codec_get_pincfg(codec, vref_pin)) == AC_JACK_PORT_NONE) {
unsigned int vref_val = snd_hda_get_default_vref(codec, vref_pin); unsigned int vref_val = snd_hda_get_default_vref(codec, vref_pin);
if (vref_val != AC_PINCTL_VREF_HIZ) if (vref_val != AC_PINCTL_VREF_HIZ)
snd_hda_set_pin_ctl(codec, vref_pin, PIN_IN | (set_as_mic ? vref_val : 0)); snd_hda_set_pin_ctl(codec, vref_pin, PIN_IN | (set_as_mic ? vref_val : 0));
} }
}
val = set_as_mic ? val | PIN_IN : PIN_HP; val = set_as_mic ? val | PIN_IN : PIN_HP;
snd_hda_set_pin_ctl(codec, pin, val); snd_hda_set_pin_ctl(codec, pin, val);
...@@ -5642,6 +5639,7 @@ static int patch_alc262(struct hda_codec *codec) ...@@ -5642,6 +5639,7 @@ static int patch_alc262(struct hda_codec *codec)
return err; return err;
spec = codec->spec; spec = codec->spec;
spec->shared_mic_vref_pin = 0x18;
#if 0 #if 0
/* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
...@@ -6431,6 +6429,7 @@ static int patch_alc269(struct hda_codec *codec) ...@@ -6431,6 +6429,7 @@ static int patch_alc269(struct hda_codec *codec)
return err; return err;
spec = codec->spec; spec = codec->spec;
spec->shared_mic_vref_pin = 0x18;
alc_pick_fixup(codec, alc269_fixup_models, alc_pick_fixup(codec, alc269_fixup_models,
alc269_fixup_tbl, alc269_fixups); alc269_fixup_tbl, alc269_fixups);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment