aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-04-22 07:23:14 -0400
committerMark Brown <broonie@linaro.org>2014-04-22 08:38:21 -0400
commit907fe36a2cd572fe58d98be01457b945c47b996e (patch)
tree736044b15f615abaac7201f3ee9fc3e777c80499 /include/sound
parent9f68730dc8be948f0ae0601ef55321765813895c (diff)
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)
1250} 1250}
1251 1251
1252/** 1252/**
1253 * snd_soc_kcontrol_component() - Returns the component that registered the
1254 * control
1255 * @kcontrol: The control for which to get the component
1256 *
1257 * Note: This function will work correctly if the control has been registered
1258 * for a component. Either with snd_soc_add_codec_controls() or
1259 * snd_soc_add_platform_controls() or via table based setup for either a
1260 * CODEC, a platform or component driver. Otherwise the behavior is undefined.
1261 */
1262static inline struct snd_soc_component *snd_soc_kcontrol_component(
1263 struct snd_kcontrol *kcontrol)
1264{
1265 return snd_kcontrol_chip(kcontrol);
1266}
1267
1268/**
1253 * snd_soc_kcontrol_codec() - Returns the CODEC that registered the control 1269 * snd_soc_kcontrol_codec() - Returns the CODEC that registered the control
1254 * @kcontrol: The control for which to get the CODEC 1270 * @kcontrol: The control for which to get the CODEC
1255 * 1271 *
@@ -1260,7 +1276,7 @@ static inline bool snd_soc_codec_is_active(struct snd_soc_codec *codec)
1260static inline struct snd_soc_codec *snd_soc_kcontrol_codec( 1276static inline struct snd_soc_codec *snd_soc_kcontrol_codec(
1261 struct snd_kcontrol *kcontrol) 1277 struct snd_kcontrol *kcontrol)
1262{ 1278{
1263 return snd_kcontrol_chip(kcontrol); 1279 return snd_soc_component_to_codec(snd_soc_kcontrol_component(kcontrol));
1264} 1280}
1265 1281
1266/** 1282/**
@@ -1274,7 +1290,7 @@ static inline struct snd_soc_codec *snd_soc_kcontrol_codec(
1274static inline struct snd_soc_platform *snd_soc_kcontrol_platform( 1290static inline struct snd_soc_platform *snd_soc_kcontrol_platform(
1275 struct snd_kcontrol *kcontrol) 1291 struct snd_kcontrol *kcontrol)
1276{ 1292{
1277 return snd_kcontrol_chip(kcontrol); 1293 return snd_soc_component_to_platform(snd_soc_kcontrol_component(kcontrol));
1278} 1294}
1279 1295
1280int snd_soc_util_init(void); 1296int snd_soc_util_init(void);