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;
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;
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 (!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
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);
- else
+ } else {
return cache[reg];
+ }
}
#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
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;