ASoC: dapm: Add snd_soc_dapm_kcontrol_widget()
authorMythri P K <mythri.p.k@intel.com>
Tue, 20 Oct 2015 17:00:08 +0000 (22:30 +0530)
committerMark Brown <broonie@kernel.org>
Thu, 22 Oct 2015 14:23:23 +0000 (15:23 +0100)
Given a kcontrol, we may want to access the parent widget
and it's associated data. So export function to return it.

Signed-off-by: Mythri P K <mythri.p.k@intel.com>
Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-dapm.h
sound/soc/soc-dapm.c

index 5abba037d2456fc2616ae5df1270fd928299c1de..7855cfe46b69a044040f9ac5be92591e33af1799 100644 (file)
@@ -451,6 +451,9 @@ int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
 struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm(
        struct snd_kcontrol *kcontrol);
 
+struct snd_soc_dapm_widget *snd_soc_dapm_kcontrol_widget(
+               struct snd_kcontrol *kcontrol);
+
 int snd_soc_dapm_force_bias_level(struct snd_soc_dapm_context *dapm,
        enum snd_soc_bias_level level);
 
index a28d6a10bad0a139e63a4660ccdeefa97c609208..38281c2325ffef3f8581cc2bae80a338aa227942 100644 (file)
@@ -508,6 +508,18 @@ static bool dapm_kcontrol_set_value(const struct snd_kcontrol *kcontrol,
        return true;
 }
 
+/**
+ * snd_soc_dapm_kcontrol_widget() - Returns the widget associated to a
+ *   kcontrol
+ * @kcontrol: The kcontrol
+ */
+struct snd_soc_dapm_widget *snd_soc_dapm_kcontrol_widget(
+                               struct snd_kcontrol *kcontrol)
+{
+       return dapm_kcontrol_get_wlist(kcontrol)->widgets[0];
+}
+EXPORT_SYMBOL_GPL(snd_soc_dapm_kcontrol_widget);
+
 /**
  * snd_soc_dapm_kcontrol_dapm() - Returns the dapm context associated to a
  *  kcontrol