linux-stable/sound/soc/sunxi
Maxime Ripard 83c2a42b1b ASoC: sun4i-i2s: Don't use the oversample to calculate BCLK
[ Upstream commit 7df8f9a201 ]

The BCLK divider should be calculated using the parameters that actually
make the BCLK rate: the number of channels, the sampling rate and the
sample width.

We've been using the oversample_rate previously because in the former SoCs,
the BCLK's parent is MCLK, which in turn is being used to generate the
oversample rate, so we end up with something like this:

oversample = mclk_rate / sampling_rate
bclk_div = oversample / word_size / channels

So, bclk_div = mclk_rate / sampling_rate / word_size / channels.

And this is actually better, since the oversampling ratio only plays a role
because the MCLK is its parent, not because of what BCLK is supposed to be.

Furthermore, that assumption of MCLK being the parent has been broken on
newer SoCs, so let's use the proper formula, and have the parent rate as an
argument.

Fixes: 7d2993811a ("ASoC: sun4i-i2s: Add support for H3")
Fixes: 21faaea134 ("ASoC: sun4i-i2s: Add support for A83T")
Fixes: 66ecce3325 ("ASoC: sun4i-i2s: Add compatibility with A64 codec I2S")
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://lore.kernel.org/r/c3595e3a9788c2ef2dcc30aa3c8c4953bb5cc249.1566242458.git-series.maxime.ripard@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-10-05 13:09:45 +02:00
..
Kconfig ASoC: sunxi: allow the analog codec driver to be built on ARM64 2017-02-08 18:29:37 +00:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sun4i-codec.c ASoC: sun4i: replace codec to component 2018-02-12 09:56:04 +00:00
sun4i-i2s.c ASoC: sun4i-i2s: Don't use the oversample to calculate BCLK 2019-10-05 13:09:45 +02:00
sun4i-spdif.c ASoC: sun4i-spdif: Handle return value of clk_prepare_enable. 2017-07-26 13:01:33 +01:00
sun8i-codec-analog.c ASoC: sun8i-codec-analog: add support for V3s SoC 2017-06-06 19:29:54 +01:00
sun8i-codec.c ASoC: sun8i-codec: fix crash on module removal 2018-12-17 09:24:30 +01:00