]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
ALSA: hda - Fix up autocfg output pin numbers in realtek parser
authorTakashi Iwai <tiwai@suse.de>
Mon, 20 Sep 2010 12:56:32 +0000 (14:56 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 20 Sep 2010 12:56:32 +0000 (14:56 +0200)
When quirks are applied, the numbers of output pins in autocfg aren't
set up properly but only pin arrays are changed.  Let's fix it up so that
the rest of the parser can use autocfg.line_outs & co safely.

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

index 6045f281b2254efa55a864abd84ef3a3d255b5d7..bb3cf3b7282b1dc065f12c53ad8f79e4a4103117 100644 (file)
@@ -876,6 +876,28 @@ static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
        snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
 }
 
+static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec)
+{
+       struct alc_spec *spec = codec->spec;
+       struct auto_pin_cfg *cfg = &spec->autocfg;
+
+       if (!cfg->line_outs) {
+               while (cfg->line_outs < AUTO_CFG_MAX_OUTS &&
+                      cfg->line_out_pins[cfg->line_outs])
+                       cfg->line_outs++;
+       }
+       if (!cfg->speaker_outs) {
+               while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS &&
+                      cfg->speaker_pins[cfg->speaker_outs])
+                       cfg->speaker_outs++;
+       }
+       if (!cfg->hp_outs) {
+               while (cfg->hp_outs < AUTO_CFG_MAX_OUTS &&
+                      cfg->hp_pins[cfg->hp_outs])
+                       cfg->hp_outs++;
+       }
+}
+
 /*
  */
 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
@@ -944,6 +966,8 @@ static void setup_preset(struct hda_codec *codec,
 
        if (preset->setup)
                preset->setup(codec);
+
+       alc_fixup_autocfg_pin_nums(codec);
 }
 
 /* Enable GPIO mask and set output */