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 | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/pmdomain/amlogic/meson-ee-pwrc.c 
b/drivers/pmdomain/amlogic/meson-ee-pwrc.c
index 338f70d77bf0..b3ae5cd7bea8 100644
--- a/drivers/pmdomain/amlogic/meson-ee-pwrc.c
+++ b/drivers/pmdomain/amlogic/meson-ee-pwrc.c
@@ -392,11 +392,21 @@ static int meson_ee_pwrc_off(struct generic_pm_domain 
*domain)
        return 0;
 }
 
+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_on(struct generic_pm_domain *domain)
 {
        struct meson_ee_pwrc_domain *pwrc_domain =
                container_of(domain, struct meson_ee_pwrc_domain, base);
-       int i, ret;
+       int ret;
 
        if (pwrc_domain->desc.top_pd)
                regmap_update_bits(pwrc_domain->pwrc->regmap_ao,
@@ -404,10 +414,7 @@ static int meson_ee_pwrc_on(struct generic_pm_domain 
*domain)
                                   pwrc_domain->desc.top_pd->sleep_mask, 0);
        udelay(20);
 
-       for (i = 0 ; i < pwrc_domain->desc.mem_pd_count ; ++i)
-               regmap_update_bits(pwrc_domain->pwrc->regmap_hhi,
-                                  pwrc_domain->desc.mem_pd[i].reg,
-                                  pwrc_domain->desc.mem_pd[i].mask, 0);
+       meson_ee_pwrc_mem_power_up(pwrc_domain);
 
        udelay(20);
 
@@ -478,6 +485,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