aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2010-02-01 13:48:03 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-02-04 05:40:45 -0500
commita3032b47c46920ed3f2fd58e64f484e3dab49f23 (patch)
treecdc6099c15a31c6fa2bae26e38da7fde7a1a3aa1
parent8c961bcca1d10be4f2c06375eb561679167653a0 (diff)
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>
-rw-r--r--include/sound/soc.h1
-rw-r--r--sound/soc/soc-cache.c20
2 files changed, 16 insertions, 5 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 4e8f14bc8ed3..e6a6d10de1d3 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -424,6 +424,7 @@ struct snd_soc_codec {
424 424
425 unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */ 425 unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
426 unsigned int cache_only:1; /* Suppress writes to hardware */ 426 unsigned int cache_only:1; /* Suppress writes to hardware */
427 unsigned int cache_sync:1; /* Cache needs to be synced to hardware */
427 428
428 /* dapm */ 429 /* dapm */
429 u32 pop_time; 430 u32 pop_time;
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,
39 if (reg < codec->reg_cache_size) 39 if (reg < codec->reg_cache_size)
40 cache[reg] = value; 40 cache[reg] = value;
41 41
42 if (codec->cache_only) 42 if (codec->cache_only) {
43 codec->cache_sync = 1;
43 return 0; 44 return 0;
45 }
44 46
45 ret = codec->hw_write(codec->control_data, data, 2); 47 ret = codec->hw_write(codec->control_data, data, 2);
46 if (ret == 2) 48 if (ret == 2)
@@ -105,8 +107,10 @@ static int snd_soc_7_9_write(struct snd_soc_codec *codec, unsigned int reg,
105 if (reg < codec->reg_cache_size) 107 if (reg < codec->reg_cache_size)
106 cache[reg] = value; 108 cache[reg] = value;
107 109
108 if (codec->cache_only) 110 if (codec->cache_only) {
111 codec->cache_sync = 1;
109 return 0; 112 return 0;
113 }
110 114
111 ret = codec->hw_write(codec->control_data, data, 2); 115 ret = codec->hw_write(codec->control_data, data, 2);
112 if (ret == 2) 116 if (ret == 2)
@@ -161,8 +165,10 @@ static int snd_soc_8_8_write(struct snd_soc_codec *codec, unsigned int reg,
161 if (reg < codec->reg_cache_size) 165 if (reg < codec->reg_cache_size)
162 cache[reg] = value; 166 cache[reg] = value;
163 167
164 if (codec->cache_only) 168 if (codec->cache_only) {
169 codec->cache_sync = 1;
165 return 0; 170 return 0;
171 }
166 172
167 if (codec->hw_write(codec->control_data, data, 2) == 2) 173 if (codec->hw_write(codec->control_data, data, 2) == 2)
168 return 0; 174 return 0;
@@ -192,8 +198,10 @@ static int snd_soc_8_16_write(struct snd_soc_codec *codec, unsigned int reg,
192 if (!snd_soc_codec_volatile_register(codec, reg)) 198 if (!snd_soc_codec_volatile_register(codec, reg))
193 reg_cache[reg] = value; 199 reg_cache[reg] = value;
194 200
195 if (codec->cache_only) 201 if (codec->cache_only) {
202 codec->cache_sync = 1;
196 return 0; 203 return 0;
204 }
197 205
198 if (codec->hw_write(codec->control_data, data, 3) == 3) 206 if (codec->hw_write(codec->control_data, data, 3) == 3)
199 return 0; 207 return 0;
@@ -313,8 +321,10 @@ static int snd_soc_16_8_write(struct snd_soc_codec *codec, unsigned int reg,
313 if (reg < codec->reg_cache_size) 321 if (reg < codec->reg_cache_size)
314 cache[reg] = value; 322 cache[reg] = value;
315 323
316 if (codec->cache_only) 324 if (codec->cache_only) {
325 codec->cache_sync = 1;
317 return 0; 326 return 0;
327 }
318 328
319 ret = codec->hw_write(codec->control_data, data, 3); 329 ret = codec->hw_write(codec->control_data, data, 3);
320 if (ret == 3) 330 if (ret == 3)