Commit 51e4152a authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda/realtek - Skip invalid digital out pins

Some BIOS report invalid pins as digital output pins.  The driver checks
the connection but it doesn't do it fully correctly, and it leaves some
undefined value as the audio-out widget, which makes the driver spewing
warnings.  This patch fixes the issue.

Reference: https://bugzilla.novell.com/show_bug.cgi?id=727348

Cc: <stable@kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 9009b0e4
...@@ -1604,27 +1604,29 @@ static void alc_auto_init_digital(struct hda_codec *codec) ...@@ -1604,27 +1604,29 @@ static void alc_auto_init_digital(struct hda_codec *codec)
static void alc_auto_parse_digital(struct hda_codec *codec) static void alc_auto_parse_digital(struct hda_codec *codec)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
int i, err; int i, err, nums;
hda_nid_t dig_nid; hda_nid_t dig_nid;
/* support multiple SPDIFs; the secondary is set up as a slave */ /* support multiple SPDIFs; the secondary is set up as a slave */
nums = 0;
for (i = 0; i < spec->autocfg.dig_outs; i++) { for (i = 0; i < spec->autocfg.dig_outs; i++) {
hda_nid_t conn[4]; hda_nid_t conn[4];
err = snd_hda_get_connections(codec, err = snd_hda_get_connections(codec,
spec->autocfg.dig_out_pins[i], spec->autocfg.dig_out_pins[i],
conn, ARRAY_SIZE(conn)); conn, ARRAY_SIZE(conn));
if (err < 0) if (err <= 0)
continue; continue;
dig_nid = conn[0]; /* assume the first element is audio-out */ dig_nid = conn[0]; /* assume the first element is audio-out */
if (!i) { if (!nums) {
spec->multiout.dig_out_nid = dig_nid; spec->multiout.dig_out_nid = dig_nid;
spec->dig_out_type = spec->autocfg.dig_out_type[0]; spec->dig_out_type = spec->autocfg.dig_out_type[0];
} else { } else {
spec->multiout.slave_dig_outs = spec->slave_dig_outs; spec->multiout.slave_dig_outs = spec->slave_dig_outs;
if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) if (nums >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
break; break;
spec->slave_dig_outs[i - 1] = dig_nid; spec->slave_dig_outs[nums - 1] = dig_nid;
} }
nums++;
} }
if (spec->autocfg.dig_in_pin) { if (spec->autocfg.dig_in_pin) {
......
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