All of lore.kernel.org
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: <broonie@kernel.org>
Cc: patches@opensource.cirrus.com, alsa-devel@alsa-project.org,
	david.rhodes@cirrus.com, lgirdwood@gmail.com, tiwai@suse.com
Subject: [PATCH 3/8] ASoC: cs35l41: Correct DSP power down
Date: Wed, 5 Jan 2022 11:30:21 +0000	[thread overview]
Message-ID: <20220105113026.18955-4-ckeepax@opensource.cirrus.com> (raw)
In-Reply-To: <20220105113026.18955-1-ckeepax@opensource.cirrus.com>

The wm_adsp_event should be called before the early_event on power
down, event stops the core running and early_event then powers down
the core. Additionally, the core should only be stopped if it was
actually running in the first place.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
 sound/soc/codecs/cs35l41.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/cs35l41.c b/sound/soc/codecs/cs35l41.c
index 980294c1bcdba..05839fabf97bc 100644
--- a/sound/soc/codecs/cs35l41.c
+++ b/sound/soc/codecs/cs35l41.c
@@ -181,17 +181,21 @@ static SOC_ENUM_SINGLE_DECL(pcm_sft_ramp,
 static int cs35l41_dsp_preload_ev(struct snd_soc_dapm_widget *w,
 				  struct snd_kcontrol *kcontrol, int event)
 {
+	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
+	struct cs35l41_private *cs35l41 = snd_soc_component_get_drvdata(component);
 	int ret;
 
 	switch (event) {
 	case SND_SOC_DAPM_PRE_PMU:
 		return wm_adsp_early_event(w, kcontrol, event);
 	case SND_SOC_DAPM_PRE_PMD:
-		ret = wm_adsp_early_event(w, kcontrol, event);
-		if (ret)
-			return ret;
+		if (cs35l41->dsp.cs_dsp.running) {
+			ret = wm_adsp_event(w, kcontrol, event);
+			if (ret)
+				return ret;
+		}
 
-		return wm_adsp_event(w, kcontrol, event);
+		return wm_adsp_early_event(w, kcontrol, event);
 	default:
 		return 0;
 	}
-- 
2.11.0


  parent reply	other threads:[~2022-01-05 11:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-05 11:30 [PATCH 0/8] Add low power hibernation support to cs35l41 Charles Keepax
2022-01-05 11:30 ` [PATCH 1/8] ASoC: cs35l41: Add cs35l51/53 IDs Charles Keepax
2022-01-05 11:30 ` [PATCH 2/8] ASoC: cs35l41: Remove incorrect comment Charles Keepax
2022-01-05 11:30 ` Charles Keepax [this message]
2022-01-05 11:30 ` [PATCH 4/8] ASoC: cs35l41: Correct handling of some registers in the cache Charles Keepax
2022-01-05 11:30 ` [PATCH 5/8] firmware: cs_dsp: Clear core reset for cache Charles Keepax
2022-01-05 11:30 ` [PATCH 6/8] ASoC: wm_adsp: Add support for "toggle" preloaders Charles Keepax
2022-01-05 11:30 ` [PATCH 7/8] ASoC: cs35l41: Update handling of test key registers Charles Keepax
2022-01-05 11:30 ` [PATCH 8/8] ASoC: cs35l41: Add support for hibernate memory retention mode Charles Keepax
2022-01-05 12:03 ` [PATCH 0/8] Add low power hibernation support to cs35l41 Takashi Iwai
2022-01-05 13:05   ` Charles Keepax
2022-01-05 14:07     ` Takashi Iwai
2022-01-05 14:23       ` Charles Keepax
2022-01-05 14:30 ` Mark Brown
2022-01-05 14:44   ` Charles Keepax
2022-01-05 16:12 ` 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=20220105113026.18955-4-ckeepax@opensource.cirrus.com \
    --to=ckeepax@opensource.cirrus.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=david.rhodes@cirrus.com \
    --cc=lgirdwood@gmail.com \
    --cc=patches@opensource.cirrus.com \
    --cc=tiwai@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.