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)
committerMatthias Brugger <matthias.bgg@gmail.com>
Wed, 2 Jun 2021 11:53:31 +0000 (13:53 +0200)
commitf0fce06e345dc4f75c1cdd21840780f5fe2df1f3
treecb04d95a9d929039959f955d43dc484d555fb2b8
parenteed6ff1bb2da65067d928f4ab322c7d75f944fa4
soc: mtk-pm-domains: Fix the clock prepared issue

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>
drivers/soc/mediatek/mtk-pm-domains.c