ALSA: hda - Handle dock line-in as auto-detectable for IDT codecs
authorTakashi Iwai <tiwai@suse.de>
Tue, 17 May 2011 10:29:09 +0000 (12:29 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 17 May 2011 10:35:03 +0000 (12:35 +0200)
When a docking-station has a line-in jack, we can handle it also as
a detectable jack just like mic-in.  This will improve the usability
of HP laptops with a docking-station.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/patch_sigmatel.c

index 8d26a5102b09a0fcbde3f2ab31591244876aa6bb..7f81cc2274f32ce75a1bee8f0ffaa2b51093486c 100644 (file)
@@ -3520,14 +3520,18 @@ static int check_mic_pin(struct hda_codec *codec, hda_nid_t nid,
                         hda_nid_t *fixed, hda_nid_t *ext, hda_nid_t *dock)
 {
        unsigned int cfg;
+       unsigned int type;
 
        if (!nid)
                return 0;
        cfg = snd_hda_codec_get_pincfg(codec, nid);
+       type = get_defcfg_device(cfg);
        switch (snd_hda_get_input_pin_attr(cfg)) {
        case INPUT_PIN_ATTR_INT:
                if (*fixed)
                        return 1; /* already occupied */
+               if (type != AC_JACK_MIC_IN)
+                       return 1; /* invalid type */
                *fixed = nid;
                break;
        case INPUT_PIN_ATTR_UNUSED:
@@ -3535,11 +3539,15 @@ static int check_mic_pin(struct hda_codec *codec, hda_nid_t nid,
        case INPUT_PIN_ATTR_DOCK:
                if (*dock)
                        return 1; /* already occupied */
+               if (type != AC_JACK_MIC_IN && type != AC_JACK_LINE_IN)
+                       return 1; /* invalid type */
                *dock = nid;
                break;
        default:
                if (*ext)
                        return 1; /* already occupied */
+               if (type != AC_JACK_MIC_IN)
+                       return 1; /* invalid type */
                *ext = nid;
                break;
        }
@@ -3595,10 +3603,6 @@ static int stac_check_auto_mic(struct hda_codec *codec)
        hda_nid_t fixed, ext, dock;
        int i;
 
-       for (i = 0; i < cfg->num_inputs; i++) {
-               if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN)
-                       return 0; /* must be exclusively mics */
-       }
        fixed = ext = dock = 0;
        for (i = 0; i < cfg->num_inputs; i++)
                if (check_mic_pin(codec, cfg->inputs[i].pin,