Commit 5fdaecdb authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Allow one chance for zero NID in connection list

The commit [2e9bf247: ALSA: hda_codec: Check for invalid zero
connections] trims the whole connection list when an invalid value is
reported by the hardware.  But some codecs (at least AD1986A) may give
a zero NID in the middle of the connection list, so dropping the whole
list isn't good for such cases.

In this patch, as a workaround, allow a single zero NID in the read
connection list.  If it hits zero twice, it's handled as an error, so
that we can avoid "too many connections" errors.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 624d914d
...@@ -424,6 +424,7 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid, ...@@ -424,6 +424,7 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid,
unsigned int shift, num_elems, mask; unsigned int shift, num_elems, mask;
unsigned int wcaps; unsigned int wcaps;
hda_nid_t prev_nid; hda_nid_t prev_nid;
int null_count = 0;
if (snd_BUG_ON(!conn_list || max_conns <= 0)) if (snd_BUG_ON(!conn_list || max_conns <= 0))
return -EINVAL; return -EINVAL;
...@@ -474,7 +475,7 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid, ...@@ -474,7 +475,7 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid,
} }
range_val = !!(parm & (1 << (shift-1))); /* ranges */ range_val = !!(parm & (1 << (shift-1))); /* ranges */
val = parm & mask; val = parm & mask;
if (val == 0) { if (val == 0 && null_count++) { /* no second chance */
snd_printk(KERN_WARNING "hda_codec: " snd_printk(KERN_WARNING "hda_codec: "
"invalid CONNECT_LIST verb %x[%i]:%x\n", "invalid CONNECT_LIST verb %x[%i]:%x\n",
nid, i, parm); nid, i, parm);
......
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