diff options
author | Takashi Iwai <tiwai@suse.de> | 2012-12-20 04:45:55 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-01-12 02:31:06 -0500 |
commit | 5fdaecdb0d8fd8131d2adb9ca0ae2b77707b36ca (patch) | |
tree | 8d6e9dbe0fd0f42539b51481e15dbdd0e3f0cb3b /sound/pci/hda/hda_codec.c | |
parent | 624d914d091a5eebb4d648bd6b4ae6481171ae5c (diff) |
ALSA: hda - Allow one chance for zero NID in connection list
The commit [2e9bf24: 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: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index e7749dee7c40..ef0a0eebec83 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -424,6 +424,7 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid, | |||
424 | unsigned int shift, num_elems, mask; | 424 | unsigned int shift, num_elems, mask; |
425 | unsigned int wcaps; | 425 | unsigned int wcaps; |
426 | hda_nid_t prev_nid; | 426 | hda_nid_t prev_nid; |
427 | int null_count = 0; | ||
427 | 428 | ||
428 | if (snd_BUG_ON(!conn_list || max_conns <= 0)) | 429 | if (snd_BUG_ON(!conn_list || max_conns <= 0)) |
429 | return -EINVAL; | 430 | return -EINVAL; |
@@ -474,7 +475,7 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid, | |||
474 | } | 475 | } |
475 | range_val = !!(parm & (1 << (shift-1))); /* ranges */ | 476 | range_val = !!(parm & (1 << (shift-1))); /* ranges */ |
476 | val = parm & mask; | 477 | val = parm & mask; |
477 | if (val == 0) { | 478 | if (val == 0 && null_count++) { /* no second chance */ |
478 | snd_printk(KERN_WARNING "hda_codec: " | 479 | snd_printk(KERN_WARNING "hda_codec: " |
479 | "invalid CONNECT_LIST verb %x[%i]:%x\n", | 480 | "invalid CONNECT_LIST verb %x[%i]:%x\n", |
480 | nid, i, parm); | 481 | nid, i, parm); |