diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-03-24 07:36:09 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-04-21 11:10:44 +0200 |
commit | b613291fb21a2d74eb8323d97fe9aa5d281b306c (patch) | |
tree | 142afbf9e2fa31b852c3fbfe1bb4dafd4977fb98 /sound/pci/hda/hda_codec.c | |
parent | ALSA: hda - Cache PCM and STREAM parameters queries (diff) | |
download | linux-b613291fb21a2d74eb8323d97fe9aa5d281b306c.tar.xz linux-b613291fb21a2d74eb8323d97fe9aa5d281b306c.zip |
ALSA: hda - Retry codec-verbs at errors
The current error-recovery scheme for the codec communication errors
doesn't work always well. Especially falling back to the
single-command mode causes the fatal problem on many systems.
In this patch, the problematic verb is re-issued again after the error
(even with polling mode) instead of the single-cmd mode. The
single-cmd mode will be used only when specified via the command
option explicitly, mainly just for testing.
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 | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 3d8bf39e6d98..1736ccbebc72 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -174,14 +174,23 @@ unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid, unsigned int verb, unsigned int parm) { struct hda_bus *bus = codec->bus; - unsigned int res; + unsigned int cmd, res; + int repeated = 0; - res = make_codec_cmd(codec, nid, direct, verb, parm); + cmd = make_codec_cmd(codec, nid, direct, verb, parm); snd_hda_power_up(codec); mutex_lock(&bus->cmd_mutex); - if (!bus->ops.command(bus, res)) + again: + if (!bus->ops.command(bus, cmd)) { res = bus->ops.get_response(bus); - else + if (res == -1 && bus->rirb_error) { + if (repeated++ < 1) { + snd_printd(KERN_WARNING "hda_codec: " + "Trying verb 0x%08x again\n", cmd); + goto again; + } + } + } else res = (unsigned int)-1; mutex_unlock(&bus->cmd_mutex); snd_hda_power_down(codec); |