ASoC: fsl_micfil: simplify clock setting
authorSascha Hauer <s.hauer@pengutronix.de>
Thu, 14 Apr 2022 16:22:43 +0000 (18:22 +0200)
committerMark Brown <broonie@kernel.org>
Tue, 19 Apr 2022 11:06:24 +0000 (12:06 +0100)
commite8936f6925c1174242e643e0aa0646359c192fe2
treecf6355ef87c658af0e890c9c89fa561ec081b56b
parentbe6aeee2eb82e5ae57f8cc613c0b6cc3e8d33664
ASoC: fsl_micfil: simplify clock setting

The reference manual has this for calculating the micfil internal clock
divider:

         MICFIL Clock rate
clkdiv = -----------------
         8 * OSR * outrate

(with OSR == Oversampling Rate, outrate == output sample rate)

The driver first sets the MICFIL Clock rate to (outrate * 1024) and then
calculates back the clkdiv value from the above calculation.

Simplify this by using a fixed clkdiv value of 8 and set the MICFIL
Clock rate to (outrate * clkdiv * OSR * 8).

While at it drop disabling the clock before setting its rate. The MICFIL
module is disabled when the rate is changed and it is also resetted
before it is started again, so I doubt it's necessary to disable the
clock.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://lore.kernel.org/r/20220414162249.3934543-16-s.hauer@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/fsl/fsl_micfil.c