alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Mark Brown <broonie@kernel.org>, Liam Girdwood <lgirdwood@gmail.com>
Cc: Vinod Koul <vinod.koul@intel.com>,
	alsa-devel@alsa-project.org, Lars-Peter Clausen <lars@metafoo.de>,
	"Subhransu S. Prusty" <subhransu.s.prusty@intel.com>
Subject: [PATCH 4/4] ASoC: Remove table based DAPM/control setup support from snd_soc_platform_driver
Date: Wed, 20 Aug 2014 13:08:49 +0200	[thread overview]
Message-ID: <1408532929-26978-5-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1408532929-26978-1-git-send-email-lars@metafoo.de>

There are no users left and new users should rather use the component_driver
struct embedded in the snd_soc_platform_driver struct to do this. E.g.:

static const struct snd_soc_platform_driver foobar_driver = {
	.component_driver = {
		.dapm_widgets = ...,
		.num_dapm_widgets = ...,
		...,
	},
	...
};

instead of

static const struct snd_soc_platform_driver foobar_driver = {
	.dapm_widgets = ...,
	.num_dapm_widgets = ...,
	...
};

This also allows us to remove the steal_sibling_dai_widgets hack.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 include/sound/soc.h  |  9 --------
 sound/soc/soc-core.c | 58 ++++++----------------------------------------------
 2 files changed, 6 insertions(+), 61 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index e6440d8..3f07a1e 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -764,7 +764,6 @@ struct snd_soc_component {
 	unsigned int num_dapm_widgets;
 	const struct snd_soc_dapm_route *dapm_routes;
 	unsigned int num_dapm_routes;
-	bool steal_sibling_dai_widgets;
 	struct snd_soc_codec *codec;
 
 	int (*probe)(struct snd_soc_component *);
@@ -869,14 +868,6 @@ 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 e982cb0..c3a63a1 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1089,7 +1089,6 @@ static int soc_probe_component(struct snd_soc_card *card,
 	struct snd_soc_component *component)
 {
 	struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
-	struct snd_soc_component *dai_component, *component2;
 	struct snd_soc_dai *dai;
 	int ret;
 
@@ -1116,44 +1115,12 @@ static int soc_probe_component(struct snd_soc_card *card,
 		}
 	}
 
-	/*
-	 * This is rather ugly, but certain platforms expect that the DAPM
-	 * widgets for the DAIs for components with the same parent device are
-	 * created in the platforms DAPM context. Until that is fixed we need to
-	 * keep this.
-	 */
-	if (component->steal_sibling_dai_widgets) {
-		dai_component = NULL;
-		list_for_each_entry(component2, &component_list, list) {
-			if (component == component2)
-				continue;
-
-			if (component2->dev == component->dev &&
-			    !list_empty(&component2->dai_list)) {
-				dai_component = component2;
-				break;
-			}
-		}
-	} else {
-		dai_component = component;
-		list_for_each_entry(component2, &component_list, list) {
-			if (component2->dev == component->dev &&
-			    component2->steal_sibling_dai_widgets) {
-				dai_component = NULL;
-				break;
-			}
-		}
-	}
-
-	if (dai_component) {
-		list_for_each_entry(dai, &dai_component->dai_list, list) {
-			snd_soc_dapm_new_dai_widgets(dapm, dai);
-			if (ret != 0) {
-				dev_err(component->dev,
-					"Failed to create DAI widgets %d\n",
-					ret);
-				goto err_probe;
-			}
+	list_for_each_entry(dai, &component->dai_list, list) {
+		ret = snd_soc_dapm_new_dai_widgets(dapm, dai);
+		if (ret != 0) {
+			dev_err(component->dev,
+				"Failed to create DAI widgets %d\n", ret);
+			goto err_probe;
 		}
 	}
 
@@ -4165,19 +4132,6 @@ int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform,
 
 	platform->dev = dev;
 	platform->driver = platform_drv;
-	if (platform_drv->controls) {
-		platform->component.controls = platform_drv->controls;
-		platform->component.num_controls = platform_drv->num_controls;
-	}
-	if (platform_drv->dapm_widgets) {
-		platform->component.dapm_widgets = platform_drv->dapm_widgets;
-		platform->component.num_dapm_widgets = platform_drv->num_dapm_widgets;
-		platform->component.steal_sibling_dai_widgets = true;
-	}
-	if (platform_drv->dapm_routes) {
-		platform->component.dapm_routes = platform_drv->dapm_routes;
-		platform->component.num_dapm_routes = platform_drv->num_dapm_routes;
-	}
 
 	if (platform_drv->probe)
 		platform->component.probe = snd_soc_platform_drv_probe;
-- 
1.8.0

  parent reply	other threads:[~2014-08-20 11:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-20 11:08 [PATCH 0/4] ASoC: sst-haswell-pcm: Move controls and DAPM elements to component Lars-Peter Clausen
2014-08-20 11:08 ` [PATCH 1/4] ASoC: Add snd_soc_component_{get, set}_drvdata() Lars-Peter Clausen
2014-09-03 12:22   ` Vinod Koul
2014-09-03 19:06     ` Lars-Peter Clausen
2014-09-04  6:33       ` Vinod Koul
2014-08-20 11:08 ` [PATCH 2/4] ASoC: sst-haswell-pcm: Alloc state struct in driver probe() Lars-Peter Clausen
2014-08-20 11:08 ` [PATCH 3/4] ASoC: sst-haswell-pcm: Move controls and DAPM elements to component Lars-Peter Clausen
2014-08-20 11:08 ` Lars-Peter Clausen [this message]
2014-09-06 13:48 ` [PATCH 0/4] " 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=1408532929-26978-5-git-send-email-lars@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=subhransu.s.prusty@intel.com \
    --cc=vinod.koul@intel.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;
as well as URLs for NNTP newsgroup(s).