|
Lines 116-121
Link Here
|
| 116 |
} |
116 |
} |
| 117 |
|
117 |
|
| 118 |
|
118 |
|
|
|
119 |
/* returns 0 if it was able to set a higher limit and |
| 120 |
another call will also succeed |
| 121 |
returns 1 if it was able to set a higher limit but |
| 122 |
no further limit possible |
| 123 |
returns < 0 otherwise |
| 124 |
*/ |
| 119 |
static int acpi_thermal_cpufreq_increase(unsigned int cpu) |
125 |
static int acpi_thermal_cpufreq_increase(unsigned int cpu) |
| 120 |
{ |
126 |
{ |
| 121 |
if (!cpu_has_cpufreq(cpu)) |
127 |
if (!cpu_has_cpufreq(cpu)) |
|
Lines 123-136
Link Here
|
| 123 |
|
129 |
|
| 124 |
if (cpufreq_thermal_reduction_pctg[cpu] < 60) { |
130 |
if (cpufreq_thermal_reduction_pctg[cpu] < 60) { |
| 125 |
cpufreq_thermal_reduction_pctg[cpu] += 20; |
131 |
cpufreq_thermal_reduction_pctg[cpu] += 20; |
|
|
132 |
|
| 133 |
if( cpufreq_thermal_reduction_pctg[cpu] >= 60) |
| 134 |
cpufreq_thermal_reduction_pctg[ cpu ] = 80; |
| 135 |
|
| 126 |
cpufreq_update_policy(cpu); |
136 |
cpufreq_update_policy(cpu); |
|
|
137 |
|
| 138 |
if( cpufreq_thermal_reduction_pctg[cpu] >= 60) |
| 139 |
return 1; |
| 127 |
return 0; |
140 |
return 0; |
| 128 |
} |
141 |
} |
| 129 |
|
142 |
|
| 130 |
return -ERANGE; |
143 |
return -ERANGE; |
| 131 |
} |
144 |
} |
| 132 |
|
145 |
|
| 133 |
|
146 |
/* returns 0 if it was able to set a higher limit and |
|
|
147 |
another call will also succeed |
| 148 |
returns 1 if it was able to set a higher limit but |
| 149 |
no further limit possible |
| 150 |
returns < 0 otherwise |
| 151 |
*/ |
| 134 |
static int acpi_thermal_cpufreq_decrease(unsigned int cpu) |
152 |
static int acpi_thermal_cpufreq_decrease(unsigned int cpu) |
| 135 |
{ |
153 |
{ |
| 136 |
if (!cpu_has_cpufreq(cpu)) |
154 |
if (!cpu_has_cpufreq(cpu)) |
|
Lines 138-145
Link Here
|
| 138 |
|
156 |
|
| 139 |
if (cpufreq_thermal_reduction_pctg[cpu] >= 20) { |
157 |
if (cpufreq_thermal_reduction_pctg[cpu] >= 20) { |
| 140 |
cpufreq_thermal_reduction_pctg[cpu] -= 20; |
158 |
cpufreq_thermal_reduction_pctg[cpu] -= 20; |
|
|
159 |
if ( cpufreq_thermal_reduction_pctg[cpu] < 20 ) |
| 160 |
cpufreq_thermal_reduction_pctg[ cpu ] = 0; |
| 161 |
|
| 141 |
cpufreq_update_policy(cpu); |
162 |
cpufreq_update_policy(cpu); |
| 142 |
return 0; |
163 |
|
|
|
164 |
if ( cpufreq_thermal_reduction_pctg[cpu] < 20 ) |
| 165 |
return 1; |
| 166 |
return 0; |
| 143 |
} |
167 |
} |
| 144 |
|
168 |
|
| 145 |
return -ERANGE; |
169 |
return -ERANGE; |
|
Lines 238-243
Link Here
|
| 238 |
case ACPI_PROCESSOR_LIMIT_NONE: |
262 |
case ACPI_PROCESSOR_LIMIT_NONE: |
| 239 |
do { |
263 |
do { |
| 240 |
result = acpi_thermal_cpufreq_decrease(pr->id); |
264 |
result = acpi_thermal_cpufreq_decrease(pr->id); |
|
|
265 |
/* result == 0 means: was able to decrease and further decrease possible */ |
| 241 |
} while (!result); |
266 |
} while (!result); |
| 242 |
tx = 0; |
267 |
tx = 0; |
| 243 |
break; |
268 |
break; |
|
Lines 245-253
Link Here
|
| 245 |
case ACPI_PROCESSOR_LIMIT_INCREMENT: |
270 |
case ACPI_PROCESSOR_LIMIT_INCREMENT: |
| 246 |
/* if going up: P-states first, T-states later */ |
271 |
/* if going up: P-states first, T-states later */ |
| 247 |
|
272 |
|
|
|
273 |
printk(KERN_INFO "throttling: %d\n", pr->flags.throttling); |
| 248 |
result = acpi_thermal_cpufreq_increase(pr->id); |
274 |
result = acpi_thermal_cpufreq_increase(pr->id); |
| 249 |
if (!result) |
275 |
printk(KERN_INFO "limit_increment: result: %d\n", result); |
| 250 |
goto end; |
276 |
if (result >= 0) |
|
|
277 |
return_VALUE(result); |
| 251 |
else if (result == -ERANGE) |
278 |
else if (result == -ERANGE) |
| 252 |
ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
279 |
ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 253 |
"At maximum performance state\n")); |
280 |
"At maximum performance state\n")); |
|
Lines 263-268
Link Here
|
| 263 |
|
290 |
|
| 264 |
case ACPI_PROCESSOR_LIMIT_DECREMENT: |
291 |
case ACPI_PROCESSOR_LIMIT_DECREMENT: |
| 265 |
/* if going down: T-states first, P-states later */ |
292 |
/* if going down: T-states first, P-states later */ |
|
|
293 |
printk(KERN_INFO "throttling: %d\n", pr->flags.throttling); |
| 266 |
|
294 |
|
| 267 |
if (pr->flags.throttling) { |
295 |
if (pr->flags.throttling) { |
| 268 |
if (tx == 0) |
296 |
if (tx == 0) |
|
Lines 275-283
Link Here
|
| 275 |
} |
303 |
} |
| 276 |
|
304 |
|
| 277 |
result = acpi_thermal_cpufreq_decrease(pr->id); |
305 |
result = acpi_thermal_cpufreq_decrease(pr->id); |
| 278 |
if (result == -ERANGE) |
306 |
|
| 279 |
ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
307 |
printk(KERN_INFO "limit_decrement: result: %d\n", result); |
| 280 |
"At minimum performance state\n")); |
308 |
if (result != 0) |
|
|
309 |
printk(KERN_INFO |
| 310 |
"At minimum performance state\n"); |
| 311 |
if ( result ) |
| 312 |
return_VALUE(result); |
| 281 |
|
313 |
|
| 282 |
break; |
314 |
break; |
| 283 |
} |
315 |
} |
|
Lines 295-302
Link Here
|
| 295 |
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Thermal limit now (P%d:T%d)\n", |
327 |
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Thermal limit now (P%d:T%d)\n", |
| 296 |
pr->limit.thermal.px, |
328 |
pr->limit.thermal.px, |
| 297 |
pr->limit.thermal.tx)); |
329 |
pr->limit.thermal.tx)); |
| 298 |
} else |
330 |
} |
| 299 |
result = 0; |
331 |
|
|
|
332 |
printk(KERN_INFO "doing return %d\n", result); |
| 300 |
|
333 |
|
| 301 |
return_VALUE(result); |
334 |
return_VALUE(result); |
| 302 |
} |
335 |
} |