diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-07-05 10:12:22 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-07-05 10:12:22 -0400 |
commit | 096e49d5e6f7bd93395e7ddf7e0239e1644d0505 (patch) | |
tree | 8247ad9e691171481fa00fd3cb301bb4f03779d8 | |
parent | af0adf3e81dbcf782388b8a7d0d7094ef5e70f50 (diff) |
ASoC: Add CODEC volatile register operation
Add a volatile_register() operation to the CODEC structure providing a
standard operation to query if a register is volatile. This will be used
to factor out the register cache I/O operations for the CODECs.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | include/sound/soc.h | 2 | ||||
-rw-r--r-- | sound/soc/soc-core.c | 17 |
2 files changed, 19 insertions, 0 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h index e6704c0a4404..94fcc65609b6 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -191,6 +191,7 @@ int snd_soc_register_platform(struct snd_soc_platform *platform); | |||
191 | void snd_soc_unregister_platform(struct snd_soc_platform *platform); | 191 | void snd_soc_unregister_platform(struct snd_soc_platform *platform); |
192 | int snd_soc_register_codec(struct snd_soc_codec *codec); | 192 | int snd_soc_register_codec(struct snd_soc_codec *codec); |
193 | void snd_soc_unregister_codec(struct snd_soc_codec *codec); | 193 | void snd_soc_unregister_codec(struct snd_soc_codec *codec); |
194 | int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int reg); | ||
194 | 195 | ||
195 | #ifdef CONFIG_PM | 196 | #ifdef CONFIG_PM |
196 | int snd_soc_suspend_device(struct device *dev); | 197 | int snd_soc_suspend_device(struct device *dev); |
@@ -361,6 +362,7 @@ struct snd_soc_codec { | |||
361 | int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); | 362 | int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); |
362 | int (*display_register)(struct snd_soc_codec *, char *, | 363 | int (*display_register)(struct snd_soc_codec *, char *, |
363 | size_t, unsigned int); | 364 | size_t, unsigned int); |
365 | int (*volatile_register)(unsigned int); | ||
364 | hw_write_t hw_write; | 366 | hw_write_t hw_write; |
365 | hw_read_t hw_read; | 367 | hw_read_t hw_read; |
366 | void *reg_cache; | 368 | void *reg_cache; |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index dfc03c0bacb6..8bf49a4e664a 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1125,6 +1125,23 @@ static int soc_new_pcm(struct snd_soc_device *socdev, | |||
1125 | return ret; | 1125 | return ret; |
1126 | } | 1126 | } |
1127 | 1127 | ||
1128 | /** | ||
1129 | * snd_soc_codec_volatile_register: Report if a register is volatile. | ||
1130 | * | ||
1131 | * @codec: CODEC to query. | ||
1132 | * @reg: Register to query. | ||
1133 | * | ||
1134 | * Boolean function indiciating if a CODEC register is volatile. | ||
1135 | */ | ||
1136 | int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int reg) | ||
1137 | { | ||
1138 | if (codec->volatile_register) | ||
1139 | return codec->volatile_register(reg); | ||
1140 | else | ||
1141 | return 0; | ||
1142 | } | ||
1143 | EXPORT_SYMBOL_GPL(snd_soc_codec_volatile_register); | ||
1144 | |||
1128 | /* codec register dump */ | 1145 | /* codec register dump */ |
1129 | static ssize_t soc_codec_reg_show(struct snd_soc_codec *codec, char *buf) | 1146 | static ssize_t soc_codec_reg_show(struct snd_soc_codec *codec, char *buf) |
1130 | { | 1147 | { |