diff options
Diffstat (limited to 'drivers/acpi/thermal.c')
-rw-r--r-- | drivers/acpi/thermal.c | 57 |
1 files changed, 35 insertions, 22 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 912703691d36..ad6cae938f0b 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -246,18 +246,18 @@ static const struct file_operations acpi_thermal_polling_fops = { | |||
246 | static int acpi_thermal_get_temperature(struct acpi_thermal *tz) | 246 | static int acpi_thermal_get_temperature(struct acpi_thermal *tz) |
247 | { | 247 | { |
248 | acpi_status status = AE_OK; | 248 | acpi_status status = AE_OK; |
249 | 249 | unsigned long long tmp; | |
250 | 250 | ||
251 | if (!tz) | 251 | if (!tz) |
252 | return -EINVAL; | 252 | return -EINVAL; |
253 | 253 | ||
254 | tz->last_temperature = tz->temperature; | 254 | tz->last_temperature = tz->temperature; |
255 | 255 | ||
256 | status = | 256 | status = acpi_evaluate_integer(tz->device->handle, "_TMP", NULL, &tmp); |
257 | acpi_evaluate_integer(tz->device->handle, "_TMP", NULL, &tz->temperature); | ||
258 | if (ACPI_FAILURE(status)) | 257 | if (ACPI_FAILURE(status)) |
259 | return -ENODEV; | 258 | return -ENODEV; |
260 | 259 | ||
260 | tz->temperature = tmp; | ||
261 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Temperature is %lu dK\n", | 261 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Temperature is %lu dK\n", |
262 | tz->temperature)); | 262 | tz->temperature)); |
263 | 263 | ||
@@ -267,17 +267,16 @@ static int acpi_thermal_get_temperature(struct acpi_thermal *tz) | |||
267 | static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz) | 267 | static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz) |
268 | { | 268 | { |
269 | acpi_status status = AE_OK; | 269 | acpi_status status = AE_OK; |
270 | 270 | unsigned long long tmp; | |
271 | 271 | ||
272 | if (!tz) | 272 | if (!tz) |
273 | return -EINVAL; | 273 | return -EINVAL; |
274 | 274 | ||
275 | status = | 275 | status = acpi_evaluate_integer(tz->device->handle, "_TZP", NULL, &tmp); |
276 | acpi_evaluate_integer(tz->device->handle, "_TZP", NULL, | ||
277 | &tz->polling_frequency); | ||
278 | if (ACPI_FAILURE(status)) | 276 | if (ACPI_FAILURE(status)) |
279 | return -ENODEV; | 277 | return -ENODEV; |
280 | 278 | ||
279 | tz->polling_frequency = tmp; | ||
281 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Polling frequency is %lu dS\n", | 280 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Polling frequency is %lu dS\n", |
282 | tz->polling_frequency)); | 281 | tz->polling_frequency)); |
283 | 282 | ||
@@ -356,6 +355,7 @@ do { \ | |||
356 | static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | 355 | static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) |
357 | { | 356 | { |
358 | acpi_status status = AE_OK; | 357 | acpi_status status = AE_OK; |
358 | unsigned long long tmp; | ||
359 | struct acpi_handle_list devices; | 359 | struct acpi_handle_list devices; |
360 | int valid = 0; | 360 | int valid = 0; |
361 | int i; | 361 | int i; |
@@ -363,7 +363,8 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
363 | /* Critical Shutdown (required) */ | 363 | /* Critical Shutdown (required) */ |
364 | if (flag & ACPI_TRIPS_CRITICAL) { | 364 | if (flag & ACPI_TRIPS_CRITICAL) { |
365 | status = acpi_evaluate_integer(tz->device->handle, | 365 | status = acpi_evaluate_integer(tz->device->handle, |
366 | "_CRT", NULL, &tz->trips.critical.temperature); | 366 | "_CRT", NULL, &tmp); |
367 | tz->trips.critical.temperature = tmp; | ||
367 | /* | 368 | /* |
368 | * Treat freezing temperatures as invalid as well; some | 369 | * Treat freezing temperatures as invalid as well; some |
369 | * BIOSes return really low values and cause reboots at startup. | 370 | * BIOSes return really low values and cause reboots at startup. |
@@ -388,10 +389,12 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
388 | } else if (crt > 0) { | 389 | } else if (crt > 0) { |
389 | unsigned long crt_k = CELSIUS_TO_KELVIN(crt); | 390 | unsigned long crt_k = CELSIUS_TO_KELVIN(crt); |
390 | /* | 391 | /* |
391 | * Allow override to lower critical threshold | 392 | * Allow override critical threshold |
392 | */ | 393 | */ |
393 | if (crt_k < tz->trips.critical.temperature) | 394 | if (crt_k > tz->trips.critical.temperature) |
394 | tz->trips.critical.temperature = crt_k; | 395 | printk(KERN_WARNING PREFIX |
396 | "Critical threshold %d C\n", crt); | ||
397 | tz->trips.critical.temperature = crt_k; | ||
395 | } | 398 | } |
396 | } | 399 | } |
397 | } | 400 | } |
@@ -399,12 +402,13 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
399 | /* Critical Sleep (optional) */ | 402 | /* Critical Sleep (optional) */ |
400 | if (flag & ACPI_TRIPS_HOT) { | 403 | if (flag & ACPI_TRIPS_HOT) { |
401 | status = acpi_evaluate_integer(tz->device->handle, | 404 | status = acpi_evaluate_integer(tz->device->handle, |
402 | "_HOT", NULL, &tz->trips.hot.temperature); | 405 | "_HOT", NULL, &tmp); |
403 | if (ACPI_FAILURE(status)) { | 406 | if (ACPI_FAILURE(status)) { |
404 | tz->trips.hot.flags.valid = 0; | 407 | tz->trips.hot.flags.valid = 0; |
405 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 408 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
406 | "No hot threshold\n")); | 409 | "No hot threshold\n")); |
407 | } else { | 410 | } else { |
411 | tz->trips.hot.temperature = tmp; | ||
408 | tz->trips.hot.flags.valid = 1; | 412 | tz->trips.hot.flags.valid = 1; |
409 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 413 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
410 | "Found hot threshold [%lu]\n", | 414 | "Found hot threshold [%lu]\n", |
@@ -418,33 +422,40 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
418 | if (psv == -1) { | 422 | if (psv == -1) { |
419 | status = AE_SUPPORT; | 423 | status = AE_SUPPORT; |
420 | } else if (psv > 0) { | 424 | } else if (psv > 0) { |
421 | tz->trips.passive.temperature = CELSIUS_TO_KELVIN(psv); | 425 | tmp = CELSIUS_TO_KELVIN(psv); |
422 | status = AE_OK; | 426 | status = AE_OK; |
423 | } else { | 427 | } else { |
424 | status = acpi_evaluate_integer(tz->device->handle, | 428 | status = acpi_evaluate_integer(tz->device->handle, |
425 | "_PSV", NULL, &tz->trips.passive.temperature); | 429 | "_PSV", NULL, &tmp); |
426 | } | 430 | } |
427 | 431 | ||
428 | if (ACPI_FAILURE(status)) | 432 | if (ACPI_FAILURE(status)) |
429 | tz->trips.passive.flags.valid = 0; | 433 | tz->trips.passive.flags.valid = 0; |
430 | else { | 434 | else { |
435 | tz->trips.passive.temperature = tmp; | ||
431 | tz->trips.passive.flags.valid = 1; | 436 | tz->trips.passive.flags.valid = 1; |
432 | if (flag == ACPI_TRIPS_INIT) { | 437 | if (flag == ACPI_TRIPS_INIT) { |
433 | status = acpi_evaluate_integer( | 438 | status = acpi_evaluate_integer( |
434 | tz->device->handle, "_TC1", | 439 | tz->device->handle, "_TC1", |
435 | NULL, &tz->trips.passive.tc1); | 440 | NULL, &tmp); |
436 | if (ACPI_FAILURE(status)) | 441 | if (ACPI_FAILURE(status)) |
437 | tz->trips.passive.flags.valid = 0; | 442 | tz->trips.passive.flags.valid = 0; |
443 | else | ||
444 | tz->trips.passive.tc1 = tmp; | ||
438 | status = acpi_evaluate_integer( | 445 | status = acpi_evaluate_integer( |
439 | tz->device->handle, "_TC2", | 446 | tz->device->handle, "_TC2", |
440 | NULL, &tz->trips.passive.tc2); | 447 | NULL, &tmp); |
441 | if (ACPI_FAILURE(status)) | 448 | if (ACPI_FAILURE(status)) |
442 | tz->trips.passive.flags.valid = 0; | 449 | tz->trips.passive.flags.valid = 0; |
450 | else | ||
451 | tz->trips.passive.tc2 = tmp; | ||
443 | status = acpi_evaluate_integer( | 452 | status = acpi_evaluate_integer( |
444 | tz->device->handle, "_TSP", | 453 | tz->device->handle, "_TSP", |
445 | NULL, &tz->trips.passive.tsp); | 454 | NULL, &tmp); |
446 | if (ACPI_FAILURE(status)) | 455 | if (ACPI_FAILURE(status)) |
447 | tz->trips.passive.flags.valid = 0; | 456 | tz->trips.passive.flags.valid = 0; |
457 | else | ||
458 | tz->trips.passive.tsp = tmp; | ||
448 | } | 459 | } |
449 | } | 460 | } |
450 | } | 461 | } |
@@ -479,7 +490,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
479 | 490 | ||
480 | if (flag & ACPI_TRIPS_ACTIVE) { | 491 | if (flag & ACPI_TRIPS_ACTIVE) { |
481 | status = acpi_evaluate_integer(tz->device->handle, | 492 | status = acpi_evaluate_integer(tz->device->handle, |
482 | name, NULL, &tz->trips.active[i].temperature); | 493 | name, NULL, &tmp); |
483 | if (ACPI_FAILURE(status)) { | 494 | if (ACPI_FAILURE(status)) { |
484 | tz->trips.active[i].flags.valid = 0; | 495 | tz->trips.active[i].flags.valid = 0; |
485 | if (i == 0) | 496 | if (i == 0) |
@@ -500,8 +511,10 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
500 | tz->trips.active[i - 2].temperature : | 511 | tz->trips.active[i - 2].temperature : |
501 | CELSIUS_TO_KELVIN(act)); | 512 | CELSIUS_TO_KELVIN(act)); |
502 | break; | 513 | break; |
503 | } else | 514 | } else { |
515 | tz->trips.active[i].temperature = tmp; | ||
504 | tz->trips.active[i].flags.valid = 1; | 516 | tz->trips.active[i].flags.valid = 1; |
517 | } | ||
505 | } | 518 | } |
506 | 519 | ||
507 | name[2] = 'L'; | 520 | name[2] = 'L'; |
@@ -1213,8 +1226,8 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) | |||
1213 | acpi_bus_private_data_handler, | 1226 | acpi_bus_private_data_handler, |
1214 | tz->thermal_zone); | 1227 | tz->thermal_zone); |
1215 | if (ACPI_FAILURE(status)) { | 1228 | if (ACPI_FAILURE(status)) { |
1216 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1229 | printk(KERN_ERR PREFIX |
1217 | "Error attaching device data\n")); | 1230 | "Error attaching device data\n"); |
1218 | return -ENODEV; | 1231 | return -ENODEV; |
1219 | } | 1232 | } |
1220 | 1233 | ||
@@ -1647,7 +1660,7 @@ static int acpi_thermal_add(struct acpi_device *device) | |||
1647 | strcpy(tz->name, device->pnp.bus_id); | 1660 | strcpy(tz->name, device->pnp.bus_id); |
1648 | strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME); | 1661 | strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME); |
1649 | strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS); | 1662 | strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS); |
1650 | acpi_driver_data(device) = tz; | 1663 | device->driver_data = tz; |
1651 | mutex_init(&tz->lock); | 1664 | mutex_init(&tz->lock); |
1652 | 1665 | ||
1653 | 1666 | ||