alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: dapm: Power off all widgets in the snd_soc_dapm_shutdown
@ 2014-03-01 16:04 Xiang Xiao
  2014-03-01 16:04 ` [PATCH 2/2] ASoC: dapm: Reorder the bias update sequence Xiang Xiao
  2014-03-03  4:41 ` [PATCH 1/2] ASoC: dapm: Power off all widgets in the snd_soc_dapm_shutdown Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Xiang Xiao @ 2014-03-01 16:04 UTC (permalink / raw)
  To: broonie, lgirdwood; +Cc: alsa-devel, xiaoxiang

The widgets generated by the machine driver need to power off too.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
---
 sound/soc/soc-dapm.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 3651a37..00ed0e9 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3899,7 +3899,7 @@ void snd_soc_dapm_free(struct snd_soc_dapm_context *dapm)
 }
 EXPORT_SYMBOL_GPL(snd_soc_dapm_free);
 
-static void soc_dapm_shutdown_codec(struct snd_soc_dapm_context *dapm)
+static void soc_dapm_shutdown_dapm(struct snd_soc_dapm_context *dapm)
 {
 	struct snd_soc_card *card = dapm->card;
 	struct snd_soc_dapm_widget *w;
@@ -3939,12 +3939,12 @@ static void soc_dapm_shutdown_codec(struct snd_soc_dapm_context *dapm)
  */
 void snd_soc_dapm_shutdown(struct snd_soc_card *card)
 {
-	struct snd_soc_codec *codec;
+	struct snd_soc_dapm_context *dapm;
 
-	list_for_each_entry(codec, &card->codec_dev_list, card_list) {
-		soc_dapm_shutdown_codec(&codec->dapm);
-		if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY)
-			snd_soc_dapm_set_bias_level(&codec->dapm,
+	list_for_each_entry(dapm, &card->dapm_list, list) {
+		soc_dapm_shutdown_dapm(dapm);
+		if (dapm->bias_level == SND_SOC_BIAS_STANDBY)
+			snd_soc_dapm_set_bias_level(dapm,
 						    SND_SOC_BIAS_OFF);
 	}
 }
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] ASoC: dapm: Reorder the bias update sequence
  2014-03-01 16:04 [PATCH 1/2] ASoC: dapm: Power off all widgets in the snd_soc_dapm_shutdown Xiang Xiao
@ 2014-03-01 16:04 ` Xiang Xiao
  2014-03-03  4:48   ` Mark Brown
  2014-03-03  4:41 ` [PATCH 1/2] ASoC: dapm: Power off all widgets in the snd_soc_dapm_shutdown Mark Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Xiang Xiao @ 2014-03-01 16:04 UTC (permalink / raw)
  To: broonie, lgirdwood; +Cc: alsa-devel, xiaoxiang

The new sequence ensure that dapm_pre_sequence_async work on
the card before all codecs and dapm_post_sequence_async work
on the card after all codecs.
So the machine driver could utilize the determinate sequence
to do the gloabl setup and teardown in the right place.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
---
 sound/soc/soc-dapm.c | 37 ++++++++++++++++++++++++++-----------
 1 file changed, 26 insertions(+), 11 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 00ed0e9..0d8ba30 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1825,10 +1825,14 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event)
 
 	trace_snd_soc_dapm_walk_done(card);
 
-	/* Run all the bias changes in parallel */
-	list_for_each_entry(d, &card->dapm_list, list)
-		async_schedule_domain(dapm_pre_sequence_async, d,
-					&async_domain);
+	/* Run card bias changes at first */
+	dapm_pre_sequence_async(&card->dapm, 0);
+	/* Run other bias changes in parallel */
+	list_for_each_entry(d, &card->dapm_list, list) {
+		if (d != &card->dapm)
+			async_schedule_domain(dapm_pre_sequence_async, d,
+						&async_domain);
+	}
 	async_synchronize_full_domain(&async_domain);
 
 	list_for_each_entry(w, &down_list, power_list) {
@@ -1848,10 +1852,14 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event)
 	dapm_seq_run(card, &up_list, event, true);
 
 	/* Run all the bias changes in parallel */
-	list_for_each_entry(d, &card->dapm_list, list)
-		async_schedule_domain(dapm_post_sequence_async, d,
-					&async_domain);
+	list_for_each_entry(d, &card->dapm_list, list) {
+		if (d != &card->dapm)
+			async_schedule_domain(dapm_post_sequence_async, d,
+						&async_domain);
+	}
 	async_synchronize_full_domain(&async_domain);
+	/* Run card bias changes at last */
+	dapm_post_sequence_async(&card->dapm, 0);
 
 	/* do we need to notify any clients that DAPM event is complete */
 	list_for_each_entry(d, &card->dapm_list, list) {
@@ -3942,11 +3950,18 @@ void snd_soc_dapm_shutdown(struct snd_soc_card *card)
 	struct snd_soc_dapm_context *dapm;
 
 	list_for_each_entry(dapm, &card->dapm_list, list) {
-		soc_dapm_shutdown_dapm(dapm);
-		if (dapm->bias_level == SND_SOC_BIAS_STANDBY)
-			snd_soc_dapm_set_bias_level(dapm,
-						    SND_SOC_BIAS_OFF);
+		if (dapm != &card->dapm) {
+			soc_dapm_shutdown_dapm(dapm);
+			if (dapm->bias_level == SND_SOC_BIAS_STANDBY)
+				snd_soc_dapm_set_bias_level(dapm,
+							    SND_SOC_BIAS_OFF);
+		}
 	}
+
+	soc_dapm_shutdown_dapm(&card->dapm);
+	if (card->dapm.bias_level == SND_SOC_BIAS_STANDBY)
+		snd_soc_dapm_set_bias_level(&card->dapm,
+					    SND_SOC_BIAS_OFF);
 }
 
 /* Module information */
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] ASoC: dapm: Power off all widgets in the snd_soc_dapm_shutdown
  2014-03-01 16:04 [PATCH 1/2] ASoC: dapm: Power off all widgets in the snd_soc_dapm_shutdown Xiang Xiao
  2014-03-01 16:04 ` [PATCH 2/2] ASoC: dapm: Reorder the bias update sequence Xiang Xiao
@ 2014-03-03  4:41 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2014-03-03  4:41 UTC (permalink / raw)
  To: Xiang Xiao; +Cc: alsa-devel, lgirdwood


[-- Attachment #1.1: Type: text/plain, Size: 147 bytes --]

On Sun, Mar 02, 2014 at 12:04:02AM +0800, Xiang Xiao wrote:
> The widgets generated by the machine driver need to power off too.

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] ASoC: dapm: Reorder the bias update sequence
  2014-03-01 16:04 ` [PATCH 2/2] ASoC: dapm: Reorder the bias update sequence Xiang Xiao
@ 2014-03-03  4:48   ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2014-03-03  4:48 UTC (permalink / raw)
  To: Xiang Xiao; +Cc: alsa-devel, lgirdwood


[-- Attachment #1.1: Type: text/plain, Size: 357 bytes --]

On Sun, Mar 02, 2014 at 12:04:03AM +0800, Xiang Xiao wrote:
> The new sequence ensure that dapm_pre_sequence_async work on
> the card before all codecs and dapm_post_sequence_async work
> on the card after all codecs.
> So the machine driver could utilize the determinate sequence
> to do the gloabl setup and teardown in the right place.

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-03-03  4:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-01 16:04 [PATCH 1/2] ASoC: dapm: Power off all widgets in the snd_soc_dapm_shutdown Xiang Xiao
2014-03-01 16:04 ` [PATCH 2/2] ASoC: dapm: Reorder the bias update sequence Xiang Xiao
2014-03-03  4:48   ` Mark Brown
2014-03-03  4:41 ` [PATCH 1/2] ASoC: dapm: Power off all widgets in the snd_soc_dapm_shutdown Mark Brown

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).