]>
Commit | Line | Data |
---|---|---|
ad8f07cc MG |
1 | /* |
2 | * Driver for Dell laptop extras | |
3 | * | |
4 | * Copyright (c) Red Hat <mjg@redhat.com> | |
5 | * | |
6 | * Based on documentation in the libsmbios package, Copyright (C) 2005 Dell | |
7 | * Inc. | |
8 | * | |
9 | * This program is free software; you can redistribute it and/or modify | |
10 | * it under the terms of the GNU General Public License version 2 as | |
11 | * published by the Free Software Foundation. | |
12 | */ | |
13 | ||
14 | #include <linux/module.h> | |
15 | #include <linux/kernel.h> | |
16 | #include <linux/init.h> | |
17 | #include <linux/platform_device.h> | |
18 | #include <linux/backlight.h> | |
19 | #include <linux/err.h> | |
20 | #include <linux/dmi.h> | |
21 | #include <linux/io.h> | |
22 | #include <linux/rfkill.h> | |
23 | #include <linux/power_supply.h> | |
24 | #include <linux/acpi.h> | |
116ee77b | 25 | #include <linux/mm.h> |
814cb8ad | 26 | #include <linux/i8042.h> |
cad73120 | 27 | #include "../../firmware/dcdbas.h" |
ad8f07cc MG |
28 | |
29 | #define BRIGHTNESS_TOKEN 0x7d | |
30 | ||
31 | /* This structure will be modified by the firmware when we enter | |
32 | * system management mode, hence the volatiles */ | |
33 | ||
34 | struct calling_interface_buffer { | |
35 | u16 class; | |
36 | u16 select; | |
37 | volatile u32 input[4]; | |
38 | volatile u32 output[4]; | |
39 | } __packed; | |
40 | ||
41 | struct calling_interface_token { | |
42 | u16 tokenID; | |
43 | u16 location; | |
44 | union { | |
45 | u16 value; | |
46 | u16 stringlength; | |
47 | }; | |
48 | }; | |
49 | ||
50 | struct calling_interface_structure { | |
51 | struct dmi_header header; | |
52 | u16 cmdIOAddress; | |
53 | u8 cmdIOCode; | |
54 | u32 supportedCmds; | |
55 | struct calling_interface_token tokens[]; | |
56 | } __packed; | |
57 | ||
58 | static int da_command_address; | |
59 | static int da_command_code; | |
60 | static int da_num_tokens; | |
61 | static struct calling_interface_token *da_tokens; | |
62 | ||
ada3248a AJ |
63 | static struct platform_driver platform_driver = { |
64 | .driver = { | |
65 | .name = "dell-laptop", | |
66 | .owner = THIS_MODULE, | |
67 | } | |
68 | }; | |
69 | ||
70 | static struct platform_device *platform_device; | |
ad8f07cc MG |
71 | static struct backlight_device *dell_backlight_device; |
72 | static struct rfkill *wifi_rfkill; | |
73 | static struct rfkill *bluetooth_rfkill; | |
74 | static struct rfkill *wwan_rfkill; | |
75 | ||
76 | static const struct dmi_system_id __initdata dell_device_table[] = { | |
77 | { | |
78 | .ident = "Dell laptop", | |
79 | .matches = { | |
80 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | |
81 | DMI_MATCH(DMI_CHASSIS_TYPE, "8"), | |
82 | }, | |
83 | }, | |
84 | { } | |
85 | }; | |
86 | ||
e5fefd0c ML |
87 | static struct dmi_system_id __devinitdata dell_blacklist[] = { |
88 | /* Supported by compal-laptop */ | |
89 | { | |
90 | .ident = "Dell Mini 9", | |
91 | .matches = { | |
92 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | |
93 | DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 910"), | |
94 | }, | |
95 | }, | |
96 | { | |
97 | .ident = "Dell Mini 10", | |
98 | .matches = { | |
99 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | |
100 | DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1010"), | |
101 | }, | |
102 | }, | |
103 | { | |
104 | .ident = "Dell Mini 10v", | |
105 | .matches = { | |
106 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | |
107 | DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1011"), | |
108 | }, | |
109 | }, | |
110 | { | |
111 | .ident = "Dell Inspiron 11z", | |
112 | .matches = { | |
113 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | |
114 | DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1110"), | |
115 | }, | |
116 | }, | |
117 | { | |
118 | .ident = "Dell Mini 12", | |
119 | .matches = { | |
120 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | |
121 | DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1210"), | |
122 | }, | |
123 | }, | |
124 | {} | |
125 | }; | |
126 | ||
116ee77b SH |
127 | static struct calling_interface_buffer *buffer; |
128 | struct page *bufferpage; | |
129 | DEFINE_MUTEX(buffer_mutex); | |
130 | ||
c6760ac4 MG |
131 | static int hwswitch_state; |
132 | ||
116ee77b SH |
133 | static void get_buffer(void) |
134 | { | |
135 | mutex_lock(&buffer_mutex); | |
136 | memset(buffer, 0, sizeof(struct calling_interface_buffer)); | |
137 | } | |
138 | ||
139 | static void release_buffer(void) | |
140 | { | |
141 | mutex_unlock(&buffer_mutex); | |
142 | } | |
143 | ||
4788df4c | 144 | static void __init parse_da_table(const struct dmi_header *dm) |
ad8f07cc MG |
145 | { |
146 | /* Final token is a terminator, so we don't want to copy it */ | |
147 | int tokens = (dm->length-11)/sizeof(struct calling_interface_token)-1; | |
148 | struct calling_interface_structure *table = | |
149 | container_of(dm, struct calling_interface_structure, header); | |
150 | ||
151 | /* 4 bytes of table header, plus 7 bytes of Dell header, plus at least | |
152 | 6 bytes of entry */ | |
153 | ||
154 | if (dm->length < 17) | |
155 | return; | |
156 | ||
157 | da_command_address = table->cmdIOAddress; | |
158 | da_command_code = table->cmdIOCode; | |
159 | ||
160 | da_tokens = krealloc(da_tokens, (da_num_tokens + tokens) * | |
161 | sizeof(struct calling_interface_token), | |
162 | GFP_KERNEL); | |
163 | ||
164 | if (!da_tokens) | |
165 | return; | |
166 | ||
167 | memcpy(da_tokens+da_num_tokens, table->tokens, | |
168 | sizeof(struct calling_interface_token) * tokens); | |
169 | ||
170 | da_num_tokens += tokens; | |
171 | } | |
172 | ||
4788df4c | 173 | static void __init find_tokens(const struct dmi_header *dm, void *dummy) |
ad8f07cc MG |
174 | { |
175 | switch (dm->type) { | |
176 | case 0xd4: /* Indexed IO */ | |
177 | break; | |
178 | case 0xd5: /* Protected Area Type 1 */ | |
179 | break; | |
180 | case 0xd6: /* Protected Area Type 2 */ | |
181 | break; | |
182 | case 0xda: /* Calling interface */ | |
183 | parse_da_table(dm); | |
184 | break; | |
185 | } | |
186 | } | |
187 | ||
188 | static int find_token_location(int tokenid) | |
189 | { | |
190 | int i; | |
191 | for (i = 0; i < da_num_tokens; i++) { | |
192 | if (da_tokens[i].tokenID == tokenid) | |
193 | return da_tokens[i].location; | |
194 | } | |
195 | ||
196 | return -1; | |
197 | } | |
198 | ||
199 | static struct calling_interface_buffer * | |
200 | dell_send_request(struct calling_interface_buffer *buffer, int class, | |
201 | int select) | |
202 | { | |
203 | struct smi_cmd command; | |
204 | ||
205 | command.magic = SMI_CMD_MAGIC; | |
206 | command.command_address = da_command_address; | |
207 | command.command_code = da_command_code; | |
208 | command.ebx = virt_to_phys(buffer); | |
209 | command.ecx = 0x42534931; | |
210 | ||
211 | buffer->class = class; | |
212 | buffer->select = select; | |
213 | ||
214 | dcdbas_smi_request(&command); | |
215 | ||
216 | return buffer; | |
217 | } | |
218 | ||
219 | /* Derived from information in DellWirelessCtl.cpp: | |
220 | Class 17, select 11 is radio control. It returns an array of 32-bit values. | |
221 | ||
c6760ac4 MG |
222 | Input byte 0 = 0: Wireless information |
223 | ||
ad8f07cc MG |
224 | result[0]: return code |
225 | result[1]: | |
226 | Bit 0: Hardware switch supported | |
227 | Bit 1: Wifi locator supported | |
228 | Bit 2: Wifi is supported | |
229 | Bit 3: Bluetooth is supported | |
230 | Bit 4: WWAN is supported | |
231 | Bit 5: Wireless keyboard supported | |
232 | Bits 6-7: Reserved | |
233 | Bit 8: Wifi is installed | |
234 | Bit 9: Bluetooth is installed | |
235 | Bit 10: WWAN is installed | |
236 | Bits 11-15: Reserved | |
237 | Bit 16: Hardware switch is on | |
238 | Bit 17: Wifi is blocked | |
239 | Bit 18: Bluetooth is blocked | |
240 | Bit 19: WWAN is blocked | |
241 | Bits 20-31: Reserved | |
242 | result[2]: NVRAM size in bytes | |
243 | result[3]: NVRAM format version number | |
c6760ac4 MG |
244 | |
245 | Input byte 0 = 2: Wireless switch configuration | |
246 | result[0]: return code | |
247 | result[1]: | |
248 | Bit 0: Wifi controlled by switch | |
249 | Bit 1: Bluetooth controlled by switch | |
250 | Bit 2: WWAN controlled by switch | |
251 | Bits 3-6: Reserved | |
252 | Bit 7: Wireless switch config locked | |
253 | Bit 8: Wifi locator enabled | |
254 | Bits 9-14: Reserved | |
255 | Bit 15: Wifi locator setting locked | |
256 | Bits 16-31: Reserved | |
ad8f07cc MG |
257 | */ |
258 | ||
19d337df | 259 | static int dell_rfkill_set(void *data, bool blocked) |
ad8f07cc | 260 | { |
624f0de4 | 261 | int disable = blocked ? 1 : 0; |
19d337df | 262 | unsigned long radio = (unsigned long)data; |
c6760ac4 | 263 | int hwswitch_bit = (unsigned long)data - 1; |
116ee77b | 264 | int ret = 0; |
ad8f07cc | 265 | |
116ee77b SH |
266 | get_buffer(); |
267 | dell_send_request(buffer, 17, 11); | |
ec1722a2 | 268 | |
c6760ac4 MG |
269 | /* If the hardware switch controls this radio, and the hardware |
270 | switch is disabled, don't allow changing the software state */ | |
271 | if ((hwswitch_state & BIT(hwswitch_bit)) && | |
272 | !(buffer->output[1] & BIT(16))) { | |
116ee77b SH |
273 | ret = -EINVAL; |
274 | goto out; | |
275 | } | |
ad8f07cc | 276 | |
116ee77b SH |
277 | buffer->input[0] = (1 | (radio<<8) | (disable << 16)); |
278 | dell_send_request(buffer, 17, 11); | |
279 | ||
280 | out: | |
281 | release_buffer(); | |
282 | return ret; | |
ad8f07cc MG |
283 | } |
284 | ||
19d337df | 285 | static void dell_rfkill_query(struct rfkill *rfkill, void *data) |
ad8f07cc | 286 | { |
ad8f07cc | 287 | int status; |
19d337df | 288 | int bit = (unsigned long)data + 16; |
c6760ac4 | 289 | int hwswitch_bit = (unsigned long)data - 1; |
ad8f07cc | 290 | |
116ee77b SH |
291 | get_buffer(); |
292 | dell_send_request(buffer, 17, 11); | |
293 | status = buffer->output[1]; | |
294 | release_buffer(); | |
ad8f07cc | 295 | |
e1fbf346 | 296 | rfkill_set_sw_state(rfkill, !!(status & BIT(bit))); |
c6760ac4 MG |
297 | |
298 | if (hwswitch_state & (BIT(hwswitch_bit))) | |
299 | rfkill_set_hw_state(rfkill, !(status & BIT(16))); | |
ad8f07cc MG |
300 | } |
301 | ||
19d337df JB |
302 | static const struct rfkill_ops dell_rfkill_ops = { |
303 | .set_block = dell_rfkill_set, | |
304 | .query = dell_rfkill_query, | |
305 | }; | |
ad8f07cc | 306 | |
814cb8ad MG |
307 | static void dell_update_rfkill(struct work_struct *ignored) |
308 | { | |
309 | if (wifi_rfkill) | |
310 | dell_rfkill_query(wifi_rfkill, (void *)1); | |
311 | if (bluetooth_rfkill) | |
312 | dell_rfkill_query(bluetooth_rfkill, (void *)2); | |
313 | if (wwan_rfkill) | |
314 | dell_rfkill_query(wwan_rfkill, (void *)3); | |
315 | } | |
316 | static DECLARE_DELAYED_WORK(dell_rfkill_work, dell_update_rfkill); | |
317 | ||
318 | ||
4788df4c | 319 | static int __init dell_setup_rfkill(void) |
ad8f07cc | 320 | { |
ad8f07cc MG |
321 | int status; |
322 | int ret; | |
323 | ||
e5fefd0c ML |
324 | if (dmi_check_system(dell_blacklist)) { |
325 | printk(KERN_INFO "dell-laptop: Blacklisted hardware detected - " | |
326 | "not enabling rfkill\n"); | |
327 | return 0; | |
328 | } | |
329 | ||
116ee77b SH |
330 | get_buffer(); |
331 | dell_send_request(buffer, 17, 11); | |
332 | status = buffer->output[1]; | |
c6760ac4 MG |
333 | buffer->input[0] = 0x2; |
334 | dell_send_request(buffer, 17, 11); | |
335 | hwswitch_state = buffer->output[1]; | |
116ee77b | 336 | release_buffer(); |
ad8f07cc MG |
337 | |
338 | if ((status & (1<<2|1<<8)) == (1<<2|1<<8)) { | |
ada3248a AJ |
339 | wifi_rfkill = rfkill_alloc("dell-wifi", &platform_device->dev, |
340 | RFKILL_TYPE_WLAN, | |
19d337df JB |
341 | &dell_rfkill_ops, (void *) 1); |
342 | if (!wifi_rfkill) { | |
343 | ret = -ENOMEM; | |
ad8f07cc | 344 | goto err_wifi; |
19d337df | 345 | } |
ad8f07cc MG |
346 | ret = rfkill_register(wifi_rfkill); |
347 | if (ret) | |
348 | goto err_wifi; | |
349 | } | |
350 | ||
351 | if ((status & (1<<3|1<<9)) == (1<<3|1<<9)) { | |
ada3248a AJ |
352 | bluetooth_rfkill = rfkill_alloc("dell-bluetooth", |
353 | &platform_device->dev, | |
19d337df JB |
354 | RFKILL_TYPE_BLUETOOTH, |
355 | &dell_rfkill_ops, (void *) 2); | |
356 | if (!bluetooth_rfkill) { | |
357 | ret = -ENOMEM; | |
ad8f07cc | 358 | goto err_bluetooth; |
19d337df | 359 | } |
ad8f07cc MG |
360 | ret = rfkill_register(bluetooth_rfkill); |
361 | if (ret) | |
362 | goto err_bluetooth; | |
363 | } | |
364 | ||
365 | if ((status & (1<<4|1<<10)) == (1<<4|1<<10)) { | |
ada3248a AJ |
366 | wwan_rfkill = rfkill_alloc("dell-wwan", |
367 | &platform_device->dev, | |
368 | RFKILL_TYPE_WWAN, | |
19d337df JB |
369 | &dell_rfkill_ops, (void *) 3); |
370 | if (!wwan_rfkill) { | |
371 | ret = -ENOMEM; | |
ad8f07cc | 372 | goto err_wwan; |
19d337df | 373 | } |
ad8f07cc MG |
374 | ret = rfkill_register(wwan_rfkill); |
375 | if (ret) | |
376 | goto err_wwan; | |
377 | } | |
378 | ||
379 | return 0; | |
380 | err_wwan: | |
19d337df JB |
381 | rfkill_destroy(wwan_rfkill); |
382 | if (bluetooth_rfkill) | |
ad8f07cc | 383 | rfkill_unregister(bluetooth_rfkill); |
ad8f07cc | 384 | err_bluetooth: |
19d337df JB |
385 | rfkill_destroy(bluetooth_rfkill); |
386 | if (wifi_rfkill) | |
ad8f07cc | 387 | rfkill_unregister(wifi_rfkill); |
ad8f07cc | 388 | err_wifi: |
19d337df | 389 | rfkill_destroy(wifi_rfkill); |
ad8f07cc MG |
390 | |
391 | return ret; | |
392 | } | |
393 | ||
4311bb23 AJ |
394 | static void dell_cleanup_rfkill(void) |
395 | { | |
396 | if (wifi_rfkill) { | |
397 | rfkill_unregister(wifi_rfkill); | |
398 | rfkill_destroy(wifi_rfkill); | |
399 | } | |
400 | if (bluetooth_rfkill) { | |
401 | rfkill_unregister(bluetooth_rfkill); | |
402 | rfkill_destroy(bluetooth_rfkill); | |
403 | } | |
404 | if (wwan_rfkill) { | |
405 | rfkill_unregister(wwan_rfkill); | |
406 | rfkill_destroy(wwan_rfkill); | |
407 | } | |
408 | } | |
409 | ||
ad8f07cc MG |
410 | static int dell_send_intensity(struct backlight_device *bd) |
411 | { | |
116ee77b | 412 | int ret = 0; |
ad8f07cc | 413 | |
116ee77b SH |
414 | get_buffer(); |
415 | buffer->input[0] = find_token_location(BRIGHTNESS_TOKEN); | |
416 | buffer->input[1] = bd->props.brightness; | |
ad8f07cc | 417 | |
116ee77b SH |
418 | if (buffer->input[0] == -1) { |
419 | ret = -ENODEV; | |
420 | goto out; | |
421 | } | |
ad8f07cc MG |
422 | |
423 | if (power_supply_is_system_supplied() > 0) | |
116ee77b | 424 | dell_send_request(buffer, 1, 2); |
ad8f07cc | 425 | else |
116ee77b | 426 | dell_send_request(buffer, 1, 1); |
ad8f07cc | 427 | |
116ee77b SH |
428 | out: |
429 | release_buffer(); | |
ad8f07cc MG |
430 | return 0; |
431 | } | |
432 | ||
433 | static int dell_get_intensity(struct backlight_device *bd) | |
434 | { | |
116ee77b | 435 | int ret = 0; |
ad8f07cc | 436 | |
116ee77b SH |
437 | get_buffer(); |
438 | buffer->input[0] = find_token_location(BRIGHTNESS_TOKEN); | |
ad8f07cc | 439 | |
116ee77b SH |
440 | if (buffer->input[0] == -1) { |
441 | ret = -ENODEV; | |
442 | goto out; | |
443 | } | |
ad8f07cc MG |
444 | |
445 | if (power_supply_is_system_supplied() > 0) | |
116ee77b | 446 | dell_send_request(buffer, 0, 2); |
ad8f07cc | 447 | else |
116ee77b | 448 | dell_send_request(buffer, 0, 1); |
ad8f07cc | 449 | |
116ee77b SH |
450 | out: |
451 | release_buffer(); | |
452 | if (ret) | |
453 | return ret; | |
454 | return buffer->output[1]; | |
ad8f07cc MG |
455 | } |
456 | ||
457 | static struct backlight_ops dell_ops = { | |
458 | .get_brightness = dell_get_intensity, | |
459 | .update_status = dell_send_intensity, | |
460 | }; | |
461 | ||
814cb8ad MG |
462 | bool dell_laptop_i8042_filter(unsigned char data, unsigned char str, |
463 | struct serio *port) | |
464 | { | |
465 | static bool extended; | |
466 | ||
467 | if (str & 0x20) | |
468 | return false; | |
469 | ||
470 | if (unlikely(data == 0xe0)) { | |
471 | extended = true; | |
472 | return false; | |
473 | } else if (unlikely(extended)) { | |
474 | switch (data) { | |
475 | case 0x8: | |
476 | schedule_delayed_work(&dell_rfkill_work, | |
477 | round_jiffies_relative(HZ)); | |
478 | break; | |
479 | } | |
480 | extended = false; | |
481 | } | |
482 | ||
483 | return false; | |
484 | } | |
485 | ||
ad8f07cc MG |
486 | static int __init dell_init(void) |
487 | { | |
ad8f07cc MG |
488 | int max_intensity = 0; |
489 | int ret; | |
490 | ||
491 | if (!dmi_check_system(dell_device_table)) | |
492 | return -ENODEV; | |
493 | ||
e7a19c56 | 494 | dmi_walk(find_tokens, NULL); |
ad8f07cc MG |
495 | |
496 | if (!da_tokens) { | |
497 | printk(KERN_INFO "dell-laptop: Unable to find dmi tokens\n"); | |
498 | return -ENODEV; | |
499 | } | |
500 | ||
ada3248a AJ |
501 | ret = platform_driver_register(&platform_driver); |
502 | if (ret) | |
503 | goto fail_platform_driver; | |
504 | platform_device = platform_device_alloc("dell-laptop", -1); | |
505 | if (!platform_device) { | |
506 | ret = -ENOMEM; | |
507 | goto fail_platform_device1; | |
508 | } | |
509 | ret = platform_device_add(platform_device); | |
510 | if (ret) | |
511 | goto fail_platform_device2; | |
512 | ||
116ee77b SH |
513 | /* |
514 | * Allocate buffer below 4GB for SMI data--only 32-bit physical addr | |
515 | * is passed to SMI handler. | |
516 | */ | |
517 | bufferpage = alloc_page(GFP_KERNEL | GFP_DMA32); | |
518 | ||
519 | if (!bufferpage) | |
520 | goto fail_buffer; | |
521 | buffer = page_address(bufferpage); | |
522 | mutex_init(&buffer_mutex); | |
523 | ||
ad8f07cc MG |
524 | ret = dell_setup_rfkill(); |
525 | ||
526 | if (ret) { | |
527 | printk(KERN_WARNING "dell-laptop: Unable to setup rfkill\n"); | |
71e9dc73 | 528 | goto fail_rfkill; |
ad8f07cc MG |
529 | } |
530 | ||
814cb8ad MG |
531 | ret = i8042_install_filter(dell_laptop_i8042_filter); |
532 | if (ret) { | |
533 | printk(KERN_WARNING | |
534 | "dell-laptop: Unable to install key filter\n"); | |
535 | goto fail_filter; | |
536 | } | |
537 | ||
ad8f07cc MG |
538 | #ifdef CONFIG_ACPI |
539 | /* In the event of an ACPI backlight being available, don't | |
540 | * register the platform controller. | |
541 | */ | |
542 | if (acpi_video_backlight_support()) | |
543 | return 0; | |
544 | #endif | |
545 | ||
116ee77b SH |
546 | get_buffer(); |
547 | buffer->input[0] = find_token_location(BRIGHTNESS_TOKEN); | |
548 | if (buffer->input[0] != -1) { | |
549 | dell_send_request(buffer, 0, 2); | |
550 | max_intensity = buffer->output[3]; | |
ad8f07cc | 551 | } |
116ee77b | 552 | release_buffer(); |
ad8f07cc MG |
553 | |
554 | if (max_intensity) { | |
555 | dell_backlight_device = backlight_device_register( | |
556 | "dell_backlight", | |
ada3248a | 557 | &platform_device->dev, NULL, |
ad8f07cc MG |
558 | &dell_ops); |
559 | ||
560 | if (IS_ERR(dell_backlight_device)) { | |
561 | ret = PTR_ERR(dell_backlight_device); | |
562 | dell_backlight_device = NULL; | |
71e9dc73 | 563 | goto fail_backlight; |
ad8f07cc MG |
564 | } |
565 | ||
566 | dell_backlight_device->props.max_brightness = max_intensity; | |
567 | dell_backlight_device->props.brightness = | |
568 | dell_get_intensity(dell_backlight_device); | |
569 | backlight_update_status(dell_backlight_device); | |
570 | } | |
571 | ||
572 | return 0; | |
71e9dc73 AJ |
573 | |
574 | fail_backlight: | |
814cb8ad MG |
575 | i8042_remove_filter(dell_laptop_i8042_filter); |
576 | fail_filter: | |
4311bb23 | 577 | dell_cleanup_rfkill(); |
71e9dc73 | 578 | fail_rfkill: |
116ee77b SH |
579 | free_page((unsigned long)bufferpage); |
580 | fail_buffer: | |
ada3248a AJ |
581 | platform_device_del(platform_device); |
582 | fail_platform_device2: | |
583 | platform_device_put(platform_device); | |
584 | fail_platform_device1: | |
585 | platform_driver_unregister(&platform_driver); | |
586 | fail_platform_driver: | |
ad8f07cc MG |
587 | kfree(da_tokens); |
588 | return ret; | |
589 | } | |
590 | ||
591 | static void __exit dell_exit(void) | |
592 | { | |
814cb8ad MG |
593 | cancel_delayed_work_sync(&dell_rfkill_work); |
594 | i8042_remove_filter(dell_laptop_i8042_filter); | |
ad8f07cc | 595 | backlight_device_unregister(dell_backlight_device); |
4311bb23 | 596 | dell_cleanup_rfkill(); |
facd61d7 MG |
597 | if (platform_device) { |
598 | platform_device_del(platform_device); | |
599 | platform_driver_unregister(&platform_driver); | |
600 | } | |
e551260b | 601 | kfree(da_tokens); |
116ee77b | 602 | free_page((unsigned long)buffer); |
ad8f07cc MG |
603 | } |
604 | ||
605 | module_init(dell_init); | |
606 | module_exit(dell_exit); | |
607 | ||
608 | MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>"); | |
609 | MODULE_DESCRIPTION("Dell laptop driver"); | |
610 | MODULE_LICENSE("GPL"); | |
611 | MODULE_ALIAS("dmi:*svnDellInc.:*:ct8:*"); |