]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
clk: imx: clk-scu: fix clk enable state save and restore
authorDong Aisheng <aisheng.dong@nxp.com>
Sun, 27 Oct 2024 12:00:10 +0000 (20:00 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 18:51:02 +0000 (19:51 +0100)
commit3e4ff2af1b0aa5c59092f90140fb7d3cdc18a839
tree26622b1422496b03a9a8c26b9820de442860610b
parent55eb217f8f80d457a8e6d1bbe4d06359dd7ec07e
clk: imx: clk-scu: fix clk enable state save and restore

[ Upstream commit e81361f6cf9bf4a1848b0813bc4becb2250870b8 ]

The scu clk_ops only inplements prepare() and unprepare() callback.
Saving the clock state during suspend by checking clk_hw_is_enabled()
is not safe as it's possible that some device drivers may only
disable the clocks without unprepare. Then the state retention will not
work for such clocks.

Fixing it by checking clk_hw_is_prepared() which is more reasonable
and safe.

Fixes: d0409631f466 ("clk: imx: scu: add suspend/resume support")
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Tested-by: Carlos Song <carlos.song@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Link: https://lore.kernel.org/r/20241027-imx-clk-v1-v3-4-89152574d1d7@nxp.com
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/imx/clk-scu.c