diff options
-rw-r--r-- | arch/arm/mach-tegra/board-cardhu-panel.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-enterprise-panel.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-ventana-panel.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-whistler-panel.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board.h | 4 | ||||
-rw-r--r-- | arch/arm/mach-tegra/common.c | 52 |
6 files changed, 67 insertions, 1 deletions
diff --git a/arch/arm/mach-tegra/board-cardhu-panel.c b/arch/arm/mach-tegra/board-cardhu-panel.c index c28352e657ff..d8b811ce932f 100644 --- a/arch/arm/mach-tegra/board-cardhu-panel.c +++ b/arch/arm/mach-tegra/board-cardhu-panel.c @@ -836,6 +836,9 @@ static void cardhu_panel_early_suspend(struct early_suspend *h) #ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND cpufreq_save_default_governor(); cpufreq_set_conservative_governor(); + cpufreq_set_conservative_governor_param( + SET_CONSERVATIVE_GOVERNOR_UP_THRESHOLD, + SET_CONSERVATIVE_GOVERNOR_DOWN_THRESHOLD); #endif } diff --git a/arch/arm/mach-tegra/board-enterprise-panel.c b/arch/arm/mach-tegra/board-enterprise-panel.c index 8ea83a4e8fe0..f15a0cc865a2 100644 --- a/arch/arm/mach-tegra/board-enterprise-panel.c +++ b/arch/arm/mach-tegra/board-enterprise-panel.c @@ -434,6 +434,9 @@ static void enterprise_panel_early_suspend(struct early_suspend *h) #ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND cpufreq_save_default_governor(); cpufreq_set_conservative_governor(); + cpufreq_set_conservative_governor_param( + SET_CONSERVATIVE_GOVERNOR_UP_THRESHOLD, + SET_CONSERVATIVE_GOVERNOR_DOWN_THRESHOLD); #endif } diff --git a/arch/arm/mach-tegra/board-ventana-panel.c b/arch/arm/mach-tegra/board-ventana-panel.c index 61e1ae4ef121..37422253c381 100644 --- a/arch/arm/mach-tegra/board-ventana-panel.c +++ b/arch/arm/mach-tegra/board-ventana-panel.c @@ -337,6 +337,9 @@ static void ventana_panel_early_suspend(struct early_suspend *h) #ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND cpufreq_save_default_governor(); cpufreq_set_conservative_governor(); + cpufreq_set_conservative_governor_param( + SET_CONSERVATIVE_GOVERNOR_UP_THRESHOLD, + SET_CONSERVATIVE_GOVERNOR_DOWN_THRESHOLD); #endif } diff --git a/arch/arm/mach-tegra/board-whistler-panel.c b/arch/arm/mach-tegra/board-whistler-panel.c index f4ec0cecd45a..41e381d16416 100644 --- a/arch/arm/mach-tegra/board-whistler-panel.c +++ b/arch/arm/mach-tegra/board-whistler-panel.c @@ -300,6 +300,9 @@ static void whistler_panel_early_suspend(struct early_suspend *h) #ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND cpufreq_save_default_governor(); cpufreq_set_conservative_governor(); + cpufreq_set_conservative_governor_param( + SET_CONSERVATIVE_GOVERNOR_UP_THRESHOLD, + SET_CONSERVATIVE_GOVERNOR_DOWN_THRESHOLD); #endif } diff --git a/arch/arm/mach-tegra/board.h b/arch/arm/mach-tegra/board.h index dafaa03560df..fea1ae78786e 100644 --- a/arch/arm/mach-tegra/board.h +++ b/arch/arm/mach-tegra/board.h @@ -72,9 +72,13 @@ enum panel_type { void tegra_get_board_info(struct board_info *); #ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND +#define SET_CONSERVATIVE_GOVERNOR_UP_THRESHOLD 95 +#define SET_CONSERVATIVE_GOVERNOR_DOWN_THRESHOLD 50 + void cpufreq_save_default_governor(void); void cpufreq_restore_default_governor(void); void cpufreq_set_conservative_governor(void); +void cpufreq_set_conservative_governor_param(int up_th, int down_th); #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 ad06ff179e99..c378de84700d 100644 --- a/arch/arm/mach-tegra/common.c +++ b/arch/arm/mach-tegra/common.c @@ -735,6 +735,7 @@ void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size, 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"; +static char *cpufreq_gov_conservative_param="/sys/devices/system/cpu/cpufreq/conservative/%s"; static void cpufreq_set_governor(char *governor) { @@ -780,7 +781,7 @@ void cpufreq_save_default_governor(void) scaling_gov->f_op->read != NULL) scaling_gov->f_op->read(scaling_gov, cpufreq_gov_default, - 127, + 32, &offset); else pr_err("f_op might be null\n"); @@ -796,6 +797,55 @@ void cpufreq_restore_default_governor(void) cpufreq_set_governor(cpufreq_gov_default); } +void cpufreq_set_conservative_governor_param(int up_th, int down_th) +{ + struct file *gov_param = NULL; + static char buf[128],parm[8]; + loff_t offset = 0; + + if (up_th <= down_th) { + printk(KERN_ERR "%s: up_th(%d) is lesser than down_th(%d)\n", + __func__, up_th, down_th); + return; + } + + sprintf(parm, "%d", up_th); + sprintf(buf, cpufreq_gov_conservative_param ,"up_threshold"); + gov_param = filp_open(buf, O_RDONLY, 0); + if (gov_param != NULL) { + if (gov_param->f_op != NULL && + gov_param->f_op->write != NULL) + gov_param->f_op->write(gov_param, + parm, + strlen(parm), + &offset); + else + pr_err("f_op might be null\n"); + + filp_close(gov_param, NULL); + } else { + pr_err("%s. Can't open %s\n", __func__, buf); + } + + sprintf(parm, "%d", down_th); + sprintf(buf, cpufreq_gov_conservative_param ,"down_threshold"); + gov_param = filp_open(buf, O_RDONLY, 0); + if (gov_param != NULL) { + if (gov_param->f_op != NULL && + gov_param->f_op->write != NULL) + gov_param->f_op->write(gov_param, + parm, + strlen(parm), + &offset); + else + pr_err("f_op might be null\n"); + + filp_close(gov_param, NULL); + } else { + pr_err("%s. Can't open %s\n", __func__, buf); + } +} + void cpufreq_set_conservative_governor(void) { cpufreq_set_governor(cpufreq_gov_conservative); |