ASoC: Add snd_soc_codec_{readable,writable}_register()
authorDimitris Papastamos <dp@opensource.wolfsonmicro.com>
Thu, 24 Mar 2011 13:45:18 +0000 (13:45 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sat, 26 Mar 2011 17:45:27 +0000 (17:45 +0000)
Provide the top level ASoC core functions for indicating whether
a given register is readable or writable.

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>
include/sound/soc.h
sound/soc/soc-core.c

index e20835753c6b134b272172debd2ea1945c027bf1..2720a9f3780b49b0bf13ab8c74b8ea64e51c5776 100644 (file)
@@ -278,6 +278,10 @@ int snd_soc_register_codec(struct device *dev,
 void snd_soc_unregister_codec(struct device *dev);
 int snd_soc_codec_volatile_register(struct snd_soc_codec *codec,
                                    unsigned int reg);
+int snd_soc_codec_readable_register(struct snd_soc_codec *codec,
+                                   unsigned int reg);
+int snd_soc_codec_writable_register(struct snd_soc_codec *codec,
+                                   unsigned int reg);
 int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
                               int addr_bits, int data_bits,
                               enum snd_soc_control_type control);
index 074a0c6e99f44a7d6d79cba398f77772dc872d79..5ae70a107f1f98784f23c1fe3fccfdc17c294dc0 100644 (file)
@@ -2146,6 +2146,42 @@ int snd_soc_codec_volatile_register(struct snd_soc_codec *codec,
 }
 EXPORT_SYMBOL_GPL(snd_soc_codec_volatile_register);
 
+/**
+ * snd_soc_codec_readable_register: Report if a register is readable.
+ *
+ * @codec: CODEC to query.
+ * @reg: Register to query.
+ *
+ * Boolean function indicating if a CODEC register is readable.
+ */
+int snd_soc_codec_readable_register(struct snd_soc_codec *codec,
+                                   unsigned int reg)
+{
+       if (codec->readable_register)
+               return codec->readable_register(codec, reg);
+       else
+               return 0;
+}
+EXPORT_SYMBOL_GPL(snd_soc_codec_readable_register);
+
+/**
+ * snd_soc_codec_writable_register: Report if a register is writable.
+ *
+ * @codec: CODEC to query.
+ * @reg: Register to query.
+ *
+ * Boolean function indicating if a CODEC register is writable.
+ */
+int snd_soc_codec_writable_register(struct snd_soc_codec *codec,
+                                   unsigned int reg)
+{
+       if (codec->writable_register)
+               return codec->writable_register(codec, reg);
+       else
+               return 0;
+}
+EXPORT_SYMBOL_GPL(snd_soc_codec_writable_register);
+
 /**
  * snd_soc_new_ac97_codec - initailise AC97 device
  * @codec: audio codec