ASoC: sun8i-codec: Round up the LRCK divisor
authorSamuel Holland <samuel@sholland.org>
Wed, 14 Oct 2020 06:19:29 +0000 (01:19 -0500)
committerMark Brown <broonie@kernel.org>
Mon, 26 Oct 2020 14:56:55 +0000 (14:56 +0000)
commite511aed79632e8a2dd03068f8bd11b64cb0d7170
tree3e63849af133475f5e96af7681f75dd8af553f6a
parent1abb43aeadfb513c0a16013cd445fb7dd3b285bb
ASoC: sun8i-codec: Round up the LRCK divisor

The codec supports only power-of-two BCLK/LRCK divisors. If either the
slot width or the number of slots is not a power of two, the LRCK
divisor must be rounded up to provide enough space. To do that, use
order_base_2 (instead of ilog2, which rounds down).

Since the rounded divisor is also needed for setting the SYSCLK/BCLK
divisor, return the order base 2 instead of fully calculating the
hardware register encoding.

Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Link: https://lore.kernel.org/r/20201014061941.4306-6-samuel@sholland.org
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sunxi/sun8i-codec.c