mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
	Witold Szczeponik <Witold.Szczeponik@gmx.net>,
	Zhao Yakui <yakui.zhao@intel.com>,
	Len Brown <len.brown@intel.com>
Subject: [patch 25/37] Enable PNPACPI _PSx Support, v3
Date: Tue, 28 Jul 2009 15:58:53 -0700	[thread overview]
Message-ID: <20090728225944.650751617@mini.kroah.org> (raw)
In-Reply-To: <20090728230145.GA10486@kroah.com>

[-- Attachment #1: enable-pnpacpi-_psx-support-v3.patch --]
[-- Type: text/plain, Size: 3622 bytes --]

2.6.27-stable review patch.  If anyone has any objections, please let us know.

------------------

From: Witold Szczeponik <Witold.Szczeponik@gmx.net>

commit 6328a57401dc5f5cf9931738eb7268fcd8058c49 upstream.

(This is an update to the patch presented earlier in
http://lkml.org/lkml/2008/12/8/284, with new error handling.)

This patch sets the power of PnP ACPI devices to D0 when they
are activated and to D3 when they are disabled.  The latter is
in correspondence with the ACPI 3.0 specification, whereas the
former is added in order to be able to power up a device after
it has been previously disabled (or when booting up a system).
(As a consequence, the patch makes the PnP ACPI code more ACPI
compliant.)

Section 6.2.2 of the ACPI Specification (at least versions 1.0b
and 3.0a) states: "Prior to running this control method [_DIS],
the OS[PM] will have already put the device in the D3 state."
Unfortunately, there is no clear statement as to when to put
a device in the D0 state. :-( Therefore, the patch executes the
method calls as _PS3/_DIS and _SRS/_PS0. What is clear: "If the
device is disabled, _SRS enables the device at the specified
resources." (From the ACPI 3.0a Specification.)

The patch fixes a problem with some IBM ThinkPads (at least the
600E and the 600X) where the serial ports have a dedicated
power source that needs to be brought up before the serial port
can be used.  Without this patch, the serial port is enabled
but has no power. (In the past, the tpctl utility had to be
utilized to turn on the power, but support for this feature
stopped with version 5.9 as it did not support the more recent
kernel versions.)

The error handlers that handle any errors that can occur during
the power up/power down phases return the error codes to the
caller directly.  Comments welcome! :-)

No regressions were observed on hardware that does not require
this patch.

The patch is applied against 2.6.27.x.

Signed-off-by: Witold Szczeponik <Witold.Szczeponik@gmx.net>
Acked-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/pnp/pnpacpi/core.c |   23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -84,7 +84,6 @@ static int pnpacpi_set_resources(struct 
 	acpi_handle handle = dev->data;
 	struct acpi_buffer buffer;
 	int ret;
-	acpi_status status;
 
 	dev_dbg(&dev->dev, "set resources\n");
 	ret = pnpacpi_build_resource_template(dev, &buffer);
@@ -95,21 +94,31 @@ static int pnpacpi_set_resources(struct 
 		kfree(buffer.pointer);
 		return ret;
 	}
-	status = acpi_set_current_resources(handle, &buffer);
-	if (ACPI_FAILURE(status))
+	if (ACPI_FAILURE(acpi_set_current_resources(handle, &buffer)))
 		ret = -EINVAL;
+	else if (acpi_bus_power_manageable(handle))
+		ret = acpi_bus_set_power(handle, ACPI_STATE_D0);
 	kfree(buffer.pointer);
 	return ret;
 }
 
 static int pnpacpi_disable_resources(struct pnp_dev *dev)
 {
-	acpi_status status;
+	acpi_handle handle = dev->data;
+	int ret;
+
+	dev_dbg(&dev->dev, "disable resources\n");
 
 	/* acpi_unregister_gsi(pnp_irq(dev, 0)); */
-	status = acpi_evaluate_object((acpi_handle) dev->data,
-				      "_DIS", NULL, NULL);
-	return ACPI_FAILURE(status) ? -ENODEV : 0;
+	ret = 0;
+	if (acpi_bus_power_manageable(handle)) {
+		ret = acpi_bus_set_power(handle, ACPI_STATE_D3);
+		if (ret)
+			return ret;
+	}
+	if (ACPI_FAILURE(acpi_evaluate_object(handle, "_DIS", NULL, NULL)))
+		ret = -ENODEV;
+	return ret;
 }
 
 #ifdef CONFIG_ACPI_SLEEP



  parent reply	other threads:[~2009-07-28 23:07 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090728225828.431071451@mini.kroah.org>
2009-07-28 23:01 ` [patch 00/37] 2.6.27.29-stable review Greg KH
2009-07-28 22:58   ` [patch 01/37] fix RCU-callback-after-kmem_cache_destroy problem in sl[aou]b Greg KH
2009-07-28 22:58   ` [patch 02/37] gigaset: accept connection establishment messages in any order Greg KH
2009-07-28 22:58   ` [patch 03/37] SCSI: zalon: fix oops on attach failure Greg KH
2009-07-28 22:58   ` [patch 04/37] sound: usb-audio: add workaround for Blue Microphones devices Greg KH
2009-07-28 22:58   ` [patch 05/37] sound: virtuoso: fix Xonar D1/DX silence after resume Greg KH
2009-07-28 22:58   ` [patch 06/37] USB: EHCI: report actual_length for iso transfers Greg KH
2009-07-28 22:58   ` [patch 07/37] USB: fix memleak in usbfs Greg KH
2009-07-28 22:58   ` [patch 08/37] USB: fix uninitialised variable in ti_do_download Greg KH
2009-07-28 22:58   ` [patch 09/37] USB: handle zero-length usbfs submissions correctly Greg KH
2009-07-28 22:58   ` [patch 10/37] USB: RNDIS gadget, fix issues talking from PXA Greg KH
2009-07-28 22:58   ` [patch 11/37] USB: ti_usb_3410_5052: fix duplicate device ids Greg KH
2009-07-28 22:58   ` [patch 12/37] ALSA: ca0106 - Fix the max capture buffer size Greg KH
2009-07-28 22:58   ` [patch 13/37] ALSA: hda - Fix mute control with some ALC262 models Greg KH
2009-07-28 22:58   ` [patch 14/37] HID: hiddev, fix lock imbalance Greg KH
2009-07-28 22:58   ` [patch 15/37] elf: fix one check-after-use Greg KH
2009-07-28 22:58   ` [patch 16/37] hwmon: (max6650) Fix lock imbalance Greg KH
2009-07-28 22:58   ` [patch 17/37] md: avoid dereferencing NULL pointer when accessing suspend_* sysfs attributes Greg KH
2009-07-28 22:58   ` [patch 18/37] mm: mark page accessed before we write_end() Greg KH
2009-07-28 22:58   ` [patch 19/37] x86-64: Fix bad_srat() to clear all state Greg KH
2009-07-28 22:58   ` [patch 20/37] x86: dont use access_ok() as a range check in get_user_pages_fast() Greg KH
2009-07-28 22:58   ` [patch 21/37] SUNRPC: Avoid an unnecessary task reschedule on ENOTCONN Greg KH
2009-07-28 22:58   ` [patch 22/37] SUNRPC: Ensure we set XPRT_CLOSING only after weve sent a tcp FIN Greg KH
2009-07-28 22:58   ` [patch 23/37] SUNRPC: Dont disconnect if a connection is still in progress Greg KH
2009-07-28 22:58   ` [patch 24/37] ACPI: EC: Limit workaround for ASUS notebooks even more Greg KH
2009-07-28 22:58   ` Greg KH [this message]
2009-07-28 22:58   ` [patch 26/37] ACPI: suspend: dont let device _PS3 failure prevent suspend Greg KH
2009-07-28 22:58   ` [patch 27/37] Input: wistron_btns - recognize Maxdata Pro 7000 notebooks Greg KH
2009-07-28 22:58   ` [patch 28/37] eCryptfs: Check Tag 11 literal data buffer size (CVE-2009-2406) Greg KH
2009-07-28 22:58   ` [patch 29/37] eCryptfs: parse_tag_3_packet check tag 3 packet encrypted key size (CVE-2009-2407) Greg KH
2009-07-28 22:58   ` [patch 30/37] ipsec: Fix name of CAST algorithm Greg KH
2009-07-28 22:58   ` [patch 31/37] pegasus usb-net: Fix endianness bugs Greg KH
2009-07-28 22:59   ` [patch 32/37] sky2: Fix checksum endianness Greg KH
2009-07-28 22:59   ` [patch 33/37] x25: Fix sleep from timer on socket destroy Greg KH
2009-07-28 22:59   ` [patch 34/37] usbnet cdc_subset: fix issues talking to PXA gadgets Greg KH
2009-07-28 22:59   ` [patch 35/37] r8169: avoid losing MSI interrupts Greg KH
2009-07-28 22:59   ` [patch 36/37] E100: work around the driver using streaming DMA mapping for RX descriptors Greg KH
2009-07-28 22:59   ` [patch 37/37] NET: Fix locking issues in PPP, 6pack, mkiss and strip line disciplines Greg KH
2009-07-28 23:39   ` [patch 00/37] 2.6.27.29-stable review Greg KH

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=20090728225944.650751617@mini.kroah.org \
    --to=gregkh@suse.de \
    --cc=Witold.Szczeponik@gmx.net \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable-review@kernel.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=yakui.zhao@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

Powered by JetHome