aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2014-11-19 10:48:20 +0000
committerMark Brown <broonie@kernel.org>2014-11-19 10:48:20 +0000
commite975cec295ea71d5ad01fd3b6195670d3e31885e (patch)
tree0b74ba93cecd9d577d6835e77ad7020f5b22db87 /include/sound
parentMerge branch 'topic/ac97' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap into asoc-ac97 (diff)
parentASoC: Add helper functions for deferred regmap setup (diff)
downloadlinux-dev-e975cec295ea71d5ad01fd3b6195670d3e31885e.tar.xz
linux-dev-e975cec295ea71d5ad01fd3b6195670d3e31885e.zip
Merge branch 'topic/regmap' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-ac97
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/soc.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 9e513ae11749..80ca937a20da 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1286,6 +1286,41 @@ void snd_soc_component_async_complete(struct snd_soc_component *component);
int snd_soc_component_test_bits(struct snd_soc_component *component,
unsigned int reg, unsigned int mask, unsigned int value);
+void snd_soc_component_init_regmap(struct snd_soc_component *component,
+ struct regmap *regmap);
+void snd_soc_component_exit_regmap(struct snd_soc_component *component);
+
+/**
+ * snd_soc_codec_init_regmap() - Initialize regmap instance for the CODEC
+ * @codec: The CODEC for which to initialize the regmap instance
+ * @regmap: The regmap instance that should be used by the CODEC
+ *
+ * This function allows deferred assignment of the regmap instance that is
+ * associated with the CODEC. Only use this if the regmap instance is not yet
+ * ready when the CODEC is registered. The function must also be called before
+ * the first IO attempt of the CODEC.
+ */
+static inline void snd_soc_codec_init_regmap(struct snd_soc_codec *codec,
+ struct regmap *regmap)
+{
+ snd_soc_component_init_regmap(&codec->component, regmap);
+}
+
+/**
+ * snd_soc_codec_exit_regmap() - De-initialize regmap instance for the CODEC
+ * @codec: The CODEC for which to de-initialize the regmap instance
+ *
+ * Calls regmap_exit() on the regmap instance associated to the CODEC and
+ * removes the regmap instance from the CODEC.
+ *
+ * This function should only be used if snd_soc_codec_init_regmap() was used to
+ * initialize the regmap instance.
+ */
+static inline void snd_soc_codec_exit_regmap(struct snd_soc_codec *codec)
+{
+ snd_soc_component_exit_regmap(&codec->component);
+}
+
/* device driver data */
static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,