]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit3f25d91ba5cd1f2303f9770bd23ae57f149be8fa
treecf6355ef87c658af0e890c9c89fa561ec081b56b
parentffebd59e78db201b1ab80d5d2753ea24f40ac45f
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