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: alsa-devel@alsa-project.org, Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH 09/10] ASoC: dapm: Delay w->power update until the changes are written
Date: Mon, 29 Jul 2013 17:14:03 +0200	[thread overview]
Message-ID: <1375110845-8069-9-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1375110845-8069-1-git-send-email-lars@metafoo.de>

Wait with updating the widgets power field until the changes are actually
written to the hardware in dapm_seq_run_coalesced(). This will allow us to query
the current hardware state between calling dapm_power_one_widget() and actually
writing the new power state to hardware.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 sound/soc/soc-dapm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index b811a27..9abb3b2 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -293,6 +293,7 @@ static void dapm_reset(struct snd_soc_card *card)
 	memset(&card->dapm_stats, 0, sizeof(card->dapm_stats));
 
 	list_for_each_entry(w, &card->widgets, list) {
+		w->new_power = w->power;
 		w->power_checked = false;
 		w->inputs = -1;
 		w->outputs = -1;
@@ -1340,7 +1341,7 @@ static void dapm_seq_check_event(struct snd_soc_card *card,
 		return;
 	}
 
-	if (w->power != power)
+	if (w->new_power != power)
 		return;
 
 	if (w->event && (w->event_flags & event)) {
@@ -1369,6 +1370,7 @@ static void dapm_seq_run_coalesced(struct snd_soc_card *card,
 
 	list_for_each_entry(w, pending, power_list) {
 		BUG_ON(reg != w->reg);
+		w->power = w->new_power;
 
 		mask |= w->mask << w->shift;
 		if (w->power)
@@ -1676,8 +1678,6 @@ static void dapm_widget_set_power(struct snd_soc_dapm_widget *w, bool power,
 		dapm_seq_insert(w, up_list, true);
 	else
 		dapm_seq_insert(w, down_list, false);
-
-	w->power = power;
 }
 
 static void dapm_power_one_widget(struct snd_soc_dapm_widget *w,
@@ -1752,7 +1752,7 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event)
 			break;
 		}
 
-		if (w->power) {
+		if (w->new_power) {
 			d = w->dapm;
 
 			/* Supplies and micbiases only bring the
-- 
1.8.0

  parent reply	other threads:[~2013-07-29 15:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-29 15:13 [PATCH 01/10] ASoC: dapm: Move snd_soc_dapm_update from dapm context to card Lars-Peter Clausen
2013-07-29 15:13 ` [PATCH 02/10] ASoC: dapm: Pass card instead of dapm context to dapm_power_widgets() Lars-Peter Clausen
2013-07-29 15:13 ` [PATCH 03/10] ASoC: dapm: Add a helper to get the CODEC for DAPM kcontrol Lars-Peter Clausen
2013-07-29 15:13 ` [PATCH 04/10] ASoC: dapm: Wrap kcontrol widget list access Lars-Peter Clausen
2013-07-29 15:13 ` [PATCH 05/10] ASoC: dapm: Move 'value' field from widget to control Lars-Peter Clausen
2013-07-29 15:14 ` [PATCH 06/10] ASoC: dapm: Keep a list of paths per kcontrol Lars-Peter Clausen
2013-07-29 15:14 ` [PATCH 07/10] ASoC: dapm: Make widget power register settings more flexible Lars-Peter Clausen
2013-07-29 15:14 ` [PATCH 08/10] ASoC: dapm: Add snd_soc_dapm_add_path() helper function Lars-Peter Clausen
2013-07-29 17:45   ` Mark Brown
2013-07-30 11:35     ` Lars-Peter Clausen
2013-07-29 15:14 ` Lars-Peter Clausen [this message]
2013-07-29 15:14 ` [PATCH 10/10] ASoC: dapm: Implement mixer input auto-disable Lars-Peter Clausen
2013-08-01 10:48   ` Mark Brown
2013-08-01 19:24     ` Lars-Peter Clausen
2013-08-02  9:53       ` Mark Brown
2013-08-02 10:22   ` 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=1375110845-8069-9-git-send-email-lars@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.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).