Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Liam Girdwood <lrg@ti.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: alsa-devel@alsa-project.org, Liam Girdwood <lrg@ti.com>
Subject: [PATCH 3/3] ASoC: core - Add convenience register for platform kcontrol and DAPM
Date: Mon, 4 Jul 2011 22:10:53 +0100	[thread overview]
Message-ID: <1309813853-7142-4-git-send-email-lrg@ti.com> (raw)
In-Reply-To: <1309813853-7142-1-git-send-email-lrg@ti.com>

Allow platform probe to register platform kcontrols and DAPM just like
the CODEC probe().

Signed-off-by: Liam Girdwood <lrg@ti.com>
---
 include/sound/soc.h  |    8 ++++++++
 sound/soc/soc-core.c |   11 +++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 6ce8dc3..aa19f5a 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -651,6 +651,14 @@ struct snd_soc_platform_driver {
 	int (*pcm_new)(struct snd_soc_pcm_runtime *);
 	void (*pcm_free)(struct snd_pcm *);
 
+	/* Default control and setup, added after probe() is run */
+	const struct snd_kcontrol_new *controls;
+	int num_controls;
+	const struct snd_soc_dapm_widget *dapm_widgets;
+	int num_dapm_widgets;
+	const struct snd_soc_dapm_route *dapm_routes;
+	int num_dapm_routes;
+
 	/*
 	 * For platform caused delay reporting.
 	 * Optional.
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 36e71e9..70f4779 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -998,6 +998,10 @@ static int soc_probe_platform(struct snd_soc_card *card,
 	if (!try_module_get(platform->dev->driver->owner))
 		return -ENODEV;
 
+	if (driver->dapm_widgets)
+		snd_soc_dapm_new_controls(&platform->dapm,
+			driver->dapm_widgets, driver->num_dapm_widgets);
+
 	if (driver->probe) {
 		ret = driver->probe(platform);
 		if (ret < 0) {
@@ -1008,6 +1012,13 @@ static int soc_probe_platform(struct snd_soc_card *card,
 		}
 	}
 
+	if (driver->controls)
+		snd_soc_add_platform_controls(platform, driver->controls,
+				     driver->num_controls);
+	if (driver->dapm_routes)
+		snd_soc_dapm_add_routes(&platform->dapm, driver->dapm_routes,
+					driver->num_dapm_routes);
+
 	/* mark platform as probed and add to card platform list */
 	platform->probed = 1;
 	list_add(&platform->card_list, &card->platform_dev_list);
-- 
1.7.4.1

  parent reply	other threads:[~2011-07-04 21:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-04 21:10 [PATCH] ASoC: core - Add platform IO tracing Liam Girdwood
2011-07-04 21:10 ` [PATCH 1/3] ASoC: core - Add API call to register platform kcontrols Liam Girdwood
2011-07-04 21:10 ` [PATCH 2/3] ASoC: core - Add platform widget IO Liam Girdwood
2011-07-04 21:10 ` Liam Girdwood [this message]
2011-07-05 18:10 ` [PATCH] ASoC: core - Add platform IO tracing Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1309813853-7142-4-git-send-email-lrg@ti.com \
    --to=lrg@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox