[ALSA] hda-codec - Avoid zero NID in line_out_pins[] of STAC codecs
authorTakashi Iwai <tiwai@suse.de>
Mon, 3 Sep 2007 07:43:38 +0000 (09:43 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 16 Oct 2007 13:59:41 +0000 (15:59 +0200)
The STAC codes adds line_out_pins[] for shared mic/line-inputs accordingly.
But, the current code may give a hole with NID=0 in some setting, which
results in an error at probe.  This patch fixes the problem.

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

index 39187828503d904f316ff16fc2e2afe7074fbbf7..b4a1d73b57212b010bc14da7558ad6d1c036848c 100644 (file)
@@ -1479,7 +1479,8 @@ static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cf
        case 3:
                /* add line-in as side */
                if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 3) {
-                       cfg->line_out_pins[3] = cfg->input_pins[AUTO_PIN_LINE];
+                       cfg->line_out_pins[cfg->line_outs] =
+                               cfg->input_pins[AUTO_PIN_LINE];
                        spec->line_switch = 1;
                        cfg->line_outs++;
                }
@@ -1487,12 +1488,14 @@ static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cf
        case 2:
                /* add line-in as clfe and mic as side */
                if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 2) {
-                       cfg->line_out_pins[2] = cfg->input_pins[AUTO_PIN_LINE];
+                       cfg->line_out_pins[cfg->line_outs] =
+                               cfg->input_pins[AUTO_PIN_LINE];
                        spec->line_switch = 1;
                        cfg->line_outs++;
                }
                if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 3) {
-                       cfg->line_out_pins[3] = cfg->input_pins[AUTO_PIN_MIC];
+                       cfg->line_out_pins[cfg->line_outs] =
+                               cfg->input_pins[AUTO_PIN_MIC];
                        spec->mic_switch = 1;
                        cfg->line_outs++;
                }
@@ -1500,12 +1503,14 @@ static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cf
        case 1:
                /* add line-in as surr and mic as clfe */
                if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 1) {
-                       cfg->line_out_pins[1] = cfg->input_pins[AUTO_PIN_LINE];
+                       cfg->line_out_pins[cfg->line_outs] =
+                               cfg->input_pins[AUTO_PIN_LINE];
                        spec->line_switch = 1;
                        cfg->line_outs++;
                }
                if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 2) {
-                       cfg->line_out_pins[2] = cfg->input_pins[AUTO_PIN_MIC];
+                       cfg->line_out_pins[cfg->line_outs] =
+                               cfg->input_pins[AUTO_PIN_MIC];
                        spec->mic_switch = 1;
                        cfg->line_outs++;
                }