--- eeb238f945bbcfcdfcf20a389cae4e02a0479019 +++ 5281c533746f977590e0e35f37aa6d3b5f789204 @@ -28,13 +28,12 @@ #include #include #include +#include #include #include #include -unsigned int thermal_max = 1512000; - #if !defined(__MP_DECISION_PATCH__) #error "__MP_DECISION_PATCH__ must be defined in cpufreq.c" #endif @@ -445,20 +444,12 @@ 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 @@ -528,27 +519,12 @@ 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 @@ -605,7 +581,6 @@ 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; @@ -724,59 +699,6 @@ static ssize_t show_bios_limit(struct cp return sprintf(buf, "%u\n", policy->cpuinfo.max_freq); } -#ifdef CONFIG_VDD_USERSPACE -extern ssize_t acpuclk_get_vdd_levels_str(char *buf); -static ssize_t show_vdd_levels(struct kobject *a, struct attribute *b, char *buf) -{ - return acpuclk_get_vdd_levels_str(buf); -} - -extern void acpuclk_set_vdd(unsigned acpu_khz, int vdd); -static ssize_t store_vdd_levels(struct kobject *a, struct attribute *b, const char *buf, size_t count) -{ - int i = 0, j; - int pair[2] = { 0, 0 }; - int sign = 0; - if (count < 1) - return 0; - if (buf[0] == '-') { - sign = -1; - i++; - } - else if (buf[0] == '+') { - sign = 1; - i++; - } - for (j = 0; i < count; i++) { - char c = buf[i]; - if ((c >= '0') && (c <= '9')) { - pair[j] *= 10; - pair[j] += (c - '0'); - } - else if ((c == ' ') || (c == '\t')) { - if (pair[j] != 0) { - j++; - if ((sign != 0) || (j > 1)) - break; - } - } - else - break; - } - if (sign != 0) { - if (pair[0] > 0) - acpuclk_set_vdd(0, sign * pair[0]); - } - else { - if ((pair[0] > 0) && (pair[1] > 0)) - acpuclk_set_vdd((unsigned)pair[0], pair[1]); - else - return -EINVAL; - } - return count; -} -#endif /* CONFIG_VDD_USERSPACE */ - cpufreq_freq_attr_ro_perm(cpuinfo_cur_freq, 0400); cpufreq_freq_attr_ro(cpuinfo_min_freq); cpufreq_freq_attr_ro(cpuinfo_max_freq); @@ -795,15 +717,9 @@ cpufreq_freq_attr_rw(scaling_max_freq); 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, @@ -819,18 +735,6 @@ static struct attribute *default_attrs[] NULL }; -#ifdef CONFIG_VDD_USERSPACE -static struct attribute *vddtbl_attrs[] = { - &vdd_levels.attr, - NULL -}; - -static struct attribute_group vddtbl_attr_group = { - .attrs = vddtbl_attrs, - .name = "vdd_table", -}; -#endif /* CONFIG_VDD_USERSPACE */ - struct kobject *cpufreq_global_kobject; EXPORT_SYMBOL(cpufreq_global_kobject); @@ -1232,9 +1136,6 @@ static int cpufreq_add_dev(struct sys_de pr_debug("initialization failed\n"); goto err_unlock_policy; } - - if (policy->max > 1512000) policy->max = 1512000; - policy->user_policy.min = policy->min; policy->user_policy.max = policy->max; @@ -1731,6 +1632,12 @@ int __cpufreq_driver_target(struct cpufr target_freq, relation); if (cpu_online(policy->cpu) && cpufreq_driver->target) retval = cpufreq_driver->target(policy, target_freq, relation); + if (likely(retval != -EINVAL)) { + if (target_freq == policy->max) + cpu_nonscaling(policy->cpu); + else + cpu_scaling(policy->cpu); + } return retval; } @@ -1974,7 +1881,6 @@ static int __cpufreq_set_policy(struct c /* start new governor */ data->governor = policy->governor; - if (!cpu_online(1)) cpu_up(1); if (__cpufreq_governor(data, CPUFREQ_GOV_START)) { /* new governor failed, so re-start old one */ pr_debug("starting governor %s failed\n", @@ -2430,9 +2336,6 @@ EXPORT_SYMBOL_GPL(cpufreq_unregister_dri static int __init cpufreq_core_init(void) { int cpu; -#ifdef CONFIG_VDD_USERSPACE - int rc; -#endif /* CONFIG_VDD_USERSPACE */ for_each_possible_cpu(cpu) { per_cpu(cpufreq_policy_cpu, cpu) = -1; @@ -2450,10 +2353,6 @@ static int __init cpufreq_core_init(void #endif register_syscore_ops(&cpufreq_syscore_ops); -#ifdef CONFIG_VDD_USERSPACE - rc = sysfs_create_group(cpufreq_global_kobject, &vddtbl_attr_group); -#endif /* CONFIG_VDD_USERSPACE */ - return 0; } core_initcall(cpufreq_core_init);