aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-cache.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-06-03 11:36:30 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-06-08 10:24:36 -0400
commitffdaa48aed8dae94037b26a2f9050128facfaa2e (patch)
tree47daedf3939f5019b5e68b302e8f77dd1fb61d52 /sound/soc/soc-cache.c
parent0168bf0d130de83cd3532b834237c6228a6158dd (diff)
ASoC: Suppress restore of default register values for rbtree cache sync
Currently the rbtree code will write out the entire register map when doing a cache sync which is wasteful and will slow things down. Check to see if the value we're about to write is the default and don't bother restoring it if it is, either the value will have been retained or the device will have been reset and holds the value already. We should really store the defaults in the nodes but this resolves the immediate issue. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'sound/soc/soc-cache.c')
-rw-r--r--sound/soc/soc-cache.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index cad70c9640d..9a88a276a0a 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -610,7 +610,7 @@ static int snd_soc_rbtree_cache_sync(struct snd_soc_codec *codec)
610 struct rb_node *node; 610 struct rb_node *node;
611 struct snd_soc_rbtree_node *rbnode; 611 struct snd_soc_rbtree_node *rbnode;
612 unsigned int regtmp; 612 unsigned int regtmp;
613 unsigned int val; 613 unsigned int val, def;
614 int ret; 614 int ret;
615 int i; 615 int i;
616 616
@@ -622,6 +622,11 @@ static int snd_soc_rbtree_cache_sync(struct snd_soc_codec *codec)
622 WARN_ON(codec->writable_register && 622 WARN_ON(codec->writable_register &&
623 codec->writable_register(codec, regtmp)); 623 codec->writable_register(codec, regtmp));
624 val = snd_soc_rbtree_get_register(rbnode, i); 624 val = snd_soc_rbtree_get_register(rbnode, i);
625 def = snd_soc_get_cache_val(codec->reg_def_copy, i,
626 rbnode->word_size);
627 if (val == def)
628 continue;
629
625 codec->cache_bypass = 1; 630 codec->cache_bypass = 1;
626 ret = snd_soc_write(codec, regtmp, val); 631 ret = snd_soc_write(codec, regtmp, val);
627 codec->cache_bypass = 0; 632 codec->cache_bypass = 0;