Commit e12e6d94db24e9050821965aa75c95e8d2c65f10

Authored by Corentin Chary
Committed by Matthew Garrett
1 parent 5b799d4fb7

eeepc-wmi: asus generic asus-wmi.ko module

New Asus notebooks are using a WMI device similar to
the one used in Eee PCs. Since we don't want to load
eeepc-wmi module on Asus notebooks, and we want to
keep the eeepc-wmi module for backward compatibility,
this patch introduce a new module, named asus-wmi, that
will be used by eeepc-wmi and the new Asus Notebook WMI
Driver.

eeepc-wmi's input device strings (device name and phys)
are kept, but rfkill and led names are changed (s/eeepc/asus/).
This should not break anything since rfkill are used by type or
index, not by name, and the eeepc::touchpad led wasn't working
correctly before 2.6.39 anyway.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>

Showing 7 changed files with 708 additions and 525 deletions Side-by-side Diff

Documentation/ABI/testing/sysfs-platform-asus-wmi
  1 +What: /sys/devices/platform/<platform>/cpufv
  2 +Date: Oct 2010
  3 +KernelVersion: 2.6.37
  4 +Contact: "Corentin Chary" <corentincj@iksaif.net>
  5 +Description:
  6 + Change CPU clock configuration (write-only).
  7 + There are three available clock configuration:
  8 + * 0 -> Super Performance Mode
  9 + * 1 -> High Performance Mode
  10 + * 2 -> Power Saving Mode
  11 +
  12 +What: /sys/devices/platform/<platform>/camera
  13 +Date: Jan 2010
  14 +KernelVersion: 2.6.39
  15 +Contact: "Corentin Chary" <corentincj@iksaif.net>
  16 +Description:
  17 + Control the camera. 1 means on, 0 means off.
  18 +
  19 +What: /sys/devices/platform/<platform>/cardr
  20 +Date: Jan 2010
  21 +KernelVersion: 2.6.39
  22 +Contact: "Corentin Chary" <corentincj@iksaif.net>
  23 +Description:
  24 + Control the card reader. 1 means on, 0 means off.
  25 +
  26 +What: /sys/devices/platform/<platform>/touchpad
  27 +Date: Jan 2010
  28 +KernelVersion: 2.6.39
  29 +Contact: "Corentin Chary" <corentincj@iksaif.net>
  30 +Description:
  31 + Control the card touchpad. 1 means on, 0 means off.
Documentation/ABI/testing/sysfs-platform-eeepc-wmi
1   -What: /sys/devices/platform/eeepc-wmi/cpufv
2   -Date: Oct 2010
3   -KernelVersion: 2.6.37
4   -Contact: "Corentin Chary" <corentincj@iksaif.net>
5   -Description:
6   - Change CPU clock configuration (write-only).
7   - There are three available clock configuration:
8   - * 0 -> Super Performance Mode
9   - * 1 -> High Performance Mode
10   - * 2 -> Power Saving Mode
11   -
12   -What: /sys/devices/platform/eeepc-wmi/camera
13   -Date: Jan 2010
14   -KernelVersion: 2.6.39
15   -Contact: "Corentin Chary" <corentincj@iksaif.net>
16   -Description:
17   - Control the camera. 1 means on, 0 means off.
18   -
19   -What: /sys/devices/platform/eeepc-wmi/cardr
20   -Date: Jan 2010
21   -KernelVersion: 2.6.39
22   -Contact: "Corentin Chary" <corentincj@iksaif.net>
23   -Description:
24   - Control the card reader. 1 means on, 0 means off.
25   -
26   -What: /sys/devices/platform/eeepc-wmi/touchpad
27   -Date: Jan 2010
28   -KernelVersion: 2.6.39
29   -Contact: "Corentin Chary" <corentincj@iksaif.net>
30   -Description:
31   - Control the card touchpad. 1 means on, 0 means off.
drivers/platform/x86/Kconfig
... ... @@ -451,10 +451,11 @@
451 451 Bluetooth, backlight and allows powering on/off some other
452 452 devices.
453 453  
454   - If you have an Eee PC laptop, say Y or M here.
  454 + If you have an Eee PC laptop, say Y or M here. If this driver
  455 + doesn't work on your Eee PC, try eeepc-wmi instead.
455 456  
456   -config EEEPC_WMI
457   - tristate "Eee PC WMI Hotkey Driver (EXPERIMENTAL)"
  457 +config ASUS_WMI
  458 + tristate "ASUS WMI Driver (EXPERIMENTAL)"
458 459 depends on ACPI_WMI
459 460 depends on INPUT
460 461 depends on EXPERIMENTAL
461 462  
... ... @@ -464,10 +465,23 @@
464 465 select LEDS_CLASS
465 466 select NEW_LEDS
466 467 ---help---
467   - Say Y here if you want to support WMI-based hotkeys on Eee PC laptops.
  468 + Say Y here if you have a WMI aware Asus laptop (like Eee PCs).
468 469  
469 470 To compile this driver as a module, choose M here: the module will
470   - be called eeepc-wmi.
  471 + be called asus-wmi.
  472 +
  473 +config EEEPC_WMI
  474 + tristate "Eee PC WMI Driver (EXPERIMENTAL)"
  475 + depends on ASUS_WMI
  476 + ---help---
  477 + This is a driver for newer Eee PC laptops. It adds extra features
  478 + like wireless radio and bluetooth control, leds, hotkeys, backlight...
  479 +
  480 + For more informations, see
  481 + <file:Documentation/ABI/testing/sysfs-platform-asus-wmi>
  482 +
  483 + If you have an ACPI-WMI compatible Eee PC laptop (>= 1000), say Y or M
  484 + here.
471 485  
472 486 config ACPI_WMI
473 487 tristate "WMI"
drivers/platform/x86/Makefile
... ... @@ -3,8 +3,9 @@
3 3 # x86 Platform-Specific Drivers
4 4 #
5 5 obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o
  6 +obj-$(CONFIG_ASUS_WMI) += asus-wmi.o
6 7 obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o
7   -obj-$(CONFIG_EEEPC_WMI) += asus-wmi.o eeepc-wmi.o
  8 +obj-$(CONFIG_EEEPC_WMI) += eeepc-wmi.o
8 9 obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o
9 10 obj-$(CONFIG_ACPI_CMPC) += classmate-laptop.o
10 11 obj-$(CONFIG_COMPAL_LAPTOP) += compal-laptop.o
drivers/platform/x86/asus-wmi.c
Changes suppressed. Click to show
1 1 /*
2   - * Eee PC WMI hotkey driver
  2 + * Asus PC WMI hotkey driver
3 3 *
4 4 * Copyright(C) 2010 Intel Corporation.
5 5 * Copyright(C) 2010 Corentin Chary <corentin.chary@gmail.com>
6 6  
7 7  
8 8  
9 9  
10 10  
... ... @@ -42,23 +42,23 @@
42 42 #include <linux/debugfs.h>
43 43 #include <linux/seq_file.h>
44 44 #include <linux/platform_device.h>
45   -#include <linux/dmi.h>
46 45 #include <acpi/acpi_bus.h>
47 46 #include <acpi/acpi_drivers.h>
48 47  
49   -#define EEEPC_WMI_FILE "eeepc-wmi"
  48 +#include "asus-wmi.h"
50 49  
51   -MODULE_AUTHOR("Yong Wang <yong.y.wang@intel.com>");
52   -MODULE_DESCRIPTION("Eee PC WMI Hotkey Driver");
  50 +MODULE_AUTHOR("Corentin Chary <corentincj@iksaif.net>, "
  51 + "Yong Wang <yong.y.wang@intel.com>");
  52 +MODULE_DESCRIPTION("Asus Generic WMI Driver");
53 53 MODULE_LICENSE("GPL");
54 54  
55   -#define EEEPC_ACPI_HID "ASUS010" /* old _HID used in eeepc-laptop */
  55 +#define to_platform_driver(drv) \
  56 + (container_of((drv), struct platform_driver, driver))
56 57  
57   -#define EEEPC_WMI_EVENT_GUID "ABBC0F72-8EA1-11D1-00A0-C90629100000"
58   -#define EEEPC_WMI_MGMT_GUID "97845ED0-4E6D-11DE-8A39-0800200C9A66"
  58 +#define to_asus_wmi_driver(pdrv) \
  59 + (container_of((pdrv), struct asus_wmi_driver, platform_driver))
59 60  
60   -MODULE_ALIAS("wmi:"EEEPC_WMI_EVENT_GUID);
61   -MODULE_ALIAS("wmi:"EEEPC_WMI_MGMT_GUID);
  61 +#define ASUS_WMI_MGMT_GUID "97845ED0-4E6D-11DE-8A39-0800200C9A66"
62 62  
63 63 #define NOTIFY_BRNUP_MIN 0x11
64 64 #define NOTIFY_BRNUP_MAX 0x1f
65 65  
66 66  
67 67  
68 68  
69 69  
70 70  
71 71  
72 72  
73 73  
74 74  
75 75  
... ... @@ -66,90 +66,55 @@
66 66 #define NOTIFY_BRNDOWN_MAX 0x2e
67 67  
68 68 /* WMI Methods */
69   -#define EEEPC_WMI_METHODID_DSTS 0x53544344
70   -#define EEEPC_WMI_METHODID_DEVS 0x53564544
71   -#define EEEPC_WMI_METHODID_CFVS 0x53564643
  69 +#define ASUS_WMI_METHODID_DSTS 0x53544344
  70 +#define ASUS_WMI_METHODID_DEVS 0x53564544
  71 +#define ASUS_WMI_METHODID_CFVS 0x53564643
72 72  
73 73 /* Wireless */
74   -#define EEEPC_WMI_DEVID_WLAN 0x00010011
75   -#define EEEPC_WMI_DEVID_BLUETOOTH 0x00010013
76   -#define EEEPC_WMI_DEVID_WIMAX 0x00010017
77   -#define EEEPC_WMI_DEVID_WWAN3G 0x00010019
  74 +#define ASUS_WMI_DEVID_WLAN 0x00010011
  75 +#define ASUS_WMI_DEVID_BLUETOOTH 0x00010013
  76 +#define ASUS_WMI_DEVID_WIMAX 0x00010017
  77 +#define ASUS_WMI_DEVID_WWAN3G 0x00010019
78 78  
79 79 /* Backlight and Brightness */
80   -#define EEEPC_WMI_DEVID_BACKLIGHT 0x00050011
81   -#define EEEPC_WMI_DEVID_BRIGHTNESS 0x00050012
  80 +#define ASUS_WMI_DEVID_BACKLIGHT 0x00050011
  81 +#define ASUS_WMI_DEVID_BRIGHTNESS 0x00050012
82 82  
83 83 /* Misc */
84   -#define EEEPC_WMI_DEVID_CAMERA 0x00060013
  84 +#define ASUS_WMI_DEVID_CAMERA 0x00060013
85 85  
86 86 /* Storage */
87   -#define EEEPC_WMI_DEVID_CARDREADER 0x00080013
  87 +#define ASUS_WMI_DEVID_CARDREADER 0x00080013
88 88  
89 89 /* Input */
90   -#define EEEPC_WMI_DEVID_TOUCHPAD 0x00100011
91   -#define EEEPC_WMI_DEVID_TOUCHPAD_LED 0x00100012
  90 +#define ASUS_WMI_DEVID_TOUCHPAD 0x00100011
  91 +#define ASUS_WMI_DEVID_TOUCHPAD_LED 0x00100012
92 92  
93 93 /* DSTS masks */
94   -#define EEEPC_WMI_DSTS_STATUS_BIT 0x00000001
95   -#define EEEPC_WMI_DSTS_PRESENCE_BIT 0x00010000
96   -#define EEEPC_WMI_DSTS_BRIGHTNESS_MASK 0x000000FF
97   -#define EEEPC_WMI_DSTS_MAX_BRIGTH_MASK 0x0000FF00
  94 +#define ASUS_WMI_DSTS_STATUS_BIT 0x00000001
  95 +#define ASUS_WMI_DSTS_PRESENCE_BIT 0x00010000
  96 +#define ASUS_WMI_DSTS_BRIGHTNESS_MASK 0x000000FF
  97 +#define ASUS_WMI_DSTS_MAX_BRIGTH_MASK 0x0000FF00
98 98  
99   -static bool hotplug_wireless;
100   -
101   -module_param(hotplug_wireless, bool, 0444);
102   -MODULE_PARM_DESC(hotplug_wireless,
103   - "Enable hotplug for wireless device. "
104   - "If your laptop needs that, please report to "
105   - "acpi4asus-user@lists.sourceforge.net.");
106   -
107   -static const struct key_entry eeepc_wmi_keymap[] = {
108   - /* Sleep already handled via generic ACPI code */
109   - { KE_IGNORE, NOTIFY_BRNDOWN_MIN, { KEY_BRIGHTNESSDOWN } },
110   - { KE_IGNORE, NOTIFY_BRNUP_MIN, { KEY_BRIGHTNESSUP } },
111   - { KE_KEY, 0x30, { KEY_VOLUMEUP } },
112   - { KE_KEY, 0x31, { KEY_VOLUMEDOWN } },
113   - { KE_KEY, 0x32, { KEY_MUTE } },
114   - { KE_KEY, 0x5c, { KEY_F15 } }, /* Power Gear key */
115   - { KE_KEY, 0x5d, { KEY_WLAN } },
116   - { KE_KEY, 0x6b, { KEY_F13 } }, /* Disable Touchpad */
117   - { KE_KEY, 0x82, { KEY_CAMERA } },
118   - { KE_KEY, 0x83, { KEY_CAMERA_ZOOMIN } },
119   - { KE_KEY, 0x88, { KEY_WLAN } },
120   - { KE_KEY, 0xcc, { KEY_SWITCHVIDEOMODE } },
121   - { KE_KEY, 0xe0, { KEY_PROG1 } }, /* Task Manager */
122   - { KE_KEY, 0xe1, { KEY_F14 } }, /* Change Resolution */
123   - { KE_KEY, 0xe9, { KEY_BRIGHTNESS_ZERO } },
124   - { KE_KEY, 0xeb, { KEY_CAMERA_ZOOMOUT } },
125   - { KE_KEY, 0xec, { KEY_CAMERA_UP } },
126   - { KE_KEY, 0xed, { KEY_CAMERA_DOWN } },
127   - { KE_KEY, 0xee, { KEY_CAMERA_LEFT } },
128   - { KE_KEY, 0xef, { KEY_CAMERA_RIGHT } },
129   - { KE_END, 0},
130   -};
131   -
132 99 struct bios_args {
133   - u32 dev_id;
134   - u32 ctrl_param;
  100 + u32 dev_id;
  101 + u32 ctrl_param;
135 102 };
136 103  
137 104 /*
138   - * eeepc-wmi/ - debugfs root directory
  105 + * <platform>/ - debugfs root directory
139 106 * dev_id - current dev_id
140 107 * ctrl_param - current ctrl_param
141 108 * devs - call DEVS(dev_id, ctrl_param) and print result
142 109 * dsts - call DSTS(dev_id) and print result
143 110 */
144   -struct eeepc_wmi_debug {
  111 +struct asus_wmi_debug {
145 112 struct dentry *root;
146 113 u32 dev_id;
147 114 u32 ctrl_param;
148 115 };
149 116  
150   -struct eeepc_wmi {
151   - bool hotplug_wireless;
152   -
  117 +struct asus_wmi {
153 118 struct input_dev *inputdev;
154 119 struct backlight_device *backlight_device;
155 120 struct platform_device *platform_device;
156 121  
157 122  
158 123  
159 124  
160 125  
161 126  
162 127  
163 128  
164 129  
165 130  
166 131  
167 132  
168 133  
... ... @@ -170,59 +135,61 @@
170 135 struct workqueue_struct *hotplug_workqueue;
171 136 struct work_struct hotplug_work;
172 137  
173   - struct eeepc_wmi_debug debug;
  138 + struct asus_wmi_debug debug;
  139 +
  140 + struct asus_wmi_driver *driver;
174 141 };
175 142  
176   -static int eeepc_wmi_input_init(struct eeepc_wmi *eeepc)
  143 +static int asus_wmi_input_init(struct asus_wmi *asus)
177 144 {
178 145 int err;
179 146  
180   - eeepc->inputdev = input_allocate_device();
181   - if (!eeepc->inputdev)
  147 + asus->inputdev = input_allocate_device();
  148 + if (!asus->inputdev)
182 149 return -ENOMEM;
183 150  
184   - eeepc->inputdev->name = "Eee PC WMI hotkeys";
185   - eeepc->inputdev->phys = EEEPC_WMI_FILE "/input0";
186   - eeepc->inputdev->id.bustype = BUS_HOST;
187   - eeepc->inputdev->dev.parent = &eeepc->platform_device->dev;
  151 + asus->inputdev->name = asus->driver->input_phys;
  152 + asus->inputdev->phys = asus->driver->input_name;
  153 + asus->inputdev->id.bustype = BUS_HOST;
  154 + asus->inputdev->dev.parent = &asus->platform_device->dev;
188 155  
189   - err = sparse_keymap_setup(eeepc->inputdev, eeepc_wmi_keymap, NULL);
  156 + err = sparse_keymap_setup(asus->inputdev, asus->driver->keymap, NULL);
190 157 if (err)
191 158 goto err_free_dev;
192 159  
193   - err = input_register_device(eeepc->inputdev);
  160 + err = input_register_device(asus->inputdev);
194 161 if (err)
195 162 goto err_free_keymap;
196 163  
197 164 return 0;
198 165  
199 166 err_free_keymap:
200   - sparse_keymap_free(eeepc->inputdev);
  167 + sparse_keymap_free(asus->inputdev);
201 168 err_free_dev:
202   - input_free_device(eeepc->inputdev);
  169 + input_free_device(asus->inputdev);
203 170 return err;
204 171 }
205 172  
206   -static void eeepc_wmi_input_exit(struct eeepc_wmi *eeepc)
  173 +static void asus_wmi_input_exit(struct asus_wmi *asus)
207 174 {
208   - if (eeepc->inputdev) {
209   - sparse_keymap_free(eeepc->inputdev);
210   - input_unregister_device(eeepc->inputdev);
  175 + if (asus->inputdev) {
  176 + sparse_keymap_free(asus->inputdev);
  177 + input_unregister_device(asus->inputdev);
211 178 }
212 179  
213   - eeepc->inputdev = NULL;
  180 + asus->inputdev = NULL;
214 181 }
215 182  
216   -static acpi_status eeepc_wmi_get_devstate(u32 dev_id, u32 *retval)
  183 +static acpi_status asus_wmi_get_devstate(u32 dev_id, u32 *retval)
217 184 {
218   - struct acpi_buffer input = { (acpi_size)sizeof(u32), &dev_id };
  185 + struct acpi_buffer input = { (acpi_size) sizeof(u32), &dev_id };
219 186 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
220 187 union acpi_object *obj;
221 188 acpi_status status;
222 189 u32 tmp;
223 190  
224   - status = wmi_evaluate_method(EEEPC_WMI_MGMT_GUID,
225   - 1, EEEPC_WMI_METHODID_DSTS,
  191 + status = wmi_evaluate_method(ASUS_WMI_MGMT_GUID,
  192 + 1, ASUS_WMI_METHODID_DSTS,
226 193 &input, &output);
227 194  
228 195 if (ACPI_FAILURE(status))
... ... @@ -230,7 +197,7 @@
230 197  
231 198 obj = (union acpi_object *)output.pointer;
232 199 if (obj && obj->type == ACPI_TYPE_INTEGER)
233   - tmp = (u32)obj->integer.value;
  200 + tmp = (u32) obj->integer.value;
234 201 else
235 202 tmp = 0;
236 203  
237 204  
238 205  
239 206  
... ... @@ -243,27 +210,27 @@
243 210  
244 211 }
245 212  
246   -static acpi_status eeepc_wmi_set_devstate(u32 dev_id, u32 ctrl_param,
247   - u32 *retval)
  213 +static acpi_status asus_wmi_set_devstate(u32 dev_id, u32 ctrl_param,
  214 + u32 *retval)
248 215 {
249 216 struct bios_args args = {
250 217 .dev_id = dev_id,
251 218 .ctrl_param = ctrl_param,
252 219 };
253   - struct acpi_buffer input = { (acpi_size)sizeof(args), &args };
  220 + struct acpi_buffer input = { (acpi_size) sizeof(args), &args };
254 221 acpi_status status;
255 222  
256 223 if (!retval) {
257   - status = wmi_evaluate_method(EEEPC_WMI_MGMT_GUID, 1,
258   - EEEPC_WMI_METHODID_DEVS,
  224 + status = wmi_evaluate_method(ASUS_WMI_MGMT_GUID, 1,
  225 + ASUS_WMI_METHODID_DEVS,
259 226 &input, NULL);
260 227 } else {
261 228 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
262 229 union acpi_object *obj;
263 230 u32 tmp;
264 231  
265   - status = wmi_evaluate_method(EEEPC_WMI_MGMT_GUID, 1,
266   - EEEPC_WMI_METHODID_DEVS,
  232 + status = wmi_evaluate_method(ASUS_WMI_MGMT_GUID, 1,
  233 + ASUS_WMI_METHODID_DEVS,
267 234 &input, &output);
268 235  
269 236 if (ACPI_FAILURE(status))
... ... @@ -271,7 +238,7 @@
271 238  
272 239 obj = (union acpi_object *)output.pointer;
273 240 if (obj && obj->type == ACPI_TYPE_INTEGER)
274   - tmp = (u32)obj->integer.value;
  241 + tmp = (u32) obj->integer.value;
275 242 else
276 243 tmp = 0;
277 244  
278 245  
279 246  
280 247  
281 248  
... ... @@ -284,25 +251,25 @@
284 251 }
285 252  
286 253 /* Helper for special devices with magic return codes */
287   -static int eeepc_wmi_get_devstate_bits(u32 dev_id, u32 mask)
  254 +static int asus_wmi_get_devstate_bits(u32 dev_id, u32 mask)
288 255 {
289 256 u32 retval = 0;
290 257 acpi_status status;
291 258  
292   - status = eeepc_wmi_get_devstate(dev_id, &retval);
  259 + status = asus_wmi_get_devstate(dev_id, &retval);
293 260  
294 261 if (ACPI_FAILURE(status))
295 262 return -EINVAL;
296 263  
297   - if (!(retval & EEEPC_WMI_DSTS_PRESENCE_BIT))
  264 + if (!(retval & ASUS_WMI_DSTS_PRESENCE_BIT))
298 265 return -ENODEV;
299 266  
300 267 return retval & mask;
301 268 }
302 269  
303   -static int eeepc_wmi_get_devstate_simple(u32 dev_id)
  270 +static int asus_wmi_get_devstate_simple(u32 dev_id)
304 271 {
305   - return eeepc_wmi_get_devstate_bits(dev_id, EEEPC_WMI_DSTS_STATUS_BIT);
  272 + return asus_wmi_get_devstate_bits(dev_id, ASUS_WMI_DSTS_STATUS_BIT);
306 273 }
307 274  
308 275 /*
309 276  
310 277  
311 278  
312 279  
313 280  
314 281  
315 282  
316 283  
317 284  
318 285  
319 286  
320 287  
321 288  
322 289  
323 290  
324 291  
325 292  
326 293  
327 294  
328 295  
329 296  
330 297  
331 298  
... ... @@ -311,93 +278,92 @@
311 278 /*
312 279 * These functions actually update the LED's, and are called from a
313 280 * workqueue. By doing this as separate work rather than when the LED
314   - * subsystem asks, we avoid messing with the Eeepc ACPI stuff during a
  281 + * subsystem asks, we avoid messing with the Asus ACPI stuff during a
315 282 * potentially bad time, such as a timer interrupt.
316 283 */
317 284 static void tpd_led_update(struct work_struct *work)
318 285 {
319 286 int ctrl_param;
320   - struct eeepc_wmi *eeepc;
  287 + struct asus_wmi *asus;
321 288  
322   - eeepc = container_of(work, struct eeepc_wmi, tpd_led_work);
  289 + asus = container_of(work, struct asus_wmi, tpd_led_work);
323 290  
324   - ctrl_param = eeepc->tpd_led_wk;
325   - eeepc_wmi_set_devstate(EEEPC_WMI_DEVID_TOUCHPAD_LED, ctrl_param, NULL);
  291 + ctrl_param = asus->tpd_led_wk;
  292 + asus_wmi_set_devstate(ASUS_WMI_DEVID_TOUCHPAD_LED, ctrl_param, NULL);
326 293 }
327 294  
328 295 static void tpd_led_set(struct led_classdev *led_cdev,
329 296 enum led_brightness value)
330 297 {
331   - struct eeepc_wmi *eeepc;
  298 + struct asus_wmi *asus;
332 299  
333   - eeepc = container_of(led_cdev, struct eeepc_wmi, tpd_led);
  300 + asus = container_of(led_cdev, struct asus_wmi, tpd_led);
334 301  
335   - eeepc->tpd_led_wk = !!value;
336   - queue_work(eeepc->led_workqueue, &eeepc->tpd_led_work);
  302 + asus->tpd_led_wk = !!value;
  303 + queue_work(asus->led_workqueue, &asus->tpd_led_work);
337 304 }
338 305  
339   -static int read_tpd_led_state(struct eeepc_wmi *eeepc)
  306 +static int read_tpd_led_state(struct asus_wmi *asus)
340 307 {
341   - return eeepc_wmi_get_devstate_simple(EEEPC_WMI_DEVID_TOUCHPAD_LED);
  308 + return asus_wmi_get_devstate_simple(ASUS_WMI_DEVID_TOUCHPAD_LED);
342 309 }
343 310  
344 311 static enum led_brightness tpd_led_get(struct led_classdev *led_cdev)
345 312 {
346   - struct eeepc_wmi *eeepc;
  313 + struct asus_wmi *asus;
347 314  
348   - eeepc = container_of(led_cdev, struct eeepc_wmi, tpd_led);
  315 + asus = container_of(led_cdev, struct asus_wmi, tpd_led);
349 316  
350   - return read_tpd_led_state(eeepc);
  317 + return read_tpd_led_state(asus);
351 318 }
352 319  
353   -static int eeepc_wmi_led_init(struct eeepc_wmi *eeepc)
  320 +static int asus_wmi_led_init(struct asus_wmi *asus)
354 321 {
355 322 int rv;
356 323  
357   - if (read_tpd_led_state(eeepc) < 0)
  324 + if (read_tpd_led_state(asus) < 0)
358 325 return 0;
359 326  
360   - eeepc->led_workqueue = create_singlethread_workqueue("led_workqueue");
361   - if (!eeepc->led_workqueue)
  327 + asus->led_workqueue = create_singlethread_workqueue("led_workqueue");
  328 + if (!asus->led_workqueue)
362 329 return -ENOMEM;
363   - INIT_WORK(&eeepc->tpd_led_work, tpd_led_update);
  330 + INIT_WORK(&asus->tpd_led_work, tpd_led_update);
364 331  
365   - eeepc->tpd_led.name = "eeepc::touchpad";
366   - eeepc->tpd_led.brightness_set = tpd_led_set;
367   - eeepc->tpd_led.brightness_get = tpd_led_get;
368   - eeepc->tpd_led.max_brightness = 1;
  332 + asus->tpd_led.name = "asus::touchpad";
  333 + asus->tpd_led.brightness_set = tpd_led_set;
  334 + asus->tpd_led.brightness_get = tpd_led_get;
  335 + asus->tpd_led.max_brightness = 1;
369 336  
370   - rv = led_classdev_register(&eeepc->platform_device->dev,
371   - &eeepc->tpd_led);
  337 + rv = led_classdev_register(&asus->platform_device->dev, &asus->tpd_led);
372 338 if (rv) {
373   - destroy_workqueue(eeepc->led_workqueue);
  339 + destroy_workqueue(asus->led_workqueue);
374 340 return rv;
375 341 }
376 342  
377 343 return 0;
378 344 }
379 345  
380   -static void eeepc_wmi_led_exit(struct eeepc_wmi *eeepc)
  346 +static void asus_wmi_led_exit(struct asus_wmi *asus)
381 347 {
382   - if (eeepc->tpd_led.dev)
383   - led_classdev_unregister(&eeepc->tpd_led);
384   - if (eeepc->led_workqueue)
385   - destroy_workqueue(eeepc->led_workqueue);
  348 + if (asus->tpd_led.dev)
  349 + led_classdev_unregister(&asus->tpd_led);
  350 + if (asus->led_workqueue)
  351 + destroy_workqueue(asus->led_workqueue);
386 352 }
387 353  
388 354 /*
389 355 * PCI hotplug (for wlan rfkill)
390 356 */
391   -static bool eeepc_wlan_rfkill_blocked(struct eeepc_wmi *eeepc)
  357 +static bool asus_wlan_rfkill_blocked(struct asus_wmi *asus)
392 358 {
393   - int result = eeepc_wmi_get_devstate_simple(EEEPC_WMI_DEVID_WLAN);
  359 + int result = asus_wmi_get_devstate_simple(ASUS_WMI_DEVID_WLAN);
394 360  
395 361 if (result < 0)
396 362 return false;
397 363 return !result;
398 364 }
399 365  
400   -static void eeepc_rfkill_hotplug(struct eeepc_wmi *eeepc)
  366 +static void asus_rfkill_hotplug(struct asus_wmi *asus)
401 367 {
402 368 struct pci_dev *dev;
403 369 struct pci_bus *bus;
404 370  
405 371  
406 372  
... ... @@ -405,16 +371,16 @@
405 371 bool absent;
406 372 u32 l;
407 373  
408   - mutex_lock(&eeepc->wmi_lock);
409   - blocked = eeepc_wlan_rfkill_blocked(eeepc);
410   - mutex_unlock(&eeepc->wmi_lock);
  374 + mutex_lock(&asus->wmi_lock);
  375 + blocked = asus_wlan_rfkill_blocked(asus);
  376 + mutex_unlock(&asus->wmi_lock);
411 377  
412   - mutex_lock(&eeepc->hotplug_lock);
  378 + mutex_lock(&asus->hotplug_lock);
413 379  
414   - if (eeepc->wlan_rfkill)
415   - rfkill_set_sw_state(eeepc->wlan_rfkill, blocked);
  380 + if (asus->wlan_rfkill)
  381 + rfkill_set_sw_state(asus->wlan_rfkill, blocked);
416 382  
417   - if (eeepc->hotplug_slot) {
  383 + if (asus->hotplug_slot) {
418 384 bus = pci_find_bus(0, 1);
419 385 if (!bus) {
420 386 pr_warning("Unable to find PCI bus 1?\n");
421 387  
... ... @@ -429,11 +395,11 @@
429 395  
430 396 if (blocked != absent) {
431 397 pr_warning("BIOS says wireless lan is %s, "
432   - "but the pci device is %s\n",
433   - blocked ? "blocked" : "unblocked",
434   - absent ? "absent" : "present");
  398 + "but the pci device is %s\n",
  399 + blocked ? "blocked" : "unblocked",
  400 + absent ? "absent" : "present");
435 401 pr_warning("skipped wireless hotplug as probably "
436   - "inappropriate for this model\n");
  402 + "inappropriate for this model\n");
437 403 goto out_unlock;
438 404 }
439 405  
440 406  
441 407  
442 408  
443 409  
444 410  
445 411  
... ... @@ -460,28 +426,27 @@
460 426 }
461 427  
462 428 out_unlock:
463   - mutex_unlock(&eeepc->hotplug_lock);
  429 + mutex_unlock(&asus->hotplug_lock);
464 430 }
465 431  
466   -static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
  432 +static void asus_rfkill_notify(acpi_handle handle, u32 event, void *data)
467 433 {
468   - struct eeepc_wmi *eeepc = data;
  434 + struct asus_wmi *asus = data;
469 435  
470 436 if (event != ACPI_NOTIFY_BUS_CHECK)
471 437 return;
472 438  
473 439 /*
474   - * We can't call directly eeepc_rfkill_hotplug because most
  440 + * We can't call directly asus_rfkill_hotplug because most
475 441 * of the time WMBC is still being executed and not reetrant.
476 442 * There is currently no way to tell ACPICA that we want this
477   - * method to be serialized, we schedule a eeepc_rfkill_hotplug
  443 + * method to be serialized, we schedule a asus_rfkill_hotplug
478 444 * call later, in a safer context.
479 445 */
480   - queue_work(eeepc->hotplug_workqueue, &eeepc->hotplug_work);
  446 + queue_work(asus->hotplug_workqueue, &asus->hotplug_work);
481 447 }
482 448  
483   -static int eeepc_register_rfkill_notifier(struct eeepc_wmi *eeepc,
484   - char *node)
  449 +static int asus_register_rfkill_notifier(struct asus_wmi *asus, char *node)
485 450 {
486 451 acpi_status status;
487 452 acpi_handle handle;
... ... @@ -491,8 +456,7 @@
491 456 if (ACPI_SUCCESS(status)) {
492 457 status = acpi_install_notify_handler(handle,
493 458 ACPI_SYSTEM_NOTIFY,
494   - eeepc_rfkill_notify,
495   - eeepc);
  459 + asus_rfkill_notify, asus);
496 460 if (ACPI_FAILURE(status))
497 461 pr_warning("Failed to register notify on %s\n", node);
498 462 } else
... ... @@ -501,8 +465,7 @@
501 465 return 0;
502 466 }
503 467  
504   -static void eeepc_unregister_rfkill_notifier(struct eeepc_wmi *eeepc,
505   - char *node)
  468 +static void asus_unregister_rfkill_notifier(struct asus_wmi *asus, char *node)
506 469 {
507 470 acpi_status status = AE_OK;
508 471 acpi_handle handle;
509 472  
510 473  
511 474  
... ... @@ -511,18 +474,18 @@
511 474  
512 475 if (ACPI_SUCCESS(status)) {
513 476 status = acpi_remove_notify_handler(handle,
514   - ACPI_SYSTEM_NOTIFY,
515   - eeepc_rfkill_notify);
  477 + ACPI_SYSTEM_NOTIFY,
  478 + asus_rfkill_notify);
516 479 if (ACPI_FAILURE(status))
517 480 pr_err("Error removing rfkill notify handler %s\n",
518   - node);
  481 + node);
519 482 }
520 483 }
521 484  
522   -static int eeepc_get_adapter_status(struct hotplug_slot *hotplug_slot,
523   - u8 *value)
  485 +static int asus_get_adapter_status(struct hotplug_slot *hotplug_slot,
  486 + u8 *value)
524 487 {
525   - int result = eeepc_wmi_get_devstate_simple(EEEPC_WMI_DEVID_WLAN);
  488 + int result = asus_wmi_get_devstate_simple(ASUS_WMI_DEVID_WLAN);
526 489  
527 490 if (result < 0)
528 491 return result;
529 492  
530 493  
531 494  
532 495  
533 496  
534 497  
... ... @@ -531,27 +494,27 @@
531 494 return 0;
532 495 }
533 496  
534   -static void eeepc_cleanup_pci_hotplug(struct hotplug_slot *hotplug_slot)
  497 +static void asus_cleanup_pci_hotplug(struct hotplug_slot *hotplug_slot)
535 498 {
536 499 kfree(hotplug_slot->info);
537 500 kfree(hotplug_slot);
538 501 }
539 502  
540   -static struct hotplug_slot_ops eeepc_hotplug_slot_ops = {
  503 +static struct hotplug_slot_ops asus_hotplug_slot_ops = {
541 504 .owner = THIS_MODULE,
542   - .get_adapter_status = eeepc_get_adapter_status,
543   - .get_power_status = eeepc_get_adapter_status,
  505 + .get_adapter_status = asus_get_adapter_status,
  506 + .get_power_status = asus_get_adapter_status,
544 507 };
545 508  
546   -static void eeepc_hotplug_work(struct work_struct *work)
  509 +static void asus_hotplug_work(struct work_struct *work)
547 510 {
548   - struct eeepc_wmi *eeepc;
  511 + struct asus_wmi *asus;
549 512  
550   - eeepc = container_of(work, struct eeepc_wmi, hotplug_work);
551   - eeepc_rfkill_hotplug(eeepc);
  513 + asus = container_of(work, struct asus_wmi, hotplug_work);
  514 + asus_rfkill_hotplug(asus);
552 515 }
553 516  
554   -static int eeepc_setup_pci_hotplug(struct eeepc_wmi *eeepc)
  517 +static int asus_setup_pci_hotplug(struct asus_wmi *asus)
555 518 {
556 519 int ret = -ENOMEM;
557 520 struct pci_bus *bus = pci_find_bus(0, 1);
558 521  
559 522  
560 523  
561 524  
562 525  
... ... @@ -561,29 +524,29 @@
561 524 return -ENODEV;
562 525 }
563 526  
564   - eeepc->hotplug_workqueue =
565   - create_singlethread_workqueue("hotplug_workqueue");
566   - if (!eeepc->hotplug_workqueue)
  527 + asus->hotplug_workqueue =
  528 + create_singlethread_workqueue("hotplug_workqueue");
  529 + if (!asus->hotplug_workqueue)
567 530 goto error_workqueue;
568 531  
569   - INIT_WORK(&eeepc->hotplug_work, eeepc_hotplug_work);
  532 + INIT_WORK(&asus->hotplug_work, asus_hotplug_work);
570 533  
571   - eeepc->hotplug_slot = kzalloc(sizeof(struct hotplug_slot), GFP_KERNEL);
572   - if (!eeepc->hotplug_slot)
  534 + asus->hotplug_slot = kzalloc(sizeof(struct hotplug_slot), GFP_KERNEL);
  535 + if (!asus->hotplug_slot)
573 536 goto error_slot;
574 537  
575   - eeepc->hotplug_slot->info = kzalloc(sizeof(struct hotplug_slot_info),
576   - GFP_KERNEL);
577   - if (!eeepc->hotplug_slot->info)
  538 + asus->hotplug_slot->info = kzalloc(sizeof(struct hotplug_slot_info),
  539 + GFP_KERNEL);
  540 + if (!asus->hotplug_slot->info)
578 541 goto error_info;
579 542  
580   - eeepc->hotplug_slot->private = eeepc;
581   - eeepc->hotplug_slot->release = &eeepc_cleanup_pci_hotplug;
582   - eeepc->hotplug_slot->ops = &eeepc_hotplug_slot_ops;
583   - eeepc_get_adapter_status(eeepc->hotplug_slot,
584   - &eeepc->hotplug_slot->info->adapter_status);
  543 + asus->hotplug_slot->private = asus;
  544 + asus->hotplug_slot->release = &asus_cleanup_pci_hotplug;
  545 + asus->hotplug_slot->ops = &asus_hotplug_slot_ops;
  546 + asus_get_adapter_status(asus->hotplug_slot,
  547 + &asus->hotplug_slot->info->adapter_status);
585 548  
586   - ret = pci_hp_register(eeepc->hotplug_slot, bus, 0, "eeepc-wifi");
  549 + ret = pci_hp_register(asus->hotplug_slot, bus, 0, "asus-wifi");
587 550 if (ret) {
588 551 pr_err("Unable to register hotplug slot - %d\n", ret);
589 552 goto error_register;
590 553  
591 554  
... ... @@ -592,12 +555,12 @@
592 555 return 0;
593 556  
594 557 error_register:
595   - kfree(eeepc->hotplug_slot->info);
  558 + kfree(asus->hotplug_slot->info);
596 559 error_info:
597   - kfree(eeepc->hotplug_slot);
598   - eeepc->hotplug_slot = NULL;
  560 + kfree(asus->hotplug_slot);
  561 + asus->hotplug_slot = NULL;
599 562 error_slot:
600   - destroy_workqueue(eeepc->hotplug_workqueue);
  563 + destroy_workqueue(asus->hotplug_workqueue);
601 564 error_workqueue:
602 565 return ret;
603 566 }
604 567  
... ... @@ -605,13 +568,13 @@
605 568 /*
606 569 * Rfkill devices
607 570 */
608   -static int eeepc_rfkill_set(void *data, bool blocked)
  571 +static int asus_rfkill_set(void *data, bool blocked)
609 572 {
610 573 int dev_id = (unsigned long)data;
611 574 u32 ctrl_param = !blocked;
612 575 acpi_status status;
613 576  
614   - status = eeepc_wmi_set_devstate(dev_id, ctrl_param, NULL);
  577 + status = asus_wmi_set_devstate(dev_id, ctrl_param, NULL);
615 578  
616 579 if (ACPI_FAILURE(status))
617 580 return -EIO;
618 581  
619 582  
620 583  
621 584  
622 585  
623 586  
624 587  
625 588  
626 589  
627 590  
628 591  
629 592  
630 593  
631 594  
... ... @@ -619,68 +582,67 @@
619 582 return 0;
620 583 }
621 584  
622   -static void eeepc_rfkill_query(struct rfkill *rfkill, void *data)
  585 +static void asus_rfkill_query(struct rfkill *rfkill, void *data)
623 586 {
624 587 int dev_id = (unsigned long)data;
625 588 int result;
626 589  
627   - result = eeepc_wmi_get_devstate_simple(dev_id);
  590 + result = asus_wmi_get_devstate_simple(dev_id);
628 591  
629 592 if (result < 0)
630   - return ;
  593 + return;
631 594  
632 595 rfkill_set_sw_state(rfkill, !result);
633 596 }
634 597  
635   -static int eeepc_rfkill_wlan_set(void *data, bool blocked)
  598 +static int asus_rfkill_wlan_set(void *data, bool blocked)
636 599 {
637   - struct eeepc_wmi *eeepc = data;
  600 + struct asus_wmi *asus = data;
638 601 int ret;
639 602  
640 603 /*
641 604 * This handler is enabled only if hotplug is enabled.
642   - * In this case, the eeepc_wmi_set_devstate() will
  605 + * In this case, the asus_wmi_set_devstate() will
643 606 * trigger a wmi notification and we need to wait
644 607 * this call to finish before being able to call
645 608 * any wmi method
646 609 */
647   - mutex_lock(&eeepc->wmi_lock);
648   - ret = eeepc_rfkill_set((void *)(long)EEEPC_WMI_DEVID_WLAN, blocked);
649   - mutex_unlock(&eeepc->wmi_lock);
  610 + mutex_lock(&asus->wmi_lock);
  611 + ret = asus_rfkill_set((void *)(long)ASUS_WMI_DEVID_WLAN, blocked);
  612 + mutex_unlock(&asus->wmi_lock);
650 613 return ret;
651 614 }
652 615  
653   -static void eeepc_rfkill_wlan_query(struct rfkill *rfkill, void *data)
  616 +static void asus_rfkill_wlan_query(struct rfkill *rfkill, void *data)
654 617 {
655   - eeepc_rfkill_query(rfkill, (void *)(long)EEEPC_WMI_DEVID_WLAN);
  618 + asus_rfkill_query(rfkill, (void *)(long)ASUS_WMI_DEVID_WLAN);
656 619 }
657 620  
658   -static const struct rfkill_ops eeepc_rfkill_wlan_ops = {
659   - .set_block = eeepc_rfkill_wlan_set,
660   - .query = eeepc_rfkill_wlan_query,
  621 +static const struct rfkill_ops asus_rfkill_wlan_ops = {
  622 + .set_block = asus_rfkill_wlan_set,
  623 + .query = asus_rfkill_wlan_query,
661 624 };
662 625  
663   -static const struct rfkill_ops eeepc_rfkill_ops = {
664   - .set_block = eeepc_rfkill_set,
665   - .query = eeepc_rfkill_query,
  626 +static const struct rfkill_ops asus_rfkill_ops = {
  627 + .set_block = asus_rfkill_set,
  628 + .query = asus_rfkill_query,
666 629 };
667 630  
668   -static int eeepc_new_rfkill(struct eeepc_wmi *eeepc,
669   - struct rfkill **rfkill,
670   - const char *name,
671   - enum rfkill_type type, int dev_id)
  631 +static int asus_new_rfkill(struct asus_wmi *asus,
  632 + struct rfkill **rfkill,
  633 + const char *name, enum rfkill_type type, int dev_id)
672 634 {
673   - int result = eeepc_wmi_get_devstate_simple(dev_id);
  635 + int result = asus_wmi_get_devstate_simple(dev_id);
674 636  
675 637 if (result < 0)
676 638 return result;
677 639  
678   - if (dev_id == EEEPC_WMI_DEVID_WLAN && eeepc->hotplug_wireless)
679   - *rfkill = rfkill_alloc(name, &eeepc->platform_device->dev, type,
680   - &eeepc_rfkill_wlan_ops, eeepc);
  640 + if (dev_id == ASUS_WMI_DEVID_WLAN && asus->driver->hotplug_wireless)
  641 + *rfkill = rfkill_alloc(name, &asus->platform_device->dev, type,
  642 + &asus_rfkill_wlan_ops, asus);
681 643 else
682   - *rfkill = rfkill_alloc(name, &eeepc->platform_device->dev, type,
683   - &eeepc_rfkill_ops, (void *)(long)dev_id);
  644 + *rfkill = rfkill_alloc(name, &asus->platform_device->dev, type,
  645 + &asus_rfkill_ops, (void *)(long)dev_id);
684 646  
685 647 if (!*rfkill)
686 648 return -EINVAL;
687 649  
688 650  
689 651  
690 652  
691 653  
692 654  
693 655  
694 656  
695 657  
696 658  
697 659  
698 660  
699 661  
700 662  
... ... @@ -695,82 +657,82 @@
695 657 return 0;
696 658 }
697 659  
698   -static void eeepc_wmi_rfkill_exit(struct eeepc_wmi *eeepc)
  660 +static void asus_wmi_rfkill_exit(struct asus_wmi *asus)
699 661 {
700   - eeepc_unregister_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P5");
701   - eeepc_unregister_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P6");
702   - eeepc_unregister_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P7");
703   - if (eeepc->wlan_rfkill) {
704   - rfkill_unregister(eeepc->wlan_rfkill);
705   - rfkill_destroy(eeepc->wlan_rfkill);
706   - eeepc->wlan_rfkill = NULL;
  662 + asus_unregister_rfkill_notifier(asus, "\\_SB.PCI0.P0P5");
  663 + asus_unregister_rfkill_notifier(asus, "\\_SB.PCI0.P0P6");
  664 + asus_unregister_rfkill_notifier(asus, "\\_SB.PCI0.P0P7");
  665 + if (asus->wlan_rfkill) {
  666 + rfkill_unregister(asus->wlan_rfkill);
  667 + rfkill_destroy(asus->wlan_rfkill);
  668 + asus->wlan_rfkill = NULL;
707 669 }
708 670 /*
709 671 * Refresh pci hotplug in case the rfkill state was changed after
710   - * eeepc_unregister_rfkill_notifier()
  672 + * asus_unregister_rfkill_notifier()
711 673 */
712   - eeepc_rfkill_hotplug(eeepc);
713   - if (eeepc->hotplug_slot)
714   - pci_hp_deregister(eeepc->hotplug_slot);
715   - if (eeepc->hotplug_workqueue)
716   - destroy_workqueue(eeepc->hotplug_workqueue);
  674 + asus_rfkill_hotplug(asus);
  675 + if (asus->hotplug_slot)
  676 + pci_hp_deregister(asus->hotplug_slot);
  677 + if (asus->hotplug_workqueue)
  678 + destroy_workqueue(asus->hotplug_workqueue);
717 679  
718   - if (eeepc->bluetooth_rfkill) {
719   - rfkill_unregister(eeepc->bluetooth_rfkill);
720   - rfkill_destroy(eeepc->bluetooth_rfkill);
721   - eeepc->bluetooth_rfkill = NULL;
  680 + if (asus->bluetooth_rfkill) {
  681 + rfkill_unregister(asus->bluetooth_rfkill);
  682 + rfkill_destroy(asus->bluetooth_rfkill);
  683 + asus->bluetooth_rfkill = NULL;
722 684 }
723   - if (eeepc->wimax_rfkill) {
724   - rfkill_unregister(eeepc->wimax_rfkill);
725   - rfkill_destroy(eeepc->wimax_rfkill);
726   - eeepc->wimax_rfkill = NULL;
  685 + if (asus->wimax_rfkill) {
  686 + rfkill_unregister(asus->wimax_rfkill);
  687 + rfkill_destroy(asus->wimax_rfkill);
  688 + asus->wimax_rfkill = NULL;
727 689 }
728   - if (eeepc->wwan3g_rfkill) {
729   - rfkill_unregister(eeepc->wwan3g_rfkill);
730   - rfkill_destroy(eeepc->wwan3g_rfkill);
731   - eeepc->wwan3g_rfkill = NULL;
  690 + if (asus->wwan3g_rfkill) {
  691 + rfkill_unregister(asus->wwan3g_rfkill);
  692 + rfkill_destroy(asus->wwan3g_rfkill);
  693 + asus->wwan3g_rfkill = NULL;
732 694 }
733 695 }
734 696  
735   -static int eeepc_wmi_rfkill_init(struct eeepc_wmi *eeepc)
  697 +static int asus_wmi_rfkill_init(struct asus_wmi *asus)
736 698 {
737 699 int result = 0;
738 700  
739   - mutex_init(&eeepc->hotplug_lock);
740   - mutex_init(&eeepc->wmi_lock);
  701 + mutex_init(&asus->hotplug_lock);
  702 + mutex_init(&asus->wmi_lock);
741 703  
742   - result = eeepc_new_rfkill(eeepc, &eeepc->wlan_rfkill,
743   - "eeepc-wlan", RFKILL_TYPE_WLAN,
744   - EEEPC_WMI_DEVID_WLAN);
  704 + result = asus_new_rfkill(asus, &asus->wlan_rfkill,
  705 + "asus-wlan", RFKILL_TYPE_WLAN,
  706 + ASUS_WMI_DEVID_WLAN);
745 707  
746 708 if (result && result != -ENODEV)
747 709 goto exit;
748 710  
749   - result = eeepc_new_rfkill(eeepc, &eeepc->bluetooth_rfkill,
750   - "eeepc-bluetooth", RFKILL_TYPE_BLUETOOTH,
751   - EEEPC_WMI_DEVID_BLUETOOTH);
  711 + result = asus_new_rfkill(asus, &asus->bluetooth_rfkill,
  712 + "asus-bluetooth", RFKILL_TYPE_BLUETOOTH,
  713 + ASUS_WMI_DEVID_BLUETOOTH);
752 714  
753 715 if (result && result != -ENODEV)
754 716 goto exit;
755 717  
756   - result = eeepc_new_rfkill(eeepc, &eeepc->wimax_rfkill,
757   - "eeepc-wimax", RFKILL_TYPE_WIMAX,
758   - EEEPC_WMI_DEVID_WIMAX);
  718 + result = asus_new_rfkill(asus, &asus->wimax_rfkill,
  719 + "asus-wimax", RFKILL_TYPE_WIMAX,
  720 + ASUS_WMI_DEVID_WIMAX);
759 721  
760 722 if (result && result != -ENODEV)
761 723 goto exit;
762 724  
763   - result = eeepc_new_rfkill(eeepc, &eeepc->wwan3g_rfkill,
764   - "eeepc-wwan3g", RFKILL_TYPE_WWAN,
765   - EEEPC_WMI_DEVID_WWAN3G);
  725 + result = asus_new_rfkill(asus, &asus->wwan3g_rfkill,
  726 + "asus-wwan3g", RFKILL_TYPE_WWAN,
  727 + ASUS_WMI_DEVID_WWAN3G);
766 728  
767 729 if (result && result != -ENODEV)
768 730 goto exit;
769 731  
770   - if (!eeepc->hotplug_wireless)
  732 + if (!asus->driver->hotplug_wireless)
771 733 goto exit;
772 734  
773   - result = eeepc_setup_pci_hotplug(eeepc);
  735 + result = asus_setup_pci_hotplug(asus);
774 736 /*
775 737 * If we get -EBUSY then something else is handling the PCI hotplug -
776 738 * don't fail in this case
777 739  
778 740  
... ... @@ -778,18 +740,18 @@
778 740 if (result == -EBUSY)
779 741 result = 0;
780 742  
781   - eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P5");
782   - eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P6");
783   - eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P7");
  743 + asus_register_rfkill_notifier(asus, "\\_SB.PCI0.P0P5");
  744 + asus_register_rfkill_notifier(asus, "\\_SB.PCI0.P0P6");
  745 + asus_register_rfkill_notifier(asus, "\\_SB.PCI0.P0P7");
784 746 /*
785 747 * Refresh pci hotplug in case the rfkill state was changed during
786 748 * setup.
787 749 */
788   - eeepc_rfkill_hotplug(eeepc);
  750 + asus_rfkill_hotplug(asus);
789 751  
790 752 exit:
791 753 if (result && result != -ENODEV)
792   - eeepc_wmi_rfkill_exit(eeepc);
  754 + asus_wmi_rfkill_exit(asus);
793 755  
794 756 if (result == -ENODEV)
795 757 result = 0;
... ... @@ -802,7 +764,7 @@
802 764 */
803 765 static int read_backlight_power(void)
804 766 {
805   - int ret = eeepc_wmi_get_devstate_simple(EEEPC_WMI_DEVID_BACKLIGHT);
  767 + int ret = asus_wmi_get_devstate_simple(ASUS_WMI_DEVID_BACKLIGHT);
806 768  
807 769 if (ret < 0)
808 770 return ret;
809 771  
... ... @@ -815,12 +777,12 @@
815 777 u32 retval;
816 778 acpi_status status;
817 779  
818   - status = eeepc_wmi_get_devstate(EEEPC_WMI_DEVID_BRIGHTNESS, &retval);
  780 + status = asus_wmi_get_devstate(ASUS_WMI_DEVID_BRIGHTNESS, &retval);
819 781  
820 782 if (ACPI_FAILURE(status))
821 783 return -EIO;
822 784 else
823   - return retval & EEEPC_WMI_DSTS_BRIGHTNESS_MASK;
  785 + return retval & ASUS_WMI_DSTS_BRIGHTNESS_MASK;
824 786 }
825 787  
826 788 static int update_bl_status(struct backlight_device *bd)
... ... @@ -831,8 +793,8 @@
831 793  
832 794 ctrl_param = bd->props.brightness;
833 795  
834   - status = eeepc_wmi_set_devstate(EEEPC_WMI_DEVID_BRIGHTNESS,
835   - ctrl_param, NULL);
  796 + status = asus_wmi_set_devstate(ASUS_WMI_DEVID_BRIGHTNESS,
  797 + ctrl_param, NULL);
836 798  
837 799 if (ACPI_FAILURE(status))
838 800 return -EIO;
... ... @@ -840,8 +802,8 @@
840 802 power = read_backlight_power();
841 803 if (power != -ENODEV && bd->props.power != power) {
842 804 ctrl_param = !!(bd->props.power == FB_BLANK_UNBLANK);
843   - status = eeepc_wmi_set_devstate(EEEPC_WMI_DEVID_BACKLIGHT,
844   - ctrl_param, NULL);
  805 + status = asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT,
  806 + ctrl_param, NULL);
845 807  
846 808 if (ACPI_FAILURE(status))
847 809 return -EIO;
848 810  
849 811  
... ... @@ -849,14 +811,14 @@
849 811 return 0;
850 812 }
851 813  
852   -static const struct backlight_ops eeepc_wmi_bl_ops = {
  814 +static const struct backlight_ops asus_wmi_bl_ops = {
853 815 .get_brightness = read_brightness,
854 816 .update_status = update_bl_status,
855 817 };
856 818  
857   -static int eeepc_wmi_backlight_notify(struct eeepc_wmi *eeepc, int code)
  819 +static int asus_wmi_backlight_notify(struct asus_wmi *asus, int code)
858 820 {
859   - struct backlight_device *bd = eeepc->backlight_device;
  821 + struct backlight_device *bd = asus->backlight_device;
860 822 int old = bd->props.brightness;
861 823 int new = old;
862 824  
863 825  
... ... @@ -872,15 +834,15 @@
872 834 return old;
873 835 }
874 836  
875   -static int eeepc_wmi_backlight_init(struct eeepc_wmi *eeepc)
  837 +static int asus_wmi_backlight_init(struct asus_wmi *asus)
876 838 {
877 839 struct backlight_device *bd;
878 840 struct backlight_properties props;
879 841 int max;
880 842 int power;
881 843  
882   - max = eeepc_wmi_get_devstate_bits(EEEPC_WMI_DEVID_BRIGHTNESS,
883   - EEEPC_WMI_DSTS_MAX_BRIGTH_MASK);
  844 + max = asus_wmi_get_devstate_bits(ASUS_WMI_DEVID_BRIGHTNESS,
  845 + ASUS_WMI_DSTS_MAX_BRIGTH_MASK);
884 846 power = read_backlight_power();
885 847  
886 848 if (max < 0 && power < 0) {
887 849  
... ... @@ -899,15 +861,15 @@
899 861  
900 862 memset(&props, 0, sizeof(struct backlight_properties));
901 863 props.max_brightness = max;
902   - bd = backlight_device_register(EEEPC_WMI_FILE,
903   - &eeepc->platform_device->dev, eeepc,
904   - &eeepc_wmi_bl_ops, &props);
  864 + bd = backlight_device_register(asus->driver->name,
  865 + &asus->platform_device->dev, asus,
  866 + &asus_wmi_bl_ops, &props);
905 867 if (IS_ERR(bd)) {
906 868 pr_err("Could not register backlight device\n");
907 869 return PTR_ERR(bd);
908 870 }
909 871  
910   - eeepc->backlight_device = bd;
  872 + asus->backlight_device = bd;
911 873  
912 874 bd->props.brightness = read_brightness(bd);
913 875 bd->props.power = power;
914 876  
915 877  
916 878  
917 879  
... ... @@ -916,17 +878,17 @@
916 878 return 0;
917 879 }
918 880  
919   -static void eeepc_wmi_backlight_exit(struct eeepc_wmi *eeepc)
  881 +static void asus_wmi_backlight_exit(struct asus_wmi *asus)
920 882 {
921   - if (eeepc->backlight_device)
922   - backlight_device_unregister(eeepc->backlight_device);
  883 + if (asus->backlight_device)
  884 + backlight_device_unregister(asus->backlight_device);
923 885  
924   - eeepc->backlight_device = NULL;
  886 + asus->backlight_device = NULL;
925 887 }
926 888  
927   -static void eeepc_wmi_notify(u32 value, void *context)
  889 +static void asus_wmi_notify(u32 value, void *context)
928 890 {
929   - struct eeepc_wmi *eeepc = context;
  891 + struct asus_wmi *asus = context;
930 892 struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
931 893 union acpi_object *obj;
932 894 acpi_status status;
933 895  
... ... @@ -953,11 +915,10 @@
953 915  
954 916 if (code == NOTIFY_BRNUP_MIN || code == NOTIFY_BRNDOWN_MIN) {
955 917 if (!acpi_video_backlight_support())
956   - eeepc_wmi_backlight_notify(eeepc, orig_code);
  918 + asus_wmi_backlight_notify(asus, orig_code);
957 919 }
958 920  
959   - if (!sparse_keymap_report_event(eeepc->inputdev,
960   - code, 1, true))
  921 + if (!sparse_keymap_report_event(asus->inputdev, code, 1, true))
961 922 pr_info("Unknown key %x pressed\n", code);
962 923 }
963 924  
964 925  
... ... @@ -982,12 +943,12 @@
982 943 u32 retval;
983 944 int rv, value;
984 945  
985   - value = eeepc_wmi_get_devstate_simple(devid);
986   - if (value == -ENODEV) /* Check device presence */
  946 + value = asus_wmi_get_devstate_simple(devid);
  947 + if (value == -ENODEV) /* Check device presence */
987 948 return value;
988 949  
989 950 rv = parse_arg(buf, count, &value);
990   - status = eeepc_wmi_set_devstate(devid, value, &retval);
  951 + status = asus_wmi_set_devstate(devid, value, &retval);
991 952  
992 953 if (ACPI_FAILURE(status))
993 954 return -EIO;
... ... @@ -996,7 +957,7 @@
996 957  
997 958 static ssize_t show_sys_wmi(int devid, char *buf)
998 959 {
999   - int value = eeepc_wmi_get_devstate_simple(devid);
  960 + int value = asus_wmi_get_devstate_simple(devid);
1000 961  
1001 962 if (value < 0)
1002 963 return value;
... ... @@ -1004,7 +965,7 @@
1004 965 return sprintf(buf, "%d\n", value);
1005 966 }
1006 967  
1007   -#define EEEPC_WMI_CREATE_DEVICE_ATTR(_name, _mode, _cm) \
  968 +#define ASUS_WMI_CREATE_DEVICE_ATTR(_name, _mode, _cm) \
1008 969 static ssize_t show_##_name(struct device *dev, \
1009 970 struct device_attribute *attr, \
1010 971 char *buf) \
1011 972  
... ... @@ -1025,15 +986,15 @@
1025 986 .store = store_##_name, \
1026 987 }
1027 988  
1028   -EEEPC_WMI_CREATE_DEVICE_ATTR(touchpad, 0644, EEEPC_WMI_DEVID_TOUCHPAD);
1029   -EEEPC_WMI_CREATE_DEVICE_ATTR(camera, 0644, EEEPC_WMI_DEVID_CAMERA);
1030   -EEEPC_WMI_CREATE_DEVICE_ATTR(cardr, 0644, EEEPC_WMI_DEVID_CARDREADER);
  989 +ASUS_WMI_CREATE_DEVICE_ATTR(touchpad, 0644, ASUS_WMI_DEVID_TOUCHPAD);
  990 +ASUS_WMI_CREATE_DEVICE_ATTR(camera, 0644, ASUS_WMI_DEVID_CAMERA);
  991 +ASUS_WMI_CREATE_DEVICE_ATTR(cardr, 0644, ASUS_WMI_DEVID_CARDREADER);
1031 992  
1032 993 static ssize_t store_cpufv(struct device *dev, struct device_attribute *attr,
1033 994 const char *buf, size_t count)
1034 995 {
1035 996 int value;
1036   - struct acpi_buffer input = { (acpi_size)sizeof(value), &value };
  997 + struct acpi_buffer input = { (acpi_size) sizeof(value), &value };
1037 998 acpi_status status;
1038 999  
1039 1000 if (!count || sscanf(buf, "%i", &value) != 1)
... ... @@ -1041,8 +1002,8 @@
1041 1002 if (value < 0 || value > 2)
1042 1003 return -EINVAL;
1043 1004  
1044   - status = wmi_evaluate_method(EEEPC_WMI_MGMT_GUID,
1045   - 1, EEEPC_WMI_METHODID_CFVS, &input, NULL);
  1005 + status = wmi_evaluate_method(ASUS_WMI_MGMT_GUID,
  1006 + 1, ASUS_WMI_METHODID_CFVS, &input, NULL);
1046 1007  
1047 1008 if (ACPI_FAILURE(status))
1048 1009 return -EIO;
1049 1010  
1050 1011  
1051 1012  
1052 1013  
1053 1014  
1054 1015  
1055 1016  
... ... @@ -1060,37 +1021,36 @@
1060 1021 NULL
1061 1022 };
1062 1023  
1063   -static mode_t eeepc_sysfs_is_visible(struct kobject *kobj,
1064   - struct attribute *attr,
1065   - int idx)
  1024 +static mode_t asus_sysfs_is_visible(struct kobject *kobj,
  1025 + struct attribute *attr, int idx)
1066 1026 {
1067 1027 bool supported = true;
1068 1028 int devid = -1;
1069 1029  
1070 1030 if (attr == &dev_attr_camera.attr)
1071   - devid = EEEPC_WMI_DEVID_CAMERA;
  1031 + devid = ASUS_WMI_DEVID_CAMERA;
1072 1032 else if (attr == &dev_attr_cardr.attr)
1073   - devid = EEEPC_WMI_DEVID_CARDREADER;
  1033 + devid = ASUS_WMI_DEVID_CARDREADER;
1074 1034 else if (attr == &dev_attr_touchpad.attr)
1075   - devid = EEEPC_WMI_DEVID_TOUCHPAD;
  1035 + devid = ASUS_WMI_DEVID_TOUCHPAD;
1076 1036  
1077 1037 if (devid != -1)
1078   - supported = eeepc_wmi_get_devstate_simple(devid) != -ENODEV;
  1038 + supported = asus_wmi_get_devstate_simple(devid) != -ENODEV;
1079 1039  
1080 1040 return supported ? attr->mode : 0;
1081 1041 }
1082 1042  
1083 1043 static struct attribute_group platform_attribute_group = {
1084   - .is_visible = eeepc_sysfs_is_visible,
1085   - .attrs = platform_attributes
  1044 + .is_visible = asus_sysfs_is_visible,
  1045 + .attrs = platform_attributes
1086 1046 };
1087 1047  
1088   -static void eeepc_wmi_sysfs_exit(struct platform_device *device)
  1048 +static void asus_wmi_sysfs_exit(struct platform_device *device)
1089 1049 {
1090 1050 sysfs_remove_group(&device->dev.kobj, &platform_attribute_group);
1091 1051 }
1092 1052  
1093   -static int eeepc_wmi_sysfs_init(struct platform_device *device)
  1053 +static int asus_wmi_sysfs_init(struct platform_device *device)
1094 1054 {
1095 1055 return sysfs_create_group(&device->dev.kobj, &platform_attribute_group);
1096 1056 }
1097 1057  
1098 1058  
1099 1059  
1100 1060  
1101 1061  
1102 1062  
1103 1063  
1104 1064  
1105 1065  
1106 1066  
1107 1067  
1108 1068  
1109 1069  
1110 1070  
1111 1071  
1112 1072  
1113 1073  
1114 1074  
1115 1075  
1116 1076  
1117 1077  
1118 1078  
1119 1079  
1120 1080  
1121 1081  
1122 1082  
... ... @@ -1098,111 +1058,111 @@
1098 1058 /*
1099 1059 * Platform device
1100 1060 */
1101   -static int __init eeepc_wmi_platform_init(struct eeepc_wmi *eeepc)
  1061 +static int __init asus_wmi_platform_init(struct asus_wmi *asus)
1102 1062 {
1103   - return eeepc_wmi_sysfs_init(eeepc->platform_device);
  1063 + return asus_wmi_sysfs_init(asus->platform_device);
1104 1064 }
1105 1065  
1106   -static void eeepc_wmi_platform_exit(struct eeepc_wmi *eeepc)
  1066 +static void asus_wmi_platform_exit(struct asus_wmi *asus)
1107 1067 {
1108   - eeepc_wmi_sysfs_exit(eeepc->platform_device);
  1068 + asus_wmi_sysfs_exit(asus->platform_device);
1109 1069 }
1110 1070  
1111 1071 /*
1112 1072 * debugfs
1113 1073 */
1114   -struct eeepc_wmi_debugfs_node {
1115   - struct eeepc_wmi *eeepc;
  1074 +struct asus_wmi_debugfs_node {
  1075 + struct asus_wmi *asus;
1116 1076 char *name;
1117   - int (*show)(struct seq_file *m, void *data);
  1077 + int (*show) (struct seq_file *m, void *data);
1118 1078 };
1119 1079  
1120 1080 static int show_dsts(struct seq_file *m, void *data)
1121 1081 {
1122   - struct eeepc_wmi *eeepc = m->private;
  1082 + struct asus_wmi *asus = m->private;
1123 1083 acpi_status status;
1124 1084 u32 retval = -1;
1125 1085  
1126   - status = eeepc_wmi_get_devstate(eeepc->debug.dev_id, &retval);
  1086 + status = asus_wmi_get_devstate(asus->debug.dev_id, &retval);
1127 1087  
1128 1088 if (ACPI_FAILURE(status))
1129 1089 return -EIO;
1130 1090  
1131   - seq_printf(m, "DSTS(%x) = %x\n", eeepc->debug.dev_id, retval);
  1091 + seq_printf(m, "DSTS(%x) = %x\n", asus->debug.dev_id, retval);
1132 1092  
1133 1093 return 0;
1134 1094 }
1135 1095  
1136 1096 static int show_devs(struct seq_file *m, void *data)
1137 1097 {
1138   - struct eeepc_wmi *eeepc = m->private;
  1098 + struct asus_wmi *asus = m->private;
1139 1099 acpi_status status;
1140 1100 u32 retval = -1;
1141 1101  
1142   - status = eeepc_wmi_set_devstate(eeepc->debug.dev_id,
1143   - eeepc->debug.ctrl_param, &retval);
  1102 + status = asus_wmi_set_devstate(asus->debug.dev_id,
  1103 + asus->debug.ctrl_param, &retval);
1144 1104 if (ACPI_FAILURE(status))
1145 1105 return -EIO;
1146 1106  
1147   - seq_printf(m, "DEVS(%x, %x) = %x\n", eeepc->debug.dev_id,
1148   - eeepc->debug.ctrl_param, retval);
  1107 + seq_printf(m, "DEVS(%x, %x) = %x\n", asus->debug.dev_id,
  1108 + asus->debug.ctrl_param, retval);
1149 1109  
1150 1110 return 0;
1151 1111 }
1152 1112  
1153   -static struct eeepc_wmi_debugfs_node eeepc_wmi_debug_files[] = {
1154   - { NULL, "devs", show_devs },
1155   - { NULL, "dsts", show_dsts },
  1113 +static struct asus_wmi_debugfs_node asus_wmi_debug_files[] = {
  1114 + {NULL, "devs", show_devs},
  1115 + {NULL, "dsts", show_dsts},
1156 1116 };
1157 1117  
1158   -static int eeepc_wmi_debugfs_open(struct inode *inode, struct file *file)
  1118 +static int asus_wmi_debugfs_open(struct inode *inode, struct file *file)
1159 1119 {
1160   - struct eeepc_wmi_debugfs_node *node = inode->i_private;
  1120 + struct asus_wmi_debugfs_node *node = inode->i_private;
1161 1121  
1162   - return single_open(file, node->show, node->eeepc);
  1122 + return single_open(file, node->show, node->asus);
1163 1123 }
1164 1124  
1165   -static const struct file_operations eeepc_wmi_debugfs_io_ops = {
  1125 +static const struct file_operations asus_wmi_debugfs_io_ops = {
1166 1126 .owner = THIS_MODULE,
1167   - .open = eeepc_wmi_debugfs_open,
  1127 + .open = asus_wmi_debugfs_open,
1168 1128 .read = seq_read,
1169 1129 .llseek = seq_lseek,
1170 1130 .release = single_release,
1171 1131 };
1172 1132  
1173   -static void eeepc_wmi_debugfs_exit(struct eeepc_wmi *eeepc)
  1133 +static void asus_wmi_debugfs_exit(struct asus_wmi *asus)
1174 1134 {
1175   - debugfs_remove_recursive(eeepc->debug.root);
  1135 + debugfs_remove_recursive(asus->debug.root);
1176 1136 }
1177 1137  
1178   -static int eeepc_wmi_debugfs_init(struct eeepc_wmi *eeepc)
  1138 +static int asus_wmi_debugfs_init(struct asus_wmi *asus)
1179 1139 {
1180 1140 struct dentry *dent;
1181 1141 int i;
1182 1142  
1183   - eeepc->debug.root = debugfs_create_dir(EEEPC_WMI_FILE, NULL);
1184   - if (!eeepc->debug.root) {
  1143 + asus->debug.root = debugfs_create_dir(asus->driver->name, NULL);
  1144 + if (!asus->debug.root) {
1185 1145 pr_err("failed to create debugfs directory");
1186 1146 goto error_debugfs;
1187 1147 }
1188 1148  
1189   - dent = debugfs_create_x32("dev_id", S_IRUGO|S_IWUSR,
1190   - eeepc->debug.root, &eeepc->debug.dev_id);
  1149 + dent = debugfs_create_x32("dev_id", S_IRUGO | S_IWUSR,
  1150 + asus->debug.root, &asus->debug.dev_id);
1191 1151 if (!dent)
1192 1152 goto error_debugfs;
1193 1153  
1194   - dent = debugfs_create_x32("ctrl_param", S_IRUGO|S_IWUSR,
1195   - eeepc->debug.root, &eeepc->debug.ctrl_param);
  1154 + dent = debugfs_create_x32("ctrl_param", S_IRUGO | S_IWUSR,
  1155 + asus->debug.root, &asus->debug.ctrl_param);
1196 1156 if (!dent)
1197 1157 goto error_debugfs;
1198 1158  
1199   - for (i = 0; i < ARRAY_SIZE(eeepc_wmi_debug_files); i++) {
1200   - struct eeepc_wmi_debugfs_node *node = &eeepc_wmi_debug_files[i];
  1159 + for (i = 0; i < ARRAY_SIZE(asus_wmi_debug_files); i++) {
  1160 + struct asus_wmi_debugfs_node *node = &asus_wmi_debug_files[i];
1201 1161  
1202   - node->eeepc = eeepc;
  1162 + node->asus = asus;
1203 1163 dent = debugfs_create_file(node->name, S_IFREG | S_IRUGO,
1204   - eeepc->debug.root, node,
1205   - &eeepc_wmi_debugfs_io_ops);
  1164 + asus->debug.root, node,
  1165 + &asus_wmi_debugfs_io_ops);
1206 1166 if (!dent) {
1207 1167 pr_err("failed to create debug file: %s\n", node->name);
1208 1168 goto error_debugfs;
1209 1169  
1210 1170  
1211 1171  
1212 1172  
1213 1173  
1214 1174  
1215 1175  
1216 1176  
1217 1177  
1218 1178  
1219 1179  
1220 1180  
1221 1181  
1222 1182  
1223 1183  
1224 1184  
1225 1185  
1226 1186  
1227 1187  
1228 1188  
1229 1189  
1230 1190  
1231 1191  
1232 1192  
1233 1193  
1234 1194  
1235 1195  
... ... @@ -1212,131 +1172,112 @@
1212 1172 return 0;
1213 1173  
1214 1174 error_debugfs:
1215   - eeepc_wmi_debugfs_exit(eeepc);
  1175 + asus_wmi_debugfs_exit(asus);
1216 1176 return -ENOMEM;
1217 1177 }
1218 1178  
1219 1179 /*
1220 1180 * WMI Driver
1221 1181 */
1222   -static void eeepc_dmi_check(struct eeepc_wmi *eeepc)
  1182 +static int asus_wmi_add(struct platform_device *pdev)
1223 1183 {
1224   - const char *model;
1225   -
1226   - model = dmi_get_system_info(DMI_PRODUCT_NAME);
1227   - if (!model)
1228   - return;
1229   -
1230   - /*
1231   - * Whitelist for wlan hotplug
1232   - *
1233   - * Eeepc 1000H needs the current hotplug code to handle
1234   - * Fn+F2 correctly. We may add other Eeepc here later, but
1235   - * it seems that most of the laptops supported by eeepc-wmi
1236   - * don't need to be on this list
1237   - */
1238   - if (strcmp(model, "1000H") == 0) {
1239   - eeepc->hotplug_wireless = true;
1240   - pr_info("wlan hotplug enabled\n");
1241   - }
1242   -}
1243   -
1244   -static int __init eeepc_wmi_add(struct platform_device *pdev)
1245   -{
1246   - struct eeepc_wmi *eeepc;
  1184 + struct platform_driver *pdrv = to_platform_driver(pdev->dev.driver);
  1185 + struct asus_wmi_driver *wdrv = to_asus_wmi_driver(pdrv);
  1186 + struct asus_wmi *asus;
1247 1187 acpi_status status;
1248 1188 int err;
1249 1189  
1250   - eeepc = kzalloc(sizeof(struct eeepc_wmi), GFP_KERNEL);
1251   - if (!eeepc)
  1190 + asus = kzalloc(sizeof(struct asus_wmi), GFP_KERNEL);
  1191 + if (!asus)
1252 1192 return -ENOMEM;
1253 1193  
1254   - eeepc->platform_device = pdev;
1255   - platform_set_drvdata(eeepc->platform_device, eeepc);
  1194 + asus->driver = wdrv;
  1195 + asus->platform_device = pdev;
  1196 + wdrv->platform_device = pdev;
  1197 + platform_set_drvdata(asus->platform_device, asus);
1256 1198  
1257   - eeepc->hotplug_wireless = hotplug_wireless;
1258   - eeepc_dmi_check(eeepc);
  1199 + if (wdrv->quirks)
  1200 + wdrv->quirks(asus->driver);
1259 1201  
1260   - err = eeepc_wmi_platform_init(eeepc);
  1202 + err = asus_wmi_platform_init(asus);
1261 1203 if (err)
1262 1204 goto fail_platform;
1263 1205  
1264   - err = eeepc_wmi_input_init(eeepc);
  1206 + err = asus_wmi_input_init(asus);
1265 1207 if (err)
1266 1208 goto fail_input;
1267 1209  
1268   - err = eeepc_wmi_led_init(eeepc);
  1210 + err = asus_wmi_led_init(asus);
1269 1211 if (err)
1270 1212 goto fail_leds;
1271 1213  
1272   - err = eeepc_wmi_rfkill_init(eeepc);
  1214 + err = asus_wmi_rfkill_init(asus);
1273 1215 if (err)
1274 1216 goto fail_rfkill;
1275 1217  
1276 1218 if (!acpi_video_backlight_support()) {
1277   - err = eeepc_wmi_backlight_init(eeepc);
  1219 + err = asus_wmi_backlight_init(asus);
1278 1220 if (err && err != -ENODEV)
1279 1221 goto fail_backlight;
1280 1222 } else
1281 1223 pr_info("Backlight controlled by ACPI video driver\n");
1282 1224  
1283   - status = wmi_install_notify_handler(EEEPC_WMI_EVENT_GUID,
1284   - eeepc_wmi_notify, eeepc);
  1225 + status = wmi_install_notify_handler(asus->driver->event_guid,
  1226 + asus_wmi_notify, asus);
1285 1227 if (ACPI_FAILURE(status)) {
1286   - pr_err("Unable to register notify handler - %d\n",
1287   - status);
  1228 + pr_err("Unable to register notify handler - %d\n", status);
1288 1229 err = -ENODEV;
1289 1230 goto fail_wmi_handler;
1290 1231 }
1291 1232  
1292   - err = eeepc_wmi_debugfs_init(eeepc);
  1233 + err = asus_wmi_debugfs_init(asus);
1293 1234 if (err)
1294 1235 goto fail_debugfs;
1295 1236  
1296 1237 return 0;
1297 1238  
1298 1239 fail_debugfs:
1299   - wmi_remove_notify_handler(EEEPC_WMI_EVENT_GUID);
  1240 + wmi_remove_notify_handler(asus->driver->event_guid);
1300 1241 fail_wmi_handler:
1301   - eeepc_wmi_backlight_exit(eeepc);
  1242 + asus_wmi_backlight_exit(asus);
1302 1243 fail_backlight:
1303   - eeepc_wmi_rfkill_exit(eeepc);
  1244 + asus_wmi_rfkill_exit(asus);
1304 1245 fail_rfkill:
1305   - eeepc_wmi_led_exit(eeepc);
  1246 + asus_wmi_led_exit(asus);
1306 1247 fail_leds:
1307   - eeepc_wmi_input_exit(eeepc);
  1248 + asus_wmi_input_exit(asus);
1308 1249 fail_input:
1309   - eeepc_wmi_platform_exit(eeepc);
  1250 + asus_wmi_platform_exit(asus);
1310 1251 fail_platform:
1311   - kfree(eeepc);
  1252 + kfree(asus);
1312 1253 return err;
1313 1254 }
1314 1255  
1315   -static int __exit eeepc_wmi_remove(struct platform_device *device)
  1256 +static int asus_wmi_remove(struct platform_device *device)
1316 1257 {
1317   - struct eeepc_wmi *eeepc;
  1258 + struct asus_wmi *asus;
1318 1259  
1319   - eeepc = platform_get_drvdata(device);
1320   - wmi_remove_notify_handler(EEEPC_WMI_EVENT_GUID);
1321   - eeepc_wmi_backlight_exit(eeepc);
1322   - eeepc_wmi_input_exit(eeepc);
1323   - eeepc_wmi_led_exit(eeepc);
1324   - eeepc_wmi_rfkill_exit(eeepc);
1325   - eeepc_wmi_debugfs_exit(eeepc);
1326   - eeepc_wmi_platform_exit(eeepc);
  1260 + asus = platform_get_drvdata(device);
  1261 + wmi_remove_notify_handler(asus->driver->event_guid);
  1262 + asus_wmi_backlight_exit(asus);
  1263 + asus_wmi_input_exit(asus);
  1264 + asus_wmi_led_exit(asus);
  1265 + asus_wmi_rfkill_exit(asus);
  1266 + asus_wmi_debugfs_exit(asus);
  1267 + asus_wmi_platform_exit(asus);
1327 1268  
1328   - kfree(eeepc);
  1269 + kfree(asus);
1329 1270 return 0;
1330 1271 }
1331 1272  
1332 1273 /*
1333 1274 * Platform driver - hibernate/resume callbacks
1334 1275 */
1335   -static int eeepc_hotk_thaw(struct device *device)
  1276 +static int asus_hotk_thaw(struct device *device)
1336 1277 {
1337   - struct eeepc_wmi *eeepc = dev_get_drvdata(device);
  1278 + struct asus_wmi *asus = dev_get_drvdata(device);
1338 1279  
1339   - if (eeepc->wlan_rfkill) {
  1280 + if (asus->wlan_rfkill) {
1340 1281 bool wlan;
1341 1282  
1342 1283 /*
1343 1284  
1344 1285  
1345 1286  
1346 1287  
1347 1288  
1348 1289  
1349 1290  
1350 1291  
1351 1292  
1352 1293  
1353 1294  
1354 1295  
1355 1296  
1356 1297  
1357 1298  
1358 1299  
1359 1300  
1360 1301  
1361 1302  
1362 1303  
1363 1304  
... ... @@ -1344,112 +1285,119 @@
1344 1285 * during suspend. Normally it restores it on resume, but
1345 1286 * we should kick it ourselves in case hibernation is aborted.
1346 1287 */
1347   - wlan = eeepc_wmi_get_devstate_simple(EEEPC_WMI_DEVID_WLAN);
1348   - eeepc_wmi_set_devstate(EEEPC_WMI_DEVID_WLAN, wlan, NULL);
  1288 + wlan = asus_wmi_get_devstate_simple(ASUS_WMI_DEVID_WLAN);
  1289 + asus_wmi_set_devstate(ASUS_WMI_DEVID_WLAN, wlan, NULL);
1349 1290 }
1350 1291  
1351 1292 return 0;
1352 1293 }
1353 1294  
1354   -static int eeepc_hotk_restore(struct device *device)
  1295 +static int asus_hotk_restore(struct device *device)
1355 1296 {
1356   - struct eeepc_wmi *eeepc = dev_get_drvdata(device);
  1297 + struct asus_wmi *asus = dev_get_drvdata(device);
1357 1298 int bl;
1358 1299  
1359 1300 /* Refresh both wlan rfkill state and pci hotplug */
1360   - if (eeepc->wlan_rfkill)
1361   - eeepc_rfkill_hotplug(eeepc);
  1301 + if (asus->wlan_rfkill)
  1302 + asus_rfkill_hotplug(asus);
1362 1303  
1363   - if (eeepc->bluetooth_rfkill) {
1364   - bl = !eeepc_wmi_get_devstate_simple(EEEPC_WMI_DEVID_BLUETOOTH);
1365   - rfkill_set_sw_state(eeepc->bluetooth_rfkill, bl);
  1304 + if (asus->bluetooth_rfkill) {
  1305 + bl = !asus_wmi_get_devstate_simple(ASUS_WMI_DEVID_BLUETOOTH);
  1306 + rfkill_set_sw_state(asus->bluetooth_rfkill, bl);
1366 1307 }
1367   - if (eeepc->wimax_rfkill) {
1368   - bl = !eeepc_wmi_get_devstate_simple(EEEPC_WMI_DEVID_WIMAX);
1369   - rfkill_set_sw_state(eeepc->wimax_rfkill, bl);
  1308 + if (asus->wimax_rfkill) {
  1309 + bl = !asus_wmi_get_devstate_simple(ASUS_WMI_DEVID_WIMAX);
  1310 + rfkill_set_sw_state(asus->wimax_rfkill, bl);
1370 1311 }
1371   - if (eeepc->wwan3g_rfkill) {
1372   - bl = !eeepc_wmi_get_devstate_simple(EEEPC_WMI_DEVID_WWAN3G);
1373   - rfkill_set_sw_state(eeepc->wwan3g_rfkill, bl);
  1312 + if (asus->wwan3g_rfkill) {
  1313 + bl = !asus_wmi_get_devstate_simple(ASUS_WMI_DEVID_WWAN3G);
  1314 + rfkill_set_sw_state(asus->wwan3g_rfkill, bl);
1374 1315 }
1375 1316  
1376 1317 return 0;
1377 1318 }
1378 1319  
1379   -static const struct dev_pm_ops eeepc_pm_ops = {
1380   - .thaw = eeepc_hotk_thaw,
1381   - .restore = eeepc_hotk_restore,
  1320 +static const struct dev_pm_ops asus_pm_ops = {
  1321 + .thaw = asus_hotk_thaw,
  1322 + .restore = asus_hotk_restore,
1382 1323 };
1383 1324  
1384   -static struct platform_driver platform_driver = {
1385   - .remove = __exit_p(eeepc_wmi_remove),
1386   - .driver = {
1387   - .name = EEEPC_WMI_FILE,
1388   - .owner = THIS_MODULE,
1389   - .pm = &eeepc_pm_ops,
1390   - },
1391   -};
1392   -
1393   -static acpi_status __init eeepc_wmi_parse_device(acpi_handle handle, u32 level,
1394   - void *context, void **retval)
  1325 +static int asus_wmi_probe(struct platform_device *pdev)
1395 1326 {
1396   - pr_warning("Found legacy ATKD device (%s)", EEEPC_ACPI_HID);
1397   - *(bool *)context = true;
1398   - return AE_CTRL_TERMINATE;
1399   -}
  1327 + struct platform_driver *pdrv = to_platform_driver(pdev->dev.driver);
  1328 + struct asus_wmi_driver *wdrv = to_asus_wmi_driver(pdrv);
  1329 + int ret;
1400 1330  
1401   -static int __init eeepc_wmi_check_atkd(void)
1402   -{
1403   - acpi_status status;
1404   - bool found = false;
1405   -
1406   - status = acpi_get_devices(EEEPC_ACPI_HID, eeepc_wmi_parse_device,
1407   - &found, NULL);
1408   -
1409   - if (ACPI_FAILURE(status) || !found)
1410   - return 0;
1411   - return -1;
1412   -}
1413   -
1414   -static int __init eeepc_wmi_probe(struct platform_device *pdev)
1415   -{
1416   - if (!wmi_has_guid(EEEPC_WMI_EVENT_GUID) ||
1417   - !wmi_has_guid(EEEPC_WMI_MGMT_GUID)) {
1418   - pr_warning("No known WMI GUID found\n");
  1331 + if (!wmi_has_guid(ASUS_WMI_MGMT_GUID)) {
  1332 + pr_warning("Management GUID not found\n");
1419 1333 return -ENODEV;
1420 1334 }
1421 1335  
1422   - if (eeepc_wmi_check_atkd()) {
1423   - pr_warning("WMI device present, but legacy ATKD device is also "
1424   - "present and enabled.");
1425   - pr_warning("You probably booted with acpi_osi=\"Linux\" or "
1426   - "acpi_osi=\"!Windows 2009\"");
1427   - pr_warning("Can't load eeepc-wmi, use default acpi_osi "
1428   - "(preferred) or eeepc-laptop");
  1336 + if (wdrv->event_guid && !wmi_has_guid(wdrv->event_guid)) {
  1337 + pr_warning("Event GUID not found\n");
1429 1338 return -ENODEV;
1430 1339 }
1431 1340  
1432   - return eeepc_wmi_add(pdev);
  1341 + if (wdrv->probe) {
  1342 + ret = wdrv->probe(pdev);
  1343 + if (ret)
  1344 + return ret;
  1345 + }
  1346 +
  1347 + return asus_wmi_add(pdev);
1433 1348 }
1434 1349  
1435   -static struct platform_device *platform_device;
  1350 +static bool used;
1436 1351  
1437   -static int __init eeepc_wmi_init(void)
  1352 +int asus_wmi_register_driver(struct asus_wmi_driver *driver)
1438 1353 {
1439   - platform_device = platform_create_bundle(&platform_driver,
1440   - eeepc_wmi_probe,
  1354 + struct platform_driver *platform_driver;
  1355 + struct platform_device *platform_device;
  1356 +
  1357 + if (used)
  1358 + return -EBUSY;
  1359 +
  1360 + platform_driver = &driver->platform_driver;
  1361 + platform_driver->remove = asus_wmi_remove;
  1362 + platform_driver->driver.owner = driver->owner;
  1363 + platform_driver->driver.name = driver->name;
  1364 + platform_driver->driver.pm = &asus_pm_ops;
  1365 +
  1366 + platform_device = platform_create_bundle(platform_driver,
  1367 + asus_wmi_probe,
1441 1368 NULL, 0, NULL, 0);
1442 1369 if (IS_ERR(platform_device))
1443 1370 return PTR_ERR(platform_device);
  1371 +
  1372 + used = true;
1444 1373 return 0;
1445 1374 }
  1375 +EXPORT_SYMBOL_GPL(asus_wmi_register_driver);
1446 1376  
1447   -static void __exit eeepc_wmi_exit(void)
  1377 +void asus_wmi_unregister_driver(struct asus_wmi_driver *driver)
1448 1378 {
1449   - platform_device_unregister(platform_device);
1450   - platform_driver_unregister(&platform_driver);
  1379 + platform_device_unregister(driver->platform_device);
  1380 + platform_driver_unregister(&driver->platform_driver);
  1381 + used = false;
1451 1382 }
  1383 +EXPORT_SYMBOL_GPL(asus_wmi_unregister_driver);
1452 1384  
1453   -module_init(eeepc_wmi_init);
1454   -module_exit(eeepc_wmi_exit);
  1385 +static int __init asus_wmi_init(void)
  1386 +{
  1387 + if (!wmi_has_guid(ASUS_WMI_MGMT_GUID)) {
  1388 + pr_info("Asus Management GUID not found");
  1389 + return -ENODEV;
  1390 + }
  1391 +
  1392 + pr_info("ASUS WMI generic driver loaded");
  1393 + return 0;
  1394 +}
  1395 +
  1396 +static void __exit asus_wmi_exit(void)
  1397 +{
  1398 + pr_info("ASUS WMI generic driver unloaded");
  1399 +}
  1400 +
  1401 +module_init(asus_wmi_init);
  1402 +module_exit(asus_wmi_exit);
drivers/platform/x86/asus-wmi.h
  1 +/*
  2 + * Asus PC WMI hotkey driver
  3 + *
  4 + * Copyright(C) 2010 Intel Corporation.
  5 + * Copyright(C) 2010-2011 Corentin Chary <corentin.chary@gmail.com>
  6 + *
  7 + * Portions based on wistron_btns.c:
  8 + * Copyright (C) 2005 Miloslav Trmac <mitr@volny.cz>
  9 + * Copyright (C) 2005 Bernhard Rosenkraenzer <bero@arklinux.org>
  10 + * Copyright (C) 2005 Dmitry Torokhov <dtor@mail.ru>
  11 + *
  12 + * This program is free software; you can redistribute it and/or modify
  13 + * it under the terms of the GNU General Public License as published by
  14 + * the Free Software Foundation; either version 2 of the License, or
  15 + * (at your option) any later version.
  16 + *
  17 + * This program is distributed in the hope that it will be useful,
  18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20 + * GNU General Public License for more details.
  21 + *
  22 + * You should have received a copy of the GNU General Public License
  23 + * along with this program; if not, write to the Free Software
  24 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  25 + */
  26 +
  27 +#ifndef _ASUS_WMI_H_
  28 +#define _ASUS_WMI_H_
  29 +
  30 +#include <linux/platform_device.h>
  31 +
  32 +struct module;
  33 +struct key_entry;
  34 +struct asus_wmi;
  35 +
  36 +struct asus_wmi_driver {
  37 + bool hotplug_wireless;
  38 +
  39 + const char *name;
  40 + struct module *owner;
  41 +
  42 + const char *event_guid;
  43 +
  44 + const struct key_entry *keymap;
  45 + const char *input_name;
  46 + const char *input_phys;
  47 +
  48 + int (*probe) (struct platform_device *device);
  49 + void (*quirks) (struct asus_wmi_driver *driver);
  50 +
  51 + struct platform_driver platform_driver;
  52 + struct platform_device *platform_device;
  53 +};
  54 +
  55 +int asus_wmi_register_driver(struct asus_wmi_driver *driver);
  56 +void asus_wmi_unregister_driver(struct asus_wmi_driver *driver);
  57 +
  58 +#endif /* !_ASUS_WMI_H_ */
drivers/platform/x86/eeepc-wmi.c
  1 +/*
  2 + * Eee PC WMI hotkey driver
  3 + *
  4 + * Copyright(C) 2010 Intel Corporation.
  5 + * Copyright(C) 2010 Corentin Chary <corentin.chary@gmail.com>
  6 + *
  7 + * Portions based on wistron_btns.c:
  8 + * Copyright (C) 2005 Miloslav Trmac <mitr@volny.cz>
  9 + * Copyright (C) 2005 Bernhard Rosenkraenzer <bero@arklinux.org>
  10 + * Copyright (C) 2005 Dmitry Torokhov <dtor@mail.ru>
  11 + *
  12 + * This program is free software; you can redistribute it and/or modify
  13 + * it under the terms of the GNU General Public License as published by
  14 + * the Free Software Foundation; either version 2 of the License, or
  15 + * (at your option) any later version.
  16 + *
  17 + * This program is distributed in the hope that it will be useful,
  18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20 + * GNU General Public License for more details.
  21 + *
  22 + * You should have received a copy of the GNU General Public License
  23 + * along with this program; if not, write to the Free Software
  24 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  25 + */
  26 +
  27 +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  28 +
  29 +#include <linux/kernel.h>
  30 +#include <linux/module.h>
  31 +#include <linux/init.h>
  32 +#include <linux/input.h>
  33 +#include <linux/input/sparse-keymap.h>
  34 +#include <linux/dmi.h>
  35 +#include <acpi/acpi_bus.h>
  36 +
  37 +#include "asus-wmi.h"
  38 +
  39 +#define EEEPC_WMI_FILE "eeepc-wmi"
  40 +
  41 +MODULE_AUTHOR("Corentin Chary <corentincj@iksaif.net>");
  42 +MODULE_DESCRIPTION("Eee PC WMI Hotkey Driver");
  43 +MODULE_LICENSE("GPL");
  44 +
  45 +#define EEEPC_ACPI_HID "ASUS010" /* old _HID used in eeepc-laptop */
  46 +
  47 +#define EEEPC_WMI_EVENT_GUID "ABBC0F72-8EA1-11D1-00A0-C90629100000"
  48 +
  49 +MODULE_ALIAS("wmi:"EEEPC_WMI_EVENT_GUID);
  50 +
  51 +static bool hotplug_wireless;
  52 +
  53 +module_param(hotplug_wireless, bool, 0444);
  54 +MODULE_PARM_DESC(hotplug_wireless,
  55 + "Enable hotplug for wireless device. "
  56 + "If your laptop needs that, please report to "
  57 + "acpi4asus-user@lists.sourceforge.net.");
  58 +
  59 +static const struct key_entry eeepc_wmi_keymap[] = {
  60 + /* Sleep already handled via generic ACPI code */
  61 + { KE_KEY, 0x30, { KEY_VOLUMEUP } },
  62 + { KE_KEY, 0x31, { KEY_VOLUMEDOWN } },
  63 + { KE_KEY, 0x32, { KEY_MUTE } },
  64 + { KE_KEY, 0x5c, { KEY_F15 } }, /* Power Gear key */
  65 + { KE_KEY, 0x5d, { KEY_WLAN } },
  66 + { KE_KEY, 0x6b, { KEY_F13 } }, /* Disable Touchpad */
  67 + { KE_KEY, 0x82, { KEY_CAMERA } },
  68 + { KE_KEY, 0x88, { KEY_WLAN } },
  69 + { KE_KEY, 0xcc, { KEY_SWITCHVIDEOMODE } },
  70 + { KE_KEY, 0xe0, { KEY_PROG1 } }, /* Task Manager */
  71 + { KE_KEY, 0xe1, { KEY_F14 } }, /* Change Resolution */
  72 + { KE_KEY, 0xe9, { KEY_BRIGHTNESS_ZERO } },
  73 + { KE_END, 0},
  74 +};
  75 +
  76 +static acpi_status eeepc_wmi_parse_device(acpi_handle handle, u32 level,
  77 + void *context, void **retval)
  78 +{
  79 + pr_warning("Found legacy ATKD device (%s)", EEEPC_ACPI_HID);
  80 + *(bool *)context = true;
  81 + return AE_CTRL_TERMINATE;
  82 +}
  83 +
  84 +static int eeepc_wmi_check_atkd(void)
  85 +{
  86 + acpi_status status;
  87 + bool found = false;
  88 +
  89 + status = acpi_get_devices(EEEPC_ACPI_HID, eeepc_wmi_parse_device,
  90 + &found, NULL);
  91 +
  92 + if (ACPI_FAILURE(status) || !found)
  93 + return 0;
  94 + return -1;
  95 +}
  96 +
  97 +static int eeepc_wmi_probe(struct platform_device *pdev)
  98 +{
  99 + if (eeepc_wmi_check_atkd()) {
  100 + pr_warning("WMI device present, but legacy ATKD device is also "
  101 + "present and enabled.");
  102 + pr_warning("You probably booted with acpi_osi=\"Linux\" or "
  103 + "acpi_osi=\"!Windows 2009\"");
  104 + pr_warning("Can't load eeepc-wmi, use default acpi_osi "
  105 + "(preferred) or eeepc-laptop");
  106 + return -EBUSY;
  107 + }
  108 + return 0;
  109 +}
  110 +
  111 +static void eeepc_dmi_check(struct asus_wmi_driver *driver)
  112 +{
  113 + const char *model;
  114 +
  115 + model = dmi_get_system_info(DMI_PRODUCT_NAME);
  116 + if (!model)
  117 + return;
  118 +
  119 + /*
  120 + * Whitelist for wlan hotplug
  121 + *
  122 + * Asus 1000H needs the current hotplug code to handle
  123 + * Fn+F2 correctly. We may add other Asus here later, but
  124 + * it seems that most of the laptops supported by asus-wmi
  125 + * don't need to be on this list
  126 + */
  127 + if (strcmp(model, "1000H") == 0) {
  128 + driver->hotplug_wireless = true;
  129 + pr_info("wlan hotplug enabled\n");
  130 + }
  131 +}
  132 +
  133 +static void eeepc_wmi_quirks(struct asus_wmi_driver *driver)
  134 +{
  135 + driver->hotplug_wireless = hotplug_wireless;
  136 + eeepc_dmi_check(driver);
  137 +}
  138 +
  139 +static struct asus_wmi_driver asus_wmi_driver = {
  140 + .name = EEEPC_WMI_FILE,
  141 + .owner = THIS_MODULE,
  142 + .event_guid = EEEPC_WMI_EVENT_GUID,
  143 + .keymap = eeepc_wmi_keymap,
  144 + .input_name = "Eee PC WMI hotkeys",
  145 + .input_phys = EEEPC_WMI_FILE "/input0",
  146 + .probe = eeepc_wmi_probe,
  147 + .quirks = eeepc_wmi_quirks,
  148 +};
  149 +
  150 +
  151 +static int __init eeepc_wmi_init(void)
  152 +{
  153 + return asus_wmi_register_driver(&asus_wmi_driver);
  154 +}
  155 +
  156 +static void __exit eeepc_wmi_exit(void)
  157 +{
  158 + asus_wmi_unregister_driver(&asus_wmi_driver);
  159 +}
  160 +
  161 +module_init(eeepc_wmi_init);
  162 +module_exit(eeepc_wmi_exit);