From 1f200f81299c8c3c506b7b7601faa3c57adc623b Mon Sep 17 00:00:00 2001 From: franciscofranco Date: Sun, 27 Jan 2013 21:12:29 -0800 Subject: [PATCH] drivers: thermal: fix its behaviour and increase polling time. Signed-off-by: franciscofranco --- drivers/thermal/msm_thermal.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/msm_thermal.c b/drivers/thermal/msm_thermal.c index 0c9ff57cf32..8dfe52689a5 100644 --- a/drivers/thermal/msm_thermal.c +++ b/drivers/thermal/msm_thermal.c @@ -25,9 +25,9 @@ #include #include -#define POLLING_DELAY 100 +#define POLLING_DELAY 500 -unsigned int temp_threshold = 65; +unsigned int temp_threshold = 70; module_param(temp_threshold, int, 0755); static int enabled; @@ -39,7 +39,7 @@ static unsigned int limit_idx; static unsigned int limit_idx_low; static unsigned int limit_idx_high; static unsigned int max_frequency; -static bool throttling = false; +bool throttling; static struct cpufreq_frequency_table *table; struct cpufreq_policy *policy = NULL; @@ -58,7 +58,7 @@ static int msm_thermal_get_freq_table(void) while (table[i].frequency != max_frequency) i++; - limit_idx_low = 6; + limit_idx_low = 4; limit_idx_high = limit_idx = i - 1; BUG_ON(limit_idx_high <= 0 || limit_idx_high <= limit_idx_low); fail: @@ -68,17 +68,18 @@ static int msm_thermal_get_freq_table(void) static int update_cpu_max_freq(int cpu, uint32_t max_freq) { int ret = 0; + policy = cpufreq_cpu_get(0); ret = msm_cpufreq_set_freq_limits(cpu, MSM_CPUFREQ_NO_LIMIT, max_freq); if (ret) return ret; limited_max_freq = max_freq; - if (max_freq != MSM_CPUFREQ_NO_LIMIT) + if (max_freq != policy->max) pr_info("msm_thermal: Limiting cpu%d max frequency to %d\n", cpu, max_freq); else { - pr_info("msm_thermal: Max frequency reset for cpu%d\n", cpu); + pr_info("msm_thermal: Max frequency reset for cpu%d to %d\n", cpu, max_freq); throttling = false; } @@ -125,6 +126,7 @@ static void check_temp(struct work_struct *work) limit_idx = limit_idx_low; if (limit_idx < limit_idx_low) limit_idx = limit_idx_low; + max_freq = table[limit_idx].frequency; } else if (temp < (temp_threshold - 5)) { if (limit_idx == limit_idx_high)