diff options
Diffstat (limited to 'sound/soc/soc-cache.c')
-rw-r--r-- | sound/soc/soc-cache.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c index 097e33510a7a..84b6916db87d 100644 --- a/sound/soc/soc-cache.c +++ b/sound/soc/soc-cache.c | |||
@@ -38,6 +38,10 @@ static int snd_soc_4_12_write(struct snd_soc_codec *codec, unsigned int reg, | |||
38 | 38 | ||
39 | if (reg < codec->reg_cache_size) | 39 | if (reg < codec->reg_cache_size) |
40 | cache[reg] = value; | 40 | cache[reg] = value; |
41 | |||
42 | if (codec->cache_only) | ||
43 | return 0; | ||
44 | |||
41 | ret = codec->hw_write(codec->control_data, data, 2); | 45 | ret = codec->hw_write(codec->control_data, data, 2); |
42 | if (ret == 2) | 46 | if (ret == 2) |
43 | return 0; | 47 | return 0; |
@@ -100,6 +104,10 @@ static int snd_soc_7_9_write(struct snd_soc_codec *codec, unsigned int reg, | |||
100 | 104 | ||
101 | if (reg < codec->reg_cache_size) | 105 | if (reg < codec->reg_cache_size) |
102 | cache[reg] = value; | 106 | cache[reg] = value; |
107 | |||
108 | if (codec->cache_only) | ||
109 | return 0; | ||
110 | |||
103 | ret = codec->hw_write(codec->control_data, data, 2); | 111 | ret = codec->hw_write(codec->control_data, data, 2); |
104 | if (ret == 2) | 112 | if (ret == 2) |
105 | return 0; | 113 | return 0; |
@@ -153,6 +161,9 @@ static int snd_soc_8_8_write(struct snd_soc_codec *codec, unsigned int reg, | |||
153 | if (reg < codec->reg_cache_size) | 161 | if (reg < codec->reg_cache_size) |
154 | cache[reg] = value; | 162 | cache[reg] = value; |
155 | 163 | ||
164 | if (codec->cache_only) | ||
165 | return 0; | ||
166 | |||
156 | if (codec->hw_write(codec->control_data, data, 2) == 2) | 167 | if (codec->hw_write(codec->control_data, data, 2) == 2) |
157 | return 0; | 168 | return 0; |
158 | else | 169 | else |
@@ -181,6 +192,9 @@ static int snd_soc_8_16_write(struct snd_soc_codec *codec, unsigned int reg, | |||
181 | if (!snd_soc_codec_volatile_register(codec, reg)) | 192 | if (!snd_soc_codec_volatile_register(codec, reg)) |
182 | reg_cache[reg] = value; | 193 | reg_cache[reg] = value; |
183 | 194 | ||
195 | if (codec->cache_only) | ||
196 | return 0; | ||
197 | |||
184 | if (codec->hw_write(codec->control_data, data, 3) == 3) | 198 | if (codec->hw_write(codec->control_data, data, 3) == 3) |
185 | return 0; | 199 | return 0; |
186 | else | 200 | else |
@@ -193,10 +207,14 @@ static unsigned int snd_soc_8_16_read(struct snd_soc_codec *codec, | |||
193 | u16 *cache = codec->reg_cache; | 207 | u16 *cache = codec->reg_cache; |
194 | 208 | ||
195 | if (reg >= codec->reg_cache_size || | 209 | if (reg >= codec->reg_cache_size || |
196 | snd_soc_codec_volatile_register(codec, reg)) | 210 | snd_soc_codec_volatile_register(codec, reg)) { |
211 | if (codec->cache_only) | ||
212 | return -EINVAL; | ||
213 | |||
197 | return codec->hw_read(codec, reg); | 214 | return codec->hw_read(codec, reg); |
198 | else | 215 | } else { |
199 | return cache[reg]; | 216 | return cache[reg]; |
217 | } | ||
200 | } | 218 | } |
201 | 219 | ||
202 | #if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE)) | 220 | #if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE)) |
@@ -294,6 +312,10 @@ static int snd_soc_16_8_write(struct snd_soc_codec *codec, unsigned int reg, | |||
294 | reg &= 0xff; | 312 | reg &= 0xff; |
295 | if (reg < codec->reg_cache_size) | 313 | if (reg < codec->reg_cache_size) |
296 | cache[reg] = value; | 314 | cache[reg] = value; |
315 | |||
316 | if (codec->cache_only) | ||
317 | return 0; | ||
318 | |||
297 | ret = codec->hw_write(codec->control_data, data, 3); | 319 | ret = codec->hw_write(codec->control_data, data, 3); |
298 | if (ret == 3) | 320 | if (ret == 3) |
299 | return 0; | 321 | return 0; |