2 * Acer WMI Laptop Extras
4 * Copyright (C) 2007-2009 Carlos Corbacho <carlos@strangeworlds.co.uk>
7 * Copyright (C) 2005-2007 E.M. Smith
8 * Copyright (C) 2007-2008 Carlos Corbacho <cathectic@gmail.com>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include <linux/kernel.h>
26 #include <linux/module.h>
27 #include <linux/init.h>
28 #include <linux/types.h>
29 #include <linux/dmi.h>
31 #include <linux/backlight.h>
32 #include <linux/leds.h>
33 #include <linux/platform_device.h>
34 #include <linux/acpi.h>
35 #include <linux/i8042.h>
36 #include <linux/rfkill.h>
37 #include <linux/workqueue.h>
38 #include <linux/debugfs.h>
39 #include <linux/slab.h>
40 #include <linux/input.h>
41 #include <linux/input/sparse-keymap.h>
42 #include <linux/dmi.h>
44 #include <acpi/acpi_drivers.h>
46 MODULE_AUTHOR("Carlos Corbacho");
47 MODULE_DESCRIPTION("Acer Laptop WMI Extras Driver");
48 MODULE_LICENSE("GPL");
50 #define ACER_LOGPREFIX "acer-wmi: "
51 #define ACER_ERR KERN_ERR ACER_LOGPREFIX
52 #define ACER_NOTICE KERN_NOTICE ACER_LOGPREFIX
53 #define ACER_INFO KERN_INFO ACER_LOGPREFIX
54 #define ACER_WARNING KERN_WARNING ACER_LOGPREFIX
58 * Meaning is unknown - this number is required for writing to ACPI for AMW0
59 * (it's also used in acerhk when directly accessing the BIOS)
61 #define ACER_AMW0_WRITE 0x9610
64 * Bit masks for the AMW0 interface
66 #define ACER_AMW0_WIRELESS_MASK 0x35
67 #define ACER_AMW0_BLUETOOTH_MASK 0x34
68 #define ACER_AMW0_MAILLED_MASK 0x31
71 * Method IDs for WMID interface
73 #define ACER_WMID_GET_WIRELESS_METHODID 1
74 #define ACER_WMID_GET_BLUETOOTH_METHODID 2
75 #define ACER_WMID_GET_BRIGHTNESS_METHODID 3
76 #define ACER_WMID_SET_WIRELESS_METHODID 4
77 #define ACER_WMID_SET_BLUETOOTH_METHODID 5
78 #define ACER_WMID_SET_BRIGHTNESS_METHODID 6
79 #define ACER_WMID_GET_THREEG_METHODID 10
80 #define ACER_WMID_SET_THREEG_METHODID 11
83 * Acer ACPI method GUIDs
85 #define AMW0_GUID1 "67C3371D-95A3-4C37-BB61-DD47B491DAAB"
86 #define AMW0_GUID2 "431F16ED-0C2B-444C-B267-27DEB140CF9C"
87 #define WMID_GUID1 "6AF4F258-B401-42FD-BE91-3D4AC2D7C0D3"
88 #define WMID_GUID2 "95764E09-FB56-4e83-B31A-37761F60994A"
89 #define WMID_GUID3 "61EF69EA-865C-4BC3-A502-A0DEBA0CB531"
92 * Acer ACPI event GUIDs
94 #define ACERWMID_EVENT_GUID "676AA15E-6A47-4D9F-A2CC-1E6D18D14026"
96 MODULE_ALIAS("wmi:67C3371D-95A3-4C37-BB61-DD47B491DAAB");
97 MODULE_ALIAS("wmi:6AF4F258-B401-42fd-BE91-3D4AC2D7C0D3");
98 MODULE_ALIAS("wmi:676AA15E-6A47-4D9F-A2CC-1E6D18D14026");
100 enum acer_wmi_event_ids
{
101 WMID_HOTKEY_EVENT
= 0x1,
104 static const struct key_entry acer_wmi_keymap
[] = {
105 {KE_KEY
, 0x01, {KEY_WLAN
} }, /* WiFi */
106 {KE_KEY
, 0x12, {KEY_BLUETOOTH
} }, /* BT */
107 {KE_KEY
, 0x21, {KEY_PROG1
} }, /* Backup */
108 {KE_KEY
, 0x22, {KEY_PROG2
} }, /* Arcade */
109 {KE_KEY
, 0x23, {KEY_PROG3
} }, /* P_Key */
110 {KE_KEY
, 0x24, {KEY_PROG4
} }, /* Social networking_Key */
111 {KE_KEY
, 0x64, {KEY_SWITCHVIDEOMODE
} }, /* Display Switch */
112 {KE_KEY
, 0x82, {KEY_F22
} }, /* Touch Pad On/Off */
116 static struct input_dev
*acer_wmi_input_dev
;
118 struct event_return_value
{
123 } __attribute__((packed
));
126 * GUID3 Get Device Status device flags
128 #define ACER_WMID3_GDS_WIRELESS (1<<0) /* WiFi */
129 #define ACER_WMID3_GDS_THREEG (1<<6) /* 3G */
130 #define ACER_WMID3_GDS_BLUETOOTH (1<<11) /* BT */
132 struct lm_input_params
{
133 u8 function_num
; /* Function Number */
134 u16 commun_devices
; /* Communication type devices default status */
135 u16 devices
; /* Other type devices default status */
136 u8 lm_status
; /* Launch Manager Status */
138 } __attribute__((packed
));
140 struct lm_return_value
{
141 u8 error_code
; /* Error Code */
142 u8 ec_return_value
; /* EC Return Value */
144 } __attribute__((packed
));
146 struct wmid3_gds_input_param
{ /* Get Device Status input parameter */
147 u8 function_num
; /* Function Number */
148 u8 hotkey_number
; /* Hotkey Number */
149 u16 devices
; /* Get Device */
150 } __attribute__((packed
));
152 struct wmid3_gds_return_value
{ /* Get Device Status return value*/
153 u8 error_code
; /* Error Code */
154 u8 ec_return_value
; /* EC Return Value */
155 u16 devices
; /* Current Device Status */
157 } __attribute__((packed
));
159 struct hotkey_function_type_aa
{
163 u16 commun_func_bitmap
;
164 } __attribute__((packed
));
167 * Interface capability flags
169 #define ACER_CAP_MAILLED (1<<0)
170 #define ACER_CAP_WIRELESS (1<<1)
171 #define ACER_CAP_BLUETOOTH (1<<2)
172 #define ACER_CAP_BRIGHTNESS (1<<3)
173 #define ACER_CAP_THREEG (1<<4)
174 #define ACER_CAP_ANY (0xFFFFFFFF)
177 * Interface type flags
179 enum interface_flags
{
185 #define ACER_DEFAULT_WIRELESS 0
186 #define ACER_DEFAULT_BLUETOOTH 0
187 #define ACER_DEFAULT_MAILLED 0
188 #define ACER_DEFAULT_THREEG 0
190 static int max_brightness
= 0xF;
192 static int mailled
= -1;
193 static int brightness
= -1;
194 static int threeg
= -1;
195 static int force_series
;
196 static bool ec_raw_mode
;
197 static bool has_type_aa
;
199 module_param(mailled
, int, 0444);
200 module_param(brightness
, int, 0444);
201 module_param(threeg
, int, 0444);
202 module_param(force_series
, int, 0444);
203 module_param(ec_raw_mode
, bool, 0444);
204 MODULE_PARM_DESC(mailled
, "Set initial state of Mail LED");
205 MODULE_PARM_DESC(brightness
, "Set initial LCD backlight brightness");
206 MODULE_PARM_DESC(threeg
, "Set initial state of 3G hardware");
207 MODULE_PARM_DESC(force_series
, "Force a different laptop series");
208 MODULE_PARM_DESC(ec_raw_mode
, "Enable EC raw mode");
218 struct dentry
*devices
;
222 static struct rfkill
*wireless_rfkill
;
223 static struct rfkill
*bluetooth_rfkill
;
224 static struct rfkill
*threeg_rfkill
;
226 /* Each low-level interface must define at least some of the following */
227 struct wmi_interface
{
228 /* The WMI device type */
231 /* The capabilities this interface provides */
234 /* Private data for the current interface */
235 struct acer_data data
;
237 /* debugfs entries associated with this interface */
238 struct acer_debug debug
;
241 /* The static interface pointer, points to the currently detected interface */
242 static struct wmi_interface
*interface
;
245 * Embedded Controller quirks
246 * Some laptops require us to directly access the EC to either enable or query
247 * features that are not available through WMI.
257 static struct quirk_entry
*quirks
;
259 static void set_quirks(void)
265 interface
->capability
|= ACER_CAP_MAILLED
;
267 if (quirks
->brightness
)
268 interface
->capability
|= ACER_CAP_BRIGHTNESS
;
271 static int dmi_matched(const struct dmi_system_id
*dmi
)
273 quirks
= dmi
->driver_data
;
277 static struct quirk_entry quirk_unknown
= {
280 static struct quirk_entry quirk_acer_aspire_1520
= {
284 static struct quirk_entry quirk_acer_travelmate_2490
= {
288 /* This AMW0 laptop has no bluetooth */
289 static struct quirk_entry quirk_medion_md_98300
= {
293 static struct quirk_entry quirk_fujitsu_amilo_li_1718
= {
297 /* The Aspire One has a dummy ACPI-WMI interface - disable it */
298 static struct dmi_system_id __devinitdata acer_blacklist
[] = {
300 .ident
= "Acer Aspire One (SSD)",
302 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
303 DMI_MATCH(DMI_PRODUCT_NAME
, "AOA110"),
307 .ident
= "Acer Aspire One (HDD)",
309 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
310 DMI_MATCH(DMI_PRODUCT_NAME
, "AOA150"),
316 static struct dmi_system_id acer_quirks
[] = {
318 .callback
= dmi_matched
,
319 .ident
= "Acer Aspire 1360",
321 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
322 DMI_MATCH(DMI_PRODUCT_NAME
, "Aspire 1360"),
324 .driver_data
= &quirk_acer_aspire_1520
,
327 .callback
= dmi_matched
,
328 .ident
= "Acer Aspire 1520",
330 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
331 DMI_MATCH(DMI_PRODUCT_NAME
, "Aspire 1520"),
333 .driver_data
= &quirk_acer_aspire_1520
,
336 .callback
= dmi_matched
,
337 .ident
= "Acer Aspire 3100",
339 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
340 DMI_MATCH(DMI_PRODUCT_NAME
, "Aspire 3100"),
342 .driver_data
= &quirk_acer_travelmate_2490
,
345 .callback
= dmi_matched
,
346 .ident
= "Acer Aspire 3610",
348 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
349 DMI_MATCH(DMI_PRODUCT_NAME
, "Aspire 3610"),
351 .driver_data
= &quirk_acer_travelmate_2490
,
354 .callback
= dmi_matched
,
355 .ident
= "Acer Aspire 5100",
357 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
358 DMI_MATCH(DMI_PRODUCT_NAME
, "Aspire 5100"),
360 .driver_data
= &quirk_acer_travelmate_2490
,
363 .callback
= dmi_matched
,
364 .ident
= "Acer Aspire 5610",
366 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
367 DMI_MATCH(DMI_PRODUCT_NAME
, "Aspire 5610"),
369 .driver_data
= &quirk_acer_travelmate_2490
,
372 .callback
= dmi_matched
,
373 .ident
= "Acer Aspire 5630",
375 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
376 DMI_MATCH(DMI_PRODUCT_NAME
, "Aspire 5630"),
378 .driver_data
= &quirk_acer_travelmate_2490
,
381 .callback
= dmi_matched
,
382 .ident
= "Acer Aspire 5650",
384 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
385 DMI_MATCH(DMI_PRODUCT_NAME
, "Aspire 5650"),
387 .driver_data
= &quirk_acer_travelmate_2490
,
390 .callback
= dmi_matched
,
391 .ident
= "Acer Aspire 5680",
393 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
394 DMI_MATCH(DMI_PRODUCT_NAME
, "Aspire 5680"),
396 .driver_data
= &quirk_acer_travelmate_2490
,
399 .callback
= dmi_matched
,
400 .ident
= "Acer Aspire 9110",
402 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
403 DMI_MATCH(DMI_PRODUCT_NAME
, "Aspire 9110"),
405 .driver_data
= &quirk_acer_travelmate_2490
,
408 .callback
= dmi_matched
,
409 .ident
= "Acer TravelMate 2490",
411 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
412 DMI_MATCH(DMI_PRODUCT_NAME
, "TravelMate 2490"),
414 .driver_data
= &quirk_acer_travelmate_2490
,
417 .callback
= dmi_matched
,
418 .ident
= "Acer TravelMate 4200",
420 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
421 DMI_MATCH(DMI_PRODUCT_NAME
, "TravelMate 4200"),
423 .driver_data
= &quirk_acer_travelmate_2490
,
426 .callback
= dmi_matched
,
427 .ident
= "Fujitsu Siemens Amilo Li 1718",
429 DMI_MATCH(DMI_SYS_VENDOR
, "FUJITSU SIEMENS"),
430 DMI_MATCH(DMI_PRODUCT_NAME
, "AMILO Li 1718"),
432 .driver_data
= &quirk_fujitsu_amilo_li_1718
,
435 .callback
= dmi_matched
,
436 .ident
= "Medion MD 98300",
438 DMI_MATCH(DMI_SYS_VENDOR
, "MEDION"),
439 DMI_MATCH(DMI_PRODUCT_NAME
, "WAM2030"),
441 .driver_data
= &quirk_medion_md_98300
,
446 /* Find which quirks are needed for a particular vendor/ model pair */
447 static void find_quirks(void)
450 dmi_check_system(acer_quirks
);
451 } else if (force_series
== 2490) {
452 quirks
= &quirk_acer_travelmate_2490
;
456 quirks
= &quirk_unknown
;
462 * General interface convenience methods
465 static bool has_cap(u32 cap
)
467 if ((interface
->capability
& cap
) != 0)
474 * AMW0 (V1) interface
491 static acpi_status
wmab_execute(struct wmab_args
*regbuf
,
492 struct acpi_buffer
*result
)
494 struct acpi_buffer input
;
496 input
.length
= sizeof(struct wmab_args
);
497 input
.pointer
= (u8
*)regbuf
;
499 status
= wmi_evaluate_method(AMW0_GUID1
, 1, 1, &input
, result
);
504 static acpi_status
AMW0_get_u32(u32
*value
, u32 cap
,
505 struct wmi_interface
*iface
)
511 case ACER_CAP_MAILLED
:
512 switch (quirks
->mailled
) {
514 err
= ec_read(0xA, &result
);
517 *value
= (result
>> 7) & 0x1;
521 case ACER_CAP_WIRELESS
:
522 switch (quirks
->wireless
) {
524 err
= ec_read(0x7B, &result
);
527 *value
= result
& 0x1;
530 err
= ec_read(0x71, &result
);
533 *value
= result
& 0x1;
536 err
= ec_read(0xA, &result
);
539 *value
= (result
>> 2) & 0x1;
543 case ACER_CAP_BLUETOOTH
:
544 switch (quirks
->bluetooth
) {
546 err
= ec_read(0xA, &result
);
549 *value
= (result
>> 4) & 0x1;
553 case ACER_CAP_BRIGHTNESS
:
554 switch (quirks
->brightness
) {
556 err
= ec_read(0x83, &result
);
569 static acpi_status
AMW0_set_u32(u32 value
, u32 cap
, struct wmi_interface
*iface
)
571 struct wmab_args args
;
573 args
.eax
= ACER_AMW0_WRITE
;
574 args
.ebx
= value
? (1<<8) : 0;
575 args
.ecx
= args
.edx
= 0;
578 case ACER_CAP_MAILLED
:
580 return AE_BAD_PARAMETER
;
581 args
.ebx
|= ACER_AMW0_MAILLED_MASK
;
583 case ACER_CAP_WIRELESS
:
585 return AE_BAD_PARAMETER
;
586 args
.ebx
|= ACER_AMW0_WIRELESS_MASK
;
588 case ACER_CAP_BLUETOOTH
:
590 return AE_BAD_PARAMETER
;
591 args
.ebx
|= ACER_AMW0_BLUETOOTH_MASK
;
593 case ACER_CAP_BRIGHTNESS
:
594 if (value
> max_brightness
)
595 return AE_BAD_PARAMETER
;
596 switch (quirks
->brightness
) {
598 return ec_write(0x83, value
);
605 /* Actually do the set */
606 return wmab_execute(&args
, NULL
);
609 static acpi_status
AMW0_find_mailled(void)
611 struct wmab_args args
;
613 acpi_status status
= AE_OK
;
614 struct acpi_buffer out
= { ACPI_ALLOCATE_BUFFER
, NULL
};
615 union acpi_object
*obj
;
618 args
.ebx
= args
.ecx
= args
.edx
= 0;
620 status
= wmab_execute(&args
, &out
);
621 if (ACPI_FAILURE(status
))
624 obj
= (union acpi_object
*) out
.pointer
;
625 if (obj
&& obj
->type
== ACPI_TYPE_BUFFER
&&
626 obj
->buffer
.length
== sizeof(struct wmab_ret
)) {
627 ret
= *((struct wmab_ret
*) obj
->buffer
.pointer
);
634 interface
->capability
|= ACER_CAP_MAILLED
;
641 static acpi_status
AMW0_set_capabilities(void)
643 struct wmab_args args
;
646 struct acpi_buffer out
= { ACPI_ALLOCATE_BUFFER
, NULL
};
647 union acpi_object
*obj
;
650 * On laptops with this strange GUID (non Acer), normal probing doesn't
653 if (wmi_has_guid(AMW0_GUID2
)) {
654 interface
->capability
|= ACER_CAP_WIRELESS
;
658 args
.eax
= ACER_AMW0_WRITE
;
659 args
.ecx
= args
.edx
= 0;
661 args
.ebx
= 0xa2 << 8;
662 args
.ebx
|= ACER_AMW0_WIRELESS_MASK
;
664 status
= wmab_execute(&args
, &out
);
665 if (ACPI_FAILURE(status
))
669 if (obj
&& obj
->type
== ACPI_TYPE_BUFFER
&&
670 obj
->buffer
.length
== sizeof(struct wmab_ret
)) {
671 ret
= *((struct wmab_ret
*) obj
->buffer
.pointer
);
678 interface
->capability
|= ACER_CAP_WIRELESS
;
681 args
.ebx
|= ACER_AMW0_BLUETOOTH_MASK
;
684 * It's ok to use existing buffer for next wmab_execute call.
685 * But we need to kfree(out.pointer) if next wmab_execute fail.
687 status
= wmab_execute(&args
, &out
);
688 if (ACPI_FAILURE(status
))
691 obj
= (union acpi_object
*) out
.pointer
;
692 if (obj
&& obj
->type
== ACPI_TYPE_BUFFER
693 && obj
->buffer
.length
== sizeof(struct wmab_ret
)) {
694 ret
= *((struct wmab_ret
*) obj
->buffer
.pointer
);
701 interface
->capability
|= ACER_CAP_BLUETOOTH
;
704 * This appears to be safe to enable, since all Wistron based laptops
705 * appear to use the same EC register for brightness, even if they
706 * differ for wireless, etc
708 if (quirks
->brightness
>= 0)
709 interface
->capability
|= ACER_CAP_BRIGHTNESS
;
717 static struct wmi_interface AMW0_interface
= {
721 static struct wmi_interface AMW0_V2_interface
= {
722 .type
= ACER_AMW0_V2
,
726 * New interface (The WMID interface)
729 WMI_execute_u32(u32 method_id
, u32 in
, u32
*out
)
731 struct acpi_buffer input
= { (acpi_size
) sizeof(u32
), (void *)(&in
) };
732 struct acpi_buffer result
= { ACPI_ALLOCATE_BUFFER
, NULL
};
733 union acpi_object
*obj
;
737 status
= wmi_evaluate_method(WMID_GUID1
, 1, method_id
, &input
, &result
);
739 if (ACPI_FAILURE(status
))
742 obj
= (union acpi_object
*) result
.pointer
;
743 if (obj
&& obj
->type
== ACPI_TYPE_BUFFER
&&
744 obj
->buffer
.length
== sizeof(u32
)) {
745 tmp
= *((u32
*) obj
->buffer
.pointer
);
753 kfree(result
.pointer
);
758 static acpi_status
WMID_get_u32(u32
*value
, u32 cap
,
759 struct wmi_interface
*iface
)
763 u32 result
, method_id
= 0;
766 case ACER_CAP_WIRELESS
:
767 method_id
= ACER_WMID_GET_WIRELESS_METHODID
;
769 case ACER_CAP_BLUETOOTH
:
770 method_id
= ACER_WMID_GET_BLUETOOTH_METHODID
;
772 case ACER_CAP_BRIGHTNESS
:
773 method_id
= ACER_WMID_GET_BRIGHTNESS_METHODID
;
775 case ACER_CAP_THREEG
:
776 method_id
= ACER_WMID_GET_THREEG_METHODID
;
778 case ACER_CAP_MAILLED
:
779 if (quirks
->mailled
== 1) {
787 status
= WMI_execute_u32(method_id
, 0, &result
);
789 if (ACPI_SUCCESS(status
))
795 static acpi_status
WMID_set_u32(u32 value
, u32 cap
, struct wmi_interface
*iface
)
801 case ACER_CAP_BRIGHTNESS
:
802 if (value
> max_brightness
)
803 return AE_BAD_PARAMETER
;
804 method_id
= ACER_WMID_SET_BRIGHTNESS_METHODID
;
806 case ACER_CAP_WIRELESS
:
808 return AE_BAD_PARAMETER
;
809 method_id
= ACER_WMID_SET_WIRELESS_METHODID
;
811 case ACER_CAP_BLUETOOTH
:
813 return AE_BAD_PARAMETER
;
814 method_id
= ACER_WMID_SET_BLUETOOTH_METHODID
;
816 case ACER_CAP_THREEG
:
818 return AE_BAD_PARAMETER
;
819 method_id
= ACER_WMID_SET_THREEG_METHODID
;
821 case ACER_CAP_MAILLED
:
823 return AE_BAD_PARAMETER
;
824 if (quirks
->mailled
== 1) {
825 param
= value
? 0x92 : 0x93;
827 i8042_command(¶m
, 0x1059);
835 return WMI_execute_u32(method_id
, (u32
)value
, NULL
);
838 static void type_aa_dmi_decode(const struct dmi_header
*header
, void *dummy
)
840 struct hotkey_function_type_aa
*type_aa
;
842 /* We are looking for OEM-specific Type AAh */
843 if (header
->type
!= 0xAA)
847 type_aa
= (struct hotkey_function_type_aa
*) header
;
849 printk(ACER_INFO
"Function bitmap for Communication Button: 0x%x\n",
850 type_aa
->commun_func_bitmap
);
852 if (type_aa
->commun_func_bitmap
& ACER_WMID3_GDS_WIRELESS
)
853 interface
->capability
|= ACER_CAP_WIRELESS
;
854 if (type_aa
->commun_func_bitmap
& ACER_WMID3_GDS_THREEG
)
855 interface
->capability
|= ACER_CAP_THREEG
;
856 if (type_aa
->commun_func_bitmap
& ACER_WMID3_GDS_BLUETOOTH
)
857 interface
->capability
|= ACER_CAP_BLUETOOTH
;
860 static acpi_status
WMID_set_capabilities(void)
862 struct acpi_buffer out
= {ACPI_ALLOCATE_BUFFER
, NULL
};
863 union acpi_object
*obj
;
867 status
= wmi_query_block(WMID_GUID2
, 1, &out
);
868 if (ACPI_FAILURE(status
))
871 obj
= (union acpi_object
*) out
.pointer
;
872 if (obj
&& obj
->type
== ACPI_TYPE_BUFFER
&&
873 obj
->buffer
.length
== sizeof(u32
)) {
874 devices
= *((u32
*) obj
->buffer
.pointer
);
880 dmi_walk(type_aa_dmi_decode
, NULL
);
882 interface
->capability
|= ACER_CAP_WIRELESS
;
883 interface
->capability
|= ACER_CAP_THREEG
;
885 interface
->capability
|= ACER_CAP_BLUETOOTH
;
888 /* WMID always provides brightness methods */
889 interface
->capability
|= ACER_CAP_BRIGHTNESS
;
891 if (!(devices
& 0x20))
892 max_brightness
= 0x9;
898 static struct wmi_interface wmid_interface
= {
903 * Generic Device (interface-independent)
906 static acpi_status
get_u32(u32
*value
, u32 cap
)
908 acpi_status status
= AE_ERROR
;
910 switch (interface
->type
) {
912 status
= AMW0_get_u32(value
, cap
, interface
);
915 if (cap
== ACER_CAP_MAILLED
) {
916 status
= AMW0_get_u32(value
, cap
, interface
);
920 status
= WMID_get_u32(value
, cap
, interface
);
927 static acpi_status
set_u32(u32 value
, u32 cap
)
931 if (interface
->capability
& cap
) {
932 switch (interface
->type
) {
934 return AMW0_set_u32(value
, cap
, interface
);
936 if (cap
== ACER_CAP_MAILLED
)
937 return AMW0_set_u32(value
, cap
, interface
);
940 * On some models, some WMID methods don't toggle
941 * properly. For those cases, we want to run the AMW0
942 * method afterwards to be certain we've really toggled
945 if (cap
== ACER_CAP_WIRELESS
||
946 cap
== ACER_CAP_BLUETOOTH
) {
947 status
= WMID_set_u32(value
, cap
, interface
);
948 if (ACPI_FAILURE(status
))
951 return AMW0_set_u32(value
, cap
, interface
);
954 return WMID_set_u32(value
, cap
, interface
);
956 return AE_BAD_PARAMETER
;
959 return AE_BAD_PARAMETER
;
962 static void __init
acer_commandline_init(void)
965 * These will all fail silently if the value given is invalid, or the
966 * capability isn't available on the given interface
968 set_u32(mailled
, ACER_CAP_MAILLED
);
970 set_u32(threeg
, ACER_CAP_THREEG
);
971 set_u32(brightness
, ACER_CAP_BRIGHTNESS
);
975 * LED device (Mail LED only, no other LEDs known yet)
977 static void mail_led_set(struct led_classdev
*led_cdev
,
978 enum led_brightness value
)
980 set_u32(value
, ACER_CAP_MAILLED
);
983 static struct led_classdev mail_led
= {
984 .name
= "acer-wmi::mail",
985 .brightness_set
= mail_led_set
,
988 static int __devinit
acer_led_init(struct device
*dev
)
990 return led_classdev_register(dev
, &mail_led
);
993 static void acer_led_exit(void)
995 led_classdev_unregister(&mail_led
);
1001 static struct backlight_device
*acer_backlight_device
;
1003 static int read_brightness(struct backlight_device
*bd
)
1006 get_u32(&value
, ACER_CAP_BRIGHTNESS
);
1010 static int update_bl_status(struct backlight_device
*bd
)
1012 int intensity
= bd
->props
.brightness
;
1014 if (bd
->props
.power
!= FB_BLANK_UNBLANK
)
1016 if (bd
->props
.fb_blank
!= FB_BLANK_UNBLANK
)
1019 set_u32(intensity
, ACER_CAP_BRIGHTNESS
);
1024 static const struct backlight_ops acer_bl_ops
= {
1025 .get_brightness
= read_brightness
,
1026 .update_status
= update_bl_status
,
1029 static int __devinit
acer_backlight_init(struct device
*dev
)
1031 struct backlight_properties props
;
1032 struct backlight_device
*bd
;
1034 memset(&props
, 0, sizeof(struct backlight_properties
));
1035 props
.max_brightness
= max_brightness
;
1036 bd
= backlight_device_register("acer-wmi", dev
, NULL
, &acer_bl_ops
,
1039 printk(ACER_ERR
"Could not register Acer backlight device\n");
1040 acer_backlight_device
= NULL
;
1044 acer_backlight_device
= bd
;
1046 bd
->props
.power
= FB_BLANK_UNBLANK
;
1047 bd
->props
.brightness
= read_brightness(bd
);
1048 backlight_update_status(bd
);
1052 static void acer_backlight_exit(void)
1054 backlight_device_unregister(acer_backlight_device
);
1057 static acpi_status
wmid3_get_device_status(u32
*value
, u16 device
)
1059 struct wmid3_gds_return_value return_value
;
1061 union acpi_object
*obj
;
1062 struct wmid3_gds_input_param params
= {
1063 .function_num
= 0x1,
1064 .hotkey_number
= 0x01,
1067 struct acpi_buffer input
= {
1068 sizeof(struct wmid3_gds_input_param
),
1071 struct acpi_buffer output
= { ACPI_ALLOCATE_BUFFER
, NULL
};
1073 status
= wmi_evaluate_method(WMID_GUID3
, 0, 0x2, &input
, &output
);
1074 if (ACPI_FAILURE(status
))
1077 obj
= output
.pointer
;
1081 else if (obj
->type
!= ACPI_TYPE_BUFFER
) {
1085 if (obj
->buffer
.length
!= 8) {
1086 printk(ACER_WARNING
"Unknown buffer length %d\n",
1087 obj
->buffer
.length
);
1092 return_value
= *((struct wmid3_gds_return_value
*)obj
->buffer
.pointer
);
1095 if (return_value
.error_code
|| return_value
.ec_return_value
)
1096 printk(ACER_WARNING
"Get Device Status failed: "
1097 "0x%x - 0x%x\n", return_value
.error_code
,
1098 return_value
.ec_return_value
);
1100 *value
= !!(return_value
.devices
& device
);
1105 static acpi_status
get_device_status(u32
*value
, u32 cap
)
1107 if (wmi_has_guid(WMID_GUID3
)) {
1111 case ACER_CAP_WIRELESS
:
1112 device
= ACER_WMID3_GDS_WIRELESS
;
1114 case ACER_CAP_BLUETOOTH
:
1115 device
= ACER_WMID3_GDS_BLUETOOTH
;
1117 case ACER_CAP_THREEG
:
1118 device
= ACER_WMID3_GDS_THREEG
;
1123 return wmid3_get_device_status(value
, device
);
1126 return get_u32(value
, cap
);
1133 static void acer_rfkill_update(struct work_struct
*ignored
);
1134 static DECLARE_DELAYED_WORK(acer_rfkill_work
, acer_rfkill_update
);
1135 static void acer_rfkill_update(struct work_struct
*ignored
)
1140 status
= get_u32(&state
, ACER_CAP_WIRELESS
);
1141 if (ACPI_SUCCESS(status
))
1142 rfkill_set_sw_state(wireless_rfkill
, !state
);
1144 if (has_cap(ACER_CAP_BLUETOOTH
)) {
1145 status
= get_u32(&state
, ACER_CAP_BLUETOOTH
);
1146 if (ACPI_SUCCESS(status
))
1147 rfkill_set_sw_state(bluetooth_rfkill
, !state
);
1150 if (has_cap(ACER_CAP_THREEG
) && wmi_has_guid(WMID_GUID3
)) {
1151 status
= wmid3_get_device_status(&state
,
1152 ACER_WMID3_GDS_THREEG
);
1153 if (ACPI_SUCCESS(status
))
1154 rfkill_set_sw_state(threeg_rfkill
, !state
);
1157 schedule_delayed_work(&acer_rfkill_work
, round_jiffies_relative(HZ
));
1160 static int acer_rfkill_set(void *data
, bool blocked
)
1163 u32 cap
= (unsigned long)data
;
1164 status
= set_u32(!blocked
, cap
);
1165 if (ACPI_FAILURE(status
))
1170 static const struct rfkill_ops acer_rfkill_ops
= {
1171 .set_block
= acer_rfkill_set
,
1174 static struct rfkill
*acer_rfkill_register(struct device
*dev
,
1175 enum rfkill_type type
,
1176 char *name
, u32 cap
)
1179 struct rfkill
*rfkill_dev
;
1183 rfkill_dev
= rfkill_alloc(name
, dev
, type
,
1185 (void *)(unsigned long)cap
);
1187 return ERR_PTR(-ENOMEM
);
1189 status
= get_device_status(&state
, cap
);
1190 if (ACPI_SUCCESS(status
))
1191 rfkill_init_sw_state(rfkill_dev
, !state
);
1193 err
= rfkill_register(rfkill_dev
);
1195 rfkill_destroy(rfkill_dev
);
1196 return ERR_PTR(err
);
1201 static int acer_rfkill_init(struct device
*dev
)
1203 wireless_rfkill
= acer_rfkill_register(dev
, RFKILL_TYPE_WLAN
,
1204 "acer-wireless", ACER_CAP_WIRELESS
);
1205 if (IS_ERR(wireless_rfkill
))
1206 return PTR_ERR(wireless_rfkill
);
1208 if (has_cap(ACER_CAP_BLUETOOTH
)) {
1209 bluetooth_rfkill
= acer_rfkill_register(dev
,
1210 RFKILL_TYPE_BLUETOOTH
, "acer-bluetooth",
1211 ACER_CAP_BLUETOOTH
);
1212 if (IS_ERR(bluetooth_rfkill
)) {
1213 rfkill_unregister(wireless_rfkill
);
1214 rfkill_destroy(wireless_rfkill
);
1215 return PTR_ERR(bluetooth_rfkill
);
1219 if (has_cap(ACER_CAP_THREEG
)) {
1220 threeg_rfkill
= acer_rfkill_register(dev
,
1221 RFKILL_TYPE_WWAN
, "acer-threeg",
1223 if (IS_ERR(threeg_rfkill
)) {
1224 rfkill_unregister(wireless_rfkill
);
1225 rfkill_destroy(wireless_rfkill
);
1226 rfkill_unregister(bluetooth_rfkill
);
1227 rfkill_destroy(bluetooth_rfkill
);
1228 return PTR_ERR(threeg_rfkill
);
1232 schedule_delayed_work(&acer_rfkill_work
, round_jiffies_relative(HZ
));
1237 static void acer_rfkill_exit(void)
1239 cancel_delayed_work_sync(&acer_rfkill_work
);
1241 rfkill_unregister(wireless_rfkill
);
1242 rfkill_destroy(wireless_rfkill
);
1244 if (has_cap(ACER_CAP_BLUETOOTH
)) {
1245 rfkill_unregister(bluetooth_rfkill
);
1246 rfkill_destroy(bluetooth_rfkill
);
1249 if (has_cap(ACER_CAP_THREEG
)) {
1250 rfkill_unregister(threeg_rfkill
);
1251 rfkill_destroy(threeg_rfkill
);
1259 static ssize_t
show_bool_threeg(struct device
*dev
,
1260 struct device_attribute
*attr
, char *buf
)
1264 if (wmi_has_guid(WMID_GUID3
))
1265 status
= wmid3_get_device_status(&result
,
1266 ACER_WMID3_GDS_THREEG
);
1268 status
= get_u32(&result
, ACER_CAP_THREEG
);
1269 if (ACPI_SUCCESS(status
))
1270 return sprintf(buf
, "%u\n", result
);
1271 return sprintf(buf
, "Read error\n");
1274 static ssize_t
set_bool_threeg(struct device
*dev
,
1275 struct device_attribute
*attr
, const char *buf
, size_t count
)
1277 u32 tmp
= simple_strtoul(buf
, NULL
, 10);
1278 acpi_status status
= set_u32(tmp
, ACER_CAP_THREEG
);
1279 if (ACPI_FAILURE(status
))
1283 static DEVICE_ATTR(threeg
, S_IRUGO
| S_IWUSR
, show_bool_threeg
,
1286 static ssize_t
show_interface(struct device
*dev
, struct device_attribute
*attr
,
1289 switch (interface
->type
) {
1291 return sprintf(buf
, "AMW0\n");
1293 return sprintf(buf
, "AMW0 v2\n");
1295 return sprintf(buf
, "WMID\n");
1297 return sprintf(buf
, "Error!\n");
1301 static DEVICE_ATTR(interface
, S_IRUGO
, show_interface
, NULL
);
1303 static void acer_wmi_notify(u32 value
, void *context
)
1305 struct acpi_buffer response
= { ACPI_ALLOCATE_BUFFER
, NULL
};
1306 union acpi_object
*obj
;
1307 struct event_return_value return_value
;
1310 status
= wmi_get_event_data(value
, &response
);
1311 if (status
!= AE_OK
) {
1312 printk(ACER_WARNING
"bad event status 0x%x\n", status
);
1316 obj
= (union acpi_object
*)response
.pointer
;
1320 if (obj
->type
!= ACPI_TYPE_BUFFER
) {
1321 printk(ACER_WARNING
"Unknown response received %d\n",
1326 if (obj
->buffer
.length
!= 8) {
1327 printk(ACER_WARNING
"Unknown buffer length %d\n",
1328 obj
->buffer
.length
);
1333 return_value
= *((struct event_return_value
*)obj
->buffer
.pointer
);
1336 switch (return_value
.function
) {
1337 case WMID_HOTKEY_EVENT
:
1338 if (!sparse_keymap_report_event(acer_wmi_input_dev
,
1339 return_value
.key_num
, 1, true))
1340 printk(ACER_WARNING
"Unknown key number - 0x%x\n",
1341 return_value
.key_num
);
1344 printk(ACER_WARNING
"Unknown function number - %d - %d\n",
1345 return_value
.function
, return_value
.key_num
);
1351 wmid3_set_lm_mode(struct lm_input_params
*params
,
1352 struct lm_return_value
*return_value
)
1355 union acpi_object
*obj
;
1357 struct acpi_buffer input
= { sizeof(struct lm_input_params
), params
};
1358 struct acpi_buffer output
= { ACPI_ALLOCATE_BUFFER
, NULL
};
1360 status
= wmi_evaluate_method(WMID_GUID3
, 0, 0x1, &input
, &output
);
1361 if (ACPI_FAILURE(status
))
1364 obj
= output
.pointer
;
1368 else if (obj
->type
!= ACPI_TYPE_BUFFER
) {
1372 if (obj
->buffer
.length
!= 4) {
1373 printk(ACER_WARNING
"Unknown buffer length %d\n",
1374 obj
->buffer
.length
);
1379 *return_value
= *((struct lm_return_value
*)obj
->buffer
.pointer
);
1385 static int acer_wmi_enable_ec_raw(void)
1387 struct lm_return_value return_value
;
1389 struct lm_input_params params
= {
1390 .function_num
= 0x1,
1391 .commun_devices
= 0xFFFF,
1393 .lm_status
= 0x00, /* Launch Manager Deactive */
1396 status
= wmid3_set_lm_mode(¶ms
, &return_value
);
1398 if (return_value
.error_code
|| return_value
.ec_return_value
)
1399 printk(ACER_WARNING
"Enabling EC raw mode failed: "
1400 "0x%x - 0x%x\n", return_value
.error_code
,
1401 return_value
.ec_return_value
);
1403 printk(ACER_INFO
"Enabled EC raw mode");
1408 static int acer_wmi_enable_lm(void)
1410 struct lm_return_value return_value
;
1412 struct lm_input_params params
= {
1413 .function_num
= 0x1,
1414 .commun_devices
= 0xFFFF,
1416 .lm_status
= 0x01, /* Launch Manager Active */
1419 status
= wmid3_set_lm_mode(¶ms
, &return_value
);
1421 if (return_value
.error_code
|| return_value
.ec_return_value
)
1422 printk(ACER_WARNING
"Enabling Launch Manager failed: "
1423 "0x%x - 0x%x\n", return_value
.error_code
,
1424 return_value
.ec_return_value
);
1429 static int __init
acer_wmi_input_setup(void)
1434 acer_wmi_input_dev
= input_allocate_device();
1435 if (!acer_wmi_input_dev
)
1438 acer_wmi_input_dev
->name
= "Acer WMI hotkeys";
1439 acer_wmi_input_dev
->phys
= "wmi/input0";
1440 acer_wmi_input_dev
->id
.bustype
= BUS_HOST
;
1442 err
= sparse_keymap_setup(acer_wmi_input_dev
, acer_wmi_keymap
, NULL
);
1446 status
= wmi_install_notify_handler(ACERWMID_EVENT_GUID
,
1447 acer_wmi_notify
, NULL
);
1448 if (ACPI_FAILURE(status
)) {
1450 goto err_free_keymap
;
1453 err
= input_register_device(acer_wmi_input_dev
);
1455 goto err_uninstall_notifier
;
1459 err_uninstall_notifier
:
1460 wmi_remove_notify_handler(ACERWMID_EVENT_GUID
);
1462 sparse_keymap_free(acer_wmi_input_dev
);
1464 input_free_device(acer_wmi_input_dev
);
1468 static void acer_wmi_input_destroy(void)
1470 wmi_remove_notify_handler(ACERWMID_EVENT_GUID
);
1471 sparse_keymap_free(acer_wmi_input_dev
);
1472 input_unregister_device(acer_wmi_input_dev
);
1478 static u32
get_wmid_devices(void)
1480 struct acpi_buffer out
= {ACPI_ALLOCATE_BUFFER
, NULL
};
1481 union acpi_object
*obj
;
1485 status
= wmi_query_block(WMID_GUID2
, 1, &out
);
1486 if (ACPI_FAILURE(status
))
1489 obj
= (union acpi_object
*) out
.pointer
;
1490 if (obj
&& obj
->type
== ACPI_TYPE_BUFFER
&&
1491 obj
->buffer
.length
== sizeof(u32
)) {
1492 devices
= *((u32
*) obj
->buffer
.pointer
);
1502 static int __devinit
acer_platform_probe(struct platform_device
*device
)
1506 if (has_cap(ACER_CAP_MAILLED
)) {
1507 err
= acer_led_init(&device
->dev
);
1512 if (has_cap(ACER_CAP_BRIGHTNESS
)) {
1513 err
= acer_backlight_init(&device
->dev
);
1515 goto error_brightness
;
1518 err
= acer_rfkill_init(&device
->dev
);
1525 if (has_cap(ACER_CAP_BRIGHTNESS
))
1526 acer_backlight_exit();
1528 if (has_cap(ACER_CAP_MAILLED
))
1534 static int acer_platform_remove(struct platform_device
*device
)
1536 if (has_cap(ACER_CAP_MAILLED
))
1538 if (has_cap(ACER_CAP_BRIGHTNESS
))
1539 acer_backlight_exit();
1545 static int acer_platform_suspend(struct platform_device
*dev
,
1549 struct acer_data
*data
= &interface
->data
;
1554 if (has_cap(ACER_CAP_MAILLED
)) {
1555 get_u32(&value
, ACER_CAP_MAILLED
);
1556 data
->mailled
= value
;
1559 if (has_cap(ACER_CAP_BRIGHTNESS
)) {
1560 get_u32(&value
, ACER_CAP_BRIGHTNESS
);
1561 data
->brightness
= value
;
1567 static int acer_platform_resume(struct platform_device
*device
)
1569 struct acer_data
*data
= &interface
->data
;
1574 if (has_cap(ACER_CAP_MAILLED
))
1575 set_u32(data
->mailled
, ACER_CAP_MAILLED
);
1577 if (has_cap(ACER_CAP_BRIGHTNESS
))
1578 set_u32(data
->brightness
, ACER_CAP_BRIGHTNESS
);
1583 static struct platform_driver acer_platform_driver
= {
1586 .owner
= THIS_MODULE
,
1588 .probe
= acer_platform_probe
,
1589 .remove
= acer_platform_remove
,
1590 .suspend
= acer_platform_suspend
,
1591 .resume
= acer_platform_resume
,
1594 static struct platform_device
*acer_platform_device
;
1596 static int remove_sysfs(struct platform_device
*device
)
1598 if (has_cap(ACER_CAP_THREEG
))
1599 device_remove_file(&device
->dev
, &dev_attr_threeg
);
1601 device_remove_file(&device
->dev
, &dev_attr_interface
);
1606 static int create_sysfs(void)
1608 int retval
= -ENOMEM
;
1610 if (has_cap(ACER_CAP_THREEG
)) {
1611 retval
= device_create_file(&acer_platform_device
->dev
,
1617 retval
= device_create_file(&acer_platform_device
->dev
,
1618 &dev_attr_interface
);
1625 remove_sysfs(acer_platform_device
);
1629 static void remove_debugfs(void)
1631 debugfs_remove(interface
->debug
.devices
);
1632 debugfs_remove(interface
->debug
.root
);
1635 static int create_debugfs(void)
1637 interface
->debug
.root
= debugfs_create_dir("acer-wmi", NULL
);
1638 if (!interface
->debug
.root
) {
1639 printk(ACER_ERR
"Failed to create debugfs directory");
1643 interface
->debug
.devices
= debugfs_create_u32("devices", S_IRUGO
,
1644 interface
->debug
.root
,
1645 &interface
->debug
.wmid_devices
);
1646 if (!interface
->debug
.devices
)
1656 static int __init
acer_wmi_init(void)
1660 printk(ACER_INFO
"Acer Laptop ACPI-WMI Extras\n");
1662 if (dmi_check_system(acer_blacklist
)) {
1663 printk(ACER_INFO
"Blacklisted hardware detected - "
1671 * Detect which ACPI-WMI interface we're using.
1673 if (wmi_has_guid(AMW0_GUID1
) && wmi_has_guid(WMID_GUID1
))
1674 interface
= &AMW0_V2_interface
;
1676 if (!wmi_has_guid(AMW0_GUID1
) && wmi_has_guid(WMID_GUID1
))
1677 interface
= &wmid_interface
;
1679 if (wmi_has_guid(WMID_GUID2
) && interface
) {
1680 if (ACPI_FAILURE(WMID_set_capabilities())) {
1681 printk(ACER_ERR
"Unable to detect available WMID "
1685 } else if (!wmi_has_guid(WMID_GUID2
) && interface
) {
1686 printk(ACER_ERR
"No WMID device detection method found\n");
1690 if (wmi_has_guid(AMW0_GUID1
) && !wmi_has_guid(WMID_GUID1
)) {
1691 interface
= &AMW0_interface
;
1693 if (ACPI_FAILURE(AMW0_set_capabilities())) {
1694 printk(ACER_ERR
"Unable to detect available AMW0 "
1700 if (wmi_has_guid(AMW0_GUID1
))
1701 AMW0_find_mailled();
1704 printk(ACER_INFO
"No or unsupported WMI interface, unable to "
1711 if (acpi_video_backlight_support() && has_cap(ACER_CAP_BRIGHTNESS
)) {
1712 interface
->capability
&= ~ACER_CAP_BRIGHTNESS
;
1713 printk(ACER_INFO
"Brightness must be controlled by "
1714 "generic video driver\n");
1717 if (wmi_has_guid(WMID_GUID3
)) {
1719 if (ACPI_FAILURE(acer_wmi_enable_ec_raw())) {
1720 printk(ACER_ERR
"Cannot enable EC raw mode\n");
1723 } else if (ACPI_FAILURE(acer_wmi_enable_lm())) {
1724 printk(ACER_ERR
"Cannot enable Launch Manager mode\n");
1727 } else if (ec_raw_mode
) {
1728 printk(ACER_INFO
"No WMID EC raw mode enable method\n");
1731 if (wmi_has_guid(ACERWMID_EVENT_GUID
)) {
1732 err
= acer_wmi_input_setup();
1737 err
= platform_driver_register(&acer_platform_driver
);
1739 printk(ACER_ERR
"Unable to register platform driver.\n");
1740 goto error_platform_register
;
1743 acer_platform_device
= platform_device_alloc("acer-wmi", -1);
1744 if (!acer_platform_device
) {
1746 goto error_device_alloc
;
1749 err
= platform_device_add(acer_platform_device
);
1751 goto error_device_add
;
1753 err
= create_sysfs();
1755 goto error_create_sys
;
1757 if (wmi_has_guid(WMID_GUID2
)) {
1758 interface
->debug
.wmid_devices
= get_wmid_devices();
1759 err
= create_debugfs();
1761 goto error_create_debugfs
;
1764 /* Override any initial settings with values from the commandline */
1765 acer_commandline_init();
1769 error_create_debugfs
:
1770 remove_sysfs(acer_platform_device
);
1772 platform_device_del(acer_platform_device
);
1774 platform_device_put(acer_platform_device
);
1776 platform_driver_unregister(&acer_platform_driver
);
1777 error_platform_register
:
1778 if (wmi_has_guid(ACERWMID_EVENT_GUID
))
1779 acer_wmi_input_destroy();
1784 static void __exit
acer_wmi_exit(void)
1786 if (wmi_has_guid(ACERWMID_EVENT_GUID
))
1787 acer_wmi_input_destroy();
1789 remove_sysfs(acer_platform_device
);
1791 platform_device_unregister(acer_platform_device
);
1792 platform_driver_unregister(&acer_platform_driver
);
1794 printk(ACER_INFO
"Acer Laptop WMI Extras unloaded\n");
1798 module_init(acer_wmi_init
);
1799 module_exit(acer_wmi_exit
);