ASoC: Add a cache_sync bit to the CODEC structure
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 1 Feb 2010 18:48:03 +0000 (18:48 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Thu, 4 Feb 2010 10:40:45 +0000 (10:40 +0000)
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>
include/sound/soc.h
sound/soc/soc-cache.c

index 4e8f14bc8ed3011eaa6020c11978b1a54b9142c3..e6a6d10de1d3b0852ea7c7e0031c075747e76094 100644 (file)
@@ -424,6 +424,7 @@ struct snd_soc_codec {
 
        unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
        unsigned int cache_only:1;  /* Suppress writes to hardware */
+       unsigned int cache_sync:1; /* Cache needs to be synced to hardware */
 
        /* dapm */
        u32 pop_time;
index 84b6916db87d4c090c1d78a2c6a60e9156eb3d49..5869dc3be7815cc6cbadb03165c2f9d84d4dae86 100644 (file)
@@ -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)
This page took 0.026125 seconds and 5 git commands to generate.