ASoC: add snd_soc_dapm_kcontrol_component()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 6 Nov 2017 01:49:06 +0000 (01:49 +0000)
committerMark Brown <broonie@kernel.org>
Wed, 8 Nov 2017 21:19:39 +0000 (21:19 +0000)
snd_soc_dapm_kcontrol_codec() (= for Codec) will be removed soon.
This patch Component version of it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc.h

index 4961f4455b6587547e5d7f3948e4d39d632271c0..0668cbd9f0b525b3b7654775621a14b7e83a916d 100644 (file)
@@ -1524,6 +1524,19 @@ static inline struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(
        return snd_soc_dapm_to_codec(snd_soc_dapm_kcontrol_dapm(kcontrol));
 }
 
+/**
+ * snd_soc_dapm_kcontrol_component() - Returns the component associated to a kcontrol
+ * @kcontrol: The kcontrol
+ *
+ * This function must only be used on DAPM contexts that are known to be part of
+ * a COMPONENT (e.g. in a COMPONENT driver). Otherwise the behavior is undefined.
+ */
+static inline struct snd_soc_component *snd_soc_dapm_kcontrol_component(
+       struct snd_kcontrol *kcontrol)
+{
+       return snd_soc_dapm_to_component(snd_soc_dapm_kcontrol_dapm(kcontrol));
+}
+
 /* codec IO */
 unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
 int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg,