public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PNPACPI: Enable Power Management
@ 2008-11-23 21:09 Witold Szczeponik
  2008-12-01 22:47 ` Bjorn Helgaas
  0 siblings, 1 reply; 5+ messages in thread
From: Witold Szczeponik @ 2008-11-23 21:09 UTC (permalink / raw)
  To: linux-acpi; +Cc: linux-kernel

Subject: Enable PNPACI Power Management

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.)

The patch fixes the 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.

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

The patch is applied against 2.6.27.7 (vanilla).


Signed-off-by: Witold Szczeponik <Witold.Szczeponik@gmx.net>


Index: linux/drivers/pnp/pnpacpi/core.c
===================================================================
--- linux.orig/drivers/pnp/pnpacpi/core.c
+++ linux/drivers/pnp/pnpacpi/core.c
@@ -98,18 +98,24 @@ static int pnpacpi_set_resources(struct
  	status = acpi_set_current_resources(handle, &buffer);
  	if (ACPI_FAILURE(status))
  		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_handle handle = dev->data;
+	int ret = 0;
  	acpi_status status;

-	/* acpi_unregister_gsi(pnp_irq(dev, 0)); */
-	status = acpi_evaluate_object((acpi_handle) dev->data,
-				      "_DIS", NULL, NULL);
-	return ACPI_FAILURE(status) ? -ENODEV : 0;
+	if (acpi_bus_power_manageable(handle))
+		ret = acpi_bus_set_power(handle, ACPI_STATE_D3);
+	status = acpi_evaluate_object(handle, "_DIS", NULL, NULL);
+	if (ACPI_FAILURE(status))
+		ret = -ENODEV;
+	return ret;
  }

  #ifdef CONFIG_ACPI_SLEEP

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-12-08 20:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-23 21:09 [PATCH] PNPACPI: Enable Power Management Witold Szczeponik
2008-12-01 22:47 ` Bjorn Helgaas
2008-12-07 12:41   ` Witold Szczeponik
2008-12-08  4:29     ` Bjorn Helgaas
2008-12-08 20:40       ` Witold Szczeponik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox