public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Aaron Lu <aaron.lu@amd.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>, Len Brown <lenb@kernel.org>
Cc: Lin Ming <ming.m.lin@intel.com>,
	linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org,
	Aaron Lu <aaron.lu@amd.com>, Andiry Xu <andiry.xu@amd.com>,
	Alex He <alex.he@amd.com>
Subject: [PATCH v2] ACPI: Evaluate _PS3 when entering D3 Cold
Date: Wed, 25 Apr 2012 12:29:50 +0800	[thread overview]
Message-ID: <1335328190-5748-1-git-send-email-aaron.lu@amd.com> (raw)

V2: set D3 Cold's explicit_set flag in acpi_bus_get_power_flags if _PS3
exists as suggested by Rafael and modify the way to change object_name
to _PS3 from _PS4 when doing explicit set to enter D3 Cold.
The patch is based on top of Lin Ming's ACPI D3 clean up patch.

V1: When entering D3 Cold from a lower device power state(higher power),
evaluate _PS3 before doing power transition.

Signed-off-by: Aaron Lu <aaron.lu@amd.com>
Cc: Andiry Xu <andiry.xu@amd.com>
Cc: Alex He <alex.he@amd.com>
---
 drivers/acpi/bus.c  |    3 +++
 drivers/acpi/scan.c |    4 ++++
 2 files changed, 7 insertions(+)

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 3263b68..3a7860f 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -273,6 +273,9 @@ static int __acpi_bus_set_power(struct acpi_device *device, int state)
 		}
 	} else {
 		if (device->power.states[state].flags.explicit_set) {
+			/* Evaluate _PS3 when entering D3cold */
+			if (state == ACPI_STATE_D3)
+				object_name[3] = '3';
 			status = acpi_evaluate_object(device->handle,
 						      object_name, NULL, NULL);
 			if (ACPI_FAILURE(status)) {
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 7417267..27906d0 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -908,6 +908,10 @@ static int acpi_bus_get_power_flags(struct acpi_device *device)
 	device->power.states[ACPI_STATE_D3].flags.valid = 1;
 	device->power.states[ACPI_STATE_D3].power = 0;
 
+	/* Also set D3cold's explicit flag when _PS3 exists */
+	if (device->power.states[ACPI_STATE_D3_HOT].flags.explicit_set)
+		device->power.states[ACPI_STATE_D3].flags.explicit_set = 1;
+
 	acpi_bus_init_power(device);
 
 	return 0;
-- 
1.7.9.6



             reply	other threads:[~2012-04-25  4:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-25  4:29 Aaron Lu [this message]
2012-04-25 19:56 ` [PATCH v2] ACPI: Evaluate _PS3 when entering D3 Cold Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1335328190-5748-1-git-send-email-aaron.lu@amd.com \
    --to=aaron.lu@amd.com \
    --cc=alex.he@amd.com \
    --cc=andiry.xu@amd.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=ming.m.lin@intel.com \
    --cc=rjw@sisk.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox