From: Chad Goodman Date: Tue, 4 Dec 2012 05:00:43 +0000 (-0800) Subject: THERMAL: fix thermal driver setting min-clock to 1.89 by default, update fastcharge ... X-Git-Url: https://ziggy471.com/git/gitweb.cgi?p=ziggy471-sgs3-jb.git;a=commitdiff;h=788a3483ff9e66bf2aa99cd09782a251ab99244e THERMAL: fix thermal driver setting min-clock to 1.89 by default, update fastcharge driver Signed-off-by: Ziggy --- --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -33,6 +33,8 @@ #include #include +unsigned int thermal_max = 1512000; + #if !defined(__MP_DECISION_PATCH__) #error "__MP_DECISION_PATCH__ must be defined in cpufreq.c" #endif @@ -443,12 +445,20 @@ static ssize_t show_##file_name \ return sprintf(buf, "%u\n", policy->object); \ } +#define findmax( a, b ) ( ((a) > (b)) ? (a) : (b) ) + show_one(cpuinfo_min_freq, cpuinfo.min_freq); show_one(cpuinfo_max_freq, cpuinfo.max_freq); show_one(cpuinfo_transition_latency, cpuinfo.transition_latency); show_one(scaling_min_freq, min); show_one(scaling_max_freq, max); show_one(scaling_cur_freq, cur); + +static ssize_t show_thermal_max_freq(struct cpufreq_policy *policy, char *buf) +{ + return sprintf(buf, "%u\n", thermal_max); +} + #if defined(__MP_DECISION_PATCH__) show_one(cpu_utilization, utils); #endif @@ -518,12 +528,27 @@ static ssize_t store_scaling_max_freq cpufreq_set_limit_defered(USER_MAX_START, value); } + thermal_max = findmax(policy->max, thermal_max); + return count; } #else store_one(scaling_min_freq, min); store_one(scaling_max_freq, max); #endif +static ssize_t store_thermal_max_freq + (struct cpufreq_policy *policy, const char *buf, size_t count) +{ + unsigned int ret = -EINVAL; + unsigned int value = 0; + + ret = sscanf(buf, "%u", &value); + if (ret != 1) + return -EINVAL; + + thermal_max = value; + return count; +} /** * show_cpuinfo_cur_freq - current CPU frequency as detected by hardware @@ -580,6 +605,7 @@ static ssize_t store_scaling_governor(st will be wrongly overridden */ ret = __cpufreq_set_policy(policy, &new_policy); + if (policy->max > 1512000) policy->max = 1512000; policy->user_policy.policy = policy->policy; policy->user_policy.governor = policy->governor; @@ -770,12 +796,14 @@ cpufreq_freq_attr_rw(scaling_governor); cpufreq_freq_attr_rw(scaling_setspeed); #ifdef CONFIG_VDD_USERSPACE +cpufreq_freq_attr_rw(thermal_max_freq); define_one_global_rw(vdd_levels); #endif static struct attribute *default_attrs[] = { &cpuinfo_min_freq.attr, &cpuinfo_max_freq.attr, + &thermal_max_freq.attr, &cpuinfo_transition_latency.attr, &scaling_min_freq.attr, &scaling_max_freq.attr, @@ -2129,7 +2157,7 @@ int cpufreq_set_limit(unsigned int flag, max_value = user_max_freq_limit; } - /* set min freq + /* set min freq */ if (freq_limit_start_flag & TOUCH_BOOSTER_FIRST_BIT) min_value = TOUCH_BOOSTER_FIRST_FREQ_LIMIT; else if (freq_limit_start_flag & TOUCH_BOOSTER_SECOND_BIT) @@ -2137,13 +2165,13 @@ int cpufreq_set_limit(unsigned int flag, else if (freq_limit_start_flag & TOUCH_BOOSTER_BIT) min_value = TOUCH_BOOSTER_FREQ_LIMIT; else - min_value = MIN_FREQ_LIMIT;*/ + min_value = MIN_FREQ_LIMIT; - /* cpufreq_min_limit + /* cpufreq_min_limit */ if (freq_limit_start_flag & APPS_MIN_BIT) { if (min_value < app_min_freq_limit) min_value = app_min_freq_limit; - }*/ + } /* user */ if (freq_limit_start_flag & USER_MIN_BIT) {