[kernel] - runtime_pm_fixups.patch: should fix this on Thinkpads

Matthew Garrett mjg59 at fedoraproject.org
Wed Oct 20 20:11:27 UTC 2010


commit 2df449634d53cf2ca8de6ae39a201ec3ec9f0d83
Author: Matthew Garrett <mjg at redhat.com>
Date:   Wed Oct 20 16:10:47 2010 -0400

    - runtime_pm_fixups.patch: should fix this on Thinkpads

 kernel.spec             |   16 ++++---
 runtime_pm_fixups.patch |  114 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 124 insertions(+), 6 deletions(-)
---
diff --git a/kernel.spec b/kernel.spec
index 75587c5..9989ea0 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -715,6 +715,7 @@ Patch12201: linux-2.6-uvc-autosuspend.patch
 Patch12202: linux-2.6-qcserial-autosuspend.patch
 Patch12203: linux-2.6-usb-pci-autosuspend.patch
 Patch12204: linux-2.6-enable-more-pci-autosuspend.patch
+Patch12205: runtime_pm_fixups.patch
 
 Patch12225: pci-crs-fixes.patch
 
@@ -1322,12 +1323,12 @@ ApplyPatch wacom-08-add-support-for-bamboo-pen.patch
 ApplyPatch wacom-09-disable-bamboo-touchpad-when-pen-is-being-used.patch
 
 # Runtime PM
-# (there's still dragons here, disabled for now... --kyle)
-#ApplyPatch linux-2.6-bluetooth-autosuspend.patch
-#ApplyPatch linux-2.6-uvc-autosuspend.patch
-#ApplyPatch linux-2.6-qcserial-autosuspend.patch
-#ApplyPatch linux-2.6-usb-pci-autosuspend.patch
-#ApplyPatch linux-2.6-enable-more-pci-autosuspend.patch
+ApplyPatch linux-2.6-bluetooth-autosuspend.patch
+ApplyPatch linux-2.6-uvc-autosuspend.patch
+ApplyPatch linux-2.6-qcserial-autosuspend.patch
+ApplyPatch linux-2.6-usb-pci-autosuspend.patch
+ApplyPatch linux-2.6-enable-more-pci-autosuspend.patch
+ApplyPatch runtime_pm_fixups.patch
 
 # PCI patches to fix problems with _CRS
 # ( from linux-pci list )
@@ -1951,6 +1952,9 @@ fi
 #                 ||     ||
 
 %changelog
+* Wed Oct 20 2010 Matthew Garrett <mjg at redhat.com> 2.6.36-0.42.rc8.git5
+- runtime_pm_fixups.patch: should fix this on Thinkpads
+
 * Tue Oct 19 2010 Chuck Ebbert <cebbert at redhat.com> 2.6.36-0.41.rc8.git5
 - Linux 2.6.36-rc8-git5
 - Update PCI _CRS fixes
diff --git a/runtime_pm_fixups.patch b/runtime_pm_fixups.patch
new file mode 100644
index 0000000..6315dc1
--- /dev/null
+++ b/runtime_pm_fixups.patch
@@ -0,0 +1,114 @@
+Experimental fixes for the interactions between runtime PM and ACPI power
+resources. Needs some work with upstream.
+
+diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
+index 310e3b9..371debe 100644
+--- a/drivers/acpi/bus.c
++++ b/drivers/acpi/bus.c
+@@ -329,7 +329,8 @@ int acpi_bus_set_power(acpi_handle handle, int state)
+ 				goto end;
+ 			}
+ 		}
+-		if (device->power.flags.power_resources) {
++		if (device->power.flags.power_resources &&
++		    !device->wakeup.run_wake_count) {
+ 			result = acpi_power_transition(device, state);
+ 			if (result)
+ 				goto end;
+diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c
+index 8b3cc6a..b013174 100644
+--- a/drivers/acpi/pci_bind.c
++++ b/drivers/acpi/pci_bind.c
+@@ -33,6 +33,8 @@
+ #include <acpi/acpi_bus.h>
+ #include <acpi/acpi_drivers.h>
+ 
++#include "internal.h"
++
+ #define _COMPONENT		ACPI_PCI_COMPONENT
+ ACPI_MODULE_NAME("pci_bind");
+ 
+@@ -173,6 +175,8 @@ static int acpi_pci_bind(struct acpi_device *device)
+ 		device->ops.unbind = acpi_pci_unbind;
+ 	}
+ 
++	acpi_power_transition(device, acpi_power_get_inferred_state(device));
++
+ 	/*
+ 	 * Evaluate and parse _PRT, if exists.  This code allows parsing of
+ 	 * _PRT objects within the scope of non-bridge devices.  Note that
+diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
+index 844c155..8a42ddf 100644
+--- a/drivers/acpi/power.c
++++ b/drivers/acpi/power.c
+@@ -394,7 +394,7 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state)
+  *    State Wake) for the device, if present
+  * 2. Shutdown down the power resources
+  */
+-int acpi_disable_wakeup_device_power(struct acpi_device *dev)
++int acpi_disable_wakeup_device_power(struct acpi_device *dev, int sleep_state)
+ {
+ 	int i, err = 0;
+ 
+@@ -417,6 +417,9 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev)
+ 	if (err)
+ 		goto out;
+ 
++	if (sleep_state == ACPI_STATE_S0)
++		goto out;
++
+ 	/* Close power resource */
+ 	for (i = 0; i < dev->wakeup.resources.count; i++) {
+ 		int ret = acpi_power_off_device(
+diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
+index 2c5cd02..6bf016b 100644
+--- a/drivers/acpi/sleep.c
++++ b/drivers/acpi/sleep.c
+@@ -670,7 +670,7 @@ int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
+ 
+ 	error = enable ?
+ 		acpi_enable_wakeup_device_power(adev, acpi_target_sleep_state) :
+-		acpi_disable_wakeup_device_power(adev);
++		acpi_disable_wakeup_device_power(adev, acpi_target_sleep_state);
+ 	if (!error)
+ 		dev_info(dev, "wake-up capability %s by ACPI\n",
+ 				enable ? "enabled" : "disabled");
+diff --git a/drivers/acpi/wakeup.c b/drivers/acpi/wakeup.c
+index f62a50c..ff48a54 100644
+--- a/drivers/acpi/wakeup.c
++++ b/drivers/acpi/wakeup.c
+@@ -71,7 +71,7 @@ void acpi_disable_wakeup_devices(u8 sleep_state)
+ 				ACPI_GPE_DISABLE);
+ 
+ 		if (dev->wakeup.state.enabled)
+-			acpi_disable_wakeup_device_power(dev);
++			acpi_disable_wakeup_device_power(dev, sleep_state);
+ 	}
+ }
+ 
+diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
+index 24e19c5..cd99494 100644
+--- a/drivers/pci/pci-acpi.c
++++ b/drivers/pci/pci-acpi.c
+@@ -302,7 +302,7 @@ static int acpi_dev_run_wake(struct device *phys_dev, bool enable)
+ 		if (!--dev->wakeup.run_wake_count) {
+ 			acpi_disable_gpe(dev->wakeup.gpe_device,
+ 					 dev->wakeup.gpe_number);
+-			acpi_disable_wakeup_device_power(dev);
++			acpi_disable_wakeup_device_power(dev, ACPI_STATE_S0);
+ 		}
+ 	} else {
+ 		error = -EALREADY;
+diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
+index 4de84ce..284f43c 100644
+--- a/include/acpi/acpi_bus.h
++++ b/include/acpi/acpi_bus.h
+@@ -387,7 +387,7 @@ struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle);
+ #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle))
+ 
+ int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state);
+-int acpi_disable_wakeup_device_power(struct acpi_device *dev);
++int acpi_disable_wakeup_device_power(struct acpi_device *dev, int state);
+ 
+ #ifdef CONFIG_PM_SLEEP
+ int acpi_pm_device_sleep_state(struct device *, int *);


More information about the scm-commits mailing list