aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/soc-cache.c')
-rw-r--r--sound/soc/soc-cache.c63
1 files changed, 0 insertions, 63 deletions
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index e72f55428f0b..eaa898f8d808 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -275,66 +275,3 @@ int snd_soc_cache_sync(struct snd_soc_codec *codec)
275 return ret; 275 return ret;
276} 276}
277EXPORT_SYMBOL_GPL(snd_soc_cache_sync); 277EXPORT_SYMBOL_GPL(snd_soc_cache_sync);
278
279static int snd_soc_get_reg_access_index(struct snd_soc_codec *codec,
280 unsigned int reg)
281{
282 const struct snd_soc_codec_driver *codec_drv;
283 unsigned int min, max, index;
284
285 codec_drv = codec->driver;
286 min = 0;
287 max = codec_drv->reg_access_size - 1;
288 do {
289 index = (min + max) / 2;
290 if (codec_drv->reg_access_default[index].reg == reg)
291 return index;
292 if (codec_drv->reg_access_default[index].reg < reg)
293 min = index + 1;
294 else
295 max = index;
296 } while (min <= max);
297 return -1;
298}
299
300int snd_soc_default_volatile_register(struct snd_soc_codec *codec,
301 unsigned int reg)
302{
303 int index;
304
305 if (reg >= codec->driver->reg_cache_size)
306 return 1;
307 index = snd_soc_get_reg_access_index(codec, reg);
308 if (index < 0)
309 return 0;
310 return codec->driver->reg_access_default[index].vol;
311}
312EXPORT_SYMBOL_GPL(snd_soc_default_volatile_register);
313
314int snd_soc_default_readable_register(struct snd_soc_codec *codec,
315 unsigned int reg)
316{
317 int index;
318
319 if (reg >= codec->driver->reg_cache_size)
320 return 1;
321 index = snd_soc_get_reg_access_index(codec, reg);
322 if (index < 0)
323 return 0;
324 return codec->driver->reg_access_default[index].read;
325}
326EXPORT_SYMBOL_GPL(snd_soc_default_readable_register);
327
328int snd_soc_default_writable_register(struct snd_soc_codec *codec,
329 unsigned int reg)
330{
331 int index;
332
333 if (reg >= codec->driver->reg_cache_size)
334 return 1;
335 index = snd_soc_get_reg_access_index(codec, reg);
336 if (index < 0)
337 return 0;
338 return codec->driver->reg_access_default[index].write;
339}
340EXPORT_SYMBOL_GPL(snd_soc_default_writable_register);