diff options
author | Alex Frid <afrid@nvidia.com> | 2011-11-19 17:28:31 -0800 |
---|---|---|
committer | Varun Wadekar <vwadekar@nvidia.com> | 2011-12-15 12:06:15 +0530 |
commit | 051a0b2e40779eee1125308bac32e1957570ccd6 (patch) | |
tree | 543f5ff68118d020092e3b6c88d178810027a5b3 /arch/arm/mach-tegra/pm.c | |
parent | 7b6ad0c9924f567c8bd4dd7c2fbadf6ee8a960a8 (diff) |
ARM: tegra: dvfs: Add DVFS rails statistic
On Tegra3: complete account of in- and out-of-bound rails control.
On Tegra2: out-of-bound vdd_cpu control in LP2 state is not accounted.
Change-Id: Ib68cbbfe3e4f965e758aca17a0ba30277d530347
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/67340
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/pm.c')
-rw-r--r-- | arch/arm/mach-tegra/pm.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c index ca3baada0aab..3fe9e2fd41c8 100644 --- a/arch/arm/mach-tegra/pm.c +++ b/arch/arm/mach-tegra/pm.c @@ -66,6 +66,7 @@ #include "reset.h" #include "sleep.h" #include "timer.h" +#include "dvfs.h" struct suspend_context { /* @@ -166,6 +167,8 @@ struct suspend_context tegra_sctx; #define MC_SECURITY_SIZE 0x70 #define MC_SECURITY_CFG2 0x7c +struct dvfs_rail *tegra_cpu_rail; +static struct dvfs_rail *tegra_core_rail; static struct clk *tegra_pclk; static const struct tegra_suspend_platform_data *pdata; static enum tegra_suspend_mode current_suspend_mode = TEGRA_SUSPEND_NONE; @@ -751,12 +754,28 @@ static const char *lp_state[TEGRA_MAX_SUSPEND_MODE] = { static int tegra_suspend_enter(suspend_state_t state) { int ret; + ktime_t delta; + struct timespec ts_entry, ts_exit; if (pdata && pdata->board_suspend) pdata->board_suspend(current_suspend_mode, TEGRA_SUSPEND_BEFORE_PERIPHERAL); + read_persistent_clock(&ts_entry); + ret = tegra_suspend_dram(current_suspend_mode, 0); + read_persistent_clock(&ts_exit); + + if (timespec_compare(&ts_exit, &ts_entry) > 0) { + delta = timespec_to_ktime(timespec_sub(ts_exit, ts_entry)); + + tegra_dvfs_rail_pause(tegra_cpu_rail, delta, false); + if (current_suspend_mode == TEGRA_SUSPEND_LP0) + tegra_dvfs_rail_pause(tegra_core_rail, delta, false); + else + tegra_dvfs_rail_pause(tegra_core_rail, delta, true); + } + if (pdata && pdata->board_resume) pdata->board_resume(current_suspend_mode, TEGRA_RESUME_AFTER_PERIPHERAL); @@ -984,6 +1003,8 @@ void __init tegra_init_suspend(struct tegra_suspend_platform_data *plat) u32 reg; u32 mode; + tegra_cpu_rail = tegra_dvfs_get_rail_by_name("vdd_cpu"); + tegra_core_rail = tegra_dvfs_get_rail_by_name("vdd_core"); tegra_pclk = clk_get_sys(NULL, "pclk"); BUG_ON(IS_ERR(tegra_pclk)); pdata = plat; |