summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorjmcneill <jmcneill@NetBSD.org>2008-01-28 20:31:55 +0000
committerjmcneill <jmcneill@NetBSD.org>2008-01-28 20:31:55 +0000
commitb7cf8d358ca5be7ed314682e88de53c9e3f4a2ab (patch)
treef860a076158629be86e13686bf380eec998a4332 /sys/dev
parentfd811360644c92437dac3408de4e68b10f1ae2b8 (diff)
The Thinkpad T61/x61 family powers off the USB power resource on resume
from S3 sleep. Until we get proper ACPI power resource support, simply call \\_SB.PCI0.LPC.EC.PUBS._ON() on resume if the method exists. Fixes kern/37279 by Steven M Bellovin.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpi/thinkpad_acpi.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/sys/dev/acpi/thinkpad_acpi.c b/sys/dev/acpi/thinkpad_acpi.c
index 26ff5ba20a4..d563d02bbde 100644
--- a/sys/dev/acpi/thinkpad_acpi.c
+++ b/sys/dev/acpi/thinkpad_acpi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: thinkpad_acpi.c,v 1.10 2008/01/09 14:52:52 xtraeme Exp $ */
+/* $NetBSD: thinkpad_acpi.c,v 1.11 2008/01/28 20:31:55 jmcneill Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca>
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.10 2008/01/09 14:52:52 xtraeme Exp $");
+__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.11 2008/01/28 20:31:55 jmcneill Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -122,6 +122,7 @@ static void thinkpad_temp_refresh(struct sysmon_envsys *, envsys_data_t *);
static void thinkpad_wireless_toggle(thinkpad_softc_t *);
+static bool thinkpad_resume(device_t);
static void thinkpad_brightness_up(device_t);
static void thinkpad_brightness_down(device_t);
static uint8_t thinkpad_brightness_read(thinkpad_softc_t *sc);
@@ -260,7 +261,7 @@ thinkpad_attach(device_t parent, device_t self, void *opaque)
thinkpad_temp_init(sc);
fail:
- if (!pmf_device_register(self, NULL, NULL))
+ if (!pmf_device_register(self, NULL, thinkpad_resume))
aprint_error_dev(self, "couldn't establish power handler\n");
if (!pmf_event_register(self, PMFE_DISPLAY_BRIGHTNESS_UP,
thinkpad_brightness_up, true))
@@ -556,3 +557,21 @@ thinkpad_cmos(thinkpad_softc_t *sc, uint8_t cmd)
aprint_error_dev(sc->sc_dev, "couldn't evalute CMOS: %s\n",
AcpiFormatException(rv));
}
+
+static bool
+thinkpad_resume(device_t dv)
+{
+ ACPI_STATUS rv;
+ ACPI_HANDLE pubs;
+
+ rv = AcpiGetHandle(NULL, "\\_SB.PCI0.LPC.EC.PUBS", &pubs);
+ if (ACPI_FAILURE(rv))
+ return true; /* not fatal */
+
+ rv = AcpiEvaluateObject(pubs, "_ON", NULL, NULL);
+ if (ACPI_FAILURE(rv))
+ aprint_error_dev(dv, "failed to execute PUBS._ON: %s\n",
+ AcpiFormatException(rv));
+
+ return true;
+}