diff options
author | Dimitris Papastamos <dp@opensource.wolfsonmicro.com> | 2011-01-19 09:53:36 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-01-20 08:40:30 -0500 |
commit | dad8e7aeeb83a26d267e757e4c1cf69591850477 (patch) | |
tree | 03ba025a19d20e4272db00761cf8723e19ecae38 /sound/soc/soc-cache.c | |
parent | e66ef2f81f1d36b5413e3fc7ff548de683f0750b (diff) |
ASoC: soc-cache: Introduce the cache_bypass option
This is primarily needed to avoid writing back to the cache
whenever we are syncing the cache with the hardware. This gives a
performance benefit especially for large register maps.
Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-cache.c')
-rw-r--r-- | sound/soc/soc-cache.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c index d97a59f6a249..1ebff9f12b4e 100644 --- a/sound/soc/soc-cache.c +++ b/sound/soc/soc-cache.c | |||
@@ -25,7 +25,8 @@ static unsigned int snd_soc_4_12_read(struct snd_soc_codec *codec, | |||
25 | unsigned int val; | 25 | unsigned int val; |
26 | 26 | ||
27 | if (reg >= codec->driver->reg_cache_size || | 27 | if (reg >= codec->driver->reg_cache_size || |
28 | snd_soc_codec_volatile_register(codec, reg)) { | 28 | snd_soc_codec_volatile_register(codec, reg) || |
29 | codec->cache_bypass) { | ||
29 | if (codec->cache_only) | 30 | if (codec->cache_only) |
30 | return -1; | 31 | return -1; |
31 | 32 | ||
@@ -49,7 +50,8 @@ static int snd_soc_4_12_write(struct snd_soc_codec *codec, unsigned int reg, | |||
49 | data[1] = value & 0x00ff; | 50 | data[1] = value & 0x00ff; |
50 | 51 | ||
51 | if (!snd_soc_codec_volatile_register(codec, reg) && | 52 | if (!snd_soc_codec_volatile_register(codec, reg) && |
52 | reg < codec->driver->reg_cache_size) { | 53 | reg < codec->driver->reg_cache_size && |
54 | !codec->cache_bypass) { | ||
53 | ret = snd_soc_cache_write(codec, reg, value); | 55 | ret = snd_soc_cache_write(codec, reg, value); |
54 | if (ret < 0) | 56 | if (ret < 0) |
55 | return -1; | 57 | return -1; |
@@ -106,7 +108,8 @@ static unsigned int snd_soc_7_9_read(struct snd_soc_codec *codec, | |||
106 | unsigned int val; | 108 | unsigned int val; |
107 | 109 | ||
108 | if (reg >= codec->driver->reg_cache_size || | 110 | if (reg >= codec->driver->reg_cache_size || |
109 | snd_soc_codec_volatile_register(codec, reg)) { | 111 | snd_soc_codec_volatile_register(codec, reg) || |
112 | codec->cache_bypass) { | ||
110 | if (codec->cache_only) | 113 | if (codec->cache_only) |
111 | return -1; | 114 | return -1; |
112 | 115 | ||
@@ -130,7 +133,8 @@ static int snd_soc_7_9_write(struct snd_soc_codec *codec, unsigned int reg, | |||
130 | data[1] = value & 0x00ff; | 133 | data[1] = value & 0x00ff; |
131 | 134 | ||
132 | if (!snd_soc_codec_volatile_register(codec, reg) && | 135 | if (!snd_soc_codec_volatile_register(codec, reg) && |
133 | reg < codec->driver->reg_cache_size) { | 136 | reg < codec->driver->reg_cache_size && |
137 | !codec->cache_bypass) { | ||
134 | ret = snd_soc_cache_write(codec, reg, value); | 138 | ret = snd_soc_cache_write(codec, reg, value); |
135 | if (ret < 0) | 139 | if (ret < 0) |
136 | return -1; | 140 | return -1; |
@@ -191,7 +195,8 @@ static int snd_soc_8_8_write(struct snd_soc_codec *codec, unsigned int reg, | |||
191 | data[1] = value & 0xff; | 195 | data[1] = value & 0xff; |
192 | 196 | ||
193 | if (!snd_soc_codec_volatile_register(codec, reg) && | 197 | if (!snd_soc_codec_volatile_register(codec, reg) && |
194 | reg < codec->driver->reg_cache_size) { | 198 | reg < codec->driver->reg_cache_size && |
199 | !codec->cache_bypass) { | ||
195 | ret = snd_soc_cache_write(codec, reg, value); | 200 | ret = snd_soc_cache_write(codec, reg, value); |
196 | if (ret < 0) | 201 | if (ret < 0) |
197 | return -1; | 202 | return -1; |
@@ -216,7 +221,8 @@ static unsigned int snd_soc_8_8_read(struct snd_soc_codec *codec, | |||
216 | 221 | ||
217 | reg &= 0xff; | 222 | reg &= 0xff; |
218 | if (reg >= codec->driver->reg_cache_size || | 223 | if (reg >= codec->driver->reg_cache_size || |
219 | snd_soc_codec_volatile_register(codec, reg)) { | 224 | snd_soc_codec_volatile_register(codec, reg) || |
225 | codec->cache_bypass) { | ||
220 | if (codec->cache_only) | 226 | if (codec->cache_only) |
221 | return -1; | 227 | return -1; |
222 | 228 | ||
@@ -271,7 +277,8 @@ static int snd_soc_8_16_write(struct snd_soc_codec *codec, unsigned int reg, | |||
271 | data[2] = value & 0xff; | 277 | data[2] = value & 0xff; |
272 | 278 | ||
273 | if (!snd_soc_codec_volatile_register(codec, reg) && | 279 | if (!snd_soc_codec_volatile_register(codec, reg) && |
274 | reg < codec->driver->reg_cache_size) { | 280 | reg < codec->driver->reg_cache_size && |
281 | !codec->cache_bypass) { | ||
275 | ret = snd_soc_cache_write(codec, reg, value); | 282 | ret = snd_soc_cache_write(codec, reg, value); |
276 | if (ret < 0) | 283 | if (ret < 0) |
277 | return -1; | 284 | return -1; |
@@ -295,7 +302,8 @@ static unsigned int snd_soc_8_16_read(struct snd_soc_codec *codec, | |||
295 | unsigned int val; | 302 | unsigned int val; |
296 | 303 | ||
297 | if (reg >= codec->driver->reg_cache_size || | 304 | if (reg >= codec->driver->reg_cache_size || |
298 | snd_soc_codec_volatile_register(codec, reg)) { | 305 | snd_soc_codec_volatile_register(codec, reg) || |
306 | codec->cache_bypass) { | ||
299 | if (codec->cache_only) | 307 | if (codec->cache_only) |
300 | return -1; | 308 | return -1; |
301 | 309 | ||
@@ -450,7 +458,8 @@ static unsigned int snd_soc_16_8_read(struct snd_soc_codec *codec, | |||
450 | 458 | ||
451 | reg &= 0xff; | 459 | reg &= 0xff; |
452 | if (reg >= codec->driver->reg_cache_size || | 460 | if (reg >= codec->driver->reg_cache_size || |
453 | snd_soc_codec_volatile_register(codec, reg)) { | 461 | snd_soc_codec_volatile_register(codec, reg) || |
462 | codec->cache_bypass) { | ||
454 | if (codec->cache_only) | 463 | if (codec->cache_only) |
455 | return -1; | 464 | return -1; |
456 | 465 | ||
@@ -476,7 +485,8 @@ static int snd_soc_16_8_write(struct snd_soc_codec *codec, unsigned int reg, | |||
476 | 485 | ||
477 | reg &= 0xff; | 486 | reg &= 0xff; |
478 | if (!snd_soc_codec_volatile_register(codec, reg) && | 487 | if (!snd_soc_codec_volatile_register(codec, reg) && |
479 | reg < codec->driver->reg_cache_size) { | 488 | reg < codec->driver->reg_cache_size && |
489 | !codec->cache_bypass) { | ||
480 | ret = snd_soc_cache_write(codec, reg, value); | 490 | ret = snd_soc_cache_write(codec, reg, value); |
481 | if (ret < 0) | 491 | if (ret < 0) |
482 | return -1; | 492 | return -1; |
@@ -568,7 +578,8 @@ static unsigned int snd_soc_16_16_read(struct snd_soc_codec *codec, | |||
568 | unsigned int val; | 578 | unsigned int val; |
569 | 579 | ||
570 | if (reg >= codec->driver->reg_cache_size || | 580 | if (reg >= codec->driver->reg_cache_size || |
571 | snd_soc_codec_volatile_register(codec, reg)) { | 581 | snd_soc_codec_volatile_register(codec, reg) || |
582 | codec->cache_bypass) { | ||
572 | if (codec->cache_only) | 583 | if (codec->cache_only) |
573 | return -1; | 584 | return -1; |
574 | 585 | ||
@@ -595,7 +606,8 @@ static int snd_soc_16_16_write(struct snd_soc_codec *codec, unsigned int reg, | |||
595 | data[3] = value & 0xff; | 606 | data[3] = value & 0xff; |
596 | 607 | ||
597 | if (!snd_soc_codec_volatile_register(codec, reg) && | 608 | if (!snd_soc_codec_volatile_register(codec, reg) && |
598 | reg < codec->driver->reg_cache_size) { | 609 | reg < codec->driver->reg_cache_size && |
610 | !codec->cache_bypass) { | ||
599 | ret = snd_soc_cache_write(codec, reg, value); | 611 | ret = snd_soc_cache_write(codec, reg, value); |
600 | if (ret < 0) | 612 | if (ret < 0) |
601 | return -1; | 613 | return -1; |