All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] ASoC: wm8960: Use physical width for bclk
@ 2017-03-14 16:57 ` Daniel Baluta
  0 siblings, 0 replies; 10+ messages in thread
From: Daniel Baluta @ 2017-03-14 16:57 UTC (permalink / raw)
  To: lgirdwood, broonie, tiwai
  Cc: ckeepax, patches, alsa-devel, linux-kernel, shengjiu.wang,
	mihai.serban, viorel.suman

bclk is derived from sysclk with the help of bclk_divs. Anyhow, for
S20_3LE format there is no bclk_divs that could be used to derive
an exact bclk.

We can fix this by using storage size instead the exact
number of bits of the sample when computing bclk.

With this approach we can play S20_3LE encoded files at the cost of
some unused BCLK cycles for S20_3LE and S24_LE.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
---
 sound/soc/codecs/wm8960.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index e1429e3..18ca5fc 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -722,7 +722,8 @@ static int wm8960_hw_params(struct snd_pcm_substream *substream,
 	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
 	int i;
 
-	wm8960->bclk = snd_soc_params_to_bclk(params);
+	wm8960->bclk = params_physical_width(params) *
+		params_channels(params) * params_rate(params);
 	if (params_channels(params) == 1)
 		wm8960->bclk *= 2;
 
-- 
2.7.4

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

end of thread, other threads:[~2017-03-15 15:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-14 16:57 [RFC PATCH] ASoC: wm8960: Use physical width for bclk Daniel Baluta
2017-03-14 16:57 ` Daniel Baluta
2017-03-15  9:19 ` Charles Keepax
2017-03-15  9:19   ` Charles Keepax
2017-03-15 11:43   ` Daniel Baluta
2017-03-15 11:43     ` Daniel Baluta
2017-03-15 13:33   ` Mark Brown
2017-03-15 13:33     ` Mark Brown
2017-03-15 15:11     ` Daniel Baluta
2017-03-15 15:11       ` [alsa-devel] " Daniel Baluta

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.