x86: move hp-wmi's probe function to .devinit.text
[deliverable/linux.git] / drivers / platform / x86 / hp-wmi.c
CommitLineData
62ec30d4
MG
1/*
2 * HP WMI hotkeys
3 *
4 * Copyright (C) 2008 Red Hat <mjg@redhat.com>
5 *
6 * Portions based on wistron_btns.c:
7 * Copyright (C) 2005 Miloslav Trmac <mitr@volny.cz>
8 * Copyright (C) 2005 Bernhard Rosenkraenzer <bero@arklinux.org>
9 * Copyright (C) 2005 Dmitry Torokhov <dtor@mail.ru>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25
26#include <linux/kernel.h>
27#include <linux/module.h>
28#include <linux/init.h>
29#include <linux/types.h>
30#include <linux/input.h>
31#include <acpi/acpi_drivers.h>
32#include <linux/platform_device.h>
33#include <linux/acpi.h>
34#include <linux/rfkill.h>
35#include <linux/string.h>
36
37MODULE_AUTHOR("Matthew Garrett <mjg59@srcf.ucam.org>");
38MODULE_DESCRIPTION("HP laptop WMI hotkeys driver");
39MODULE_LICENSE("GPL");
40
41MODULE_ALIAS("wmi:95F24279-4D7B-4334-9387-ACCDC67EF61C");
42MODULE_ALIAS("wmi:5FB7F034-2C63-45e9-BE91-3D44E2C707E4");
43
44#define HPWMI_EVENT_GUID "95F24279-4D7B-4334-9387-ACCDC67EF61C"
45#define HPWMI_BIOS_GUID "5FB7F034-2C63-45e9-BE91-3D44E2C707E4"
46
47#define HPWMI_DISPLAY_QUERY 0x1
48#define HPWMI_HDDTEMP_QUERY 0x2
49#define HPWMI_ALS_QUERY 0x3
871043bc 50#define HPWMI_HARDWARE_QUERY 0x4
62ec30d4 51#define HPWMI_WIRELESS_QUERY 0x5
a8823aef 52#define HPWMI_HOTKEY_QUERY 0xc
62ec30d4 53
e5fbba85
AJ
54enum hp_wmi_radio {
55 HPWMI_WIFI = 0,
56 HPWMI_BLUETOOTH = 1,
57 HPWMI_WWAN = 2,
58};
59
ea79632d 60static int __devinit hp_wmi_bios_setup(struct platform_device *device);
62ec30d4 61static int __exit hp_wmi_bios_remove(struct platform_device *device);
8dd2b426 62static int hp_wmi_resume_handler(struct device *device);
62ec30d4
MG
63
64struct bios_args {
65 u32 signature;
66 u32 command;
67 u32 commandtype;
68 u32 datasize;
69 u32 data;
70};
71
72struct bios_return {
73 u32 sigpass;
74 u32 return_code;
75 u32 value;
76};
77
78struct key_entry {
79 char type; /* See KE_* below */
a8823aef 80 u16 code;
62ec30d4
MG
81 u16 keycode;
82};
83
871043bc 84enum { KE_KEY, KE_END };
62ec30d4
MG
85
86static struct key_entry hp_wmi_keymap[] = {
62ec30d4
MG
87 {KE_KEY, 0x02, KEY_BRIGHTNESSUP},
88 {KE_KEY, 0x03, KEY_BRIGHTNESSDOWN},
a8823aef
MG
89 {KE_KEY, 0x20e6, KEY_PROG1},
90 {KE_KEY, 0x2142, KEY_MEDIA},
5c624841 91 {KE_KEY, 0x213b, KEY_INFO},
caeacf59 92 {KE_KEY, 0x2169, KEY_DIRECTION},
a8823aef 93 {KE_KEY, 0x231b, KEY_HELP},
62ec30d4
MG
94 {KE_END, 0}
95};
96
97static struct input_dev *hp_wmi_input_dev;
98static struct platform_device *hp_wmi_platform_dev;
99
100static struct rfkill *wifi_rfkill;
101static struct rfkill *bluetooth_rfkill;
102static struct rfkill *wwan_rfkill;
103
47145210 104static const struct dev_pm_ops hp_wmi_pm_ops = {
8dd2b426
FP
105 .resume = hp_wmi_resume_handler,
106 .restore = hp_wmi_resume_handler,
107};
108
62ec30d4
MG
109static struct platform_driver hp_wmi_driver = {
110 .driver = {
8dd2b426
FP
111 .name = "hp-wmi",
112 .owner = THIS_MODULE,
113 .pm = &hp_wmi_pm_ops,
62ec30d4
MG
114 },
115 .probe = hp_wmi_bios_setup,
116 .remove = hp_wmi_bios_remove,
117};
118
119static int hp_wmi_perform_query(int query, int write, int value)
120{
121 struct bios_return bios_return;
122 acpi_status status;
123 union acpi_object *obj;
124 struct bios_args args = {
125 .signature = 0x55434553,
126 .command = write ? 0x2 : 0x1,
127 .commandtype = query,
128 .datasize = write ? 0x4 : 0,
129 .data = value,
130 };
131 struct acpi_buffer input = { sizeof(struct bios_args), &args };
132 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
133
134 status = wmi_evaluate_method(HPWMI_BIOS_GUID, 0, 0x3, &input, &output);
135
136 obj = output.pointer;
137
44ef00e6 138 if (!obj)
62ec30d4 139 return -EINVAL;
44ef00e6
TR
140 else if (obj->type != ACPI_TYPE_BUFFER) {
141 kfree(obj);
142 return -EINVAL;
143 }
62ec30d4
MG
144
145 bios_return = *((struct bios_return *)obj->buffer.pointer);
44ef00e6 146 kfree(obj);
62ec30d4
MG
147 if (bios_return.return_code > 0)
148 return bios_return.return_code * -1;
149 else
150 return bios_return.value;
151}
152
153static int hp_wmi_display_state(void)
154{
155 return hp_wmi_perform_query(HPWMI_DISPLAY_QUERY, 0, 0);
156}
157
158static int hp_wmi_hddtemp_state(void)
159{
160 return hp_wmi_perform_query(HPWMI_HDDTEMP_QUERY, 0, 0);
161}
162
163static int hp_wmi_als_state(void)
164{
165 return hp_wmi_perform_query(HPWMI_ALS_QUERY, 0, 0);
166}
167
168static int hp_wmi_dock_state(void)
169{
871043bc 170 int ret = hp_wmi_perform_query(HPWMI_HARDWARE_QUERY, 0, 0);
62ec30d4 171
871043bc
MG
172 if (ret < 0)
173 return ret;
174
175 return ret & 0x1;
62ec30d4
MG
176}
177
871043bc 178static int hp_wmi_tablet_state(void)
62ec30d4 179{
871043bc
MG
180 int ret = hp_wmi_perform_query(HPWMI_HARDWARE_QUERY, 0, 0);
181
182 if (ret < 0)
183 return ret;
184
185 return (ret & 0x4) ? 1 : 0;
62ec30d4
MG
186}
187
19d337df 188static int hp_wmi_set_block(void *data, bool blocked)
62ec30d4 189{
e5fbba85
AJ
190 enum hp_wmi_radio r = (enum hp_wmi_radio) data;
191 int query = BIT(r + 8) | ((!blocked) << r);
62ec30d4 192
19d337df 193 return hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1, query);
62ec30d4
MG
194}
195
19d337df
JB
196static const struct rfkill_ops hp_wmi_rfkill_ops = {
197 .set_block = hp_wmi_set_block,
198};
62ec30d4 199
e5fbba85 200static bool hp_wmi_get_sw_state(enum hp_wmi_radio r)
62ec30d4
MG
201{
202 int wireless = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0, 0);
e5fbba85 203 int mask = 0x200 << (r * 8);
62ec30d4 204
e5fbba85 205 if (wireless & mask)
19d337df 206 return false;
62ec30d4 207 else
19d337df 208 return true;
62ec30d4
MG
209}
210
e5fbba85 211static bool hp_wmi_get_hw_state(enum hp_wmi_radio r)
62ec30d4
MG
212{
213 int wireless = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0, 0);
e5fbba85 214 int mask = 0x800 << (r * 8);
62ec30d4 215
e5fbba85 216 if (wireless & mask)
19d337df 217 return false;
62ec30d4 218 else
19d337df 219 return true;
62ec30d4
MG
220}
221
222static ssize_t show_display(struct device *dev, struct device_attribute *attr,
223 char *buf)
224{
225 int value = hp_wmi_display_state();
226 if (value < 0)
227 return -EINVAL;
228 return sprintf(buf, "%d\n", value);
229}
230
231static ssize_t show_hddtemp(struct device *dev, struct device_attribute *attr,
232 char *buf)
233{
234 int value = hp_wmi_hddtemp_state();
235 if (value < 0)
236 return -EINVAL;
237 return sprintf(buf, "%d\n", value);
238}
239
240static ssize_t show_als(struct device *dev, struct device_attribute *attr,
241 char *buf)
242{
243 int value = hp_wmi_als_state();
244 if (value < 0)
245 return -EINVAL;
246 return sprintf(buf, "%d\n", value);
247}
248
249static ssize_t show_dock(struct device *dev, struct device_attribute *attr,
250 char *buf)
251{
252 int value = hp_wmi_dock_state();
253 if (value < 0)
254 return -EINVAL;
255 return sprintf(buf, "%d\n", value);
256}
257
871043bc
MG
258static ssize_t show_tablet(struct device *dev, struct device_attribute *attr,
259 char *buf)
260{
261 int value = hp_wmi_tablet_state();
262 if (value < 0)
263 return -EINVAL;
264 return sprintf(buf, "%d\n", value);
265}
266
62ec30d4
MG
267static ssize_t set_als(struct device *dev, struct device_attribute *attr,
268 const char *buf, size_t count)
269{
270 u32 tmp = simple_strtoul(buf, NULL, 10);
271 hp_wmi_perform_query(HPWMI_ALS_QUERY, 1, tmp);
272 return count;
273}
274
275static DEVICE_ATTR(display, S_IRUGO, show_display, NULL);
276static DEVICE_ATTR(hddtemp, S_IRUGO, show_hddtemp, NULL);
277static DEVICE_ATTR(als, S_IRUGO | S_IWUSR, show_als, set_als);
278static DEVICE_ATTR(dock, S_IRUGO, show_dock, NULL);
871043bc 279static DEVICE_ATTR(tablet, S_IRUGO, show_tablet, NULL);
62ec30d4
MG
280
281static struct key_entry *hp_wmi_get_entry_by_scancode(int code)
282{
283 struct key_entry *key;
284
285 for (key = hp_wmi_keymap; key->type != KE_END; key++)
286 if (code == key->code)
287 return key;
288
289 return NULL;
290}
291
292static struct key_entry *hp_wmi_get_entry_by_keycode(int keycode)
293{
294 struct key_entry *key;
295
296 for (key = hp_wmi_keymap; key->type != KE_END; key++)
297 if (key->type == KE_KEY && keycode == key->keycode)
298 return key;
299
300 return NULL;
301}
302
303static int hp_wmi_getkeycode(struct input_dev *dev, int scancode, int *keycode)
304{
305 struct key_entry *key = hp_wmi_get_entry_by_scancode(scancode);
306
307 if (key && key->type == KE_KEY) {
308 *keycode = key->keycode;
309 return 0;
310 }
311
312 return -EINVAL;
313}
314
315static int hp_wmi_setkeycode(struct input_dev *dev, int scancode, int keycode)
316{
317 struct key_entry *key;
318 int old_keycode;
319
320 if (keycode < 0 || keycode > KEY_MAX)
321 return -EINVAL;
322
323 key = hp_wmi_get_entry_by_scancode(scancode);
324 if (key && key->type == KE_KEY) {
325 old_keycode = key->keycode;
326 key->keycode = keycode;
327 set_bit(keycode, dev->keybit);
328 if (!hp_wmi_get_entry_by_keycode(old_keycode))
329 clear_bit(old_keycode, dev->keybit);
330 return 0;
331 }
332
333 return -EINVAL;
334}
335
88429a10 336static void hp_wmi_notify(u32 value, void *context)
62ec30d4
MG
337{
338 struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
339 static struct key_entry *key;
340 union acpi_object *obj;
e5fbba85 341 int eventcode;
fda11e61 342 acpi_status status;
62ec30d4 343
fda11e61
LB
344 status = wmi_get_event_data(value, &response);
345 if (status != AE_OK) {
346 printk(KERN_INFO "hp-wmi: bad event status 0x%x\n", status);
347 return;
348 }
62ec30d4
MG
349
350 obj = (union acpi_object *)response.pointer;
351
e5fbba85
AJ
352 if (!obj || obj->type != ACPI_TYPE_BUFFER || obj->buffer.length != 8) {
353 printk(KERN_INFO "HP WMI: Unknown response received\n");
44ef00e6 354 kfree(obj);
e5fbba85
AJ
355 return;
356 }
357
358 eventcode = *((u8 *) obj->buffer.pointer);
44ef00e6 359 kfree(obj);
e5fbba85
AJ
360 if (eventcode == 0x4)
361 eventcode = hp_wmi_perform_query(HPWMI_HOTKEY_QUERY, 0,
362 0);
363 key = hp_wmi_get_entry_by_scancode(eventcode);
364 if (key) {
365 switch (key->type) {
366 case KE_KEY:
367 input_report_key(hp_wmi_input_dev,
368 key->keycode, 1);
369 input_sync(hp_wmi_input_dev);
370 input_report_key(hp_wmi_input_dev,
371 key->keycode, 0);
871043bc 372 input_sync(hp_wmi_input_dev);
e5fbba85
AJ
373 break;
374 }
375 } else if (eventcode == 0x1) {
376 input_report_switch(hp_wmi_input_dev, SW_DOCK,
377 hp_wmi_dock_state());
378 input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE,
379 hp_wmi_tablet_state());
380 input_sync(hp_wmi_input_dev);
381 } else if (eventcode == 0x5) {
382 if (wifi_rfkill)
383 rfkill_set_states(wifi_rfkill,
384 hp_wmi_get_sw_state(HPWMI_WIFI),
385 hp_wmi_get_hw_state(HPWMI_WIFI));
386 if (bluetooth_rfkill)
387 rfkill_set_states(bluetooth_rfkill,
388 hp_wmi_get_sw_state(HPWMI_BLUETOOTH),
389 hp_wmi_get_hw_state(HPWMI_BLUETOOTH));
390 if (wwan_rfkill)
391 rfkill_set_states(wwan_rfkill,
392 hp_wmi_get_sw_state(HPWMI_WWAN),
393 hp_wmi_get_hw_state(HPWMI_WWAN));
62ec30d4 394 } else
e5fbba85
AJ
395 printk(KERN_INFO "HP WMI: Unknown key pressed - %x\n",
396 eventcode);
62ec30d4
MG
397}
398
399static int __init hp_wmi_input_setup(void)
400{
401 struct key_entry *key;
402 int err;
403
404 hp_wmi_input_dev = input_allocate_device();
405
406 hp_wmi_input_dev->name = "HP WMI hotkeys";
407 hp_wmi_input_dev->phys = "wmi/input0";
408 hp_wmi_input_dev->id.bustype = BUS_HOST;
409 hp_wmi_input_dev->getkeycode = hp_wmi_getkeycode;
410 hp_wmi_input_dev->setkeycode = hp_wmi_setkeycode;
411
412 for (key = hp_wmi_keymap; key->type != KE_END; key++) {
413 switch (key->type) {
414 case KE_KEY:
415 set_bit(EV_KEY, hp_wmi_input_dev->evbit);
416 set_bit(key->keycode, hp_wmi_input_dev->keybit);
417 break;
62ec30d4
MG
418 }
419 }
420
871043bc
MG
421 set_bit(EV_SW, hp_wmi_input_dev->evbit);
422 set_bit(SW_DOCK, hp_wmi_input_dev->swbit);
423 set_bit(SW_TABLET_MODE, hp_wmi_input_dev->swbit);
424
425 /* Set initial hardware state */
426 input_report_switch(hp_wmi_input_dev, SW_DOCK, hp_wmi_dock_state());
427 input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE,
428 hp_wmi_tablet_state());
429 input_sync(hp_wmi_input_dev);
430
62ec30d4
MG
431 err = input_register_device(hp_wmi_input_dev);
432
433 if (err) {
434 input_free_device(hp_wmi_input_dev);
435 return err;
436 }
437
438 return 0;
439}
440
441static void cleanup_sysfs(struct platform_device *device)
442{
443 device_remove_file(&device->dev, &dev_attr_display);
444 device_remove_file(&device->dev, &dev_attr_hddtemp);
445 device_remove_file(&device->dev, &dev_attr_als);
446 device_remove_file(&device->dev, &dev_attr_dock);
871043bc 447 device_remove_file(&device->dev, &dev_attr_tablet);
62ec30d4
MG
448}
449
ea79632d 450static int __devinit hp_wmi_bios_setup(struct platform_device *device)
62ec30d4
MG
451{
452 int err;
3f6e2f13 453 int wireless = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0, 0);
62ec30d4
MG
454
455 err = device_create_file(&device->dev, &dev_attr_display);
456 if (err)
457 goto add_sysfs_error;
458 err = device_create_file(&device->dev, &dev_attr_hddtemp);
459 if (err)
460 goto add_sysfs_error;
461 err = device_create_file(&device->dev, &dev_attr_als);
462 if (err)
463 goto add_sysfs_error;
464 err = device_create_file(&device->dev, &dev_attr_dock);
871043bc
MG
465 if (err)
466 goto add_sysfs_error;
467 err = device_create_file(&device->dev, &dev_attr_tablet);
62ec30d4
MG
468 if (err)
469 goto add_sysfs_error;
470
3f6e2f13 471 if (wireless & 0x1) {
19d337df
JB
472 wifi_rfkill = rfkill_alloc("hp-wifi", &device->dev,
473 RFKILL_TYPE_WLAN,
474 &hp_wmi_rfkill_ops,
e5fbba85
AJ
475 (void *) HPWMI_WIFI);
476 rfkill_init_sw_state(wifi_rfkill,
477 hp_wmi_get_sw_state(HPWMI_WIFI));
478 rfkill_set_hw_state(wifi_rfkill,
479 hp_wmi_get_hw_state(HPWMI_WIFI));
fe8e4e03
LF
480 err = rfkill_register(wifi_rfkill);
481 if (err)
19d337df 482 goto register_wifi_error;
3f6e2f13
MG
483 }
484
485 if (wireless & 0x2) {
19d337df
JB
486 bluetooth_rfkill = rfkill_alloc("hp-bluetooth", &device->dev,
487 RFKILL_TYPE_BLUETOOTH,
488 &hp_wmi_rfkill_ops,
e5fbba85
AJ
489 (void *) HPWMI_BLUETOOTH);
490 rfkill_init_sw_state(bluetooth_rfkill,
491 hp_wmi_get_sw_state(HPWMI_BLUETOOTH));
492 rfkill_set_hw_state(bluetooth_rfkill,
493 hp_wmi_get_hw_state(HPWMI_BLUETOOTH));
fe8e4e03 494 err = rfkill_register(bluetooth_rfkill);
6989d565 495 if (err)
fe8e4e03 496 goto register_bluetooth_error;
3f6e2f13
MG
497 }
498
499 if (wireless & 0x4) {
19d337df
JB
500 wwan_rfkill = rfkill_alloc("hp-wwan", &device->dev,
501 RFKILL_TYPE_WWAN,
502 &hp_wmi_rfkill_ops,
e5fbba85
AJ
503 (void *) HPWMI_WWAN);
504 rfkill_init_sw_state(wwan_rfkill,
505 hp_wmi_get_sw_state(HPWMI_WWAN));
506 rfkill_set_hw_state(wwan_rfkill,
507 hp_wmi_get_hw_state(HPWMI_WWAN));
fe8e4e03
LF
508 err = rfkill_register(wwan_rfkill);
509 if (err)
510 goto register_wwan_err;
3f6e2f13 511 }
62ec30d4
MG
512
513 return 0;
fe8e4e03 514register_wwan_err:
19d337df 515 rfkill_destroy(wwan_rfkill);
44f0606d
AM
516 if (bluetooth_rfkill)
517 rfkill_unregister(bluetooth_rfkill);
fe8e4e03 518register_bluetooth_error:
19d337df 519 rfkill_destroy(bluetooth_rfkill);
44f0606d
AM
520 if (wifi_rfkill)
521 rfkill_unregister(wifi_rfkill);
19d337df
JB
522register_wifi_error:
523 rfkill_destroy(wifi_rfkill);
62ec30d4
MG
524add_sysfs_error:
525 cleanup_sysfs(device);
526 return err;
527}
528
529static int __exit hp_wmi_bios_remove(struct platform_device *device)
530{
531 cleanup_sysfs(device);
532
19d337df 533 if (wifi_rfkill) {
3f6e2f13 534 rfkill_unregister(wifi_rfkill);
19d337df
JB
535 rfkill_destroy(wifi_rfkill);
536 }
537 if (bluetooth_rfkill) {
3f6e2f13 538 rfkill_unregister(bluetooth_rfkill);
09729f0b 539 rfkill_destroy(bluetooth_rfkill);
19d337df
JB
540 }
541 if (wwan_rfkill) {
3f6e2f13 542 rfkill_unregister(wwan_rfkill);
19d337df
JB
543 rfkill_destroy(wwan_rfkill);
544 }
62ec30d4
MG
545
546 return 0;
547}
548
8dd2b426 549static int hp_wmi_resume_handler(struct device *device)
4c395bdd 550{
4c395bdd 551 /*
871043bc
MG
552 * Hardware state may have changed while suspended, so trigger
553 * input events for the current state. As this is a switch,
4c395bdd
FP
554 * the input layer will only actually pass it on if the state
555 * changed.
556 */
daed9537
FP
557 if (hp_wmi_input_dev) {
558 input_report_switch(hp_wmi_input_dev, SW_DOCK,
559 hp_wmi_dock_state());
560 input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE,
561 hp_wmi_tablet_state());
562 input_sync(hp_wmi_input_dev);
563 }
4c395bdd 564
e5fbba85
AJ
565 if (wifi_rfkill)
566 rfkill_set_states(wifi_rfkill,
567 hp_wmi_get_sw_state(HPWMI_WIFI),
568 hp_wmi_get_hw_state(HPWMI_WIFI));
569 if (bluetooth_rfkill)
570 rfkill_set_states(bluetooth_rfkill,
571 hp_wmi_get_sw_state(HPWMI_BLUETOOTH),
572 hp_wmi_get_hw_state(HPWMI_BLUETOOTH));
573 if (wwan_rfkill)
574 rfkill_set_states(wwan_rfkill,
575 hp_wmi_get_sw_state(HPWMI_WWAN),
576 hp_wmi_get_hw_state(HPWMI_WWAN));
577
4c395bdd
FP
578 return 0;
579}
580
62ec30d4
MG
581static int __init hp_wmi_init(void)
582{
583 int err;
584
585 if (wmi_has_guid(HPWMI_EVENT_GUID)) {
586 err = wmi_install_notify_handler(HPWMI_EVENT_GUID,
587 hp_wmi_notify, NULL);
f2772575 588 if (ACPI_SUCCESS(err))
62ec30d4
MG
589 hp_wmi_input_setup();
590 }
591
592 if (wmi_has_guid(HPWMI_BIOS_GUID)) {
593 err = platform_driver_register(&hp_wmi_driver);
594 if (err)
595 return 0;
596 hp_wmi_platform_dev = platform_device_alloc("hp-wmi", -1);
597 if (!hp_wmi_platform_dev) {
598 platform_driver_unregister(&hp_wmi_driver);
599 return 0;
600 }
601 platform_device_add(hp_wmi_platform_dev);
602 }
603
604 return 0;
605}
606
607static void __exit hp_wmi_exit(void)
608{
609 if (wmi_has_guid(HPWMI_EVENT_GUID)) {
610 wmi_remove_notify_handler(HPWMI_EVENT_GUID);
611 input_unregister_device(hp_wmi_input_dev);
612 }
613 if (hp_wmi_platform_dev) {
614 platform_device_del(hp_wmi_platform_dev);
615 platform_driver_unregister(&hp_wmi_driver);
616 }
617}
618
619module_init(hp_wmi_init);
620module_exit(hp_wmi_exit);
This page took 0.294308 seconds and 5 git commands to generate.