[PATCH] ACPI, execute _PSx control method if exists during device power init phase

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Per the acpi spec, for OSPM to put the device in the Dx device state,
the following must occur:
1. All Power Resources referenced by elements 1 through N must be in the
ON state.
2. All Power Resources no longer referenced by any device in the system
must be in the OFF state.
3. If present, the _PSx control method is executed to set the device
into the Dx device state.

This patch adds support for the execution of _PSx control method during
device power init phase.

This could also solve the problem I encountered, please see:
http://marc.info/?l=linux-acpi&m=130579961021505&w=2

Signed-off-by: Aaron Lu <aaron.lu@xxxxxxx>
---
 drivers/acpi/bus.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 9749980..71c9e35 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -339,6 +339,18 @@ int acpi_bus_init_power(struct acpi_device *device)
 
 	if (device->power.flags.power_resources)
 		result = acpi_power_on_resources(device, state);
+	if (result)
+		return result;
+
+	/* if _PSx exists, execute it */
+	if (device->power.states[state].flags.explicit_set) {
+		acpi_status status;
+		char object_name[5] = { '_', 'P', 'S', '0' + state, '\0' };
+		status = acpi_evaluate_object(device->handle, object_name,
+				NULL, NULL);
+		if (ACPI_FAILURE(status))
+			result = -ENODEV;
+	}
 
 	if (!result)
 		device->power.state = state;
-- 
1.7.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux