summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-09-27 17:33:45 +0200
committerTakashi Iwai <tiwai@suse.de>2011-09-27 17:33:45 +0200
commit218264ae9ab3e12a785e1faeb2e15c8ae7172863 (patch)
treefe2e22fefa237cbf6e8e90da967aa89dd2c76ee1
parent5ec02a1cfa9497f585721ec775c9b3e2783ff6fb (diff)
ALSA: hda - Avoid unnecessary verbs to clear PCM formats
Since really_cleanup_stream() is called from both purity_inactive_streams() and hda_cleanup_all_streams(), the verbs to clear the PCM channel and format may be called multiple times unnecessarily. This patch adds checks to skip these unneeded verbs. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/hda_codec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 6b611d50d03f..e3db19610411 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1491,8 +1491,11 @@ static void really_cleanup_stream(struct hda_codec *codec,
struct hda_cvt_setup *q)
{
hda_nid_t nid = q->nid;
- snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CHANNEL_STREAMID, 0);
- snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, 0);
+ if (q->stream_tag || q->channel_id)
+ snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CHANNEL_STREAMID, 0);
+ if (q->format_id)
+ snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, 0
+);
memset(q, 0, sizeof(*q));
q->nid = nid;
}