linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH v2] ASoC: wm8960: Remove bitclk relax condition in wm8960_configure_sysclk
@ 2021-03-10  2:00 Shengjiu Wang
  2021-03-10 13:24 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Shengjiu Wang @ 2021-03-10  2:00 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, shengjiu.wang, ckeepax,
	kuninori.morimoto.gx, gustavoars, pierre-louis.bossart,
	daniel.baluta, patches, alsa-devel, linux-kernel

The call sequence in wm8960_configure_clocking is

   ret = wm8960_configure_sysclk();
   if (ret >= 0)
        goto configure_clock;

   ....

   ret = wm8960_configure_pll();

configure_clock:
   ...

wm8960_configure_sysclk is called before wm8960_configure_pll, as
there is bitclk relax on both functions, so wm8960_configure_sysclk
always return success, then wm8960_configure_pll() never be called.

With this case:
aplay -Dhw:0,0 -d 5 -r 48000 -f S24_LE -c 2 audio48k24b2c.wav
the required bitclk is 48000 * 24 * 2 = 2304000, bitclk got from
wm8960_configure_sysclk is 3072000, but if go to wm8960_configure_pll.
it can get correct bitclk 2304000.

So bitclk relax condition should be removed in wm8960_configure_sysclk,
then wm8960_configure_pll can be called, and there is also bitclk relax
function in wm8960_configure_pll.

Fixes: 3c01b9ee2ab9 ("ASoC: codec: wm8960: Relax bit clock computation")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
changes in resend v2
- Add acked-by Charles

changes in v2:
- Find the real reason for the case, just patially remove bitclk relax

 sound/soc/codecs/wm8960.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index df351519a3a6..847ca16b9841 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -608,10 +608,6 @@ static const int bclk_divs[] = {
  *		- lrclk      = sysclk / dac_divs
  *		- 10 * bclk  = sysclk / bclk_divs
  *
- *	If we cannot find an exact match for (sysclk, lrclk, bclk)
- *	triplet, we relax the bclk such that bclk is chosen as the
- *	closest available frequency greater than expected bclk.
- *
  * @wm8960: codec private data
  * @mclk: MCLK used to derive sysclk
  * @sysclk_idx: sysclk_divs index for found sysclk
@@ -629,7 +625,7 @@ int wm8960_configure_sysclk(struct wm8960_priv *wm8960, int mclk,
 {
 	int sysclk, bclk, lrclk;
 	int i, j, k;
-	int diff, closest = mclk;
+	int diff;
 
 	/* marker for no match */
 	*bclk_idx = -1;
@@ -653,12 +649,6 @@ int wm8960_configure_sysclk(struct wm8960_priv *wm8960, int mclk,
 					*bclk_idx = k;
 					break;
 				}
-				if (diff > 0 && closest > diff) {
-					*sysclk_idx = i;
-					*dac_idx = j;
-					*bclk_idx = k;
-					closest = diff;
-				}
 			}
 			if (k != ARRAY_SIZE(bclk_divs))
 				break;
-- 
2.27.0


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

* Re: [RESEND PATCH v2] ASoC: wm8960: Remove bitclk relax condition in wm8960_configure_sysclk
  2021-03-10  2:00 [RESEND PATCH v2] ASoC: wm8960: Remove bitclk relax condition in wm8960_configure_sysclk Shengjiu Wang
@ 2021-03-10 13:24 ` Mark Brown
  2021-03-24  1:44   ` Shengjiu Wang
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2021-03-10 13:24 UTC (permalink / raw)
  To: Shengjiu Wang
  Cc: lgirdwood, perex, tiwai, ckeepax, kuninori.morimoto.gx,
	gustavoars, pierre-louis.bossart, daniel.baluta, patches,
	alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 173 bytes --]

On Wed, Mar 10, 2021 at 10:00:42AM +0800, Shengjiu Wang wrote:

> changes in resend v2
> - Add acked-by Charles

Please don't resend for acks, it just makes for more noise.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [RESEND PATCH v2] ASoC: wm8960: Remove bitclk relax condition in wm8960_configure_sysclk
  2021-03-10 13:24 ` Mark Brown
@ 2021-03-24  1:44   ` Shengjiu Wang
  2021-03-24 19:48     ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Shengjiu Wang @ 2021-03-24  1:44 UTC (permalink / raw)
  To: Mark Brown
  Cc: Shengjiu Wang, Pierre-Louis Bossart, alsa-devel, Charles Keepax,
	Kuninori Morimoto, Liam Girdwood, patches, gustavoars,
	Takashi Iwai, daniel.baluta, linux-kernel

Hi Mark

On Wed, Mar 10, 2021 at 9:26 PM Mark Brown <broonie@kernel.org> wrote:
>
> On Wed, Mar 10, 2021 at 10:00:42AM +0800, Shengjiu Wang wrote:
>
> > changes in resend v2
> > - Add acked-by Charles
>
> Please don't resend for acks, it just makes for more noise.

ok, but could you please review this patch?

Best regards
wang shengjiu

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

* Re: [RESEND PATCH v2] ASoC: wm8960: Remove bitclk relax condition in wm8960_configure_sysclk
  2021-03-24  1:44   ` Shengjiu Wang
@ 2021-03-24 19:48     ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2021-03-24 19:48 UTC (permalink / raw)
  To: Shengjiu Wang
  Cc: Shengjiu Wang, Pierre-Louis Bossart, alsa-devel, Charles Keepax,
	Kuninori Morimoto, Liam Girdwood, patches, gustavoars,
	Takashi Iwai, daniel.baluta, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 374 bytes --]

On Wed, Mar 24, 2021 at 09:44:26AM +0800, Shengjiu Wang wrote:
> On Wed, Mar 10, 2021 at 9:26 PM Mark Brown <broonie@kernel.org> wrote:

> > Please don't resend for acks, it just makes for more noise.

> ok, but could you please review this patch?

I already had it queued when you resent your patch, that's part of why I
was complaining about the resend.  It's in git now.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2021-03-24 19:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10  2:00 [RESEND PATCH v2] ASoC: wm8960: Remove bitclk relax condition in wm8960_configure_sysclk Shengjiu Wang
2021-03-10 13:24 ` Mark Brown
2021-03-24  1:44   ` Shengjiu Wang
2021-03-24 19:48     ` 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).