diff options
author | Dimitris Papavasiliou <dpapavas@gmail.com> | 2019-01-26 14:23:45 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-01-28 13:34:14 +0100 |
commit | 51b033c2608147efe3a5368bfa64837e772d8c55 (patch) | |
tree | 6a2a8b724c77dc449e7dc7f40c3e2c0d7fc7fa37 /sound/soc/codecs/pcm512x.c | |
parent | ASoC: pcm512x: Implement the set_bclk_ratio interface (diff) | |
download | linux-51b033c2608147efe3a5368bfa64837e772d8c55.tar.xz linux-51b033c2608147efe3a5368bfa64837e772d8c55.zip |
ASoC: pcm512x: Fix clocking calculations when not using the PLL
The rationale behind the current calculation is somewhat obscure [1]
and can yield slightly wrong dividers in certain cases, which the
machine drivers for some boards (like the HiFiBerry DAC+ Pro)
seemingly try to circumvent, by updating the rate fraction so as to
suit this calculation.
The updated calculation should correctly yield the smallest bit clock
rate that would fit the frame.
[1] http://mailman.alsa-project.org/pipermail/alsa-devel/2019-January/144219.html
Signed-off-by: Dimitris Papavasiliou <dpapavas@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/pcm512x.c')
-rw-r--r-- | sound/soc/codecs/pcm512x.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c index ce8c5dbd2164..ae3bd533eadb 100644 --- a/sound/soc/codecs/pcm512x.c +++ b/sound/soc/codecs/pcm512x.c @@ -929,8 +929,8 @@ static int pcm512x_set_dividers(struct snd_soc_dai *dai, if (!pcm512x->pll_out) { sck_rate = clk_get_rate(pcm512x->sclk); - bclk_div = params->rate_den * 64 / lrclk_div; - bclk_rate = DIV_ROUND_CLOSEST(sck_rate, bclk_div); + bclk_rate = params_rate(params) * lrclk_div; + bclk_div = DIV_ROUND_CLOSEST(sck_rate, bclk_rate); mck_rate = sck_rate; } else { |