diff options
author | Dimitris Papastamos <dp@opensource.wolfsonmicro.com> | 2011-03-24 09:45:17 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-03-26 13:45:16 -0400 |
commit | 8020454c9a1ec5ac5801805896b5f69d0c573e17 (patch) | |
tree | 60141172b88a90a0f31d9412d338d65c2d9c4f00 /sound/soc/soc-cache.c | |
parent | acd61451e55ea5848a6ab50d39a103e146fcf7ba (diff) |
ASoC: Add default snd_soc_default_writable_register() callback
By using struct snd_soc_reg_access for the read/write/vol attributes
of the registers, we provide callbacks that automatically determine whether
a given register is readable/writable or volatile.
Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-cache.c')
-rw-r--r-- | sound/soc/soc-cache.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c index 258c3b2098b5..1210a6f70a90 100644 --- a/sound/soc/soc-cache.c +++ b/sound/soc/soc-cache.c | |||
@@ -1449,3 +1449,17 @@ int snd_soc_default_readable_register(struct snd_soc_codec *codec, | |||
1449 | return codec->driver->reg_access_default[index].read; | 1449 | return codec->driver->reg_access_default[index].read; |
1450 | } | 1450 | } |
1451 | EXPORT_SYMBOL_GPL(snd_soc_default_readable_register); | 1451 | EXPORT_SYMBOL_GPL(snd_soc_default_readable_register); |
1452 | |||
1453 | int snd_soc_default_writable_register(struct snd_soc_codec *codec, | ||
1454 | unsigned int reg) | ||
1455 | { | ||
1456 | int index; | ||
1457 | |||
1458 | if (reg >= codec->driver->reg_cache_size) | ||
1459 | return 1; | ||
1460 | index = snd_soc_get_reg_access_index(codec, reg); | ||
1461 | if (index < 0) | ||
1462 | return 0; | ||
1463 | return codec->driver->reg_access_default[index].write; | ||
1464 | } | ||
1465 | EXPORT_SYMBOL_GPL(snd_soc_default_writable_register); | ||