From e6d2918173d88cf85752ec574d989fba5b29c895 Mon Sep 17 00:00:00 2001 From: iwasaki Date: Tue, 5 Jan 2010 20:29:30 +0000 Subject: [PATCH] Update acpi_ibm syctl nodes on resume. This should fix some Thinkpad specific problems such as connecting to a headphone jack is not functional on X41. Reviewed by: takawata MFC after: 1 week --- sys/dev/acpi_support/acpi_ibm.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/sys/dev/acpi_support/acpi_ibm.c b/sys/dev/acpi_support/acpi_ibm.c index 25db9b0be961..22899820b1fa 100644 --- a/sys/dev/acpi_support/acpi_ibm.c +++ b/sys/dev/acpi_support/acpi_ibm.c @@ -255,6 +255,7 @@ ACPI_SERIAL_DECL(ibm, "ACPI IBM extras"); static int acpi_ibm_probe(device_t dev); static int acpi_ibm_attach(device_t dev); static int acpi_ibm_detach(device_t dev); +static int acpi_ibm_resume(device_t dev); static void ibm_led(void *softc, int onoff); static void ibm_led_task(struct acpi_ibm_softc *sc, int pending __unused); @@ -273,6 +274,7 @@ static device_method_t acpi_ibm_methods[] = { DEVMETHOD(device_probe, acpi_ibm_probe), DEVMETHOD(device_attach, acpi_ibm_attach), DEVMETHOD(device_detach, acpi_ibm_detach), + DEVMETHOD(device_resume, acpi_ibm_resume), {0, 0} }; @@ -434,6 +436,34 @@ acpi_ibm_detach(device_t dev) return (0); } +static int +acpi_ibm_resume(device_t dev) +{ + struct acpi_ibm_softc *sc = device_get_softc(dev); + + ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); + + ACPI_SERIAL_BEGIN(ibm); + for (int i = 0; acpi_ibm_sysctls[i].name != NULL; i++) { + int val; + + if ((acpi_ibm_sysctls[i].access & CTLFLAG_RD) == 0) { + continue; + } + + val = acpi_ibm_sysctl_get(sc, i); + + if ((acpi_ibm_sysctls[i].access & CTLFLAG_WR) == 0) { + continue; + } + + acpi_ibm_sysctl_set(sc, i, val); + } + ACPI_SERIAL_END(ibm); + + return (0); +} + static int acpi_ibm_eventmask_set(struct acpi_ibm_softc *sc, int val) {