soc: mtk-pm-domains: Fix the clock prepared issue
authorWeiyi Lu <weiyi.lu@mediatek.com>
Tue, 1 Jun 2021 03:59:03 +0000 (11:59 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:02:25 +0000 (16:02 +0200)
commit7e17ac2049626f0d385b015318696577198f0e4c
treea86375505d22cdc16332cc0cd3e5b2b1ff0efd57
parentace0c0fbb39a4bd6a781ef957fccbf0bf989dfc4
soc: mtk-pm-domains: Fix the clock prepared issue

[ Upstream commit f0fce06e345dc4f75c1cdd21840780f5fe2df1f3 ]

In this new power domain driver, when adding one power domain
it will prepare the dependent clocks at the same.
So we only do clk_bulk_enable/disable control during power ON/OFF.
When system suspend, the pm runtime framework will forcely power off
power domains. However, the dependent clocks are disabled but kept
prepared.

In MediaTek clock drivers, PLL would be turned ON when we do
clk_bulk_prepare control.

Clock hierarchy:
PLL -->
       DIV_CK -->
                 CLK_MUX
                 (may be dependent clocks)
                         -->
                             SUBSYS_CG
                             (may be dependent clocks)

It will lead some unexpected clock states during system suspend.
This patch will fix by doing prepare_enable/disable_unprepare on
dependent clocks at the same time while we are going to power on/off
any power domain.

Fixes: 59b644b01cf4 ("soc: mediatek: Add MediaTek SCPSYS power domains")
Signed-off-by: Weiyi Lu <weiyi.lu@mediatek.com>
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: chun-jie.chen <chun-jie.chen@mediatek.com>
Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20210601035905.2970384-1-hsinyi@chromium.org
Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/soc/mediatek/mtk-pm-domains.c