static int cpufreq_get_max_state(unsigned int cpu) { if (!cpu_has_cpufreq(cpu)) return 0; return CPUFREQ_THERMAL_MAX_STEP; }
static int cpufreq_get_cur_state(unsigned int cpu) { if (!cpu_has_cpufreq(cpu)) return 0; return reduction_pctg(cpu); }
static int cpufreq_get_cur_state(unsigned int cpu) { if (!cpu_has_cpufreq(cpu)) return 0; return per_cpu(cpufreq_thermal_reduction_pctg, cpu); }
static int cpufreq_set_cur_state(unsigned int cpu, int state) { if (!cpu_has_cpufreq(cpu)) return 0; per_cpu(cpufreq_thermal_reduction_pctg, cpu) = state; cpufreq_update_policy(cpu); return 0; }
static int acpi_thermal_cpufreq_decrease(unsigned int cpu) { if (!cpu_has_cpufreq(cpu)) return -ENODEV; if (cpufreq_thermal_reduction_pctg[cpu] > 20) cpufreq_thermal_reduction_pctg[cpu] -= 20; else cpufreq_thermal_reduction_pctg[cpu] = 0; cpufreq_update_policy(cpu); /* We reached max freq again and can leave passive mode */ return !cpufreq_thermal_reduction_pctg[cpu]; }
static int acpi_thermal_cpufreq_increase(unsigned int cpu) { if (!cpu_has_cpufreq(cpu)) return -ENODEV; if (cpufreq_thermal_reduction_pctg[cpu] < 60) { cpufreq_thermal_reduction_pctg[cpu] += 20; cpufreq_update_policy(cpu); return 0; } return -ERANGE; }
static int acpi_thermal_cpufreq_decrease(unsigned int cpu) { if (!cpu_has_cpufreq(cpu)) return -ENODEV; if (per_cpu(cpufreq_thermal_reduction_pctg, cpu) > (CPUFREQ_THERMAL_MIN_STEP + 1)) per_cpu(cpufreq_thermal_reduction_pctg, cpu)--; else per_cpu(cpufreq_thermal_reduction_pctg, cpu) = 0; cpufreq_update_policy(cpu); /* We reached max freq again and can leave passive mode */ return !per_cpu(cpufreq_thermal_reduction_pctg, cpu); }
static int acpi_thermal_cpufreq_increase(unsigned int cpu) { if (!cpu_has_cpufreq(cpu)) return -ENODEV; if (per_cpu(cpufreq_thermal_reduction_pctg, cpu) < CPUFREQ_THERMAL_MAX_STEP) { per_cpu(cpufreq_thermal_reduction_pctg, cpu)++; cpufreq_update_policy(cpu); return 0; } return -ERANGE; }
static int cpufreq_set_cur_state(unsigned int cpu, int state) { int i; if (!cpu_has_cpufreq(cpu)) return 0; reduction_pctg(cpu) = state; /* * Update all the CPUs in the same package because they all * contribute to the temperature and often share the same * frequency. */ for_each_online_cpu(i) { if (topology_physical_package_id(i) == topology_physical_package_id(cpu)) cpufreq_update_policy(i); } return 0; }
static int cpufreq_set_cur_state(unsigned int cpu, int state) { int i; if (!cpu_has_cpufreq(cpu)) return 0; reduction_pctg(cpu) = state; /* */ for_each_online_cpu(i) { if (topology_physical_package_id(i) == topology_physical_package_id(cpu)) cpufreq_update_policy(i); } return 0; }