Skip to content

Commit

Permalink
drivers: thermal: fix its behaviour and increase polling time.
Browse files Browse the repository at this point in the history
Signed-off-by: franciscofranco <[email protected]>
  • Loading branch information
franciscofranco committed Jan 28, 2013
1 parent f870b1d commit 1f200f8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions drivers/thermal/msm_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
#include <linux/of.h>
#include <mach/cpufreq.h>

#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;
Expand All @@ -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;

Expand All @@ -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:
Expand All @@ -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;
}

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1f200f8

Please sign in to comment.