ACPICA: Add new GPE public interface - acpi_mark_gpe_for_wake.
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 23 Jul 2014 05:12:16 +0000 (13:12 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 23 Jul 2014 21:12:33 +0000 (23:12 +0200)
ACPICA commit c49dbfed2bc069d0038ea7e1294409bfde7c2c8c

Some potential callers of acpi_setup_gpe_for_wake may know in advance that
there won't be any notify handlers installed for device wake notifications
from the given GPE (one example is a button GPE in Linux). For these cases,
acpi_mark_gpe_for_wake should be used instead of acpi_setup_gpe_for_wake.
This will set the ACPI_GPE_CAN_WAKE flag for the GPE without trying to
setup implicit wake notification for it (since there's no handler method).
Rafael Wysocki.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
drivers/acpi/acpica/evxfgpe.c
include/acpi/acpixf.h

index 82e5c146bdd4d2bd577f4e18e3c20a47fabb39ad..0cf159cc6e6d79085fa03ef15dcc91d9e53ec409 100644 (file)
@@ -185,6 +185,53 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number)
 ACPI_EXPORT_SYMBOL(acpi_disable_gpe)
 
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_mark_gpe_for_wake
+ *
+ * PARAMETERS:  gpe_device          - Parent GPE Device. NULL for GPE0/GPE1
+ *              gpe_number          - GPE level within the GPE block
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Mark a GPE as having the ability to wake the system. Simply
+ *              sets the ACPI_GPE_CAN_WAKE flag.
+ *
+ * Some potential callers of acpi_setup_gpe_for_wake may know in advance that
+ * there won't be any notify handlers installed for device wake notifications
+ * from the given GPE (one example is a button GPE in Linux). For these cases,
+ * acpi_mark_gpe_for_wake should be used instead of acpi_setup_gpe_for_wake.
+ * This will set the ACPI_GPE_CAN_WAKE flag for the GPE without trying to
+ * setup implicit wake notification for it (since there's no handler method).
+ *
+ ******************************************************************************/
+acpi_status acpi_mark_gpe_for_wake(acpi_handle gpe_device, u32 gpe_number)
+{
+       struct acpi_gpe_event_info *gpe_event_info;
+       acpi_status status = AE_BAD_PARAMETER;
+       acpi_cpu_flags flags;
+
+       ACPI_FUNCTION_TRACE(acpi_mark_gpe_for_wake);
+
+       flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
+
+       /* Ensure that we have a valid GPE number */
+
+       gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
+       if (gpe_event_info) {
+
+               /* Mark the GPE as a possible wake event */
+
+               gpe_event_info->flags |= ACPI_GPE_CAN_WAKE;
+               status = AE_OK;
+       }
+
+       acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
+       return_ACPI_STATUS(status);
+}
+
+ACPI_EXPORT_SYMBOL(acpi_mark_gpe_for_wake)
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_setup_gpe_for_wake
index 3f6e14ff24b1377cdce28b56b8aaa7bc5811a910..508e5649dda97260c985bea026f9f3df106aaae4 100644 (file)
@@ -674,6 +674,10 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
                                acpi_finish_gpe(acpi_handle gpe_device,
                                                u32 gpe_number))
 
+ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
+                               acpi_mark_gpe_for_wake(acpi_handle gpe_device,
+                                                      u32 gpe_number))
+
 ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
                                acpi_setup_gpe_for_wake(acpi_handle
                                                        parent_device,