All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ASoC: wm8960: Fix clock configuration on slave mode
@ 2021-10-13  5:17 Shengjiu Wang
  2021-10-13  8:05   ` Charles Keepax
  2021-10-13 19:59 ` Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Shengjiu Wang @ 2021-10-13  5:17 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, ckeepax, kuninori.morimoto.gx,
	patches, alsa-devel, linux-kernel

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 <shengjiu.wang@nxp.com>
---
changes in v2:
- change error message to warning
- add more comments

 sound/soc/codecs/wm8960.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index 9e621a254392..499604f1e178 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -742,9 +742,16 @@ static int wm8960_configure_clocking(struct snd_soc_component *component)
 	int i, j, k;
 	int ret;
 
-	if (!(iface1 & (1<<6))) {
-		dev_dbg(component->dev,
-			"Codec is slave mode, no need to configure clock\n");
+	/*
+	 * For Slave mode clocking should still be configured,
+	 * so this if statement should be removed, but some platform
+	 * may not work if the sysclk is not configured, to avoid such
+	 * compatible issue, just add '!wm8960->sysclk' condition in
+	 * this if statement.
+	 */
+	if (!(iface1 & (1 << 6)) && !wm8960->sysclk) {
+		dev_warn(component->dev,
+			 "slave mode, but proceeding with no clock configuration\n");
 		return 0;
 	}
 
-- 
2.17.1


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

* Re: [PATCH v2] ASoC: wm8960: Fix clock configuration on slave mode
  2021-10-13  5:17 [PATCH v2] ASoC: wm8960: Fix clock configuration on slave mode Shengjiu Wang
@ 2021-10-13  8:05   ` Charles Keepax
  2021-10-13 19:59 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Charles Keepax @ 2021-10-13  8:05 UTC (permalink / raw)
  To: Shengjiu Wang
  Cc: alsa-devel, kuninori.morimoto.gx, patches, tiwai, lgirdwood,
	broonie, linux-kernel

On Wed, Oct 13, 2021 at 01:17:04PM +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.
> 
> 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 <shengjiu.wang@nxp.com>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

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

* Re: [PATCH v2] ASoC: wm8960: Fix clock configuration on slave mode
@ 2021-10-13  8:05   ` Charles Keepax
  0 siblings, 0 replies; 4+ messages in thread
From: Charles Keepax @ 2021-10-13  8:05 UTC (permalink / raw)
  To: Shengjiu Wang
  Cc: lgirdwood, broonie, perex, tiwai, kuninori.morimoto.gx, patches,
	alsa-devel, linux-kernel

On Wed, Oct 13, 2021 at 01:17:04PM +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.
> 
> 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 <shengjiu.wang@nxp.com>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

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

* Re: [PATCH v2] ASoC: wm8960: Fix clock configuration on slave mode
  2021-10-13  5:17 [PATCH v2] ASoC: wm8960: Fix clock configuration on slave mode Shengjiu Wang
  2021-10-13  8:05   ` Charles Keepax
@ 2021-10-13 19:59 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2021-10-13 19:59 UTC (permalink / raw)
  To: kuninori.morimoto.gx, linux-kernel, tiwai, lgirdwood, patches,
	Shengjiu Wang, ckeepax, perex, alsa-devel
  Cc: Mark Brown

On Wed, 13 Oct 2021 13:17:04 +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.
> 
> There is no noise issue for 48kHz sample rate, because
> the default value of DACDIV is correct for 48kHz.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: wm8960: Fix clock configuration on slave mode
      commit: 6b9b546dc00797c74bef491668ce5431ff54e1e2

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

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

end of thread, other threads:[~2021-10-13 20:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-13  5:17 [PATCH v2] ASoC: wm8960: Fix clock configuration on slave mode Shengjiu Wang
2021-10-13  8:05 ` Charles Keepax
2021-10-13  8:05   ` Charles Keepax
2021-10-13 19:59 ` Mark Brown

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.