ASoC: tlv320aic32x4: Fix the divide by zero
authorGuiting Shen <aarongt.shen@gmail.com>
Sun, 13 Aug 2023 12:55:20 +0000 (20:55 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 14 Aug 2023 12:10:37 +0000 (13:10 +0100)
commit11e756cc85fac43e2025306ad6aea80114cc7e98
tree0de0b0fd6803b8f20adc4fee815a6d2e97e9b148
parentb39eee2754e9fbcbbdd866c1aad59575d8c4342e
ASoC: tlv320aic32x4: Fix the divide by zero

The value of register(NDAC,MDAC,NADC,MADC,BCLKN) maybe zero lead to
divide by zero in clk_aic32x4_div_recalc_rate().And the rate should be
divide by 128 if the value was zero in this function according to the
datasheet.

Add the macro AIC32X4_DIV_MAX to present the 128 and return 0 if failing
to read the value of register.

Signed-off-by: Guiting Shen <aarongt.shen@gmail.com>
Link: https://lore.kernel.org/r/20230813125520.11067-1-aarongt.shen@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/tlv320aic32x4-clk.c
sound/soc/codecs/tlv320aic32x4.h