blob: aac47573f9ed83e4c42ea84aef9c3940644e4db1 [file] [log] [blame]
Carlos Corbachobff431e2008-02-05 02:17:04 +00001/*
2 * ACPI-WMI mapping driver
3 *
4 * Copyright (C) 2007-2008 Carlos Corbacho <carlos@strangeworlds.co.uk>
5 *
6 * GUID parsing code from ldm.c is:
7 * Copyright (C) 2001,2002 Richard Russon <ldm@flatcap.org>
8 * Copyright (c) 2001-2007 Anton Altaparmakov
9 * Copyright (C) 2001,2002 Jakob Kemi <jakob.kemi@telia.com>
10 *
11 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or (at
16 * your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
26 *
27 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28 */
29
Dmitry Torokhov8e075142010-08-26 00:15:19 -070030#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31
Carlos Corbachobff431e2008-02-05 02:17:04 +000032#include <linux/kernel.h>
33#include <linux/init.h>
34#include <linux/types.h>
Matthew Garrett1caab3c2009-11-04 14:17:53 -050035#include <linux/device.h>
Carlos Corbachobff431e2008-02-05 02:17:04 +000036#include <linux/list.h>
37#include <linux/acpi.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090038#include <linux/slab.h>
Paul Gortmaker7c52d552011-05-27 12:33:10 -040039#include <linux/module.h>
Carlos Corbachobff431e2008-02-05 02:17:04 +000040
41ACPI_MODULE_NAME("wmi");
42MODULE_AUTHOR("Carlos Corbacho");
43MODULE_DESCRIPTION("ACPI-WMI Mapping Driver");
44MODULE_LICENSE("GPL");
45
46#define ACPI_WMI_CLASS "wmi"
47
Dmitry Torokhov762e1a22010-08-26 00:15:14 -070048static LIST_HEAD(wmi_block_list);
Carlos Corbachobff431e2008-02-05 02:17:04 +000049
50struct guid_block {
51 char guid[16];
52 union {
53 char object_id[2];
54 struct {
55 unsigned char notify_id;
56 unsigned char reserved;
57 };
58 };
59 u8 instance_count;
60 u8 flags;
61};
62
63struct wmi_block {
64 struct list_head list;
65 struct guid_block gblock;
66 acpi_handle handle;
67 wmi_notify_handler handler;
68 void *handler_data;
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -070069 struct device dev;
Carlos Corbachobff431e2008-02-05 02:17:04 +000070};
71
Carlos Corbachobff431e2008-02-05 02:17:04 +000072
73/*
74 * If the GUID data block is marked as expensive, we must enable and
75 * explicitily disable data collection.
76 */
77#define ACPI_WMI_EXPENSIVE 0x1
78#define ACPI_WMI_METHOD 0x2 /* GUID is a method */
79#define ACPI_WMI_STRING 0x4 /* GUID takes & returns a string */
80#define ACPI_WMI_EVENT 0x8 /* GUID is an event */
81
Rusty Russell90ab5ee2012-01-13 09:32:20 +103082static bool debug_event;
Thomas Renningerfc3155b2010-05-03 15:30:15 +020083module_param(debug_event, bool, 0444);
84MODULE_PARM_DESC(debug_event,
85 "Log WMI Events [0/1]");
86
Rusty Russell90ab5ee2012-01-13 09:32:20 +103087static bool debug_dump_wdg;
Thomas Renningera929aae2010-05-03 15:30:17 +020088module_param(debug_dump_wdg, bool, 0444);
89MODULE_PARM_DESC(debug_dump_wdg,
90 "Dump available WMI interfaces [0/1]");
91
Rafael J. Wysocki51fac832013-01-24 00:24:48 +010092static int acpi_wmi_remove(struct acpi_device *device);
Carlos Corbachobff431e2008-02-05 02:17:04 +000093static int acpi_wmi_add(struct acpi_device *device);
Bjorn Helgaasf61bb932009-04-07 15:37:37 +000094static void acpi_wmi_notify(struct acpi_device *device, u32 event);
Carlos Corbachobff431e2008-02-05 02:17:04 +000095
96static const struct acpi_device_id wmi_device_ids[] = {
97 {"PNP0C14", 0},
98 {"pnp0c14", 0},
99 {"", 0},
100};
101MODULE_DEVICE_TABLE(acpi, wmi_device_ids);
102
103static struct acpi_driver acpi_wmi_driver = {
104 .name = "wmi",
105 .class = ACPI_WMI_CLASS,
106 .ids = wmi_device_ids,
107 .ops = {
108 .add = acpi_wmi_add,
109 .remove = acpi_wmi_remove,
Bjorn Helgaasf61bb932009-04-07 15:37:37 +0000110 .notify = acpi_wmi_notify,
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700111 },
Carlos Corbachobff431e2008-02-05 02:17:04 +0000112};
113
114/*
115 * GUID parsing functions
116 */
117
118/**
119 * wmi_parse_hexbyte - Convert a ASCII hex number to a byte
120 * @src: Pointer to at least 2 characters to convert.
121 *
122 * Convert a two character ASCII hex string to a number.
123 *
124 * Return: 0-255 Success, the byte was parsed correctly
125 * -1 Error, an invalid character was supplied
126 */
127static int wmi_parse_hexbyte(const u8 *src)
128{
Carlos Corbachobff431e2008-02-05 02:17:04 +0000129 int h;
Andy Shevchenko392bd8b2010-09-11 16:31:02 +0300130 int value;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000131
132 /* high part */
Andy Shevchenko392bd8b2010-09-11 16:31:02 +0300133 h = value = hex_to_bin(src[0]);
134 if (value < 0)
Carlos Corbachobff431e2008-02-05 02:17:04 +0000135 return -1;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000136
137 /* low part */
Andy Shevchenko392bd8b2010-09-11 16:31:02 +0300138 value = hex_to_bin(src[1]);
139 if (value >= 0)
140 return (h << 4) | value;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000141 return -1;
142}
143
144/**
145 * wmi_swap_bytes - Rearrange GUID bytes to match GUID binary
146 * @src: Memory block holding binary GUID (16 bytes)
147 * @dest: Memory block to hold byte swapped binary GUID (16 bytes)
148 *
149 * Byte swap a binary GUID to match it's real GUID value
150 */
151static void wmi_swap_bytes(u8 *src, u8 *dest)
152{
153 int i;
154
155 for (i = 0; i <= 3; i++)
156 memcpy(dest + i, src + (3 - i), 1);
157
158 for (i = 0; i <= 1; i++)
159 memcpy(dest + 4 + i, src + (5 - i), 1);
160
161 for (i = 0; i <= 1; i++)
162 memcpy(dest + 6 + i, src + (7 - i), 1);
163
164 memcpy(dest + 8, src + 8, 8);
165}
166
167/**
168 * wmi_parse_guid - Convert GUID from ASCII to binary
169 * @src: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba
170 * @dest: Memory block to hold binary GUID (16 bytes)
171 *
172 * N.B. The GUID need not be NULL terminated.
173 *
174 * Return: 'true' @dest contains binary GUID
175 * 'false' @dest contents are undefined
176 */
177static bool wmi_parse_guid(const u8 *src, u8 *dest)
178{
179 static const int size[] = { 4, 2, 2, 2, 6 };
180 int i, j, v;
181
182 if (src[8] != '-' || src[13] != '-' ||
183 src[18] != '-' || src[23] != '-')
184 return false;
185
186 for (j = 0; j < 5; j++, src++) {
187 for (i = 0; i < size[j]; i++, src += 2, *dest++ = v) {
188 v = wmi_parse_hexbyte(src);
189 if (v < 0)
190 return false;
191 }
192 }
193
194 return true;
195}
196
Matthew Garrett1caab3c2009-11-04 14:17:53 -0500197/*
198 * Convert a raw GUID to the ACII string representation
199 */
200static int wmi_gtoa(const char *in, char *out)
201{
202 int i;
203
204 for (i = 3; i >= 0; i--)
205 out += sprintf(out, "%02X", in[i] & 0xFF);
206
207 out += sprintf(out, "-");
208 out += sprintf(out, "%02X", in[5] & 0xFF);
209 out += sprintf(out, "%02X", in[4] & 0xFF);
210 out += sprintf(out, "-");
211 out += sprintf(out, "%02X", in[7] & 0xFF);
212 out += sprintf(out, "%02X", in[6] & 0xFF);
213 out += sprintf(out, "-");
214 out += sprintf(out, "%02X", in[8] & 0xFF);
215 out += sprintf(out, "%02X", in[9] & 0xFF);
216 out += sprintf(out, "-");
217
218 for (i = 10; i <= 15; i++)
219 out += sprintf(out, "%02X", in[i] & 0xFF);
220
Dmitry Torokhov4e4304d2010-08-26 00:14:53 -0700221 *out = '\0';
Matthew Garrett1caab3c2009-11-04 14:17:53 -0500222 return 0;
223}
224
Carlos Corbachobff431e2008-02-05 02:17:04 +0000225static bool find_guid(const char *guid_string, struct wmi_block **out)
226{
227 char tmp[16], guid_input[16];
228 struct wmi_block *wblock;
229 struct guid_block *block;
230 struct list_head *p;
231
232 wmi_parse_guid(guid_string, tmp);
233 wmi_swap_bytes(tmp, guid_input);
234
Dmitry Torokhov762e1a22010-08-26 00:15:14 -0700235 list_for_each(p, &wmi_block_list) {
Carlos Corbachobff431e2008-02-05 02:17:04 +0000236 wblock = list_entry(p, struct wmi_block, list);
237 block = &wblock->gblock;
238
239 if (memcmp(block->guid, guid_input, 16) == 0) {
240 if (out)
241 *out = wblock;
Joe Perches097c27f2015-03-30 10:43:20 -0700242 return true;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000243 }
244 }
Joe Perches097c27f2015-03-30 10:43:20 -0700245 return false;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000246}
247
Matthew Garretta66bfa72008-10-08 21:40:32 +0100248static acpi_status wmi_method_enable(struct wmi_block *wblock, int enable)
249{
250 struct guid_block *block = NULL;
251 char method[5];
Matthew Garretta66bfa72008-10-08 21:40:32 +0100252 acpi_status status;
253 acpi_handle handle;
254
255 block = &wblock->gblock;
256 handle = wblock->handle;
257
Matthew Garretta66bfa72008-10-08 21:40:32 +0100258 snprintf(method, 5, "WE%02X", block->notify_id);
Zhang Rui8122ab62013-09-03 08:31:57 +0800259 status = acpi_execute_simple_method(handle, method, enable);
Matthew Garretta66bfa72008-10-08 21:40:32 +0100260
261 if (status != AE_OK && status != AE_NOT_FOUND)
262 return status;
263 else
264 return AE_OK;
265}
266
Carlos Corbachobff431e2008-02-05 02:17:04 +0000267/*
268 * Exported WMI functions
269 */
270/**
271 * wmi_evaluate_method - Evaluate a WMI method
272 * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba
273 * @instance: Instance index
274 * @method_id: Method ID to call
275 * &in: Buffer containing input for the method call
276 * &out: Empty buffer to return the method results
277 *
278 * Call an ACPI-WMI method
279 */
280acpi_status wmi_evaluate_method(const char *guid_string, u8 instance,
281u32 method_id, const struct acpi_buffer *in, struct acpi_buffer *out)
282{
283 struct guid_block *block = NULL;
284 struct wmi_block *wblock = NULL;
285 acpi_handle handle;
286 acpi_status status;
287 struct acpi_object_list input;
288 union acpi_object params[3];
Costantino Leandrof3d83e22009-08-26 14:29:28 -0700289 char method[5] = "WM";
Carlos Corbachobff431e2008-02-05 02:17:04 +0000290
291 if (!find_guid(guid_string, &wblock))
Lin Ming08237972008-08-08 11:57:11 +0800292 return AE_ERROR;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000293
294 block = &wblock->gblock;
295 handle = wblock->handle;
296
Al Viroe6bafba2008-02-13 04:03:25 +0000297 if (!(block->flags & ACPI_WMI_METHOD))
Carlos Corbachobff431e2008-02-05 02:17:04 +0000298 return AE_BAD_DATA;
299
300 if (block->instance_count < instance)
301 return AE_BAD_PARAMETER;
302
303 input.count = 2;
304 input.pointer = params;
305 params[0].type = ACPI_TYPE_INTEGER;
306 params[0].integer.value = instance;
307 params[1].type = ACPI_TYPE_INTEGER;
308 params[1].integer.value = method_id;
309
310 if (in) {
311 input.count = 3;
312
313 if (block->flags & ACPI_WMI_STRING) {
314 params[2].type = ACPI_TYPE_STRING;
315 } else {
316 params[2].type = ACPI_TYPE_BUFFER;
317 }
318 params[2].buffer.length = in->length;
319 params[2].buffer.pointer = in->pointer;
320 }
321
322 strncat(method, block->object_id, 2);
323
324 status = acpi_evaluate_object(handle, method, &input, out);
325
326 return status;
327}
328EXPORT_SYMBOL_GPL(wmi_evaluate_method);
329
330/**
331 * wmi_query_block - Return contents of a WMI block
332 * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba
333 * @instance: Instance index
334 * &out: Empty buffer to return the contents of the data block to
335 *
336 * Return the contents of an ACPI-WMI data block to a buffer
337 */
338acpi_status wmi_query_block(const char *guid_string, u8 instance,
339struct acpi_buffer *out)
340{
341 struct guid_block *block = NULL;
342 struct wmi_block *wblock = NULL;
Zhang Rui54f14c22013-09-03 08:32:07 +0800343 acpi_handle handle;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000344 acpi_status status, wc_status = AE_ERROR;
Zhang Rui8122ab62013-09-03 08:31:57 +0800345 struct acpi_object_list input;
346 union acpi_object wq_params[1];
Costantino Leandrof3d83e22009-08-26 14:29:28 -0700347 char method[5];
348 char wc_method[5] = "WC";
Carlos Corbachobff431e2008-02-05 02:17:04 +0000349
350 if (!guid_string || !out)
351 return AE_BAD_PARAMETER;
352
353 if (!find_guid(guid_string, &wblock))
Lin Ming08237972008-08-08 11:57:11 +0800354 return AE_ERROR;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000355
356 block = &wblock->gblock;
357 handle = wblock->handle;
358
359 if (block->instance_count < instance)
360 return AE_BAD_PARAMETER;
361
362 /* Check GUID is a data block */
363 if (block->flags & (ACPI_WMI_EVENT | ACPI_WMI_METHOD))
Lin Ming08237972008-08-08 11:57:11 +0800364 return AE_ERROR;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000365
366 input.count = 1;
367 input.pointer = wq_params;
368 wq_params[0].type = ACPI_TYPE_INTEGER;
369 wq_params[0].integer.value = instance;
370
371 /*
372 * If ACPI_WMI_EXPENSIVE, call the relevant WCxx method first to
373 * enable collection.
374 */
375 if (block->flags & ACPI_WMI_EXPENSIVE) {
Carlos Corbachobff431e2008-02-05 02:17:04 +0000376 strncat(wc_method, block->object_id, 2);
377
378 /*
379 * Some GUIDs break the specification by declaring themselves
380 * expensive, but have no corresponding WCxx method. So we
381 * should not fail if this happens.
382 */
Zhang Rui54f14c22013-09-03 08:32:07 +0800383 if (acpi_has_method(handle, wc_method))
Zhang Rui8122ab62013-09-03 08:31:57 +0800384 wc_status = acpi_execute_simple_method(handle,
385 wc_method, 1);
Carlos Corbachobff431e2008-02-05 02:17:04 +0000386 }
387
388 strcpy(method, "WQ");
389 strncat(method, block->object_id, 2);
390
Carlos Corbachodab36ad2008-08-02 17:28:45 +0100391 status = acpi_evaluate_object(handle, method, &input, out);
Carlos Corbachobff431e2008-02-05 02:17:04 +0000392
393 /*
394 * If ACPI_WMI_EXPENSIVE, call the relevant WCxx method, even if
395 * the WQxx method failed - we should disable collection anyway.
396 */
Carlos Corbachoa527f2d2008-02-24 13:34:34 +0000397 if ((block->flags & ACPI_WMI_EXPENSIVE) && ACPI_SUCCESS(wc_status)) {
Zhang Rui8122ab62013-09-03 08:31:57 +0800398 status = acpi_execute_simple_method(handle, wc_method, 0);
Carlos Corbachobff431e2008-02-05 02:17:04 +0000399 }
400
401 return status;
402}
403EXPORT_SYMBOL_GPL(wmi_query_block);
404
405/**
406 * wmi_set_block - Write to a WMI block
407 * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba
408 * @instance: Instance index
409 * &in: Buffer containing new values for the data block
410 *
411 * Write the contents of the input buffer to an ACPI-WMI data block
412 */
413acpi_status wmi_set_block(const char *guid_string, u8 instance,
414const struct acpi_buffer *in)
415{
416 struct guid_block *block = NULL;
417 struct wmi_block *wblock = NULL;
418 acpi_handle handle;
419 struct acpi_object_list input;
420 union acpi_object params[2];
Costantino Leandrof3d83e22009-08-26 14:29:28 -0700421 char method[5] = "WS";
Carlos Corbachobff431e2008-02-05 02:17:04 +0000422
423 if (!guid_string || !in)
424 return AE_BAD_DATA;
425
426 if (!find_guid(guid_string, &wblock))
Lin Ming08237972008-08-08 11:57:11 +0800427 return AE_ERROR;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000428
429 block = &wblock->gblock;
430 handle = wblock->handle;
431
432 if (block->instance_count < instance)
433 return AE_BAD_PARAMETER;
434
435 /* Check GUID is a data block */
436 if (block->flags & (ACPI_WMI_EVENT | ACPI_WMI_METHOD))
Lin Ming08237972008-08-08 11:57:11 +0800437 return AE_ERROR;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000438
439 input.count = 2;
440 input.pointer = params;
441 params[0].type = ACPI_TYPE_INTEGER;
442 params[0].integer.value = instance;
443
444 if (block->flags & ACPI_WMI_STRING) {
445 params[1].type = ACPI_TYPE_STRING;
446 } else {
447 params[1].type = ACPI_TYPE_BUFFER;
448 }
449 params[1].buffer.length = in->length;
450 params[1].buffer.pointer = in->pointer;
451
452 strncat(method, block->object_id, 2);
453
454 return acpi_evaluate_object(handle, method, &input, NULL);
455}
456EXPORT_SYMBOL_GPL(wmi_set_block);
457
Dmitry Torokhov37830662010-08-26 00:15:09 -0700458static void wmi_dump_wdg(const struct guid_block *g)
Thomas Renningera929aae2010-05-03 15:30:17 +0200459{
460 char guid_string[37];
461
462 wmi_gtoa(g->guid, guid_string);
Dmitry Torokhov8e075142010-08-26 00:15:19 -0700463
464 pr_info("%s:\n", guid_string);
465 pr_info("\tobject_id: %c%c\n", g->object_id[0], g->object_id[1]);
466 pr_info("\tnotify_id: %02X\n", g->notify_id);
467 pr_info("\treserved: %02X\n", g->reserved);
468 pr_info("\tinstance_count: %d\n", g->instance_count);
Joe Perchesdd8e9082011-03-29 15:21:53 -0700469 pr_info("\tflags: %#x", g->flags);
Thomas Renningera929aae2010-05-03 15:30:17 +0200470 if (g->flags) {
Thomas Renningera929aae2010-05-03 15:30:17 +0200471 if (g->flags & ACPI_WMI_EXPENSIVE)
Joe Perchesdd8e9082011-03-29 15:21:53 -0700472 pr_cont(" ACPI_WMI_EXPENSIVE");
Thomas Renningera929aae2010-05-03 15:30:17 +0200473 if (g->flags & ACPI_WMI_METHOD)
Joe Perchesdd8e9082011-03-29 15:21:53 -0700474 pr_cont(" ACPI_WMI_METHOD");
Thomas Renningera929aae2010-05-03 15:30:17 +0200475 if (g->flags & ACPI_WMI_STRING)
Joe Perchesdd8e9082011-03-29 15:21:53 -0700476 pr_cont(" ACPI_WMI_STRING");
Thomas Renningera929aae2010-05-03 15:30:17 +0200477 if (g->flags & ACPI_WMI_EVENT)
Joe Perchesdd8e9082011-03-29 15:21:53 -0700478 pr_cont(" ACPI_WMI_EVENT");
Thomas Renningera929aae2010-05-03 15:30:17 +0200479 }
Dmitry Torokhov8e075142010-08-26 00:15:19 -0700480 pr_cont("\n");
Thomas Renningera929aae2010-05-03 15:30:17 +0200481
482}
483
Thomas Renningerfc3155b2010-05-03 15:30:15 +0200484static void wmi_notify_debug(u32 value, void *context)
485{
486 struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
487 union acpi_object *obj;
Axel Lin1492616a2010-06-28 09:30:45 +0800488 acpi_status status;
Thomas Renningerfc3155b2010-05-03 15:30:15 +0200489
Axel Lin1492616a2010-06-28 09:30:45 +0800490 status = wmi_get_event_data(value, &response);
491 if (status != AE_OK) {
Dmitry Torokhov8e075142010-08-26 00:15:19 -0700492 pr_info("bad event status 0x%x\n", status);
Axel Lin1492616a2010-06-28 09:30:45 +0800493 return;
494 }
Thomas Renningerfc3155b2010-05-03 15:30:15 +0200495
496 obj = (union acpi_object *)response.pointer;
497
498 if (!obj)
499 return;
500
Dmitry Torokhov8e075142010-08-26 00:15:19 -0700501 pr_info("DEBUG Event ");
Thomas Renningerfc3155b2010-05-03 15:30:15 +0200502 switch(obj->type) {
503 case ACPI_TYPE_BUFFER:
Dmitry Torokhov8e075142010-08-26 00:15:19 -0700504 pr_cont("BUFFER_TYPE - length %d\n", obj->buffer.length);
Thomas Renningerfc3155b2010-05-03 15:30:15 +0200505 break;
506 case ACPI_TYPE_STRING:
Dmitry Torokhov8e075142010-08-26 00:15:19 -0700507 pr_cont("STRING_TYPE - %s\n", obj->string.pointer);
Thomas Renningerfc3155b2010-05-03 15:30:15 +0200508 break;
509 case ACPI_TYPE_INTEGER:
Dmitry Torokhov8e075142010-08-26 00:15:19 -0700510 pr_cont("INTEGER_TYPE - %llu\n", obj->integer.value);
Thomas Renningerfc3155b2010-05-03 15:30:15 +0200511 break;
512 case ACPI_TYPE_PACKAGE:
Dmitry Torokhov8e075142010-08-26 00:15:19 -0700513 pr_cont("PACKAGE_TYPE - %d elements\n", obj->package.count);
Thomas Renningerfc3155b2010-05-03 15:30:15 +0200514 break;
515 default:
Dmitry Torokhov8e075142010-08-26 00:15:19 -0700516 pr_cont("object type 0x%X\n", obj->type);
Thomas Renningerfc3155b2010-05-03 15:30:15 +0200517 }
Axel Lin1492616a2010-06-28 09:30:45 +0800518 kfree(obj);
Thomas Renningerfc3155b2010-05-03 15:30:15 +0200519}
520
Carlos Corbachobff431e2008-02-05 02:17:04 +0000521/**
522 * wmi_install_notify_handler - Register handler for WMI events
523 * @handler: Function to handle notifications
524 * @data: Data to be returned to handler when event is fired
525 *
526 * Register a handler for events sent to the ACPI-WMI mapper device.
527 */
528acpi_status wmi_install_notify_handler(const char *guid,
529wmi_notify_handler handler, void *data)
530{
531 struct wmi_block *block;
Colin King58f64252010-11-19 15:40:02 +0000532 acpi_status status = AE_NOT_EXIST;
533 char tmp[16], guid_input[16];
534 struct list_head *p;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000535
536 if (!guid || !handler)
537 return AE_BAD_PARAMETER;
538
Colin King58f64252010-11-19 15:40:02 +0000539 wmi_parse_guid(guid, tmp);
540 wmi_swap_bytes(tmp, guid_input);
Carlos Corbachobff431e2008-02-05 02:17:04 +0000541
Colin King58f64252010-11-19 15:40:02 +0000542 list_for_each(p, &wmi_block_list) {
543 acpi_status wmi_status;
544 block = list_entry(p, struct wmi_block, list);
Carlos Corbachobff431e2008-02-05 02:17:04 +0000545
Colin King58f64252010-11-19 15:40:02 +0000546 if (memcmp(block->gblock.guid, guid_input, 16) == 0) {
547 if (block->handler &&
548 block->handler != wmi_notify_debug)
549 return AE_ALREADY_ACQUIRED;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000550
Colin King58f64252010-11-19 15:40:02 +0000551 block->handler = handler;
552 block->handler_data = data;
553
554 wmi_status = wmi_method_enable(block, 1);
555 if ((wmi_status != AE_OK) ||
556 ((wmi_status == AE_OK) && (status == AE_NOT_EXIST)))
557 status = wmi_status;
558 }
559 }
Matthew Garretta66bfa72008-10-08 21:40:32 +0100560
561 return status;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000562}
563EXPORT_SYMBOL_GPL(wmi_install_notify_handler);
564
565/**
566 * wmi_uninstall_notify_handler - Unregister handler for WMI events
567 *
568 * Unregister handler for events sent to the ACPI-WMI mapper device.
569 */
570acpi_status wmi_remove_notify_handler(const char *guid)
571{
572 struct wmi_block *block;
Colin King58f64252010-11-19 15:40:02 +0000573 acpi_status status = AE_NOT_EXIST;
574 char tmp[16], guid_input[16];
575 struct list_head *p;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000576
577 if (!guid)
578 return AE_BAD_PARAMETER;
579
Colin King58f64252010-11-19 15:40:02 +0000580 wmi_parse_guid(guid, tmp);
581 wmi_swap_bytes(tmp, guid_input);
Carlos Corbachobff431e2008-02-05 02:17:04 +0000582
Colin King58f64252010-11-19 15:40:02 +0000583 list_for_each(p, &wmi_block_list) {
584 acpi_status wmi_status;
585 block = list_entry(p, struct wmi_block, list);
Carlos Corbachobff431e2008-02-05 02:17:04 +0000586
Colin King58f64252010-11-19 15:40:02 +0000587 if (memcmp(block->gblock.guid, guid_input, 16) == 0) {
588 if (!block->handler ||
589 block->handler == wmi_notify_debug)
590 return AE_NULL_ENTRY;
591
592 if (debug_event) {
593 block->handler = wmi_notify_debug;
594 status = AE_OK;
595 } else {
596 wmi_status = wmi_method_enable(block, 0);
597 block->handler = NULL;
598 block->handler_data = NULL;
599 if ((wmi_status != AE_OK) ||
600 ((wmi_status == AE_OK) &&
601 (status == AE_NOT_EXIST)))
602 status = wmi_status;
603 }
604 }
Thomas Renningerfc3155b2010-05-03 15:30:15 +0200605 }
Colin King58f64252010-11-19 15:40:02 +0000606
Matthew Garretta66bfa72008-10-08 21:40:32 +0100607 return status;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000608}
609EXPORT_SYMBOL_GPL(wmi_remove_notify_handler);
610
611/**
612 * wmi_get_event_data - Get WMI data associated with an event
613 *
Anisse Astier3e9b9882009-12-04 10:10:09 +0100614 * @event: Event to find
615 * @out: Buffer to hold event data. out->pointer should be freed with kfree()
Carlos Corbachobff431e2008-02-05 02:17:04 +0000616 *
617 * Returns extra data associated with an event in WMI.
618 */
619acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out)
620{
621 struct acpi_object_list input;
622 union acpi_object params[1];
623 struct guid_block *gblock;
624 struct wmi_block *wblock;
625 struct list_head *p;
626
627 input.count = 1;
628 input.pointer = params;
629 params[0].type = ACPI_TYPE_INTEGER;
630 params[0].integer.value = event;
631
Dmitry Torokhov762e1a22010-08-26 00:15:14 -0700632 list_for_each(p, &wmi_block_list) {
Carlos Corbachobff431e2008-02-05 02:17:04 +0000633 wblock = list_entry(p, struct wmi_block, list);
634 gblock = &wblock->gblock;
635
636 if ((gblock->flags & ACPI_WMI_EVENT) &&
637 (gblock->notify_id == event))
638 return acpi_evaluate_object(wblock->handle, "_WED",
639 &input, out);
640 }
641
642 return AE_NOT_FOUND;
643}
644EXPORT_SYMBOL_GPL(wmi_get_event_data);
645
646/**
647 * wmi_has_guid - Check if a GUID is available
648 * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba
649 *
650 * Check if a given GUID is defined by _WDG
651 */
652bool wmi_has_guid(const char *guid_string)
653{
654 return find_guid(guid_string, NULL);
655}
656EXPORT_SYMBOL_GPL(wmi_has_guid);
657
658/*
Matthew Garrett1caab3c2009-11-04 14:17:53 -0500659 * sysfs interface
660 */
Dmitry Torokhov614ef432010-08-26 00:15:25 -0700661static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
Matthew Garrett1caab3c2009-11-04 14:17:53 -0500662 char *buf)
663{
664 char guid_string[37];
665 struct wmi_block *wblock;
666
667 wblock = dev_get_drvdata(dev);
Prarit Bhargavaa80e1052013-10-03 19:23:36 -0400668 if (!wblock) {
669 strcat(buf, "\n");
670 return strlen(buf);
671 }
Matthew Garrett1caab3c2009-11-04 14:17:53 -0500672
673 wmi_gtoa(wblock->gblock.guid, guid_string);
674
675 return sprintf(buf, "wmi:%s\n", guid_string);
676}
Greg Kroah-Hartmane80b89a2013-07-24 15:05:18 -0700677static DEVICE_ATTR_RO(modalias);
Dmitry Torokhov614ef432010-08-26 00:15:25 -0700678
Greg Kroah-Hartmane80b89a2013-07-24 15:05:18 -0700679static struct attribute *wmi_attrs[] = {
680 &dev_attr_modalias.attr,
681 NULL,
Dmitry Torokhov614ef432010-08-26 00:15:25 -0700682};
Greg Kroah-Hartmane80b89a2013-07-24 15:05:18 -0700683ATTRIBUTE_GROUPS(wmi);
Matthew Garrett1caab3c2009-11-04 14:17:53 -0500684
685static int wmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
686{
687 char guid_string[37];
688
689 struct wmi_block *wblock;
690
691 if (add_uevent_var(env, "MODALIAS="))
692 return -ENOMEM;
693
694 wblock = dev_get_drvdata(dev);
695 if (!wblock)
696 return -ENOMEM;
697
698 wmi_gtoa(wblock->gblock.guid, guid_string);
699
700 strcpy(&env->buf[env->buflen - 1], "wmi:");
701 memcpy(&env->buf[env->buflen - 1 + 4], guid_string, 36);
702 env->buflen += 40;
703
704 return 0;
705}
706
707static void wmi_dev_free(struct device *dev)
708{
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700709 struct wmi_block *wmi_block = container_of(dev, struct wmi_block, dev);
710
711 kfree(wmi_block);
Matthew Garrett1caab3c2009-11-04 14:17:53 -0500712}
713
714static struct class wmi_class = {
715 .name = "wmi",
716 .dev_release = wmi_dev_free,
717 .dev_uevent = wmi_dev_uevent,
Greg Kroah-Hartmane80b89a2013-07-24 15:05:18 -0700718 .dev_groups = wmi_groups,
Matthew Garrett1caab3c2009-11-04 14:17:53 -0500719};
720
Colin King58f64252010-11-19 15:40:02 +0000721static int wmi_create_device(const struct guid_block *gblock,
722 struct wmi_block *wblock, acpi_handle handle)
Matthew Garrett1caab3c2009-11-04 14:17:53 -0500723{
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700724 char guid_string[37];
Matthew Garrett1caab3c2009-11-04 14:17:53 -0500725
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700726 wblock->dev.class = &wmi_class;
727
728 wmi_gtoa(gblock->guid, guid_string);
Kees Cook02aa2a32013-07-03 15:04:56 -0700729 dev_set_name(&wblock->dev, "%s", guid_string);
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700730
731 dev_set_drvdata(&wblock->dev, wblock);
732
Colin King58f64252010-11-19 15:40:02 +0000733 return device_register(&wblock->dev);
Matthew Garrett1caab3c2009-11-04 14:17:53 -0500734}
735
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700736static void wmi_free_devices(void)
Matthew Garrett1caab3c2009-11-04 14:17:53 -0500737{
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700738 struct wmi_block *wblock, *next;
Matthew Garrett1caab3c2009-11-04 14:17:53 -0500739
740 /* Delete devices for all the GUIDs */
Dmitry Torokhov023b9562011-09-07 15:00:02 -0700741 list_for_each_entry_safe(wblock, next, &wmi_block_list, list) {
742 list_del(&wblock->list);
Colin King58f64252010-11-19 15:40:02 +0000743 if (wblock->dev.class)
744 device_unregister(&wblock->dev);
Dmitry Torokhov023b9562011-09-07 15:00:02 -0700745 else
746 kfree(wblock);
747 }
Matthew Garrett1caab3c2009-11-04 14:17:53 -0500748}
749
Carlos Corbachod1f9e492009-12-26 19:14:59 +0000750static bool guid_already_parsed(const char *guid_string)
751{
Carlos Corbachod1f9e492009-12-26 19:14:59 +0000752 struct wmi_block *wblock;
Carlos Corbachod1f9e492009-12-26 19:14:59 +0000753
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700754 list_for_each_entry(wblock, &wmi_block_list, list)
Thadeu Lima de Souza Cascardo8b14d7b2010-11-28 19:46:50 -0200755 if (memcmp(wblock->gblock.guid, guid_string, 16) == 0)
Carlos Corbachod1f9e492009-12-26 19:14:59 +0000756 return true;
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700757
Carlos Corbachod1f9e492009-12-26 19:14:59 +0000758 return false;
759}
760
Matthew Garrett1caab3c2009-11-04 14:17:53 -0500761/*
Carlos Corbachobff431e2008-02-05 02:17:04 +0000762 * Parse the _WDG method for the GUID data blocks
763 */
Dan Carpenter0a018a62013-08-14 12:02:30 +0300764static int parse_wdg(acpi_handle handle)
Carlos Corbachobff431e2008-02-05 02:17:04 +0000765{
766 struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL};
767 union acpi_object *obj;
Dmitry Torokhov37830662010-08-26 00:15:09 -0700768 const struct guid_block *gblock;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000769 struct wmi_block *wblock;
770 acpi_status status;
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700771 int retval;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000772 u32 i, total;
773
774 status = acpi_evaluate_object(handle, "_WDG", NULL, &out);
Carlos Corbachobff431e2008-02-05 02:17:04 +0000775 if (ACPI_FAILURE(status))
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700776 return -ENXIO;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000777
778 obj = (union acpi_object *) out.pointer;
Dmitry Torokhov3d2c63e2010-08-26 00:15:03 -0700779 if (!obj)
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700780 return -ENXIO;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000781
Dmitry Torokhov64ed0ab2010-08-26 00:14:58 -0700782 if (obj->type != ACPI_TYPE_BUFFER) {
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700783 retval = -ENXIO;
Dmitry Torokhov64ed0ab2010-08-26 00:14:58 -0700784 goto out_free_pointer;
785 }
Carlos Corbachobff431e2008-02-05 02:17:04 +0000786
Dmitry Torokhov37830662010-08-26 00:15:09 -0700787 gblock = (const struct guid_block *)obj->buffer.pointer;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000788 total = obj->buffer.length / sizeof(struct guid_block);
789
Carlos Corbachobff431e2008-02-05 02:17:04 +0000790 for (i = 0; i < total; i++) {
Thomas Renningera929aae2010-05-03 15:30:17 +0200791 if (debug_dump_wdg)
792 wmi_dump_wdg(&gblock[i]);
793
Colin King58f64252010-11-19 15:40:02 +0000794 wblock = kzalloc(sizeof(struct wmi_block), GFP_KERNEL);
795 if (!wblock)
Dan Carpenter0a018a62013-08-14 12:02:30 +0300796 return -ENOMEM;
Colin King58f64252010-11-19 15:40:02 +0000797
798 wblock->handle = handle;
799 wblock->gblock = gblock[i];
800
801 /*
802 Some WMI devices, like those for nVidia hooks, have a
803 duplicate GUID. It's not clear what we should do in this
804 case yet, so for now, we'll just ignore the duplicate
805 for device creation.
806 */
807 if (!guid_already_parsed(gblock[i].guid)) {
808 retval = wmi_create_device(&gblock[i], wblock, handle);
809 if (retval) {
810 wmi_free_devices();
Dan Carpentere1e0dac2010-12-06 16:44:23 -0500811 goto out_free_pointer;
Colin King58f64252010-11-19 15:40:02 +0000812 }
Axel Lina5167c52010-06-03 11:45:45 +0800813 }
Carlos Corbachobff431e2008-02-05 02:17:04 +0000814
Colin King58f64252010-11-19 15:40:02 +0000815 list_add_tail(&wblock->list, &wmi_block_list);
816
Thomas Renningerfc3155b2010-05-03 15:30:15 +0200817 if (debug_event) {
818 wblock->handler = wmi_notify_debug;
Dmitry Torokhov2d5ab552010-08-26 00:14:48 -0700819 wmi_method_enable(wblock, 1);
Thomas Renningerfc3155b2010-05-03 15:30:15 +0200820 }
Carlos Corbachobff431e2008-02-05 02:17:04 +0000821 }
822
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700823 retval = 0;
824
Axel Lina5167c52010-06-03 11:45:45 +0800825out_free_pointer:
826 kfree(out.pointer);
Carlos Corbachobff431e2008-02-05 02:17:04 +0000827
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700828 return retval;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000829}
830
831/*
832 * WMI can have EmbeddedControl access regions. In which case, we just want to
833 * hand these off to the EC driver.
834 */
835static acpi_status
836acpi_wmi_ec_space_handler(u32 function, acpi_physical_address address,
Lin Ming439913f2010-01-28 10:53:19 +0800837 u32 bits, u64 *value,
Carlos Corbachobff431e2008-02-05 02:17:04 +0000838 void *handler_context, void *region_context)
839{
840 int result = 0, i = 0;
841 u8 temp = 0;
842
843 if ((address > 0xFF) || !value)
844 return AE_BAD_PARAMETER;
845
846 if (function != ACPI_READ && function != ACPI_WRITE)
847 return AE_BAD_PARAMETER;
848
849 if (bits != 8)
850 return AE_BAD_PARAMETER;
851
852 if (function == ACPI_READ) {
853 result = ec_read(address, &temp);
Lin Ming439913f2010-01-28 10:53:19 +0800854 (*value) |= ((u64)temp) << i;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000855 } else {
856 temp = 0xff & ((*value) >> i);
857 result = ec_write(address, temp);
858 }
859
860 switch (result) {
861 case -EINVAL:
862 return AE_BAD_PARAMETER;
863 break;
864 case -ENODEV:
865 return AE_NOT_FOUND;
866 break;
867 case -ETIME:
868 return AE_TIME;
869 break;
870 default:
871 return AE_OK;
872 }
873}
874
Bjorn Helgaasf61bb932009-04-07 15:37:37 +0000875static void acpi_wmi_notify(struct acpi_device *device, u32 event)
Carlos Corbachobff431e2008-02-05 02:17:04 +0000876{
877 struct guid_block *block;
878 struct wmi_block *wblock;
879 struct list_head *p;
Thomas Renninger7715348c2010-05-03 15:30:16 +0200880 char guid_string[37];
Carlos Corbachobff431e2008-02-05 02:17:04 +0000881
Dmitry Torokhov762e1a22010-08-26 00:15:14 -0700882 list_for_each(p, &wmi_block_list) {
Carlos Corbachobff431e2008-02-05 02:17:04 +0000883 wblock = list_entry(p, struct wmi_block, list);
884 block = &wblock->gblock;
885
886 if ((block->flags & ACPI_WMI_EVENT) &&
887 (block->notify_id == event)) {
888 if (wblock->handler)
889 wblock->handler(event, wblock->handler_data);
Thomas Renninger7715348c2010-05-03 15:30:16 +0200890 if (debug_event) {
891 wmi_gtoa(wblock->gblock.guid, guid_string);
Dmitry Torokhov8e075142010-08-26 00:15:19 -0700892 pr_info("DEBUG Event GUID: %s\n", guid_string);
Thomas Renninger7715348c2010-05-03 15:30:16 +0200893 }
Carlos Corbachobff431e2008-02-05 02:17:04 +0000894
895 acpi_bus_generate_netlink_event(
Kay Sievers07944692008-10-30 01:18:59 +0100896 device->pnp.device_class, dev_name(&device->dev),
Carlos Corbachobff431e2008-02-05 02:17:04 +0000897 event, 0);
898 break;
899 }
900 }
901}
902
Rafael J. Wysocki51fac832013-01-24 00:24:48 +0100903static int acpi_wmi_remove(struct acpi_device *device)
Carlos Corbachobff431e2008-02-05 02:17:04 +0000904{
Carlos Corbachobff431e2008-02-05 02:17:04 +0000905 acpi_remove_address_space_handler(device->handle,
906 ACPI_ADR_SPACE_EC, &acpi_wmi_ec_space_handler);
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700907 wmi_free_devices();
Carlos Corbachobff431e2008-02-05 02:17:04 +0000908
909 return 0;
910}
911
Thomas Renninger925b1082010-07-16 13:11:36 +0200912static int acpi_wmi_add(struct acpi_device *device)
Carlos Corbachobff431e2008-02-05 02:17:04 +0000913{
914 acpi_status status;
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700915 int error;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000916
Carlos Corbachobff431e2008-02-05 02:17:04 +0000917 status = acpi_install_address_space_handler(device->handle,
918 ACPI_ADR_SPACE_EC,
919 &acpi_wmi_ec_space_handler,
920 NULL, NULL);
Dmitry Torokhov5212cd62010-08-26 00:14:42 -0700921 if (ACPI_FAILURE(status)) {
Dmitry Torokhov8e075142010-08-26 00:15:19 -0700922 pr_err("Error installing EC region handler\n");
Carlos Corbachobff431e2008-02-05 02:17:04 +0000923 return -ENODEV;
Dmitry Torokhov5212cd62010-08-26 00:14:42 -0700924 }
Carlos Corbachobff431e2008-02-05 02:17:04 +0000925
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700926 error = parse_wdg(device->handle);
927 if (error) {
Dmitry Torokhov5212cd62010-08-26 00:14:42 -0700928 acpi_remove_address_space_handler(device->handle,
929 ACPI_ADR_SPACE_EC,
930 &acpi_wmi_ec_space_handler);
Dmitry Torokhov8e075142010-08-26 00:15:19 -0700931 pr_err("Failed to parse WDG method\n");
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700932 return error;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000933 }
934
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700935 return 0;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000936}
937
938static int __init acpi_wmi_init(void)
939{
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700940 int error;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000941
942 if (acpi_disabled)
943 return -ENODEV;
944
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700945 error = class_register(&wmi_class);
946 if (error)
947 return error;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000948
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700949 error = acpi_bus_register_driver(&acpi_wmi_driver);
950 if (error) {
951 pr_err("Error loading mapper\n");
952 class_unregister(&wmi_class);
953 return error;
Matthew Garrett1caab3c2009-11-04 14:17:53 -0500954 }
955
Dmitry Torokhov8e075142010-08-26 00:15:19 -0700956 pr_info("Mapper loaded\n");
Dmitry Torokhov8e075142010-08-26 00:15:19 -0700957 return 0;
Carlos Corbachobff431e2008-02-05 02:17:04 +0000958}
959
960static void __exit acpi_wmi_exit(void)
961{
Carlos Corbachobff431e2008-02-05 02:17:04 +0000962 acpi_bus_unregister_driver(&acpi_wmi_driver);
Dmitry Torokhovc64eefd2010-08-26 00:15:30 -0700963 class_unregister(&wmi_class);
Carlos Corbachobff431e2008-02-05 02:17:04 +0000964
Dmitry Torokhov8e075142010-08-26 00:15:19 -0700965 pr_info("Mapper unloaded\n");
Carlos Corbachobff431e2008-02-05 02:17:04 +0000966}
967
968subsys_initcall(acpi_wmi_init);
969module_exit(acpi_wmi_exit);