aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-03-18 04:02:04 -0400
committerMark Brown <broonie@linaro.org>2014-04-14 12:22:43 -0400
commitea53bf77d147e7e560ac007fdaa30fb98c37c712 (patch)
treefb5917764aa5b2c0f4122708097446c3110541a0 /include/sound
parentc9eaa447e77efe77b7fa4c953bd62de8297fd6c5 (diff)
ASoC: Add snd_soc_kcontrol_codec() helper function
For CODEC controls snd_kcontrol_chip() currently returns a pointer to the CODEC 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_codec() helper function that will hide the implementation details of how the CODEC for a control can be obtained. This will allow us to change this easily in the future. The patch also updates all CODEC drivers to use the new helper function. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'include/sound')
-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 0b83168d8ff4..e150030b754d 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1228,6 +1228,20 @@ static inline bool snd_soc_codec_is_active(struct snd_soc_codec *codec)
1228 return snd_soc_component_is_active(&codec->component); 1228 return snd_soc_component_is_active(&codec->component);
1229} 1229}
1230 1230
1231/**
1232 * snd_soc_kcontrol_codec() - Returns the CODEC that registered the control
1233 * @kcontrol: The control for which to get the CODEC
1234 *
1235 * Note: This function will only work correctly if the control has been
1236 * registered with snd_soc_add_codec_controls() or via table based setup of
1237 * snd_soc_codec_driver. Otherwise the behavior is undefined.
1238 */
1239static inline struct snd_soc_codec *snd_soc_kcontrol_codec(
1240 struct snd_kcontrol *kcontrol)
1241{
1242 return snd_kcontrol_chip(kcontrol);
1243}
1244
1231int snd_soc_util_init(void); 1245int snd_soc_util_init(void);
1232void snd_soc_util_exit(void); 1246void snd_soc_util_exit(void);
1233 1247