summaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
authorLars-Peter Clausen2014-04-22 13:23:14 +0200
committerMark Brown2014-04-22 14:38:21 +0200
commit907fe36a2cd572fe58d98be01457b945c47b996e (patch)
tree736044b15f615abaac7201f3ee9fc3e777c80499 /include/sound
parentMerge branch 'topic/multicodec' of git://git.kernel.org/pub/scm/linux/kernel/... (diff)
downloadkernel-qcow2-linux-907fe36a2cd572fe58d98be01457b945c47b996e.tar.gz
kernel-qcow2-linux-907fe36a2cd572fe58d98be01457b945c47b996e.tar.xz
kernel-qcow2-linux-907fe36a2cd572fe58d98be01457b945c47b996e.zip
ASoC: Move standard kcontrol helpers to the component level
After moving the IO layer inside ASoC to the component level we can now easily move the standard control helpers also to the component level. This allows to reuse the same standard helper control implementations for other components. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/soc.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index a4179e73369a..c0b65fc90783 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1250,6 +1250,22 @@ static inline bool snd_soc_codec_is_active(struct snd_soc_codec *codec)
}
/**
+ * snd_soc_kcontrol_component() - Returns the component that registered the
+ * control
+ * @kcontrol: The control for which to get the component
+ *
+ * Note: This function will work correctly if the control has been registered
+ * for a component. Either with snd_soc_add_codec_controls() or
+ * snd_soc_add_platform_controls() or via table based setup for either a
+ * CODEC, a platform or component driver. Otherwise the behavior is undefined.
+ */
+static inline struct snd_soc_component *snd_soc_kcontrol_component(
+ struct snd_kcontrol *kcontrol)
+{
+ return snd_kcontrol_chip(kcontrol);
+}
+
+/**
* snd_soc_kcontrol_codec() - Returns the CODEC that registered the control
* @kcontrol: The control for which to get the CODEC
*
@@ -1260,7 +1276,7 @@ static inline bool snd_soc_codec_is_active(struct snd_soc_codec *codec)
static inline struct snd_soc_codec *snd_soc_kcontrol_codec(
struct snd_kcontrol *kcontrol)
{
- return snd_kcontrol_chip(kcontrol);
+ return snd_soc_component_to_codec(snd_soc_kcontrol_component(kcontrol));
}
/**
@@ -1274,7 +1290,7 @@ static inline struct snd_soc_codec *snd_soc_kcontrol_codec(
static inline struct snd_soc_platform *snd_soc_kcontrol_platform(
struct snd_kcontrol *kcontrol)
{
- return snd_kcontrol_chip(kcontrol);
+ return snd_soc_component_to_platform(snd_soc_kcontrol_component(kcontrol));
}
int snd_soc_util_init(void);