diff mbox

[v2,2/2] ASoC: dapm: Add a helper to get the platform for DAPM kcontrol

Message ID 1401357817-17942-2-git-send-email-vinod.koul@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vinod Koul May 29, 2014, 10:03 a.m. UTC
From: Subhransu S. Prusty <subhransu.s.prusty@intel.com>

commit eee5d7f9 - "ASoC: dapm: Add a helper to get the CODEC for DAPM kcontrol"
introduced helper for getting codec for DAPM kcontrol. For DSPs we need similar
method to get the platform pointer while handling the widgets.

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 include/sound/soc-dapm.h |    2 ++
 sound/soc/soc-dapm.c     |   11 +++++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)

Comments

Mark Brown June 1, 2014, 7:28 p.m. UTC | #1
On Thu, May 29, 2014 at 03:33:37PM +0530, Vinod Koul wrote:
> From: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
> 
> commit eee5d7f9 - "ASoC: dapm: Add a helper to get the CODEC for DAPM kcontrol"
> introduced helper for getting codec for DAPM kcontrol. For DSPs we need similar
> method to get the platform pointer while handling the widgets.

This is fine if we need it but hopefully soon we'll be able to just use
a component for everything instead of a platform and so it won't be
needed at all so I'd rather wait until there's a user.
diff mbox

Patch

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index abda467..247cd5e 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -459,6 +459,8 @@  int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
 	struct snd_soc_dapm_widget_list **list);
 
 struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(struct snd_kcontrol *kcontrol);
+struct snd_soc_platform *snd_soc_dapm_kcontrol_platform(
+		struct snd_kcontrol *kcontrol);
 
 /* dapm widget types */
 enum snd_soc_dapm_type {
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index d831e73..8a4a733 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -362,6 +362,17 @@  struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(struct snd_kcontrol *kcontrol)
 }
 EXPORT_SYMBOL_GPL(snd_soc_dapm_kcontrol_codec);
 
+/**
+ * snd_soc_dapm_kcontrol_platform() - Returns the platform associated to a kcontrol
+ * @kcontrol: The kcontrol
+ */
+struct snd_soc_platform *snd_soc_dapm_kcontrol_platform(
+		struct snd_kcontrol *kcontrol)
+{
+	return dapm_kcontrol_get_wlist(kcontrol)->widgets[0]->platform;
+}
+EXPORT_SYMBOL_GPL(snd_soc_dapm_kcontrol_platform);
+
 static void dapm_reset(struct snd_soc_card *card)
 {
 	struct snd_soc_dapm_widget *w;