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>
Subject: [PATCH v2 07/11] ASoC: Use component DAPM context for platforms
Date: Mon, 16 Jun 2014 18:13:07 +0200	[thread overview]
Message-ID: <1402935191-18398-8-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1402935191-18398-1-git-send-email-lars@metafoo.de>

The snd_soc_platform dapm field is not accessed outside of the ASoC core. Switch
it over to using the snd_soc_component DAPM context.

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

diff --git a/include/sound/soc.h b/include/sound/soc.h
index a21dfec..84ebc07 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -862,8 +862,6 @@ struct snd_soc_platform {
 
 	struct snd_soc_component component;
 
-	struct snd_soc_dapm_context dapm;
-
 #ifdef CONFIG_DEBUG_FS
 	struct dentry *debugfs_platform_root;
 #endif
@@ -1203,7 +1201,7 @@ static inline struct snd_soc_codec *snd_soc_dapm_to_codec(
 static inline struct snd_soc_platform *snd_soc_dapm_to_platform(
 	struct snd_soc_dapm_context *dapm)
 {
-	return container_of(dapm, struct snd_soc_platform, dapm);
+	return snd_soc_component_to_platform(snd_soc_dapm_to_component(dapm));
 }
 
 /**
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index f519a9f..711e99c 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -314,7 +314,7 @@ static void soc_init_platform_debugfs(struct snd_soc_platform *platform)
 		return;
 	}
 
-	snd_soc_dapm_debugfs_init(&platform->dapm,
+	snd_soc_dapm_debugfs_init(&platform->component.dapm,
 		platform->debugfs_platform_root);
 }
 
@@ -974,7 +974,7 @@ static int soc_remove_platform(struct snd_soc_platform *platform)
 	}
 
 	/* Make sure all DAPM widgets are freed */
-	snd_soc_dapm_free(&platform->dapm);
+	snd_soc_dapm_free(&platform->component.dapm);
 
 	soc_cleanup_platform_debugfs(platform);
 	platform->probed = 0;
@@ -1210,7 +1210,7 @@ static int soc_probe_platform(struct snd_soc_card *card,
 	struct snd_soc_dai *dai;
 
 	platform->card = card;
-	platform->dapm.card = card;
+	platform->component.dapm.card = card;
 
 	if (!try_module_get(platform->dev->driver->owner))
 		return -ENODEV;
@@ -1218,7 +1218,7 @@ static int soc_probe_platform(struct snd_soc_card *card,
 	soc_init_platform_debugfs(platform);
 
 	if (driver->dapm_widgets)
-		snd_soc_dapm_new_controls(&platform->dapm,
+		snd_soc_dapm_new_controls(&platform->component.dapm,
 			driver->dapm_widgets, driver->num_dapm_widgets);
 
 	/* Create DAPM widgets for each DAI stream */
@@ -1226,10 +1226,11 @@ static int soc_probe_platform(struct snd_soc_card *card,
 		if (component->dev != platform->dev)
 			continue;
 		list_for_each_entry(dai, &component->dai_list, list)
-			snd_soc_dapm_new_dai_widgets(&platform->dapm, dai);
+			snd_soc_dapm_new_dai_widgets(&platform->component.dapm,
+				dai);
 	}
 
-	platform->dapm.idle_bias_off = 1;
+	platform->component.dapm.idle_bias_off = 1;
 
 	if (driver->probe) {
 		ret = driver->probe(platform);
@@ -1244,13 +1245,13 @@ static int soc_probe_platform(struct snd_soc_card *card,
 		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);
+		snd_soc_dapm_add_routes(&platform->component.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);
-	list_add(&platform->dapm.list, &card->dapm_list);
+	list_add(&platform->component.dapm.list, &card->dapm_list);
 
 	return 0;
 
@@ -4141,8 +4142,6 @@ int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform,
 {
 	int ret;
 
-	platform->component.dapm_ptr = &platform->dapm;
-
 	ret = snd_soc_component_initialize(&platform->component,
 			&platform_drv->component_driver, dev);
 	if (ret)
@@ -4150,8 +4149,8 @@ int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform,
 
 	platform->dev = dev;
 	platform->driver = platform_drv;
-	platform->dapm.platform = platform;
-	platform->dapm.stream_event = platform_drv->stream_event;
+	platform->component.dapm.platform = platform;
+	platform->component.dapm.stream_event = platform_drv->stream_event;
 	if (platform_drv->write)
 		platform->component.write = snd_soc_platform_drv_write;
 	if (platform_drv->read)
-- 
1.8.0

  parent reply	other threads:[~2014-06-16 16:13 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-16 16:13 [PATCH v2 00/11] ASoC: Add support for DAPM at the component level Lars-Peter Clausen
2014-06-16 16:13 ` [PATCH v2 01/11] ASoC: Move name_prefix from CODEC to component Lars-Peter Clausen
2014-06-21 20:03   ` Mark Brown
2014-06-16 16:13 ` [PATCH v2 02/11] ASoC: Move name and id from CODEC/platform " Lars-Peter Clausen
2014-06-21 20:04   ` Mark Brown
2014-06-16 16:13 ` [PATCH v2 03/11] ASoC: Split component registration into two steps Lars-Peter Clausen
2014-06-21 20:05   ` Mark Brown
2014-06-16 16:13 ` [PATCH v2 04/11] ASoC: Auto disconnect pins from all DAPM contexts Lars-Peter Clausen
2014-06-21 20:07   ` Mark Brown
2014-06-16 16:13 ` [PATCH v2 05/11] ASoC: Add a set_bias_level() callback to the DAPM context struct Lars-Peter Clausen
2014-06-21 20:14   ` Mark Brown
2014-06-22  5:26     ` Vinod Koul
2014-06-22 10:12       ` Mark Brown
2014-06-23  4:34         ` Vinod Koul
2014-06-23 10:08           ` Mark Brown
2014-06-21 20:34   ` Mark Brown
2014-06-16 16:13 ` [PATCH v2 06/11] ASoC: Add DAPM support at the component level Lars-Peter Clausen
2014-06-21 20:34   ` Mark Brown
2014-06-16 16:13 ` Lars-Peter Clausen [this message]
2014-06-21 20:34   ` [PATCH v2 07/11] ASoC: Use component DAPM context for platforms Mark Brown
2014-06-16 16:13 ` [PATCH v2 08/11] ASoC: Add component level stream_event() and seq_notifier() support Lars-Peter Clausen
2014-06-21 20:35   ` Mark Brown
2014-06-16 16:13 ` [PATCH v2 09/11] ASoC: Add component level set_bias_level() support Lars-Peter Clausen
2014-06-21 20:38   ` Mark Brown
2014-06-16 16:13 ` [PATCH v2 10/11] ASoC: dapm: Remove DAI DAPM context Lars-Peter Clausen
2014-06-21 20:36   ` Mark Brown
2014-06-16 16:13 ` [PATCH v2 11/11] ASoC: dapm: Remove platform field from widget and dapm context struct Lars-Peter Clausen
2014-06-21 20:36   ` 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=1402935191-18398-8-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=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).