From: Ronald Claveau <[email protected]>

When a power domain is found already powered on at probe time (typically
the VPU domain left enabled by the bootloader), the driver registers the
genpd in the ON state with GENPD_FLAG_ALWAYS_ON and never calls
meson_ee_pwrc_on(). As a result, the memory power-down bits of the domain
are not touched.

pwrc_ee_is_powered_off() only checks the top-level sleep bit, so a
bootloader that enabled the VPU without waking every memory block
leaves those memories powered down, and nothing in the genpd framework
will wake them since pm_runtime_resume_and_get() is a no-op for an
always-on domain.

This is a preparatory change: a following patch drops the explicit
HHI_MEM_PD_REG0 write from the meson_dw_hdmi driver, which relies on the
power domain to power the HDMITX memory.

Signed-off-by: Ronald Claveau <[email protected]>
---
 drivers/pmdomain/amlogic/meson-ee-pwrc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/pmdomain/amlogic/meson-ee-pwrc.c 
b/drivers/pmdomain/amlogic/meson-ee-pwrc.c
index 338f70d77bf0..404af4619256 100644
--- a/drivers/pmdomain/amlogic/meson-ee-pwrc.c
+++ b/drivers/pmdomain/amlogic/meson-ee-pwrc.c
@@ -428,6 +428,16 @@ static int meson_ee_pwrc_on(struct generic_pm_domain 
*domain)
                                       pwrc_domain->clks);
 }
 
+static void meson_ee_pwrc_mem_power_up(struct meson_ee_pwrc_domain *dom)
+{
+       int i;
+
+       for (i = 0; i < dom->desc.mem_pd_count; i++)
+               regmap_update_bits(dom->pwrc->regmap_hhi,
+                                  dom->desc.mem_pd[i].reg,
+                                  dom->desc.mem_pd[i].mask, 0);
+}
+
 static int meson_ee_pwrc_init_domain(struct platform_device *pdev,
                                     struct meson_ee_pwrc *pwrc,
                                     struct meson_ee_pwrc_domain *dom)
@@ -478,6 +488,8 @@ static int meson_ee_pwrc_init_domain(struct platform_device 
*pdev,
          * prepare/enable counters won't be in sync.
          */
        if (dom->num_clks && dom->desc.is_powered_off && 
!dom->desc.is_powered_off(dom)) {
+               meson_ee_pwrc_mem_power_up(dom);
+
                ret = clk_bulk_prepare_enable(dom->num_clks, dom->clks);
                if (ret)
                        return ret;

-- 
2.56.1


Reply via email to