summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-cache.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2010-02-01 19:48:03 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-02-04 11:40:45 +0100
commita3032b47c46920ed3f2fd58e64f484e3dab49f23 (patch)
treecdc6099c15a31c6fa2bae26e38da7fde7a1a3aa1 /sound/soc/soc-cache.c
parentASoC: Allow CODECs to ask soc-cache to suppress physical writes (diff)
downloadlinux-a3032b47c46920ed3f2fd58e64f484e3dab49f23.tar.xz
linux-a3032b47c46920ed3f2fd58e64f484e3dab49f23.zip
ASoC: Add a cache_sync bit to the CODEC structure
Add a bit to the CODEC structure indicating if a cache sync is required. By default this will be set if a cache only write is done to a soc-cache register cache. This allows us to avoid syncing the cache back after using cache only writes if there were no changes. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc/soc-cache.c')
-rw-r--r--sound/soc/soc-cache.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 84b6916db87d..5869dc3be781 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -39,8 +39,10 @@ static int snd_soc_4_12_write(struct snd_soc_codec *codec, unsigned int reg,
if (reg < codec->reg_cache_size)
cache[reg] = value;
- if (codec->cache_only)
+ if (codec->cache_only) {
+ codec->cache_sync = 1;
return 0;
+ }
ret = codec->hw_write(codec->control_data, data, 2);
if (ret == 2)
@@ -105,8 +107,10 @@ static int snd_soc_7_9_write(struct snd_soc_codec *codec, unsigned int reg,
if (reg < codec->reg_cache_size)
cache[reg] = value;
- if (codec->cache_only)
+ if (codec->cache_only) {
+ codec->cache_sync = 1;
return 0;
+ }
ret = codec->hw_write(codec->control_data, data, 2);
if (ret == 2)
@@ -161,8 +165,10 @@ static int snd_soc_8_8_write(struct snd_soc_codec *codec, unsigned int reg,
if (reg < codec->reg_cache_size)
cache[reg] = value;
- if (codec->cache_only)
+ if (codec->cache_only) {
+ codec->cache_sync = 1;
return 0;
+ }
if (codec->hw_write(codec->control_data, data, 2) == 2)
return 0;
@@ -192,8 +198,10 @@ static int snd_soc_8_16_write(struct snd_soc_codec *codec, unsigned int reg,
if (!snd_soc_codec_volatile_register(codec, reg))
reg_cache[reg] = value;
- if (codec->cache_only)
+ if (codec->cache_only) {
+ codec->cache_sync = 1;
return 0;
+ }
if (codec->hw_write(codec->control_data, data, 3) == 3)
return 0;
@@ -313,8 +321,10 @@ static int snd_soc_16_8_write(struct snd_soc_codec *codec, unsigned int reg,
if (reg < codec->reg_cache_size)
cache[reg] = value;
- if (codec->cache_only)
+ if (codec->cache_only) {
+ codec->cache_sync = 1;
return 0;
+ }
ret = codec->hw_write(codec->control_data, data, 3);
if (ret == 3)