From: niklas.morberg@axis.com, Carlsson@axis.com
To: unlisted-recipients:; (no To-header on input)
Cc: <niklasc@axis.com>, Lars-Peter Clausen <lars@metafoo.de>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>, <alsa-devel@alsa-project.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH] ASoC: adau1761: Ensure DSP_RUN and DSP_ENABLE are disabled
Date: Thu, 29 Nov 2018 08:21:44 +0100 [thread overview]
Message-ID: <20181129072144.16208-1-niklasc@axis.com> (raw)
From: Niklas Carlsson <niklasc@axis.com>
DSP_RUN and DSP_ENABLE needs to be disabled during FW load. This is not
a problem after power-cycling but for soft reboots.
Signed-off-by: Niklas Carlsson <niklasc@axis.com>
---
sound/soc/codecs/adau1761.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/adau1761.c b/sound/soc/codecs/adau1761.c
index bef3e9e74c26..3075c13bcbbc 100644
--- a/sound/soc/codecs/adau1761.c
+++ b/sound/soc/codecs/adau1761.c
@@ -460,8 +460,35 @@ static int adau1761_set_bias_level(struct snd_soc_component *component,
regmap_update_bits(adau->regmap, ADAU17X1_CLOCK_CONTROL,
ADAU17X1_CLOCK_CONTROL_SYSCLK_EN,
ADAU17X1_CLOCK_CONTROL_SYSCLK_EN);
- if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF)
+ if (snd_soc_component_get_bias_level(component) ==
+ SND_SOC_BIAS_OFF) {
+ /*
+ * When going OFF -> STANDBY, the device can be in two
+ * states:
+ * 1) Power-cycled and reset
+ * 2) Soft reboot
+ * In the case of soft reboot, we need to sync the HW
+ * registers even if our regmap reports default values.
+ * Marking the cache as dirty ensures that both cases
+ * are handled.
+ */
+ regcache_mark_dirty(adau->regmap);
regcache_sync(adau->regmap);
+ /*
+ * In order for FW to load correctly, the device needs
+ * DSP_RUN and DSP_ENABLE to be 0. This might not be the
+ * case for soft reboots. Ensure that DSP_RUN and
+ * DSP_ENABLE is 0 by bypassing the cache and write
+ * directly to HW when going OFF -> STANDBY.
+ */
+ if (adau17x1_has_dsp(adau)) {
+ regcache_cache_bypass(adau->regmap, true);
+ regmap_write(adau->regmap, ADAU17X1_DSP_RUN, 0);
+ regmap_write(adau->regmap,
+ ADAU17X1_DSP_ENABLE, 0);
+ regcache_cache_bypass(adau->regmap, false);
+ }
+ }
break;
case SND_SOC_BIAS_OFF:
regmap_update_bits(adau->regmap, ADAU17X1_CLOCK_CONTROL,
--
2.11.0
next reply other threads:[~2018-11-29 7:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-29 7:21 niklas.morberg, Carlsson [this message]
2018-11-29 11:57 ` kbuild test robot
2018-11-29 12:51 ` kbuild test robot
2018-11-29 10:05 Niklas Carlsson
2018-11-30 0:45 ` kbuild test robot
2018-12-06 18:03 ` kbuild test robot
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=20181129072144.16208-1-niklasc@axis.com \
--to=niklas.morberg@axis.com \
--cc=Carlsson@axis.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lars@metafoo.de \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=niklasc@axis.com \
--cc=perex@perex.cz \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®