12 #include <linux/kernel.h>
17 #include <linux/export.h>
21 #include <asm/system_misc.h>
42 static int __init _init_omap_device(
char *
name)
48 if (
WARN(!oh,
"%s: could not find omap_hwmod for %s\n",
53 if (
WARN(IS_ERR(pdev),
"%s: could not build omap_device for %s\n",
63 static void __init omap2_init_processor_devices(
void)
65 _init_omap_device(
"mpu");
67 _init_omap_device(
"iva");
70 _init_omap_device(
"l3_main_1");
71 _init_omap_device(
"dsp");
72 _init_omap_device(
"iva");
74 _init_omap_device(
"l3_main");
79 #define FORCEWAKEUP_SWITCH 0
80 #define LOWPOWERSTATE_SWITCH 1
99 u8 curr_pwrst, next_pwrst;
100 int sleep_switch = -1,
ret = 0, hwsup = 0;
102 if (!pwrdm || IS_ERR(pwrdm))
105 while (!(pwrdm->
pwrsts & (1 << pwrst))) {
112 if (next_pwrst == pwrst)
117 if ((curr_pwrst > pwrst) &&
129 pr_err(
"%s: unable to set power state of powerdomain: %s\n",
130 __func__, pwrdm->
name);
132 switch (sleep_switch) {
159 static int __init omap2_set_init_voltage(
char *vdd_name,
char *clk_name,
165 unsigned long freq, bootup_volt;
168 if (!vdd_name || !clk_name || !oh_name) {
169 pr_err(
"%s: invalid parameters\n", __func__);
173 if (!
strncmp(oh_name,
"mpu", 3))
183 pr_err(
"%s: Unable to get dev pointer for hwmod %s\n",
190 pr_err(
"%s: unable to get vdd pointer for vdd_%s\n",
197 pr_err(
"%s: unable to get clk %s\n", __func__, clk_name);
208 pr_err(
"%s: unable to find boot up OPP for vdd_%s\n",
216 pr_err(
"%s: unable to find voltage corresponding to the bootup OPP for vdd_%s\n",
225 pr_err(
"%s: unable to set vdd_%s\n", __func__, vdd_name);
229 #ifdef CONFIG_SUSPEND
237 switch (suspend_state) {
257 static void omap_pm_end(
void)
263 static void omap_pm_finish(
void)
270 .
begin = omap_pm_begin,
272 .enter = omap_pm_enter,
273 .finish = omap_pm_finish,
279 static void __init omap3_init_voltages(
void)
284 omap2_set_init_voltage(
"mpu_iva",
"dpll1_ck",
"mpu");
285 omap2_set_init_voltage(
"core",
"l3_ick",
"l3_main");
288 static void __init omap4_init_voltages(
void)
293 omap2_set_init_voltage(
"mpu",
"dpll_mpu_ck",
"mpu");
294 omap2_set_init_voltage(
"core",
"l3_div_ck",
"l3_main_1");
295 omap2_set_init_voltage(
"iva",
"dpll_iva_m5x2_ck",
"iva");
298 static int __init omap2_common_pm_init(
void)
300 if (!of_have_populated_dt())
301 omap2_init_processor_devices();
315 if (of_have_populated_dt())
323 omap3_init_voltages();
324 omap4_init_voltages();
329 #ifdef CONFIG_SUSPEND