summaryrefslogtreecommitdiffstats
path: root/include/sound/soc.h
diff options
context:
space:
mode:
authorDimitris Papastamos <dp@opensource.wolfsonmicro.com>2011-01-13 12:20:36 +0000
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-01-13 14:17:32 +0000
commit066d16c3e8194677a9aaeb06a45e4014387d16f1 (patch)
treefbdd51ab4478d56fdba8d3c30a381c248a5a3718 /include/sound/soc.h
parent3e8e2cc45c9d6b5c1265838a8cff701815321dbc (diff)
downloadop-kernel-dev-066d16c3e8194677a9aaeb06a45e4014387d16f1.zip
op-kernel-dev-066d16c3e8194677a9aaeb06a45e4014387d16f1.tar.gz
ASoC: soc-cache: Add support for default readable()/volatile() functions
For common scenarios, device drivers can provide a table of all the registers that are at least either readable/writable/volatile. The idea is that if a register lookup fails, all of its read/write/vol members will be zero and will be treated as default. This also reduces the size of the register access array. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'include/sound/soc.h')
-rw-r--r--include/sound/soc.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index d609232..b8acf99 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -276,6 +276,10 @@ int snd_soc_cache_write(struct snd_soc_codec *codec,
unsigned int reg, unsigned int value);
int snd_soc_cache_read(struct snd_soc_codec *codec,
unsigned int reg, unsigned int *value);
+int snd_soc_default_volatile_register(struct snd_soc_codec *codec,
+ unsigned int reg);
+int snd_soc_default_readable_register(struct snd_soc_codec *codec,
+ unsigned int reg);
/* Utility functions to get clock rates from various things */
int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots);
@@ -367,6 +371,22 @@ int snd_soc_put_volsw_2r_sx(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
/**
+ * struct snd_soc_reg_access - Describes whether a given register is
+ * readable, writable or volatile.
+ *
+ * @reg: the register number
+ * @read: whether this register is readable
+ * @write: whether this register is writable
+ * @vol: whether this register is volatile
+ */
+struct snd_soc_reg_access {
+ u16 reg;
+ u16 read;
+ u16 write;
+ u16 vol;
+};
+
+/**
* struct snd_soc_jack_pin - Describes a pin to update based on jack detection
*
* @pin: name of the pin to update
@@ -515,6 +535,8 @@ struct snd_soc_codec_driver {
short reg_cache_step;
short reg_word_size;
const void *reg_cache_default;
+ short reg_access_size;
+ const struct snd_soc_reg_access *reg_access_default;
enum snd_soc_compress_type compress_type;
/* codec bias level */
OpenPOWER on IntegriCloud