ARM: tegra: pm: add platform suspend support
Subsystems (3)
PATCH 4/10 ARM: tegra: pm: add platform suspend support
Adding suspend to ram support for Tegra platform. There are three suspend mode for Tegra. The difference were below.
* LP2: CPU voltage off
* LP1: CPU voltage off, DRAM in self-refresh
* LP0: CPU + Core voltage off, DRAM in self-refresh
After this patch, the LP2 suspend mode will be supported.
--- arch/arm/mach-tegra/common.c | 1 + arch/arm/mach-tegra/pm.c | 75 ++++++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-tegra/pm.h | 2 ++ arch/arm/mach-tegra/pmc.c | 45 ++++++++++++++++++++++++++ arch/arm/mach-tegra/pmc.h | 8 +++++ 5 files changed, 131 insertions(+)
arch/arm/mach-tegra/common.c +1 -0
@@ -65,6 +65,7 @@ void __init tegra_dt_init_irq(void)tegra_init_irq ();irqchip_init ();tegra_legacy_irq_syscore_init (); + tegra_init_suspend(); }#endif
arch/arm/mach-tegra/pm.c +75 -0
91 lines not on this page · raw message
arch/arm/mach-tegra/pm.h +2 -0
@@ -32,4 +32,6 @@ bool tegra_set_cpu_in_lp2(int phy_cpu_id);void tegra_idle_lp2_last (u32 cpu_on_time,u32 cpu_off_time);extern void (*tegra_tear_down_cpu)(void ); +void tegra_init_suspend (void ); +#endif /* _MACH_TEGRA_PM_H_ */
arch/arm/mach-tegra/pmc.c +45 -0
58 lines not on this page · raw message
arch/arm/mach-tegra/pmc.h +8 -0
@@ -26,6 +26,14 @@ enum tegra_suspend_mode { TEGRA_MAX_SUSPEND_MODE, }; +#ifdef CONFIG_PM_SLEEP +enum tegra_suspend_mode tegra_pmc_get_suspend_mode (void ); +unsigned long tegra_pmc_get_cpu_timer (void ); +unsigned long tegra_pmc_get_cpu_off_timer (void ); +void tegra_pmc_pm_set (enum tegra_suspend_mode mode); +void tegra_pmc_suspend_init (void ); +#endif +bool tegra_pmc_cpu_is_powered (int cpuid);int tegra_pmc_cpu_power_on (int cpuid);int tegra_pmc_cpu_remove_clamping (int cpuid);
Signature · 1 line
1.8.1.1
PATCH 4/10 ARM: tegra: pm: add platform suspend support
Quoted 1 line · Joseph Lo
Adding suspend to ram support for Tegra platform. There are three suspend
nit: s/ram/RAM/
Quoted 1 line
mode for Tegra. The difference were below.
Does this patch work for all 3 upstream Tegras, or just Tegra20 (or 20+30?).
arch/arm/mach-tegra/common.c
Quoted 3 lines
arch/arm/mach-tegra/common.c +1
-0+tegra_init_suspend ();
That call isn't ifdef'd on anything ...
arch/arm/mach-tegra/pm.c void tegra_idle_lp2_last(u32 cpu_on_time, u32 cpu_off_time) · line 230
Quoted 11 lines
arch/arm/mach-tegra/pm.c +9
-0+static void tegra_suspend_enter_lp2 (void ) +{ +tegra_set_cpu_in_lp2 (0 ); +} + +static void tegra_suspend_exit_lp2 (void ) +{ +tegra_clear_cpu_in_lp2 (0 ); +}
Are those two functions going to get larger? If not, why not just call tegra_{set,clear}_cpu_in_lp2() from tegra_suspend_enter()?
Note: I realized that the LP0/LP1 functions might be larger, and feel free to make them separate functions when they're implemented, but if those two functions specifically are always going to be a single line, then there's little point in separating them out, is there?
Quoted 1 line
+void
__inittegra_init_suspend(void)
...
Quoted 1 line
#endif
... but this function is only implemented inside an ifdef ...
arch/arm/mach-tegra/pm.h bool tegra_set_cpu_in_lp2(int phy_cpu_id); · line 35
Quoted 3 lines
arch/arm/mach-tegra/pm.h +1
-0+void tegra_init_suspend (void );
... and no dummy inline is provided if the ifdef isn't defined.
So, turning off whatever that ifdef is would cause a build error.
Quoted 3 lines
arch/arm/mach-tegra/pmc.c +1
-0+unsigned long tegra_pmc_get_cpu_timer (void )
...
Quoted 1 line
+unsigned long
tegra_pmc_get_cpu_off_timer(void)
I think you want to make those return u32, since the values they return should be u32 to match DT cell type.
arch/arm/mach-tegra/pmc.c int tegra_pmc_cpu_remove_clamping(int cpuid) · line 185
Quoted 10 lines
arch/arm/mach-tegra/pmc.c +10
-0+void tegra_pmc_pm_set (enum tegra_suspend_mode mode) +{ +u32 reg; + + reg =tegra_pmc_readl (PMC_CTRL ); + reg |=TEGRA_POWER_CPU_PWRREQ_OE ; + reg &= ~TEGRA_POWER_EFFECT_LP0 ; + +tegra_pmc_writel (reg,PMC_CTRL ); +}
The "mode" parameter doesn't seem to be used here.
One overall comment: tegra_suspend_enter() only supports LP2 so far, but I don't see a check anywhere (e.g. tegra_init_suspend() or tegra_pmc_parse_dt()) which prevents suspend from being initialized if the user requested some other type, or on SoCs where even LP2 isn't supported yet (e.g. Tegra114).
PATCH 4/10 ARM: tegra: pm: add platform suspend support
Quoted 9 lines · Stephen Warren
Quoted 1 line · Joseph Lo
Adding suspend to ram support for Tegra platform. There are three suspend
nit: s/ram/RAM/
Quoted 1 line
mode for Tegra. The difference were below.
Does this patch work for all 3 upstream Tegras, or just Tegra20 (or 20+30?).
Only for Tegra20 and 30 now. The Tegra114's support need to wait for cpu suspend function first.
Quoted 6 lines
arch/arm/mach-tegra/common.c
Quoted 3 lines
arch/arm/mach-tegra/common.c +1
-0+tegra_init_suspend ();That call isn't ifdef'd on anything ...
Will fix.
Quoted 15 lines
arch/arm/mach-tegra/pm.c void tegra_idle_lp2_last(u32 cpu_on_time, u32 cpu_off_time) · line 230
Quoted 11 lines
arch/arm/mach-tegra/pm.c +9
-0+static void tegra_suspend_enter_lp2 (void ) +{ +tegra_set_cpu_in_lp2 (0 ); +} + +static void tegra_suspend_exit_lp2 (void ) +{ +tegra_clear_cpu_in_lp2 (0 ); +}Are those two functions going to get larger? If not, why not just call tegra_{set,clear}_cpu_in_lp2() from
tegra_suspend_enter()?
Quoted 5 lines
Note: I realized that the LP0/LP1 functions might be larger, and feel free to make them separate functions when they're implemented, but if those two functions specifically are always going to be a single line, then there's little point in separating them out, is there?
No, just like you said for LP2 suspend it only just need to call tegra_{set,clear}_cpu_in_lp2(). So I will follow your suggestion. Thanks.
Quoted 14 lines
Quoted 1 line
+void
__inittegra_init_suspend(void)...
Quoted 1 line
#endif
... but this function is only implemented inside an ifdef ...
arch/arm/mach-tegra/pm.h bool tegra_set_cpu_in_lp2(int phy_cpu_id); · line 35
Quoted 3 lines
arch/arm/mach-tegra/pm.h +1
-0+void tegra_init_suspend (void );... and no dummy inline is provided if the ifdef isn't defined.
So, turning off whatever that ifdef is would cause a build error.
Quoted 9 lines
Quoted 3 lines
arch/arm/mach-tegra/pmc.c +1
-0+unsigned long tegra_pmc_get_cpu_timer (void )...
Quoted 1 line
+unsigned long
tegra_pmc_get_cpu_off_timer(void)I think you want to make those return u32, since the values they return should be u32 to match DT cell type.
Will fix.
Quoted 13 lines
arch/arm/mach-tegra/pmc.c int tegra_pmc_cpu_remove_clamping(int cpuid) · line 185
Quoted 10 lines
arch/arm/mach-tegra/pmc.c +10
-0+void tegra_pmc_pm_set (enum tegra_suspend_mode mode) +{ +u32 reg; + + reg =tegra_pmc_readl (PMC_CTRL ); + reg |=TEGRA_POWER_CPU_PWRREQ_OE ; + reg &= ~TEGRA_POWER_EFFECT_LP0 ; + +tegra_pmc_writel (reg,PMC_CTRL ); +}The "mode" parameter doesn't seem to be used here.
Quoted 5 lines
One overall comment:
tegra_suspend_enter()only supports LP2 so far, but I don't see a check anywhere (e.g.tegra_init_suspend()ortegra_pmc_parse_dt()) which prevents suspend from being initialized if the user requested some other type, or on SoCs where even LP2 isn't supported yet (e.g. Tegra114).
OK. Will remove now.
Thanks,
Joseph