diff options
-rw-r--r-- | arch/arm/mach-tegra/board-enterprise-panel.c | 11 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-ventana-panel.c | 13 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-whistler-panel.c | 11 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board.h | 7 | ||||
-rw-r--r-- | arch/arm/mach-tegra/common.c | 58 |
5 files changed, 45 insertions, 55 deletions
diff --git a/arch/arm/mach-tegra/board-enterprise-panel.c b/arch/arm/mach-tegra/board-enterprise-panel.c index a94eb40b3b7d..ec7eae3b365d 100644 --- a/arch/arm/mach-tegra/board-enterprise-panel.c +++ b/arch/arm/mach-tegra/board-enterprise-panel.c @@ -722,9 +722,14 @@ 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); + cpufreq_set_conservative_governor_param("up_threshold", + SET_CONSERVATIVE_GOVERNOR_UP_THRESHOLD); + + cpufreq_set_conservative_governor_param("down_threshold", + SET_CONSERVATIVE_GOVERNOR_DOWN_THRESHOLD); + + cpufreq_set_conservative_governor_param("freq_step", + SET_CONSERVATIVE_GOVERNOR_FREQ_STEP); #endif } diff --git a/arch/arm/mach-tegra/board-ventana-panel.c b/arch/arm/mach-tegra/board-ventana-panel.c index 5290a3da02ca..e2a54cdb2a68 100644 --- a/arch/arm/mach-tegra/board-ventana-panel.c +++ b/arch/arm/mach-tegra/board-ventana-panel.c @@ -352,8 +352,6 @@ struct early_suspend ventana_panel_early_suspender; static void ventana_panel_early_suspend(struct early_suspend *h) { - unsigned i; - /* power down LCD, add use a black screen for HDMI */ if (num_registered_fb > 0) fb_blank(registered_fb[0], FB_BLANK_POWERDOWN); @@ -362,9 +360,14 @@ 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); + cpufreq_set_conservative_governor_param("up_threshold", + SET_CONSERVATIVE_GOVERNOR_UP_THRESHOLD); + + cpufreq_set_conservative_governor_param("down_threshold", + SET_CONSERVATIVE_GOVERNOR_DOWN_THRESHOLD); + + cpufreq_set_conservative_governor_param("freq_step", + SET_CONSERVATIVE_GOVERNOR_FREQ_STEP); #endif } diff --git a/arch/arm/mach-tegra/board-whistler-panel.c b/arch/arm/mach-tegra/board-whistler-panel.c index e68d6bf40292..9bdde43b8925 100644 --- a/arch/arm/mach-tegra/board-whistler-panel.c +++ b/arch/arm/mach-tegra/board-whistler-panel.c @@ -320,9 +320,14 @@ 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); + cpufreq_set_conservative_governor_param("up_threshold", + SET_CONSERVATIVE_GOVERNOR_UP_THRESHOLD); + + cpufreq_set_conservative_governor_param("down_threshold", + SET_CONSERVATIVE_GOVERNOR_DOWN_THRESHOLD); + + cpufreq_set_conservative_governor_param("freq_step", + SET_CONSERVATIVE_GOVERNOR_FREQ_STEP); #endif } diff --git a/arch/arm/mach-tegra/board.h b/arch/arm/mach-tegra/board.h index 950ccdf21afe..fc22b76160f9 100644 --- a/arch/arm/mach-tegra/board.h +++ b/arch/arm/mach-tegra/board.h @@ -102,13 +102,14 @@ void tegra_get_pmu_board_info(struct board_info *bi); void tegra_get_display_board_info(struct board_info *bi); void tegra_get_camera_board_info(struct board_info *bi); #ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND -#define SET_CONSERVATIVE_GOVERNOR_UP_THRESHOLD 95 -#define SET_CONSERVATIVE_GOVERNOR_DOWN_THRESHOLD 50 +#define SET_CONSERVATIVE_GOVERNOR_UP_THRESHOLD 95 +#define SET_CONSERVATIVE_GOVERNOR_DOWN_THRESHOLD 50 +#define SET_CONSERVATIVE_GOVERNOR_FREQ_STEP 3 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); +void cpufreq_set_conservative_governor_param(char *name, int value); #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 9d5b0819c9d0..b2ce3910931c 100644 --- a/arch/arm/mach-tegra/common.c +++ b/arch/arm/mach-tegra/common.c @@ -961,7 +961,7 @@ static void cpufreq_set_governor(char *governor) struct file *scaling_gov = NULL; mm_segment_t old_fs; char buf[128]; - int i = 0; + int i; loff_t offset = 0; if (governor == NULL) @@ -976,9 +976,7 @@ static void cpufreq_set_governor(char *governor) { sprintf(buf, cpufreq_sysfs_place_holder, i); scaling_gov = filp_open(buf, O_RDWR, 0); - if (IS_ERR_OR_NULL(scaling_gov)) { - pr_err("%s. Can't open %s\n", __func__, buf); - } else { + if (scaling_gov != NULL) { if (scaling_gov->f_op != NULL && scaling_gov->f_op->write != NULL) scaling_gov->f_op->write(scaling_gov, @@ -989,6 +987,8 @@ static void cpufreq_set_governor(char *governor) pr_err("f_op might be null\n"); filp_close(scaling_gov, NULL); + } else { + pr_err("%s. Can't open %s\n", __func__, buf); } } set_fs(old_fs); @@ -1008,9 +1008,7 @@ void cpufreq_save_default_governor(void) buf[127] = 0; sprintf(buf, cpufreq_sysfs_place_holder,0); scaling_gov = filp_open(buf, O_RDONLY, 0); - if (IS_ERR_OR_NULL(scaling_gov)) { - pr_err("%s. Can't open %s\n", __func__, buf); - } else { + if (scaling_gov != NULL) { if (scaling_gov->f_op != NULL && scaling_gov->f_op->read != NULL) scaling_gov->f_op->read(scaling_gov, @@ -1021,6 +1019,8 @@ void cpufreq_save_default_governor(void) pr_err("f_op might be null\n"); filp_close(scaling_gov, NULL); + } else { + pr_err("%s. Can't open %s\n", __func__, buf); } set_fs(old_fs); } @@ -1030,57 +1030,33 @@ void cpufreq_restore_default_governor(void) cpufreq_set_governor(cpufreq_gov_default); } -void cpufreq_set_conservative_governor_param(int up_th, int down_th) +void cpufreq_set_conservative_governor_param(char *name, int value) { struct file *gov_param = NULL; - static char buf[128],parm[8]; - loff_t offset = 0; mm_segment_t old_fs; - - 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; - } + static char buf[128], param_value[8]; + loff_t offset = 0; /* change to KERNEL_DS address limit */ old_fs = get_fs(); set_fs(KERNEL_DS); - sprintf(parm, "%d", up_th); - sprintf(buf, cpufreq_gov_conservative_param ,"up_threshold"); - gov_param = filp_open(buf, O_RDONLY, 0); - if (IS_ERR_OR_NULL(gov_param)) { - pr_err("%s. Can't open %s\n", __func__, buf); - } else { + sprintf(param_value, "%d", value); + sprintf(buf, cpufreq_gov_conservative_param, name); + gov_param = filp_open(buf, O_RDWR, 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), + param_value, + strlen(param_value), &offset); else pr_err("f_op might be null\n"); filp_close(gov_param, NULL); - } - - sprintf(parm, "%d", down_th); - sprintf(buf, cpufreq_gov_conservative_param ,"down_threshold"); - gov_param = filp_open(buf, O_RDONLY, 0); - if (IS_ERR_OR_NULL(gov_param)) { - pr_err("%s. Can't open %s\n", __func__, buf); } else { - 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); + pr_err("%s. Can't open %s\n", __func__, buf); } set_fs(old_fs); } |