diff options
author | Puneet Saxena <puneets@nvidia.com> | 2012-05-30 16:28:31 +0530 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-06-19 14:48:07 -0700 |
commit | 52b391ca43416e2dbf11487b37652e8ebfec0aaf (patch) | |
tree | c8bc2d04472d96222e18487ed03dd5a5be327c24 /arch/arm/mach-tegra | |
parent | 45db91063208a3f973ed0cf78a4a0a5b9f54a36d (diff) |
arm: tegra: Fix cpu governor change issue
It fixes the issue where cpu governor change
was inconsistent across platforms.
In T2x, AUTO HOTPLUG is disabled therefore we need
to store/restore gov for all online cpus across
LP0 cycle.
In T3x, AUTO HOTPLUG is enabled therefore storing/restoring
gov for Cpu0 across LP0 cycle. Cpu0 remains online in suspend
and resume.
bug 991081
Change-Id: I167654aa21e4832b3fdc40e3d388a4d3f984632b
Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Reviewed-on: http://git-master/r/105404
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra')
-rw-r--r-- | arch/arm/mach-tegra/board-enterprise-panel.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-kai-panel.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-ventana-panel.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-whistler-panel.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board.h | 4 | ||||
-rw-r--r-- | arch/arm/mach-tegra/common.c | 50 |
6 files changed, 46 insertions, 36 deletions
diff --git a/arch/arm/mach-tegra/board-enterprise-panel.c b/arch/arm/mach-tegra/board-enterprise-panel.c index 7043916921d0..97a2294e6f5b 100644 --- a/arch/arm/mach-tegra/board-enterprise-panel.c +++ b/arch/arm/mach-tegra/board-enterprise-panel.c @@ -818,9 +818,7 @@ static void enterprise_panel_early_suspend(struct early_suspend *h) #ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND cpufreq_store_default_gov(); - if (cpufreq_change_gov(cpufreq_conservative_gov)) - pr_err("Early_suspend: Error changing governor to %s\n", - cpufreq_conservative_gov); + cpufreq_change_gov(cpufreq_conservative_gov); #endif } @@ -829,8 +827,7 @@ static void enterprise_panel_late_resume(struct early_suspend *h) unsigned i; #ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND - if (cpufreq_restore_default_gov()) - pr_err("Early_suspend: Unable to restore governor\n"); + cpufreq_restore_default_gov(); #endif for (i = 0; i < num_registered_fb; i++) fb_blank(registered_fb[i], FB_BLANK_UNBLANK); diff --git a/arch/arm/mach-tegra/board-kai-panel.c b/arch/arm/mach-tegra/board-kai-panel.c index e6ac6dd82846..d98550faf123 100644 --- a/arch/arm/mach-tegra/board-kai-panel.c +++ b/arch/arm/mach-tegra/board-kai-panel.c @@ -618,9 +618,7 @@ static void kai_panel_early_suspend(struct early_suspend *h) fb_blank(registered_fb[1], FB_BLANK_NORMAL); #ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND cpufreq_store_default_gov(); - if (cpufreq_change_gov(cpufreq_conservative_gov)) - pr_err("Early_suspend: Error changing governor to %s\n", - cpufreq_conservative_gov); + cpufreq_change_gov(cpufreq_conservative_gov); #endif } @@ -628,8 +626,7 @@ static void kai_panel_late_resume(struct early_suspend *h) { unsigned i; #ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND - if (cpufreq_restore_default_gov()) - pr_err("Early_suspend: Unable to restore governor\n"); + cpufreq_restore_default_gov(); #endif for (i = 0; i < num_registered_fb; i++) fb_blank(registered_fb[i], FB_BLANK_UNBLANK); diff --git a/arch/arm/mach-tegra/board-ventana-panel.c b/arch/arm/mach-tegra/board-ventana-panel.c index a9e7a67f2bb1..0013e36d38a6 100644 --- a/arch/arm/mach-tegra/board-ventana-panel.c +++ b/arch/arm/mach-tegra/board-ventana-panel.c @@ -367,9 +367,7 @@ static void ventana_panel_early_suspend(struct early_suspend *h) fb_blank(registered_fb[1], FB_BLANK_NORMAL); #ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND cpufreq_store_default_gov(); - if (cpufreq_change_gov(cpufreq_conservative_gov)) - pr_err("Early_suspend: Error changing governor to %s\n", - cpufreq_conservative_gov); + cpufreq_change_gov(cpufreq_conservative_gov); #endif } @@ -377,8 +375,7 @@ static void ventana_panel_late_resume(struct early_suspend *h) { unsigned i; #ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND - if (cpufreq_restore_default_gov()) - pr_err("Early_suspend: Unable to restore governor\n"); + cpufreq_restore_default_gov(); #endif for (i = 0; i < num_registered_fb; i++) fb_blank(registered_fb[i], FB_BLANK_UNBLANK); diff --git a/arch/arm/mach-tegra/board-whistler-panel.c b/arch/arm/mach-tegra/board-whistler-panel.c index 3510f9468394..df8b2859e81c 100644 --- a/arch/arm/mach-tegra/board-whistler-panel.c +++ b/arch/arm/mach-tegra/board-whistler-panel.c @@ -320,9 +320,7 @@ static void whistler_panel_early_suspend(struct early_suspend *h) #ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND cpufreq_store_default_gov(); - if (cpufreq_change_gov(cpufreq_conservative_gov)) - pr_err("Early_suspend: Error changing governor to %s\n", - cpufreq_conservative_gov); + cpufreq_change_gov(cpufreq_conservative_gov); #endif } @@ -331,8 +329,7 @@ static void whistler_panel_late_resume(struct early_suspend *h) unsigned i; #ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND - if (cpufreq_restore_default_gov()) - pr_err("Early_suspend: Unable to restore governor\n"); + cpufreq_restore_default_gov(); #endif for (i = 0; i < num_registered_fb; i++) diff --git a/arch/arm/mach-tegra/board.h b/arch/arm/mach-tegra/board.h index 63095ce9336a..7c081fad642a 100644 --- a/arch/arm/mach-tegra/board.h +++ b/arch/arm/mach-tegra/board.h @@ -164,8 +164,8 @@ extern char cpufreq_default_gov[][MAX_GOV_NAME_LEN]; extern char *cpufreq_conservative_gov; void cpufreq_store_default_gov(void); -int cpufreq_restore_default_gov(void); -int cpufreq_change_gov(char *target_gov); +void cpufreq_restore_default_gov(void); +void cpufreq_change_gov(char *target_gov); #endif int get_core_edp(void); diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c index 2986f1cf61ac..59b4f954ee79 100644 --- a/arch/arm/mach-tegra/common.c +++ b/arch/arm/mach-tegra/common.c @@ -959,38 +959,61 @@ char *cpufreq_conservative_gov = "conservative"; void cpufreq_store_default_gov(void) { - unsigned int cpu; + unsigned int cpu = 0; struct cpufreq_policy *policy; - for (cpu = 0; cpu < CONFIG_NR_CPUS; cpu++) { +#ifndef CONFIG_TEGRA_AUTO_HOTPLUG + for_each_online_cpu(cpu) +#endif + { policy = cpufreq_cpu_get(cpu); - if (policy) { + if (policy && policy->governor) { sprintf(cpufreq_default_gov[cpu], "%s", policy->governor->name); cpufreq_cpu_put(policy); + } else { + /* No policy or no gov set for this + * online cpu. If we are here, require + * serious debugging hence setting + * as pr_error. + */ + pr_err("No gov or No policy for online cpu:%d," + , cpu); } } } -int cpufreq_change_gov(char *target_gov) +void cpufreq_change_gov(char *target_gov) { - unsigned int cpu = 0, ret = -EINVAL; + int ret = -EINVAL; + unsigned int cpu = 0; #ifndef CONFIG_TEGRA_AUTO_HOTPLUG for_each_online_cpu(cpu) #endif - ret = cpufreq_set_gov(target_gov, cpu); - - return ret; + { + ret = cpufreq_set_gov(target_gov, cpu); + if (ret < 0) + /* Unable to set gov for the online cpu. + * If it happens, needs to debug. + */ + pr_info("Unable to set gov:%s for online cpu:%d," + , cpufreq_default_gov[cpu] + , cpu); + } } -int cpufreq_restore_default_gov(void) +void cpufreq_restore_default_gov(void) { - int ret = 0; - unsigned int cpu; + int ret = -EINVAL; + unsigned int cpu = 0; - for (cpu = 0; cpu < CONFIG_NR_CPUS; cpu++) { - if (strlen((const char *)&cpufreq_default_gov[cpu])) { +#ifndef CONFIG_TEGRA_AUTO_HOTPLUG + for_each_online_cpu(cpu) +#endif + { + if (&cpufreq_default_gov[cpu] && + strlen((const char *)&cpufreq_default_gov[cpu])) { ret = cpufreq_set_gov(cpufreq_default_gov[cpu], cpu); if (ret < 0) /* Unable to restore gov for the cpu as @@ -1003,6 +1026,5 @@ int cpufreq_restore_default_gov(void) } cpufreq_default_gov[cpu][0] = '\0'; } - return ret; } #endif /* CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND */ |