mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: ACPI Devel Maling List <linux-acpi@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Len Brown <lenb@kernel.org>,
	Lv Zheng <lv.zheng@intel.com>, Huang Ying <ying.huang@intel.com>
Subject: [PATCH 1/6] ACPI / PM: Change the way power transitions to D3cold are carried out
Date: Fri, 04 Jan 2013 23:00:26 +0100	[thread overview]
Message-ID: <3421785.2lTFog1i8W@vostro.rjw.lan> (raw)
In-Reply-To: <2311196.icSMDvAsYg@vostro.rjw.lan>

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

During power transitions into D3cold from any shallower power states
we are supposed to transition the device into D3hot and remove power
from it afterward, but the current code in acpi_device_set_power()
doesn't work this way.

At the same time, though, we need to be careful enough to preserve
backwards compatibility for systems that don't distinguish between
D3hot and D3cold (e.g. designed before ACPI 4).

Modify acpi_device_set_power() so that it works in accordance with
the expectations in both cases.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/bus.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Index: linux/drivers/acpi/bus.c
===================================================================
--- linux.orig/drivers/acpi/bus.c
+++ linux/drivers/acpi/bus.c
@@ -270,6 +270,7 @@ int acpi_device_set_power(struct acpi_de
 	int result = 0;
 	acpi_status status = AE_OK;
 	char object_name[5] = { '_', 'P', 'S', '0' + state, '\0' };
+	bool cut_power = false;
 
 	if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3_COLD))
 		return -EINVAL;
@@ -294,9 +295,13 @@ int acpi_device_set_power(struct acpi_de
 		return -ENODEV;
 	}
 
-	/* For D3cold we should execute _PS3, not _PS4. */
-	if (state == ACPI_STATE_D3_COLD)
+	/* For D3cold we should first transition into D3hot. */
+	if (state == ACPI_STATE_D3_COLD
+	    && device->power.states[ACPI_STATE_D3_COLD].flags.os_accessible) {
+		state = ACPI_STATE_D3_HOT;
 		object_name[3] = '3';
+		cut_power = true;
+	}
 
 	/*
 	 * Transition Power
@@ -341,6 +346,9 @@ int acpi_device_set_power(struct acpi_de
 		}
 	}
 
+	if (cut_power)
+		result = acpi_power_transition(device, ACPI_STATE_D3_COLD);
+
       end:
 	if (result)
 		printk(KERN_WARNING PREFIX


  reply	other threads:[~2013-01-04 22:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-04 21:58 [PATCH 0/6] ACPI / PM: ACPI power management update Rafael J. Wysocki
2013-01-04 22:00 ` Rafael J. Wysocki [this message]
2013-01-05  2:37   ` [PATCH 1/6] ACPI / PM: Change the way power transitions to D3cold are carried out Zheng, Lv
2013-01-04 22:01 ` [PATCH 2/6] ACPI / PM: More visible function for retrieving device power states Rafael J. Wysocki
2013-01-04 22:02 ` [PATCH 3/6] ACPI / PM: Common string representations of " Rafael J. Wysocki
2013-01-04 22:03 ` [PATCH 4/6] ACPI / PM: Export power states of ACPI devices via sysfs Rafael J. Wysocki
2013-01-19 20:53   ` [Update][PATCH] " Rafael J. Wysocki
2013-01-21 12:59     ` Rafael J. Wysocki
2013-01-04 22:03 ` [PATCH 5/6] ACPI / PM: Move device power management functions to device_pm.c Rafael J. Wysocki
2013-01-04 22:04 ` [PATCH 6/6] ACPI / PM: Consolidate suspend-specific and hibernate-specific code Rafael J. Wysocki
2013-01-11 21:59 ` [PATCH 0/6] ACPI / PM: ACPI power management update 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=3421785.2lTFog1i8W@vostro.rjw.lan \
    --to=rjw@sisk.pl \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lv.zheng@intel.com \
    --cc=ying.huang@intel.com \
    /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

all inboxes | Powered by JetHome®