Commit fb2c599f authored by Andreas Kemnade's avatar Andreas Kemnade Committed by Tony Lindgren

ARM: omap3: enable off mode automatically

Enabling off mode was only reachable deeply hidden
in the debugfs. As powersaving is an important feature,
move the option out of its shady place.
The debugfs file can still be used to override the default.

Use the presence of a device compatible to ti,twl4030-idle or
ti,twl4030-idle-osc-off as an indicator that the board is wired correctly
for off mode.
Signed-off-by: default avatarAndreas Kemnade <andreas@kemnade.info>
[tony@atomide.com: updated to fix a checkpatch warning]
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 501e69b0
...@@ -34,8 +34,6 @@ ...@@ -34,8 +34,6 @@
#include "prm2xxx_3xxx.h" #include "prm2xxx_3xxx.h"
#include "pm.h" #include "pm.h"
u32 enable_off_mode;
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include "clockdomain.h" #include "clockdomain.h"
#include "pm.h" #include "pm.h"
u32 enable_off_mode;
#ifdef CONFIG_SUSPEND #ifdef CONFIG_SUSPEND
/* /*
* omap_pm_suspend: points to a function that does the SoC-specific * omap_pm_suspend: points to a function that does the SoC-specific
......
...@@ -49,11 +49,7 @@ static inline int omap4_opp_init(void) ...@@ -49,11 +49,7 @@ static inline int omap4_opp_init(void)
extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm); extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm);
extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state); extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state);
#ifdef CONFIG_PM_DEBUG
extern u32 enable_off_mode; extern u32 enable_off_mode;
#else
#define enable_off_mode 0
#endif
#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) #if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
extern void pm_dbg_update_time(struct powerdomain *pwrdm, int prev); extern void pm_dbg_update_time(struct powerdomain *pwrdm, int prev);
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/of.h>
#include <linux/omap-gpmc.h> #include <linux/omap-gpmc.h>
#include <trace/events/power.h> #include <trace/events/power.h>
...@@ -414,7 +415,12 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) ...@@ -414,7 +415,12 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
if (!pwrst) if (!pwrst)
return -ENOMEM; return -ENOMEM;
pwrst->pwrdm = pwrdm; pwrst->pwrdm = pwrdm;
pwrst->next_state = PWRDM_POWER_RET;
if (enable_off_mode)
pwrst->next_state = PWRDM_POWER_OFF;
else
pwrst->next_state = PWRDM_POWER_RET;
list_add(&pwrst->node, &pwrst_list); list_add(&pwrst->node, &pwrst_list);
if (pwrdm_has_hdwr_sar(pwrdm)) if (pwrdm_has_hdwr_sar(pwrdm))
...@@ -448,6 +454,22 @@ static void __init pm_errata_configure(void) ...@@ -448,6 +454,22 @@ static void __init pm_errata_configure(void)
} }
} }
static void __init omap3_pm_check_pmic(void)
{
struct device_node *np;
np = of_find_compatible_node(NULL, NULL, "ti,twl4030-power-idle");
if (!np)
np = of_find_compatible_node(NULL, NULL, "ti,twl4030-power-idle-osc-off");
if (np) {
of_node_put(np);
enable_off_mode = 1;
} else {
enable_off_mode = 0;
}
}
int __init omap3_pm_init(void) int __init omap3_pm_init(void)
{ {
struct power_state *pwrst, *tmp; struct power_state *pwrst, *tmp;
...@@ -481,6 +503,8 @@ int __init omap3_pm_init(void) ...@@ -481,6 +503,8 @@ int __init omap3_pm_init(void)
goto err2; goto err2;
} }
omap3_pm_check_pmic();
ret = pwrdm_for_each(pwrdms_setup, NULL); ret = pwrdm_for_each(pwrdms_setup, NULL);
if (ret) { if (ret) {
pr_err("Failed to setup powerdomains\n"); pr_err("Failed to setup powerdomains\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment