static int limit_temp;
module_param(limit_temp, int, 0444);
-#define LIMIT_AVG_VOLTAGE 1225000 /* vU */
+#define LIMIT_AVG_VOLTAGE 1200000 /* vU */
#else /* !CONFIG_RK29_CPU_FREQ_LIMIT_BY_TEMP */
#define LIMIT_AVG_VOLTAGE 1400000 /* vU */
#endif /* CONFIG_RK29_CPU_FREQ_LIMIT_BY_TEMP */
#define LIMIT_AVG_FREQ (816 * KHZ) /* kHz */
static unsigned int limit_avg_freq = LIMIT_AVG_FREQ;
-static int rk29_cpufreq_set_limit_avg_freq(const char *val, struct kernel_param *kp)
-{
- int err = param_set_uint(val, kp);
- if (!err) {
- board_update_cpufreq_table(freq_table);
- }
- return err;
-}
-module_param_call(limit_avg_freq, rk29_cpufreq_set_limit_avg_freq, param_get_uint, &limit_avg_freq, 0644);
+module_param(limit_avg_freq, uint, 0444);
static int limit_avg_index = -1;
static bool limit_fb1_is_on;
static bool limit_hdmi_is_on;
static inline bool aclk_limit(void) { return limit_hdmi_is_on && limit_fb1_is_on; }
-static int limit_index_816 = -1;
module_param(limit_fb1_is_on, bool, 0644);
module_param(limit_hdmi_is_on, bool, 0644);
#else
#endif
#if defined(CONFIG_RK29_CPU_FREQ_LIMIT_BY_DISP) || defined(CONFIG_RK29_CPU_FREQ_LIMIT_BY_TEMP)
+static int limit_index_816 = -1;
+static unsigned int limit_freq_816;
static int limit_index_1008 = -1;
static unsigned int limit_freq_1008;
#endif
limit_avg_freq = 0;
limit_avg_index = -1;
-#ifdef CONFIG_RK29_CPU_FREQ_LIMIT_BY_DISP
- limit_index_816 = -1;
-#endif
#if defined(CONFIG_RK29_CPU_FREQ_LIMIT_BY_DISP) || defined(CONFIG_RK29_CPU_FREQ_LIMIT_BY_TEMP)
+ limit_index_816 = -1;
+ limit_freq_816 = 0;
limit_index_1008 = -1;
limit_freq_1008 = 0;
#endif
limit_avg_freq = table[i].frequency;
limit_avg_index = i;
}
-#ifdef CONFIG_RK29_CPU_FREQ_LIMIT_BY_DISP
+#if defined(CONFIG_RK29_CPU_FREQ_LIMIT_BY_DISP) || defined(CONFIG_RK29_CPU_FREQ_LIMIT_BY_TEMP)
if (table[i].frequency <= 816 * KHZ &&
(limit_index_816 < 0 ||
(limit_index_816 >= 0 && table[limit_index_816].frequency < table[i].frequency)))
limit_index_816 = i;
-#endif
-#if defined(CONFIG_RK29_CPU_FREQ_LIMIT_BY_DISP) || defined(CONFIG_RK29_CPU_FREQ_LIMIT_BY_TEMP)
if (table[i].frequency <= 1008 * KHZ &&
(limit_index_1008 < 0 ||
(limit_index_1008 >= 0 && table[limit_index_1008].frequency < table[i].frequency))) {
unsigned int target_freq;
if (!limit || !rk29_cpufreq_is_ondemand_policy(policy) ||
- (limit_avg_index < 0) || (relation & MASK_FURTHER_CPUFREQ)) {
+ (limit_index_816 < 0) || (relation & MASK_FURTHER_CPUFREQ)) {
limit_temp = 0;
last.tv64 = 0;
return;
c = TEMP_COEFF_408;
else if (cur <= 624 * 1000)
c = TEMP_COEFF_624;
- else if (cur <= limit_avg_freq)
+ else if (cur <= 816 * 1000)
c = TEMP_COEFF_816;
else if (cur <= 1008 * 1000)
c = TEMP_COEFF_1008;
overheat_temp = TEMP_COEFF_1008 * limit_secs * 1000;
overheat_temp_1200 = overheat_temp - TEMP_COEFF_1200 * (WORK_DELAY/HZ) * 1000;
- if (temp > overheat_temp && target_freq > limit_avg_freq)
- target_index = limit_avg_index;
- else if (target_freq > limit_freq_1008 && limit_freq_1008 > limit_avg_freq &&
+ if (temp > overheat_temp && target_freq > limit_freq_816)
+ target_index = limit_index_816;
+ else if (target_freq > limit_freq_1008 && limit_freq_1008 > limit_freq_816 &&
temp > overheat_temp_1200 && temp <= overheat_temp)
target_index = limit_index_1008;
switch (event) {
case PM_SUSPEND_PREPARE:
- ret = cpufreq_driver_target(policy, limit_avg_freq, DISABLE_FURTHER_CPUFREQ | CPUFREQ_RELATION_L);
+ ret = cpufreq_driver_target(policy, limit_avg_freq, DISABLE_FURTHER_CPUFREQ | CPUFREQ_RELATION_H);
if (ret < 0) {
ret = NOTIFY_BAD;
goto out;
break;
case PM_POST_RESTORE:
case PM_POST_SUSPEND:
- cpufreq_driver_target(policy, limit_avg_freq, ENABLE_FURTHER_CPUFREQ | CPUFREQ_RELATION_L);
+ cpufreq_driver_target(policy, limit_avg_freq, ENABLE_FURTHER_CPUFREQ | CPUFREQ_RELATION_H);
ret = NOTIFY_OK;
break;
}
struct cpufreq_policy *policy = cpufreq_cpu_get(0);
if (policy) {
- cpufreq_driver_target(policy, limit_avg_freq, DISABLE_FURTHER_CPUFREQ | CPUFREQ_RELATION_L);
+ cpufreq_driver_target(policy, limit_avg_freq, DISABLE_FURTHER_CPUFREQ | CPUFREQ_RELATION_H);
cpufreq_cpu_put(policy);
}