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.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 986afd470a14..0ae8b9310cbf 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -47,7 +47,6 @@
47 47
48#define ACPI_THERMAL_COMPONENT 0x04000000 48#define ACPI_THERMAL_COMPONENT 0x04000000
49#define ACPI_THERMAL_CLASS "thermal_zone" 49#define ACPI_THERMAL_CLASS "thermal_zone"
50#define ACPI_THERMAL_DRIVER_NAME "ACPI Thermal Zone Driver"
51#define ACPI_THERMAL_DEVICE_NAME "Thermal Zone" 50#define ACPI_THERMAL_DEVICE_NAME "Thermal Zone"
52#define ACPI_THERMAL_FILE_STATE "state" 51#define ACPI_THERMAL_FILE_STATE "state"
53#define ACPI_THERMAL_FILE_TEMPERATURE "temperature" 52#define ACPI_THERMAL_FILE_TEMPERATURE "temperature"
@@ -71,10 +70,10 @@
71#define CELSIUS_TO_KELVIN(t) ((t+273)*10) 70#define CELSIUS_TO_KELVIN(t) ((t+273)*10)
72 71
73#define _COMPONENT ACPI_THERMAL_COMPONENT 72#define _COMPONENT ACPI_THERMAL_COMPONENT
74ACPI_MODULE_NAME("acpi_thermal") 73ACPI_MODULE_NAME("thermal");
75 74
76MODULE_AUTHOR("Paul Diefenbaugh"); 75MODULE_AUTHOR("Paul Diefenbaugh");
77MODULE_DESCRIPTION(ACPI_THERMAL_DRIVER_NAME); 76MODULE_DESCRIPTION("ACPI Thermal Zone Driver");
78MODULE_LICENSE("GPL"); 77MODULE_LICENSE("GPL");
79 78
80static int tzp; 79static int tzp;
@@ -99,7 +98,7 @@ static ssize_t acpi_thermal_write_polling(struct file *, const char __user *,
99 size_t, loff_t *); 98 size_t, loff_t *);
100 99
101static struct acpi_driver acpi_thermal_driver = { 100static struct acpi_driver acpi_thermal_driver = {
102 .name = ACPI_THERMAL_DRIVER_NAME, 101 .name = "thermal",
103 .class = ACPI_THERMAL_CLASS, 102 .class = ACPI_THERMAL_CLASS,
104 .ids = ACPI_THERMAL_HID, 103 .ids = ACPI_THERMAL_HID,
105 .ops = { 104 .ops = {
@@ -270,7 +269,7 @@ static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds)
270 269
271 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 270 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
272 "Polling frequency set to %lu seconds\n", 271 "Polling frequency set to %lu seconds\n",
273 tz->polling_frequency)); 272 tz->polling_frequency/10));
274 273
275 return 0; 274 return 0;
276} 275}
@@ -1357,28 +1356,32 @@ static int acpi_thermal_remove(struct acpi_device *device, int type)
1357static int acpi_thermal_resume(struct acpi_device *device) 1356static int acpi_thermal_resume(struct acpi_device *device)
1358{ 1357{
1359 struct acpi_thermal *tz = NULL; 1358 struct acpi_thermal *tz = NULL;
1360 int i; 1359 int i, j, power_state, result;
1360
1361 1361
1362 if (!device || !acpi_driver_data(device)) 1362 if (!device || !acpi_driver_data(device))
1363 return -EINVAL; 1363 return -EINVAL;
1364 1364
1365 tz = acpi_driver_data(device); 1365 tz = acpi_driver_data(device);
1366 1366
1367 acpi_thermal_get_temperature(tz);
1368
1369 for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) { 1367 for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
1370 if (tz->trips.active[i].flags.valid) { 1368 if (!(&tz->trips.active[i]))
1371 tz->temperature = tz->trips.active[i].temperature; 1369 break;
1372 tz->trips.active[i].flags.enabled = 0; 1370 if (!tz->trips.active[i].flags.valid)
1373 1371 break;
1374 acpi_thermal_active(tz); 1372 tz->trips.active[i].flags.enabled = 1;
1375 1373 for (j = 0; j < tz->trips.active[i].devices.count; j++) {
1376 tz->state.active |= tz->trips.active[i].flags.enabled; 1374 result = acpi_bus_get_power(tz->trips.active[i].devices.
1377 tz->state.active_index = i; 1375 handles[j], &power_state);
1376 if (result || (power_state != ACPI_STATE_D0)) {
1377 tz->trips.active[i].flags.enabled = 0;
1378 break;
1379 }
1378 } 1380 }
1381 tz->state.active |= tz->trips.active[i].flags.enabled;
1379 } 1382 }
1380 1383
1381 acpi_thermal_check(tz); 1384 acpi_thermal_check(tz);
1382 1385
1383 return AE_OK; 1386 return AE_OK;
1384} 1387}