aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Karasyov <konstantin.a.karasyov@intel.com>2007-02-16 02:23:07 -0500
committerLen Brown <len.brown@intel.com>2007-02-16 02:23:07 -0500
commitb1028c545ced13590dd9a9a8086543aef26c7187 (patch)
treec02123c234525697bae75e3817ca663ea787cbfb
parent724339d76d9407cd1a8ad32a9c1fdf64840cc51b (diff)
ACPI: fix fan after resume from S3
http://bugzilla.kernel.org/show_bug.cgi?id=7570 Signed-off-by: Konstantin Karasyov <konstantin.a.karasyov@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--drivers/acpi/bus.c15
-rw-r--r--drivers/acpi/power.c4
-rw-r--r--drivers/acpi/thermal.c28
3 files changed, 27 insertions, 20 deletions
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index c26468da4295..be9a878557c7 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -199,15 +199,14 @@ int acpi_bus_set_power(acpi_handle handle, int state)
199 * Get device's current power state if it's unknown 199 * Get device's current power state if it's unknown
200 * This means device power state isn't initialized or previous setting failed 200 * This means device power state isn't initialized or previous setting failed
201 */ 201 */
202 if (!device->flags.force_power_state) { 202 if ((device->power.state == ACPI_STATE_UNKNOWN) || device->flags.force_power_state)
203 if (device->power.state == ACPI_STATE_UNKNOWN) 203 acpi_bus_get_power(device->handle, &device->power.state);
204 acpi_bus_get_power(device->handle, &device->power.state); 204 if ((state == device->power.state) && !device->flags.force_power_state) {
205 if (state == device->power.state) { 205 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n",
206 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", 206 state));
207 state)); 207 return 0;
208 return 0;
209 }
210 } 208 }
209
211 if (!device->power.states[state].flags.valid) { 210 if (!device->power.states[state].flags.valid) {
212 printk(KERN_WARNING PREFIX "Device does not support D%d\n", state); 211 printk(KERN_WARNING PREFIX "Device does not support D%d\n", state);
213 return -ENODEV; 212 return -ENODEV;
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 0ba7dfbbb2ee..01ce311ed6ee 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -412,6 +412,10 @@ int acpi_power_transition(struct acpi_device *device, int state)
412 goto end; 412 goto end;
413 } 413 }
414 414
415 if (device->power.state == state) {
416 goto end;
417 }
418
415 /* 419 /*
416 * Then we dereference all power resources used in the current list. 420 * Then we dereference all power resources used in the current list.
417 */ 421 */
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 986afd470a14..7118ac67ef68 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -1357,28 +1357,32 @@ static int acpi_thermal_remove(struct acpi_device *device, int type)
1357static int acpi_thermal_resume(struct acpi_device *device) 1357static int acpi_thermal_resume(struct acpi_device *device)
1358{ 1358{
1359 struct acpi_thermal *tz = NULL; 1359 struct acpi_thermal *tz = NULL;
1360 int i; 1360 int i, j, power_state, result;
1361
1361 1362
1362 if (!device || !acpi_driver_data(device)) 1363 if (!device || !acpi_driver_data(device))
1363 return -EINVAL; 1364 return -EINVAL;
1364 1365
1365 tz = acpi_driver_data(device); 1366 tz = acpi_driver_data(device);
1366 1367
1367 acpi_thermal_get_temperature(tz);
1368
1369 for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) { 1368 for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
1370 if (tz->trips.active[i].flags.valid) { 1369 if (!(&tz->trips.active[i]))
1371 tz->temperature = tz->trips.active[i].temperature; 1370 break;
1372 tz->trips.active[i].flags.enabled = 0; 1371 if (!tz->trips.active[i].flags.valid)
1373 1372 break;
1374 acpi_thermal_active(tz); 1373 tz->trips.active[i].flags.enabled = 1;
1375 1374 for (j = 0; j < tz->trips.active[i].devices.count; j++) {
1376 tz->state.active |= tz->trips.active[i].flags.enabled; 1375 result = acpi_bus_get_power(tz->trips.active[i].devices.
1377 tz->state.active_index = i; 1376 handles[j], &power_state);
1377 if (result || (power_state != ACPI_STATE_D0)) {
1378 tz->trips.active[i].flags.enabled = 0;
1379 break;
1380 }
1378 } 1381 }
1382 tz->state.active |= tz->trips.active[i].flags.enabled;
1379 } 1383 }
1380 1384
1381 acpi_thermal_check(tz); 1385 acpi_thermal_check(tz);
1382 1386
1383 return AE_OK; 1387 return AE_OK;
1384} 1388}