summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-12-20 11:00:21 +0100
committerTakashi Iwai <tiwai@suse.de>2013-01-12 08:33:43 +0100
commitde1e37b7d0dc3f1b8d0f84f5ff64ef8eebdf1e9f (patch)
tree15b5e48b18fbbc0bf06bfecddccc3fd1551de9e1 /sound/pci/hda/hda_codec.c
parent5fdaecdb0d8fd8131d2adb9ca0ae2b77707b36ca (diff)
downloadop-kernel-dev-de1e37b7d0dc3f1b8d0f84f5ff64ef8eebdf1e9f.zip
op-kernel-dev-de1e37b7d0dc3f1b8d0f84f5ff64ef8eebdf1e9f.tar.gz
ALSA: hda - Clear dirty flag upon cache write
When verbs or amps are actually written to the hardware, we can clear dirty flag so that the later snd_hda_codec_resume_*() calls can skip these verbs / amps. 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.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index ef0a0ee..23c8214 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1848,6 +1848,7 @@ static int codec_amp_update(struct hda_codec *codec, hda_nid_t nid, int ch,
bool init_only)
{
struct hda_amp_info *info;
+ unsigned int cache_only;
if (snd_BUG_ON(mask & ~0xff))
mask &= 0xff;
@@ -1865,10 +1866,9 @@ static int codec_amp_update(struct hda_codec *codec, hda_nid_t nid, int ch,
return 0;
}
info->vol[ch] = val;
- if (codec->cached_write)
- info->head.dirty = 1;
+ cache_only = info->head.dirty = codec->cached_write;
mutex_unlock(&codec->hash_mutex);
- if (!codec->cached_write)
+ if (!cache_only)
put_vol_mute(codec, info, nid, ch, direction, idx, val);
return 1;
}
@@ -3450,8 +3450,10 @@ int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid,
int err;
struct hda_cache_head *c;
u32 key;
+ unsigned int cache_only;
- if (!codec->cached_write) {
+ cache_only = codec->cached_write;
+ if (!cache_only) {
err = snd_hda_codec_write(codec, nid, direct, verb, parm);
if (err < 0)
return err;
@@ -3465,8 +3467,7 @@ int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid,
c = get_alloc_hash(&codec->cmd_cache, key);
if (c) {
c->val = parm;
- if (codec->cached_write)
- c->dirty = 1;
+ c->dirty = cache_only;
}
mutex_unlock(&codec->bus->cmd_mutex);
return 0;
OpenPOWER on IntegriCloud