summaryrefslogtreecommitdiff
path: root/sound/soc/soc-cache.c
diff options
context:
space:
mode:
authorDimitris Papastamos <dp@opensource.wolfsonmicro.com>2011-03-28 14:39:15 +0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-03-31 01:21:29 +0400
commitf20eda5d8fafe35ca3c63ec8149a700a7db228a5 (patch)
treecf300d095ab70d3b5b897fc5581bd3b057a55837 /sound/soc/soc-cache.c
parentfbda18245beff52ec1edf096e7a77d4cdf3effb9 (diff)
downloadlinux-f20eda5d8fafe35ca3c63ec8149a700a7db228a5.tar.xz
ASoC: soc-cache: Warn on syncing any non-writable registers
When syncing the cache, if the driver has given us a writable_register() callback, use it to check if we are syncing a non-writable register and if so warn the user. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-cache.c')
-rw-r--r--sound/soc/soc-cache.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 22c0b95fb007..22b099076223 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -661,6 +661,8 @@ static int snd_soc_rbtree_cache_sync(struct snd_soc_codec *codec)
rbnode = rb_entry(node, struct snd_soc_rbtree_node, node);
if (rbnode->value == rbnode->defval)
continue;
+ WARN_ON(codec->writable_register &&
+ codec->writable_register(codec, rbnode->reg));
ret = snd_soc_cache_read(codec, rbnode->reg, &val);
if (ret)
return ret;
@@ -921,6 +923,8 @@ static int snd_soc_lzo_cache_sync(struct snd_soc_codec *codec)
lzo_blocks = codec->reg_cache;
for_each_set_bit(i, lzo_blocks[0]->sync_bmp, lzo_blocks[0]->sync_bmp_nbits) {
+ WARN_ON(codec->writable_register &&
+ codec->writable_register(codec, i));
ret = snd_soc_cache_read(codec, i, &val);
if (ret)
return ret;
@@ -1179,6 +1183,8 @@ static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec)
codec_drv = codec->driver;
for (i = 0; i < codec_drv->reg_cache_size; ++i) {
+ WARN_ON(codec->writable_register &&
+ codec->writable_register(codec, i));
ret = snd_soc_cache_read(codec, i, &val);
if (ret)
return ret;