summaryrefslogtreecommitdiff
path: root/include/sound/soc.h
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-03-18 09:02:05 +0100
committerMark Brown <broonie@linaro.org>2014-04-14 17:22:43 +0100
commitf6272ff8a5f42c614f4a338013f5323979121e0f (patch)
tree3234194eddb26577f3fa1c8e2ea720fe6c005a97 /include/sound/soc.h
parentea53bf77d147e7e560ac007fdaa30fb98c37c712 (diff)
ASoC: Add snd_soc_kcontrol_platform() helper function
For platform controls snd_kcontrol_chip() currently returns a pointer to the platform that registered the control. With the upcoming consolidation of platform and CODEC controls this will change. Prepare for this by introducing the snd_soc_kcontrol_platform() helper function that will hide the implementation details of how the platform for a control can be obtained. This will allow us to change this easily in the future. The patch also updates all platforms to use this new helper function. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'include/sound/soc.h')
-rw-r--r--include/sound/soc.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index e150030b754d..14e7457e2347 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1242,6 +1242,20 @@ static inline struct snd_soc_codec *snd_soc_kcontrol_codec(
return snd_kcontrol_chip(kcontrol);
}
+/**
+ * snd_soc_kcontrol_platform() - Returns the platform that registerd the control
+ * @kcontrol: The control for which to get the platform
+ *
+ * Note: This function will only work correctly if the control has been
+ * registered with snd_soc_add_platform_controls() or via table based setup of
+ * a snd_soc_platform_driver. Otherwise the behavior is undefined.
+ */
+static inline struct snd_soc_codec *snd_soc_kcontrol_platform(
+ struct snd_kcontrol *kcontrol)
+{
+ return snd_kcontrol_chip(kcontrol);
+}
+
int snd_soc_util_init(void);
void snd_soc_util_exit(void);