2021-10-12 11:21:56

by Shengjiu Wang

[permalink] [raw]
Subject: [RESEND PATCH] ASoC: wm8960: Fix clock configuration on slave mode

There is a noise issue for 8kHz sample rate on slave mode.
Compared with master mode, the difference is the DACDIV
setting, after correcting the DACDIV, the noise is gone.

There is no noise issue for 48kHz sample rate, because
the default value of DACDIV is correct for 48kHz.

So wm8960_configure_clocking() should be functional for
ADC and DAC function even if it is slave mode.

In order to be compatible for old use case, just add
condition for checking that sysclk is zero with
slave mode.

Fixes: 0e50b51aa22f ("ASoC: wm8960: Let wm8960 driver configure its bit clock and frame clock")
Signed-off-by: Shengjiu Wang <[email protected]>
---
sound/soc/codecs/wm8960.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index 9e621a254392..9c6af76a60fd 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -742,7 +742,7 @@ static int wm8960_configure_clocking(struct snd_soc_component *component)
int i, j, k;
int ret;

- if (!(iface1 & (1<<6))) {
+ if (!(iface1 & (1 << 6)) && !wm8960->sysclk) {
dev_dbg(component->dev,
"Codec is slave mode, no need to configure clock\n");
return 0;
--
2.17.1


2021-10-12 11:28:57

by Mark Brown

[permalink] [raw]
Subject: Re: [RESEND PATCH] ASoC: wm8960: Fix clock configuration on slave mode

On Tue, Oct 12, 2021 at 06:54:30PM +0800, Shengjiu Wang wrote:
> There is a noise issue for 8kHz sample rate on slave mode.
> Compared with master mode, the difference is the DACDIV
> setting, after correcting the DACDIV, the noise is gone.

Charles suggested some updates to the patch to improve the error
reporting here which you don't seem to have addressed.


Attachments:
(No filename) (369.00 B)
signature.asc (499.00 B)
Download all attachments

2021-10-13 03:12:54

by Shengjiu Wang

[permalink] [raw]
Subject: Re: [RESEND PATCH] ASoC: wm8960: Fix clock configuration on slave mode

On Tue, Oct 12, 2021 at 7:26 PM Mark Brown <[email protected]> wrote:
>
> On Tue, Oct 12, 2021 at 06:54:30PM +0800, Shengjiu Wang wrote:
> > There is a noise issue for 8kHz sample rate on slave mode.
> > Compared with master mode, the difference is the DACDIV
> > setting, after correcting the DACDIV, the noise is gone.
>
> Charles suggested some updates to the patch to improve the error
> reporting here which you don't seem to have addressed.

Sorry, it seems his mail is missing from gmail. I find
it in my outlook now. Let me check his comments.

Best regards
Wang Shengjiu