summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Nihalani <bnihalani@nvidia.com>2011-05-19 20:09:14 +0530
committerNiket Sirsi <nsirsi@nvidia.com>2011-05-27 16:01:39 -0700
commit87f319f8915ff4bc6b17ac7ddeb3b1bb0edc34d9 (patch)
tree11dd613510a1747d9d1400e0a4ce0d06ef12cc1c
parent5fc17afa5ecc181304950db89c0d06ab295e620f (diff)
ARM: tegra: common: dynamic cpufreq governor
To improve the power consumption situation for MP3 playback the scaling governor is set to conservative when display is turned off and the default governor is saved. The governor is restored when display is turned on. Bug 817727 Original work done by "Wen Yi <wyi@nvidia.com>" Change-Id: I43ffb0d508cc6d0a80eeeffcbab77526b644c437 Reviewed-on: http://git-master/r/32194 Reviewed-by: Niket Sirsi <nsirsi@nvidia.com> Tested-by: Niket Sirsi <nsirsi@nvidia.com>
-rw-r--r--arch/arm/mach-tegra/Kconfig7
-rw-r--r--arch/arm/mach-tegra/board-cardhu-panel.c7
-rw-r--r--arch/arm/mach-tegra/board-enterprise-panel.c7
-rw-r--r--arch/arm/mach-tegra/board-ventana-panel.c6
-rw-r--r--arch/arm/mach-tegra/board-whistler-panel.c5
-rw-r--r--arch/arm/mach-tegra/board.h3
-rw-r--r--arch/arm/mach-tegra/common.c6
7 files changed, 30 insertions, 11 deletions
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index a8a58d7a94b7..6884fe061c84 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -261,3 +261,10 @@ config TEGRA_EMC_TO_DDR_CLOCK
int "EMC to DDR clocks ratio"
default "2" if ARCH_TEGRA_2x_SOC
default "1"
+
+config TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND
+ bool "Use conservative cpu frequency governor when device enters early suspend"
+ depends on HAS_EARLYSUSPEND && CPU_FREQ
+ default n
+ help
+ Also will restore to original cpu frequency governor when device is resumed
diff --git a/arch/arm/mach-tegra/board-cardhu-panel.c b/arch/arm/mach-tegra/board-cardhu-panel.c
index b65f345f9497..28a9e31be5b3 100644
--- a/arch/arm/mach-tegra/board-cardhu-panel.c
+++ b/arch/arm/mach-tegra/board-cardhu-panel.c
@@ -842,6 +842,10 @@ static void cardhu_panel_early_suspend(struct early_suspend *h)
unsigned i;
for (i = 0; i < num_registered_fb; i++)
fb_blank(registered_fb[i], FB_BLANK_POWERDOWN);
+#ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND
+ cpufreq_save_default_governor();
+ cpufreq_set_conservative_governor();
+#endif
}
static void cardhu_panel_late_resume(struct early_suspend *h)
@@ -849,6 +853,9 @@ static void cardhu_panel_late_resume(struct early_suspend *h)
unsigned i;
for (i = 0; i < num_registered_fb; i++)
fb_blank(registered_fb[i], FB_BLANK_UNBLANK);
+#ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND
+ cpufreq_restore_default_governor();
+#endif
}
#endif
diff --git a/arch/arm/mach-tegra/board-enterprise-panel.c b/arch/arm/mach-tegra/board-enterprise-panel.c
index 51bfa1807458..53a737d1291c 100644
--- a/arch/arm/mach-tegra/board-enterprise-panel.c
+++ b/arch/arm/mach-tegra/board-enterprise-panel.c
@@ -466,12 +466,19 @@ static void enterprise_panel_early_suspend(struct early_suspend *h)
{
if (num_registered_fb > 0)
fb_blank(registered_fb[0], FB_BLANK_POWERDOWN);
+#ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND
+ cpufreq_save_default_governor();
+ cpufreq_set_conservative_governor();
+#endif
}
static void enterprise_panel_late_resume(struct early_suspend *h)
{
if (num_registered_fb > 0)
fb_blank(registered_fb[0], FB_BLANK_UNBLANK);
+#ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND
+ cpufreq_restore_default_governor();
+#endif
}
#endif
diff --git a/arch/arm/mach-tegra/board-ventana-panel.c b/arch/arm/mach-tegra/board-ventana-panel.c
index 4ba5b91ce5b9..61e1ae4ef121 100644
--- a/arch/arm/mach-tegra/board-ventana-panel.c
+++ b/arch/arm/mach-tegra/board-ventana-panel.c
@@ -334,7 +334,7 @@ static void ventana_panel_early_suspend(struct early_suspend *h)
{
if (num_registered_fb > 0)
fb_blank(registered_fb[0], FB_BLANK_POWERDOWN);
-#ifdef CONFIG_CPU_FREQ
+#ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND
cpufreq_save_default_governor();
cpufreq_set_conservative_governor();
#endif
@@ -344,11 +344,9 @@ static void ventana_panel_late_resume(struct early_suspend *h)
{
if (num_registered_fb > 0)
fb_blank(registered_fb[0], FB_BLANK_UNBLANK);
-
-#ifdef CONFIG_CPU_FREQ
+#ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND
cpufreq_restore_default_governor();
#endif
-
}
#endif
diff --git a/arch/arm/mach-tegra/board-whistler-panel.c b/arch/arm/mach-tegra/board-whistler-panel.c
index 62b938bc165f..f4ec0cecd45a 100644
--- a/arch/arm/mach-tegra/board-whistler-panel.c
+++ b/arch/arm/mach-tegra/board-whistler-panel.c
@@ -297,7 +297,7 @@ static void whistler_panel_early_suspend(struct early_suspend *h)
{
if (num_registered_fb > 0)
fb_blank(registered_fb[0], FB_BLANK_POWERDOWN);
-#ifdef CONFIG_CPU_FREQ
+#ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND
cpufreq_save_default_governor();
cpufreq_set_conservative_governor();
#endif
@@ -307,8 +307,7 @@ static void whistler_panel_late_resume(struct early_suspend *h)
{
if (num_registered_fb > 0)
fb_blank(registered_fb[0], FB_BLANK_UNBLANK);
-
-#ifdef CONFIG_CPU_FREQ
+#ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND
cpufreq_restore_default_governor();
#endif
}
diff --git a/arch/arm/mach-tegra/board.h b/arch/arm/mach-tegra/board.h
index 7b5708636df3..dafaa03560df 100644
--- a/arch/arm/mach-tegra/board.h
+++ b/arch/arm/mach-tegra/board.h
@@ -71,10 +71,11 @@ enum panel_type {
};
void tegra_get_board_info(struct board_info *);
+#ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND
void cpufreq_save_default_governor(void);
void cpufreq_restore_default_governor(void);
void cpufreq_set_conservative_governor(void);
-
+#endif
int get_core_edp(void);
enum panel_type get_panel_type(void);
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c
index c6e130d554ce..26ecd1217f80 100644
--- a/arch/arm/mach-tegra/common.c
+++ b/arch/arm/mach-tegra/common.c
@@ -641,7 +641,7 @@ void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size,
#endif
}
-#if defined CONFIG_HAS_EARLYSUSPEND && defined CONFIG_CPU_FREQ
+#ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND
static char cpufreq_gov_default[32];
static char *cpufreq_gov_conservative = "conservative";
static char *cpufreq_sysfs_place_holder="/sys/devices/system/cpu/cpu%i/cpufreq/scaling_governor";
@@ -656,7 +656,7 @@ static void cpufreq_set_governor(char *governor)
if (governor == NULL)
return;
- for_each_cpu(i, cpu_present_mask) {
+ for_each_online_cpu(i) {
sprintf(buf, cpufreq_sysfs_place_holder, i);
scaling_gov = filp_open(buf, O_RDWR, 0);
if (scaling_gov != NULL) {
@@ -710,4 +710,4 @@ void cpufreq_set_conservative_governor(void)
{
cpufreq_set_governor(cpufreq_gov_conservative);
}
-#endif
+#endif /* CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND */