diff options
author | Matthew Garrett <mjg@redhat.com> | 2008-10-08 16:40:32 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-10-08 16:56:41 -0400 |
commit | a66bfa7a4726e9cbdc985133af728a4bd9925d96 (patch) | |
tree | e233422ff9a908d756d50a2058c19ab745122498 /drivers/acpi/wmi.c | |
parent | 7d9a06de616f69374dab00396f27cf00962a72c9 (diff) |
ACPI: WMI: Enable event methods when registering notifiers
According to the ACPI-WMI spec, event blocks may provide a function call
for enabling/disabling them. This patch adds support for making these
calls when registering or removing notifications. Without this, my Dell
firmware provides no data in the event notification.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Carlos Corbacho <carlos@strangeworlds.co.uk>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/wmi.c')
-rw-r--r-- | drivers/acpi/wmi.c | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/drivers/acpi/wmi.c b/drivers/acpi/wmi.c index cfe2c833474d..5464cfcf8297 100644 --- a/drivers/acpi/wmi.c +++ b/drivers/acpi/wmi.c | |||
@@ -217,6 +217,35 @@ static bool find_guid(const char *guid_string, struct wmi_block **out) | |||
217 | return 0; | 217 | return 0; |
218 | } | 218 | } |
219 | 219 | ||
220 | static acpi_status wmi_method_enable(struct wmi_block *wblock, int enable) | ||
221 | { | ||
222 | struct guid_block *block = NULL; | ||
223 | char method[5]; | ||
224 | struct acpi_object_list input; | ||
225 | union acpi_object params[1]; | ||
226 | acpi_status status; | ||
227 | acpi_handle handle; | ||
228 | |||
229 | block = &wblock->gblock; | ||
230 | handle = wblock->handle; | ||
231 | |||
232 | if (!block) | ||
233 | return AE_NOT_EXIST; | ||
234 | |||
235 | input.count = 1; | ||
236 | input.pointer = params; | ||
237 | params[0].type = ACPI_TYPE_INTEGER; | ||
238 | params[0].integer.value = enable; | ||
239 | |||
240 | snprintf(method, 5, "WE%02X", block->notify_id); | ||
241 | status = acpi_evaluate_object(handle, method, &input, NULL); | ||
242 | |||
243 | if (status != AE_OK && status != AE_NOT_FOUND) | ||
244 | return status; | ||
245 | else | ||
246 | return AE_OK; | ||
247 | } | ||
248 | |||
220 | /* | 249 | /* |
221 | * Exported WMI functions | 250 | * Exported WMI functions |
222 | */ | 251 | */ |
@@ -427,6 +456,7 @@ acpi_status wmi_install_notify_handler(const char *guid, | |||
427 | wmi_notify_handler handler, void *data) | 456 | wmi_notify_handler handler, void *data) |
428 | { | 457 | { |
429 | struct wmi_block *block; | 458 | struct wmi_block *block; |
459 | acpi_status status; | ||
430 | 460 | ||
431 | if (!guid || !handler) | 461 | if (!guid || !handler) |
432 | return AE_BAD_PARAMETER; | 462 | return AE_BAD_PARAMETER; |
@@ -441,7 +471,9 @@ wmi_notify_handler handler, void *data) | |||
441 | block->handler = handler; | 471 | block->handler = handler; |
442 | block->handler_data = data; | 472 | block->handler_data = data; |
443 | 473 | ||
444 | return AE_OK; | 474 | status = wmi_method_enable(block, 1); |
475 | |||
476 | return status; | ||
445 | } | 477 | } |
446 | EXPORT_SYMBOL_GPL(wmi_install_notify_handler); | 478 | EXPORT_SYMBOL_GPL(wmi_install_notify_handler); |
447 | 479 | ||
@@ -453,6 +485,7 @@ EXPORT_SYMBOL_GPL(wmi_install_notify_handler); | |||
453 | acpi_status wmi_remove_notify_handler(const char *guid) | 485 | acpi_status wmi_remove_notify_handler(const char *guid) |
454 | { | 486 | { |
455 | struct wmi_block *block; | 487 | struct wmi_block *block; |
488 | acpi_status status; | ||
456 | 489 | ||
457 | if (!guid) | 490 | if (!guid) |
458 | return AE_BAD_PARAMETER; | 491 | return AE_BAD_PARAMETER; |
@@ -464,10 +497,12 @@ acpi_status wmi_remove_notify_handler(const char *guid) | |||
464 | if (!block->handler) | 497 | if (!block->handler) |
465 | return AE_NULL_ENTRY; | 498 | return AE_NULL_ENTRY; |
466 | 499 | ||
500 | status = wmi_method_enable(block, 0); | ||
501 | |||
467 | block->handler = NULL; | 502 | block->handler = NULL; |
468 | block->handler_data = NULL; | 503 | block->handler_data = NULL; |
469 | 504 | ||
470 | return AE_OK; | 505 | return status; |
471 | } | 506 | } |
472 | EXPORT_SYMBOL_GPL(wmi_remove_notify_handler); | 507 | EXPORT_SYMBOL_GPL(wmi_remove_notify_handler); |
473 | 508 | ||