ASoC: Add CODEC volatile register operation
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 5 Jul 2009 14:12:22 +0000 (15:12 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 5 Jul 2009 14:12:22 +0000 (15:12 +0100)
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>
include/sound/soc.h
sound/soc/soc-core.c

index e6704c0a44044300f60633f3855564b799b1c425..94fcc65609b6e68043c5eb009a65ebfaef3edcb8 100644 (file)
@@ -191,6 +191,7 @@ int snd_soc_register_platform(struct snd_soc_platform *platform);
 void snd_soc_unregister_platform(struct snd_soc_platform *platform);
 int snd_soc_register_codec(struct snd_soc_codec *codec);
 void snd_soc_unregister_codec(struct snd_soc_codec *codec);
+int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int reg);
 
 #ifdef CONFIG_PM
 int snd_soc_suspend_device(struct device *dev);
@@ -361,6 +362,7 @@ struct snd_soc_codec {
        int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
        int (*display_register)(struct snd_soc_codec *, char *,
                                size_t, unsigned int);
+       int (*volatile_register)(unsigned int);
        hw_write_t hw_write;
        hw_read_t hw_read;
        void *reg_cache;
index dfc03c0bacb601f141b2d70699d5a8010e513f7a..8bf49a4e664ab53f43fe7b777061dc4f60a1cf82 100644 (file)
@@ -1125,6 +1125,23 @@ static int soc_new_pcm(struct snd_soc_device *socdev,
        return ret;
 }
 
+/**
+ * snd_soc_codec_volatile_register: Report if a register is volatile.
+ *
+ * @codec: CODEC to query.
+ * @reg: Register to query.
+ *
+ * Boolean function indiciating if a CODEC register is volatile.
+ */
+int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int reg)
+{
+       if (codec->volatile_register)
+               return codec->volatile_register(reg);
+       else
+               return 0;
+}
+EXPORT_SYMBOL_GPL(snd_soc_codec_volatile_register);
+
 /* codec register dump */
 static ssize_t soc_codec_reg_show(struct snd_soc_codec *codec, char *buf)
 {