Currently the soc-cache code will always write to the device, meaning
that we need the device to be powered and active at pretty much all
times the system is active. Allowing cache only writes lays some
groundwork for future enhancements to allow devices to be put into a
full off state when the audio subsystem is idle.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
short reg_cache_step;
unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
short reg_cache_step;
unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
+ unsigned int cache_only:1; /* Suppress writes to hardware */
if (reg < codec->reg_cache_size)
cache[reg] = value;
if (reg < codec->reg_cache_size)
cache[reg] = value;
+
+ if (codec->cache_only)
+ return 0;
+
ret = codec->hw_write(codec->control_data, data, 2);
if (ret == 2)
return 0;
ret = codec->hw_write(codec->control_data, data, 2);
if (ret == 2)
return 0;
if (reg < codec->reg_cache_size)
cache[reg] = value;
if (reg < codec->reg_cache_size)
cache[reg] = value;
+
+ if (codec->cache_only)
+ return 0;
+
ret = codec->hw_write(codec->control_data, data, 2);
if (ret == 2)
return 0;
ret = codec->hw_write(codec->control_data, data, 2);
if (ret == 2)
return 0;
if (reg < codec->reg_cache_size)
cache[reg] = value;
if (reg < codec->reg_cache_size)
cache[reg] = value;
+ if (codec->cache_only)
+ return 0;
+
if (codec->hw_write(codec->control_data, data, 2) == 2)
return 0;
else
if (codec->hw_write(codec->control_data, data, 2) == 2)
return 0;
else
if (!snd_soc_codec_volatile_register(codec, reg))
reg_cache[reg] = value;
if (!snd_soc_codec_volatile_register(codec, reg))
reg_cache[reg] = value;
+ if (codec->cache_only)
+ return 0;
+
if (codec->hw_write(codec->control_data, data, 3) == 3)
return 0;
else
if (codec->hw_write(codec->control_data, data, 3) == 3)
return 0;
else
u16 *cache = codec->reg_cache;
if (reg >= codec->reg_cache_size ||
u16 *cache = codec->reg_cache;
if (reg >= codec->reg_cache_size ||
- snd_soc_codec_volatile_register(codec, reg))
+ snd_soc_codec_volatile_register(codec, reg)) {
+ if (codec->cache_only)
+ return -EINVAL;
+
return codec->hw_read(codec, reg);
return codec->hw_read(codec, reg);
}
#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
}
#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
reg &= 0xff;
if (reg < codec->reg_cache_size)
cache[reg] = value;
reg &= 0xff;
if (reg < codec->reg_cache_size)
cache[reg] = value;
+
+ if (codec->cache_only)
+ return 0;
+
ret = codec->hw_write(codec->control_data, data, 3);
if (ret == 3)
return 0;
ret = codec->hw_write(codec->control_data, data, 3);
if (ret == 3)
return 0;