From: Chancel Liu <chancel.liu@nxp.com>
To: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz,
tiwai@suse.com, ckeepax@opensource.cirrus.com,
luca.ceresoli@bootlin.com, ojeda@kernel.org, cmo@melexis.com,
u.kleine-koenig@pengutronix.de, xiaolei.wang@windriver.com,
steve@sk2.org, chi.minghao@zte.com.cn,
patches@opensource.cirrus.com, alsa-devel@alsa-project.org,
linux-kernel@vger.kernel.org
Cc: shengjiu.wang@nxp.com, Chancel Liu <chancel.liu@nxp.com>
Subject: [PATCH] ASoC: wm8962: Wait for updated value of WM8962_CLOCKING1 register
Date: Mon, 7 Nov 2022 14:38:18 +0800 [thread overview]
Message-ID: <20221107063818.2468193-1-chancel.liu@nxp.com> (raw)
DSPCLK_DIV field in WM8962_CLOCKING1 register is used to generate
correct frequency of LRCLK and BCLK. Sometimes the read-only value
can't be updated timely after enabling SYSCLK. This results in wrong
calculation values. Delay is introduced here to wait for newest value
from register. The time of the delay should be at least 500~1000us
according to test.
Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
---
sound/soc/codecs/wm8962.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index b4b4355c6728..563843565f68 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -2503,6 +2503,14 @@ static void wm8962_configure_bclk(struct snd_soc_component *component)
snd_soc_component_update_bits(component, WM8962_CLOCKING2,
WM8962_SYSCLK_ENA_MASK, WM8962_SYSCLK_ENA);
+ /* DSPCLK_DIV field in WM8962_CLOCKING1 register is used to generate
+ * correct frequency of LRCLK and BCLK. Sometimes the read-only value
+ * can't be updated timely after enabling SYSCLK. This results in wrong
+ * calculation values. Delay is introduced here to wait for newest
+ * value from register. The time of the delay should be at least
+ * 500~1000us according to test.
+ */
+ msleep(1);
dspclk = snd_soc_component_read(component, WM8962_CLOCKING1);
if (snd_soc_component_get_bias_level(component) != SND_SOC_BIAS_ON)
--
2.25.1
next reply other threads:[~2022-11-07 6:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-07 6:38 Chancel Liu [this message]
2022-11-07 10:10 ` Charles Keepax
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=20221107063818.2468193-1-chancel.liu@nxp.com \
--to=chancel.liu@nxp.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=chi.minghao@zte.com.cn \
--cc=ckeepax@opensource.cirrus.com \
--cc=cmo@melexis.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.ceresoli@bootlin.com \
--cc=ojeda@kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=perex@perex.cz \
--cc=shengjiu.wang@nxp.com \
--cc=steve@sk2.org \
--cc=tiwai@suse.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=xiaolei.wang@windriver.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®