struct reset_control *rstc;
struct clk *vpu_clk;
struct clk *vapb_clk;
- bool powered;
};
static inline
clk_disable_unprepare(pd->vpu_clk);
clk_disable_unprepare(pd->vapb_clk);
- pd->powered = false;
-
return 0;
}
if (ret)
return ret;
- return clk_prepare_enable(pd->vapb_clk);
+ ret = clk_prepare_enable(pd->vapb_clk);
+ if (ret)
+ clk_disable_unprepare(pd->vpu_clk);
+
+ return ret;
}
static int meson_gx_pwrc_vpu_power_on(struct generic_pm_domain *genpd)
if (ret)
return ret;
- pd->powered = true;
-
return 0;
}
struct reset_control *rstc;
struct clk *vpu_clk;
struct clk *vapb_clk;
+ bool powered_off;
+ int ret;
regmap_ao = syscon_node_to_regmap(of_get_parent(pdev->dev.of_node));
if (IS_ERR(regmap_ao)) {
vpu_hdmi_pd.vpu_clk = vpu_clk;
vpu_hdmi_pd.vapb_clk = vapb_clk;
- pm_genpd_init(&vpu_hdmi_pd.genpd, &simple_qos_governor,
- meson_gx_pwrc_vpu_get_power(&vpu_hdmi_pd));
+ powered_off = meson_gx_pwrc_vpu_get_power(&vpu_hdmi_pd);
+
+ /* If already powered, sync the clock states */
+ if (!powered_off) {
+ ret = meson_gx_pwrc_vpu_setup_clk(&vpu_hdmi_pd);
+ if (ret)
+ return ret;
+ }
+
+ pm_genpd_init(&vpu_hdmi_pd.genpd, &pm_domain_always_on_gov,
+ powered_off);
return of_genpd_add_provider_simple(pdev->dev.of_node,
&vpu_hdmi_pd.genpd);
static void meson_gx_pwrc_vpu_shutdown(struct platform_device *pdev)
{
- if (vpu_hdmi_pd.powered)
- meson_gx_pwrc_vpu_power_off(&vpu_hdmi_pd.genpd);
+ meson_gx_pwrc_vpu_power_off(&vpu_hdmi_pd.genpd);
}
static const struct of_device_id meson_gx_pwrc_vpu_match_table[] = {