clk: qcom: clk-rcg2: Make sure to not write d=0 to the NMD register
authorNikita Travkin <nikita@trvn.ru>
Sun, 12 Jun 2022 14:59:53 +0000 (19:59 +0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:23:47 +0000 (14:23 +0200)
commit0b9f2f2a0488f151d1b42e5084cafdff1b00a9a9
treea06e6a601d7ea5765b85be2c435fe2b3d633fb27
parent522e13ebbf48de0b193d7cf2977d274a9be52aa4
clk: qcom: clk-rcg2: Make sure to not write d=0 to the NMD register

[ Upstream commit d0696770cef35a1fd16ea2167e2198c18aa6fbfe ]

Sometimes calculation of d value may result in 0 because of the
rounding after integer division. This causes the following error:

[  113.969689] camss_gp1_clk_src: rcg didn't update its configuration.
[  113.969754] WARNING: CPU: 3 PID: 35 at drivers/clk/qcom/clk-rcg2.c:122 update_config+0xc8/0xdc

Make sure that D value is never zero.

Fixes: 7f891faf596e ("clk: qcom: clk-rcg2: Add support for duty-cycle for RCG")
Signed-off-by: Nikita Travkin <nikita@trvn.ru>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220612145955.385787-3-nikita@trvn.ru
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/qcom/clk-rcg2.c