aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/thermal.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/thermal.c')
-rw-r--r--drivers/acpi/thermal.c43
1 files changed, 27 insertions, 16 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index f26c6463a09e..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 = {
246static int acpi_thermal_get_temperature(struct acpi_thermal *tz) 246static 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)
267static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz) 267static 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 { \
356static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) 355static 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.
@@ -401,12 +402,13 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
401 /* Critical Sleep (optional) */ 402 /* Critical Sleep (optional) */
402 if (flag & ACPI_TRIPS_HOT) { 403 if (flag & ACPI_TRIPS_HOT) {
403 status = acpi_evaluate_integer(tz->device->handle, 404 status = acpi_evaluate_integer(tz->device->handle,
404 "_HOT", NULL, &tz->trips.hot.temperature); 405 "_HOT", NULL, &tmp);
405 if (ACPI_FAILURE(status)) { 406 if (ACPI_FAILURE(status)) {
406 tz->trips.hot.flags.valid = 0; 407 tz->trips.hot.flags.valid = 0;
407 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 408 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
408 "No hot threshold\n")); 409 "No hot threshold\n"));
409 } else { 410 } else {
411 tz->trips.hot.temperature = tmp;
410 tz->trips.hot.flags.valid = 1; 412 tz->trips.hot.flags.valid = 1;
411 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 413 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
412 "Found hot threshold [%lu]\n", 414 "Found hot threshold [%lu]\n",
@@ -420,33 +422,40 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
420 if (psv == -1) { 422 if (psv == -1) {
421 status = AE_SUPPORT; 423 status = AE_SUPPORT;
422 } else if (psv > 0) { 424 } else if (psv > 0) {
423 tz->trips.passive.temperature = CELSIUS_TO_KELVIN(psv); 425 tmp = CELSIUS_TO_KELVIN(psv);
424 status = AE_OK; 426 status = AE_OK;
425 } else { 427 } else {
426 status = acpi_evaluate_integer(tz->device->handle, 428 status = acpi_evaluate_integer(tz->device->handle,
427 "_PSV", NULL, &tz->trips.passive.temperature); 429 "_PSV", NULL, &tmp);
428 } 430 }
429 431
430 if (ACPI_FAILURE(status)) 432 if (ACPI_FAILURE(status))
431 tz->trips.passive.flags.valid = 0; 433 tz->trips.passive.flags.valid = 0;
432 else { 434 else {
435 tz->trips.passive.temperature = tmp;
433 tz->trips.passive.flags.valid = 1; 436 tz->trips.passive.flags.valid = 1;
434 if (flag == ACPI_TRIPS_INIT) { 437 if (flag == ACPI_TRIPS_INIT) {
435 status = acpi_evaluate_integer( 438 status = acpi_evaluate_integer(
436 tz->device->handle, "_TC1", 439 tz->device->handle, "_TC1",
437 NULL, &tz->trips.passive.tc1); 440 NULL, &tmp);
438 if (ACPI_FAILURE(status)) 441 if (ACPI_FAILURE(status))
439 tz->trips.passive.flags.valid = 0; 442 tz->trips.passive.flags.valid = 0;
443 else
444 tz->trips.passive.tc1 = tmp;
440 status = acpi_evaluate_integer( 445 status = acpi_evaluate_integer(
441 tz->device->handle, "_TC2", 446 tz->device->handle, "_TC2",
442 NULL, &tz->trips.passive.tc2); 447 NULL, &tmp);
443 if (ACPI_FAILURE(status)) 448 if (ACPI_FAILURE(status))
444 tz->trips.passive.flags.valid = 0; 449 tz->trips.passive.flags.valid = 0;
450 else
451 tz->trips.passive.tc2 = tmp;
445 status = acpi_evaluate_integer( 452 status = acpi_evaluate_integer(
446 tz->device->handle, "_TSP", 453 tz->device->handle, "_TSP",
447 NULL, &tz->trips.passive.tsp); 454 NULL, &tmp);
448 if (ACPI_FAILURE(status)) 455 if (ACPI_FAILURE(status))
449 tz->trips.passive.flags.valid = 0; 456 tz->trips.passive.flags.valid = 0;
457 else
458 tz->trips.passive.tsp = tmp;
450 } 459 }
451 } 460 }
452 } 461 }
@@ -481,7 +490,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
481 490
482 if (flag & ACPI_TRIPS_ACTIVE) { 491 if (flag & ACPI_TRIPS_ACTIVE) {
483 status = acpi_evaluate_integer(tz->device->handle, 492 status = acpi_evaluate_integer(tz->device->handle,
484 name, NULL, &tz->trips.active[i].temperature); 493 name, NULL, &tmp);
485 if (ACPI_FAILURE(status)) { 494 if (ACPI_FAILURE(status)) {
486 tz->trips.active[i].flags.valid = 0; 495 tz->trips.active[i].flags.valid = 0;
487 if (i == 0) 496 if (i == 0)
@@ -502,8 +511,10 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
502 tz->trips.active[i - 2].temperature : 511 tz->trips.active[i - 2].temperature :
503 CELSIUS_TO_KELVIN(act)); 512 CELSIUS_TO_KELVIN(act));
504 break; 513 break;
505 } else 514 } else {
515 tz->trips.active[i].temperature = tmp;
506 tz->trips.active[i].flags.valid = 1; 516 tz->trips.active[i].flags.valid = 1;
517 }
507 } 518 }
508 519
509 name[2] = 'L'; 520 name[2] = 'L';