Skip to content

Commit fb2c599

Browse files
akemnadetmlind
authored andcommitted
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: Andreas Kemnade <andreas@kemnade.info> [tony@atomide.com: updated to fix a checkpatch warning] Signed-off-by: Tony Lindgren <tony@atomide.com>
1 parent 501e69b commit fb2c599

4 files changed

Lines changed: 27 additions & 7 deletions

File tree

arch/arm/mach-omap2/pm-debug.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
#include "prm2xxx_3xxx.h"
3535
#include "pm.h"
3636

37-
u32 enable_off_mode;
38-
3937
#ifdef CONFIG_DEBUG_FS
4038
#include <linux/debugfs.h>
4139
#include <linux/seq_file.h>

arch/arm/mach-omap2/pm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include "clockdomain.h"
2929
#include "pm.h"
3030

31+
u32 enable_off_mode;
32+
3133
#ifdef CONFIG_SUSPEND
3234
/*
3335
* omap_pm_suspend: points to a function that does the SoC-specific

arch/arm/mach-omap2/pm.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ static inline int omap4_opp_init(void)
4949
extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm);
5050
extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state);
5151

52-
#ifdef CONFIG_PM_DEBUG
5352
extern u32 enable_off_mode;
54-
#else
55-
#define enable_off_mode 0
56-
#endif
5753

5854
#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
5955
extern void pm_dbg_update_time(struct powerdomain *pwrdm, int prev);

arch/arm/mach-omap2/pm34xx.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <linux/clk.h>
2626
#include <linux/delay.h>
2727
#include <linux/slab.h>
28+
#include <linux/of.h>
2829
#include <linux/omap-gpmc.h>
2930

3031
#include <trace/events/power.h>
@@ -414,7 +415,12 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
414415
if (!pwrst)
415416
return -ENOMEM;
416417
pwrst->pwrdm = pwrdm;
417-
pwrst->next_state = PWRDM_POWER_RET;
418+
419+
if (enable_off_mode)
420+
pwrst->next_state = PWRDM_POWER_OFF;
421+
else
422+
pwrst->next_state = PWRDM_POWER_RET;
423+
418424
list_add(&pwrst->node, &pwrst_list);
419425

420426
if (pwrdm_has_hdwr_sar(pwrdm))
@@ -448,6 +454,22 @@ static void __init pm_errata_configure(void)
448454
}
449455
}
450456

457+
static void __init omap3_pm_check_pmic(void)
458+
{
459+
struct device_node *np;
460+
461+
np = of_find_compatible_node(NULL, NULL, "ti,twl4030-power-idle");
462+
if (!np)
463+
np = of_find_compatible_node(NULL, NULL, "ti,twl4030-power-idle-osc-off");
464+
465+
if (np) {
466+
of_node_put(np);
467+
enable_off_mode = 1;
468+
} else {
469+
enable_off_mode = 0;
470+
}
471+
}
472+
451473
int __init omap3_pm_init(void)
452474
{
453475
struct power_state *pwrst, *tmp;
@@ -481,6 +503,8 @@ int __init omap3_pm_init(void)
481503
goto err2;
482504
}
483505

506+
omap3_pm_check_pmic();
507+
484508
ret = pwrdm_for_each(pwrdms_setup, NULL);
485509
if (ret) {
486510
pr_err("Failed to setup powerdomains\n");

0 commit comments

Comments
 (0)