acpi: Enable GPE for button and lid, if they have _PRW object
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 17 Apr 2011 05:00:17 +0000 (13:00 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 17 Apr 2011 05:00:17 +0000 (13:00 +0800)
For devices which has _PRW object, AcpiSetupGpeForWake() will be called,
however, AcpiSetupGpeForWake() will disable GPE, which causes devices
like button and lid to stop function if they have _PRW object.  So for
button and lid, we explicitly enable GPE if they have _PRW object.

Reported-by: y0netan1@
sys/dev/acpica5/acpi_button.c
sys/dev/acpica5/acpi_lid.c

index 974e29b..978f544 100644 (file)
@@ -126,6 +126,7 @@ acpi_button_probe(device_t dev)
 static int
 acpi_button_attach(device_t dev)
 {
+    struct acpi_prw_data       prw;
     struct acpi_button_softc   *sc;
     ACPI_STATUS                        status;
     int event;
@@ -162,8 +163,10 @@ acpi_button_attach(device_t dev)
        return_VALUE (ENXIO);
     }
 
-    /* Enable the GPE for wake */
+    /* Enable the GPE for wake/runtime */
     acpi_wake_set_enable(dev, 1);
+    if (acpi_parse_prw(sc->button_handle, &prw) == 0)
+       AcpiEnableGpe(prw.gpe_handle, prw.gpe_bit);
     
     return_VALUE (0);
 }
index fb74cae..eb69b2a 100644 (file)
@@ -99,6 +99,7 @@ acpi_lid_probe(device_t dev)
 static int
 acpi_lid_attach(device_t dev)
 {
+    struct acpi_prw_data       prw;
     struct acpi_lid_softc      *sc;
 
     ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
@@ -117,8 +118,10 @@ acpi_lid_attach(device_t dev)
     AcpiInstallNotifyHandler(sc->lid_handle, ACPI_DEVICE_NOTIFY,
                             acpi_lid_notify_handler, sc);
 
-    /* Enable the GPE for wake */
+    /* Enable the GPE for wake/runtime */
     acpi_wake_set_enable(dev, 1);
+    if (acpi_parse_prw(sc->lid_handle, &prw) == 0)
+       AcpiEnableGpe(prw.gpe_handle, prw.gpe_bit);
 
     return (0);
 }