OSDN Git Service

ALSA: hda/realtek - Allow different pins for shared hp/mic vref check
authorTakashi Iwai <tiwai@suse.de>
Tue, 18 Dec 2012 13:22:45 +0000 (14:22 +0100)
committerTakashi Iwai <tiwai@suse.de>
Sat, 12 Jan 2013 07:30:30 +0000 (08:30 +0100)
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: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/patch_realtek.c

index 0d6e9d8..c6cc833 100644 (file)
@@ -187,6 +187,7 @@ struct alc_spec {
        unsigned int dyn_adc_idx[HDA_MAX_NUM_INPUTS];
        int int_mic_idx, ext_mic_idx, dock_mic_idx; /* for auto-mic */
        hda_nid_t inv_dmic_pin;
+       hda_nid_t shared_mic_vref_pin;
 
        /* DAC list */
        int num_all_dacs;
@@ -343,15 +344,11 @@ 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
           instead, as suggested by Realtek */
-       if (val == AC_PINCTL_VREF_HIZ) {
-               const hda_nid_t vref_pin = 0x18;
-               /* 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);
-                       if (vref_val != AC_PINCTL_VREF_HIZ)
-                               snd_hda_set_pin_ctl(codec, vref_pin, PIN_IN | (set_as_mic ? vref_val : 0));
-               }
+       if (val == AC_PINCTL_VREF_HIZ && spec->shared_mic_vref_pin) {
+               const hda_nid_t vref_pin = spec->shared_mic_vref_pin;
+               unsigned int vref_val = snd_hda_get_default_vref(codec, vref_pin);
+               if (vref_val != AC_PINCTL_VREF_HIZ)
+                       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;
@@ -5642,6 +5639,7 @@ static int patch_alc262(struct hda_codec *codec)
                return err;
 
        spec = codec->spec;
+       spec->shared_mic_vref_pin = 0x18;
 
 #if 0
        /* 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)
                return err;
 
        spec = codec->spec;
+       spec->shared_mic_vref_pin = 0x18;
 
        alc_pick_fixup(codec, alc269_fixup_models,
                       alc269_fixup_tbl, alc269_fixups);