提交 a3032b47 编写于 作者: M Mark Brown

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: NMark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: NLiam Girdwood <lrg@slimlogic.co.uk>
上级 8c961bcc
...@@ -424,6 +424,7 @@ struct snd_soc_codec { ...@@ -424,6 +424,7 @@ struct snd_soc_codec {
unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */ unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
unsigned int cache_only:1; /* Suppress writes to hardware */ unsigned int cache_only:1; /* Suppress writes to hardware */
unsigned int cache_sync:1; /* Cache needs to be synced to hardware */
/* dapm */ /* dapm */
u32 pop_time; u32 pop_time;
......
...@@ -39,8 +39,10 @@ static int snd_soc_4_12_write(struct snd_soc_codec *codec, unsigned int reg, ...@@ -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) if (reg < codec->reg_cache_size)
cache[reg] = value; cache[reg] = value;
if (codec->cache_only) if (codec->cache_only) {
codec->cache_sync = 1;
return 0; return 0;
}
ret = codec->hw_write(codec->control_data, data, 2); ret = codec->hw_write(codec->control_data, data, 2);
if (ret == 2) if (ret == 2)
...@@ -105,8 +107,10 @@ static int snd_soc_7_9_write(struct snd_soc_codec *codec, unsigned int reg, ...@@ -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) if (reg < codec->reg_cache_size)
cache[reg] = value; cache[reg] = value;
if (codec->cache_only) if (codec->cache_only) {
codec->cache_sync = 1;
return 0; return 0;
}
ret = codec->hw_write(codec->control_data, data, 2); ret = codec->hw_write(codec->control_data, data, 2);
if (ret == 2) if (ret == 2)
...@@ -161,8 +165,10 @@ static int snd_soc_8_8_write(struct snd_soc_codec *codec, unsigned int reg, ...@@ -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) if (reg < codec->reg_cache_size)
cache[reg] = value; cache[reg] = value;
if (codec->cache_only) if (codec->cache_only) {
codec->cache_sync = 1;
return 0; return 0;
}
if (codec->hw_write(codec->control_data, data, 2) == 2) if (codec->hw_write(codec->control_data, data, 2) == 2)
return 0; return 0;
...@@ -192,8 +198,10 @@ static int snd_soc_8_16_write(struct snd_soc_codec *codec, unsigned int reg, ...@@ -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)) if (!snd_soc_codec_volatile_register(codec, reg))
reg_cache[reg] = value; reg_cache[reg] = value;
if (codec->cache_only) if (codec->cache_only) {
codec->cache_sync = 1;
return 0; return 0;
}
if (codec->hw_write(codec->control_data, data, 3) == 3) if (codec->hw_write(codec->control_data, data, 3) == 3)
return 0; return 0;
...@@ -313,8 +321,10 @@ static int snd_soc_16_8_write(struct snd_soc_codec *codec, unsigned int reg, ...@@ -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) if (reg < codec->reg_cache_size)
cache[reg] = value; cache[reg] = value;
if (codec->cache_only) if (codec->cache_only) {
codec->cache_sync = 1;
return 0; return 0;
}
ret = codec->hw_write(codec->control_data, data, 3); ret = codec->hw_write(codec->control_data, data, 3);
if (ret == 3) if (ret == 3)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册