2 * Driver for Dell laptop extras
4 * Copyright (c) Red Hat <mjg@redhat.com>
6 * Based on documentation in the libsmbios package, Copyright (C) 2005 Dell
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.
14 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
16 #include <linux/module.h>
17 #include <linux/kernel.h>
18 #include <linux/init.h>
19 #include <linux/platform_device.h>
20 #include <linux/backlight.h>
21 #include <linux/err.h>
22 #include <linux/dmi.h>
24 #include <linux/rfkill.h>
25 #include <linux/power_supply.h>
26 #include <linux/acpi.h>
28 #include <linux/i8042.h>
29 #include <linux/slab.h>
30 #include <linux/debugfs.h>
31 #include <linux/seq_file.h>
32 #include "../../firmware/dcdbas.h"
34 #define BRIGHTNESS_TOKEN 0x7d
36 /* This structure will be modified by the firmware when we enter
37 * system management mode, hence the volatiles */
39 struct calling_interface_buffer
{
42 volatile u32 input
[4];
43 volatile u32 output
[4];
46 struct calling_interface_token
{
55 struct calling_interface_structure
{
56 struct dmi_header header
;
60 struct calling_interface_token tokens
[];
67 static struct quirk_entry
*quirks
;
69 static struct quirk_entry quirk_dell_vostro_v130
= {
73 static int dmi_matched(const struct dmi_system_id
*dmi
)
75 quirks
= dmi
->driver_data
;
79 static int da_command_address
;
80 static int da_command_code
;
81 static int da_num_tokens
;
82 static struct calling_interface_token
*da_tokens
;
84 static struct platform_driver platform_driver
= {
86 .name
= "dell-laptop",
91 static struct platform_device
*platform_device
;
92 static struct backlight_device
*dell_backlight_device
;
93 static struct rfkill
*wifi_rfkill
;
94 static struct rfkill
*bluetooth_rfkill
;
95 static struct rfkill
*wwan_rfkill
;
96 static bool force_rfkill
;
98 module_param(force_rfkill
, bool, 0444);
99 MODULE_PARM_DESC(force_rfkill
, "enable rfkill on non whitelisted models");
101 static const struct dmi_system_id dell_device_table
[] __initconst
= {
103 .ident
= "Dell laptop",
105 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
106 DMI_MATCH(DMI_CHASSIS_TYPE
, "8"),
111 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
112 DMI_MATCH(DMI_CHASSIS_TYPE
, "9"), /*Laptop*/
116 .ident
= "Dell Computer Corporation",
118 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Computer Corporation"),
119 DMI_MATCH(DMI_CHASSIS_TYPE
, "8"),
124 MODULE_DEVICE_TABLE(dmi
, dell_device_table
);
126 static struct dmi_system_id dell_quirks
[] = {
128 .callback
= dmi_matched
,
129 .ident
= "Dell Vostro V130",
131 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
132 DMI_MATCH(DMI_PRODUCT_NAME
, "Vostro V130"),
134 .driver_data
= &quirk_dell_vostro_v130
,
137 .callback
= dmi_matched
,
138 .ident
= "Dell Vostro V131",
140 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
141 DMI_MATCH(DMI_PRODUCT_NAME
, "Vostro V131"),
143 .driver_data
= &quirk_dell_vostro_v130
,
146 .callback
= dmi_matched
,
147 .ident
= "Dell Vostro 3350",
149 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
150 DMI_MATCH(DMI_PRODUCT_NAME
, "Vostro 3350"),
152 .driver_data
= &quirk_dell_vostro_v130
,
155 .callback
= dmi_matched
,
156 .ident
= "Dell Vostro 3555",
158 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
159 DMI_MATCH(DMI_PRODUCT_NAME
, "Vostro 3555"),
161 .driver_data
= &quirk_dell_vostro_v130
,
164 .callback
= dmi_matched
,
165 .ident
= "Dell Inspiron N311z",
167 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
168 DMI_MATCH(DMI_PRODUCT_NAME
, "Inspiron N311z"),
170 .driver_data
= &quirk_dell_vostro_v130
,
173 .callback
= dmi_matched
,
174 .ident
= "Dell Inspiron M5110",
176 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
177 DMI_MATCH(DMI_PRODUCT_NAME
, "Inspiron M5110"),
179 .driver_data
= &quirk_dell_vostro_v130
,
182 .callback
= dmi_matched
,
183 .ident
= "Dell Vostro 3360",
185 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
186 DMI_MATCH(DMI_PRODUCT_NAME
, "Vostro 3360"),
188 .driver_data
= &quirk_dell_vostro_v130
,
191 .callback
= dmi_matched
,
192 .ident
= "Dell Vostro 3460",
194 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
195 DMI_MATCH(DMI_PRODUCT_NAME
, "Vostro 3460"),
197 .driver_data
= &quirk_dell_vostro_v130
,
200 .callback
= dmi_matched
,
201 .ident
= "Dell Vostro 3560",
203 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
204 DMI_MATCH(DMI_PRODUCT_NAME
, "Vostro 3560"),
206 .driver_data
= &quirk_dell_vostro_v130
,
209 .callback
= dmi_matched
,
210 .ident
= "Dell Vostro 3450",
212 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
213 DMI_MATCH(DMI_PRODUCT_NAME
, "Dell System Vostro 3450"),
215 .driver_data
= &quirk_dell_vostro_v130
,
218 .callback
= dmi_matched
,
219 .ident
= "Dell Inspiron 5420",
221 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
222 DMI_MATCH(DMI_PRODUCT_NAME
, "Inspiron 5420"),
224 .driver_data
= &quirk_dell_vostro_v130
,
227 .callback
= dmi_matched
,
228 .ident
= "Dell Inspiron 5520",
230 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
231 DMI_MATCH(DMI_PRODUCT_NAME
, "Inspiron 5520"),
233 .driver_data
= &quirk_dell_vostro_v130
,
236 .callback
= dmi_matched
,
237 .ident
= "Dell Inspiron 5720",
239 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
240 DMI_MATCH(DMI_PRODUCT_NAME
, "Inspiron 5720"),
242 .driver_data
= &quirk_dell_vostro_v130
,
245 .callback
= dmi_matched
,
246 .ident
= "Dell Inspiron 7420",
248 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
249 DMI_MATCH(DMI_PRODUCT_NAME
, "Inspiron 7420"),
251 .driver_data
= &quirk_dell_vostro_v130
,
254 .callback
= dmi_matched
,
255 .ident
= "Dell Inspiron 7520",
257 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
258 DMI_MATCH(DMI_PRODUCT_NAME
, "Inspiron 7520"),
260 .driver_data
= &quirk_dell_vostro_v130
,
263 .callback
= dmi_matched
,
264 .ident
= "Dell Inspiron 7720",
266 DMI_MATCH(DMI_SYS_VENDOR
, "Dell Inc."),
267 DMI_MATCH(DMI_PRODUCT_NAME
, "Inspiron 7720"),
269 .driver_data
= &quirk_dell_vostro_v130
,
274 static struct calling_interface_buffer
*buffer
;
275 static struct page
*bufferpage
;
276 static DEFINE_MUTEX(buffer_mutex
);
278 static int hwswitch_state
;
280 static void get_buffer(void)
282 mutex_lock(&buffer_mutex
);
283 memset(buffer
, 0, sizeof(struct calling_interface_buffer
));
286 static void release_buffer(void)
288 mutex_unlock(&buffer_mutex
);
291 static void __init
parse_da_table(const struct dmi_header
*dm
)
293 /* Final token is a terminator, so we don't want to copy it */
294 int tokens
= (dm
->length
-11)/sizeof(struct calling_interface_token
)-1;
295 struct calling_interface_token
*new_da_tokens
;
296 struct calling_interface_structure
*table
=
297 container_of(dm
, struct calling_interface_structure
, header
);
299 /* 4 bytes of table header, plus 7 bytes of Dell header, plus at least
305 da_command_address
= table
->cmdIOAddress
;
306 da_command_code
= table
->cmdIOCode
;
308 new_da_tokens
= krealloc(da_tokens
, (da_num_tokens
+ tokens
) *
309 sizeof(struct calling_interface_token
),
314 da_tokens
= new_da_tokens
;
316 memcpy(da_tokens
+da_num_tokens
, table
->tokens
,
317 sizeof(struct calling_interface_token
) * tokens
);
319 da_num_tokens
+= tokens
;
322 static void __init
find_tokens(const struct dmi_header
*dm
, void *dummy
)
325 case 0xd4: /* Indexed IO */
326 case 0xd5: /* Protected Area Type 1 */
327 case 0xd6: /* Protected Area Type 2 */
329 case 0xda: /* Calling interface */
335 static int find_token_location(int tokenid
)
338 for (i
= 0; i
< da_num_tokens
; i
++) {
339 if (da_tokens
[i
].tokenID
== tokenid
)
340 return da_tokens
[i
].location
;
346 static struct calling_interface_buffer
*
347 dell_send_request(struct calling_interface_buffer
*buffer
, int class,
350 struct smi_cmd command
;
352 command
.magic
= SMI_CMD_MAGIC
;
353 command
.command_address
= da_command_address
;
354 command
.command_code
= da_command_code
;
355 command
.ebx
= virt_to_phys(buffer
);
356 command
.ecx
= 0x42534931;
358 buffer
->class = class;
359 buffer
->select
= select
;
361 dcdbas_smi_request(&command
);
366 /* Derived from information in DellWirelessCtl.cpp:
367 Class 17, select 11 is radio control. It returns an array of 32-bit values.
369 Input byte 0 = 0: Wireless information
371 result[0]: return code
373 Bit 0: Hardware switch supported
374 Bit 1: Wifi locator supported
375 Bit 2: Wifi is supported
376 Bit 3: Bluetooth is supported
377 Bit 4: WWAN is supported
378 Bit 5: Wireless keyboard supported
380 Bit 8: Wifi is installed
381 Bit 9: Bluetooth is installed
382 Bit 10: WWAN is installed
384 Bit 16: Hardware switch is on
385 Bit 17: Wifi is blocked
386 Bit 18: Bluetooth is blocked
387 Bit 19: WWAN is blocked
389 result[2]: NVRAM size in bytes
390 result[3]: NVRAM format version number
392 Input byte 0 = 2: Wireless switch configuration
393 result[0]: return code
395 Bit 0: Wifi controlled by switch
396 Bit 1: Bluetooth controlled by switch
397 Bit 2: WWAN controlled by switch
399 Bit 7: Wireless switch config locked
400 Bit 8: Wifi locator enabled
402 Bit 15: Wifi locator setting locked
406 static int dell_rfkill_set(void *data
, bool blocked
)
408 int disable
= blocked
? 1 : 0;
409 unsigned long radio
= (unsigned long)data
;
410 int hwswitch_bit
= (unsigned long)data
- 1;
413 dell_send_request(buffer
, 17, 11);
415 /* If the hardware switch controls this radio, and the hardware
416 switch is disabled, always disable the radio */
417 if ((hwswitch_state
& BIT(hwswitch_bit
)) &&
418 !(buffer
->output
[1] & BIT(16)))
421 buffer
->input
[0] = (1 | (radio
<<8) | (disable
<< 16));
422 dell_send_request(buffer
, 17, 11);
428 /* Must be called with the buffer held */
429 static void dell_rfkill_update_sw_state(struct rfkill
*rfkill
, int radio
,
432 if (status
& BIT(0)) {
433 /* Has hw-switch, sync sw_state to BIOS */
434 int block
= rfkill_blocked(rfkill
);
435 buffer
->input
[0] = (1 | (radio
<< 8) | (block
<< 16));
436 dell_send_request(buffer
, 17, 11);
438 /* No hw-switch, sync BIOS state to sw_state */
439 rfkill_set_sw_state(rfkill
, !!(status
& BIT(radio
+ 16)));
443 static void dell_rfkill_update_hw_state(struct rfkill
*rfkill
, int radio
,
446 if (hwswitch_state
& (BIT(radio
- 1)))
447 rfkill_set_hw_state(rfkill
, !(status
& BIT(16)));
450 static void dell_rfkill_query(struct rfkill
*rfkill
, void *data
)
455 dell_send_request(buffer
, 17, 11);
456 status
= buffer
->output
[1];
458 dell_rfkill_update_hw_state(rfkill
, (unsigned long)data
, status
);
463 static const struct rfkill_ops dell_rfkill_ops
= {
464 .set_block
= dell_rfkill_set
,
465 .query
= dell_rfkill_query
,
468 static struct dentry
*dell_laptop_dir
;
470 static int dell_debugfs_show(struct seq_file
*s
, void *data
)
475 dell_send_request(buffer
, 17, 11);
476 status
= buffer
->output
[1];
479 seq_printf(s
, "status:\t0x%X\n", status
);
480 seq_printf(s
, "Bit 0 : Hardware switch supported: %lu\n",
482 seq_printf(s
, "Bit 1 : Wifi locator supported: %lu\n",
483 (status
& BIT(1)) >> 1);
484 seq_printf(s
, "Bit 2 : Wifi is supported: %lu\n",
485 (status
& BIT(2)) >> 2);
486 seq_printf(s
, "Bit 3 : Bluetooth is supported: %lu\n",
487 (status
& BIT(3)) >> 3);
488 seq_printf(s
, "Bit 4 : WWAN is supported: %lu\n",
489 (status
& BIT(4)) >> 4);
490 seq_printf(s
, "Bit 5 : Wireless keyboard supported: %lu\n",
491 (status
& BIT(5)) >> 5);
492 seq_printf(s
, "Bit 8 : Wifi is installed: %lu\n",
493 (status
& BIT(8)) >> 8);
494 seq_printf(s
, "Bit 9 : Bluetooth is installed: %lu\n",
495 (status
& BIT(9)) >> 9);
496 seq_printf(s
, "Bit 10: WWAN is installed: %lu\n",
497 (status
& BIT(10)) >> 10);
498 seq_printf(s
, "Bit 16: Hardware switch is on: %lu\n",
499 (status
& BIT(16)) >> 16);
500 seq_printf(s
, "Bit 17: Wifi is blocked: %lu\n",
501 (status
& BIT(17)) >> 17);
502 seq_printf(s
, "Bit 18: Bluetooth is blocked: %lu\n",
503 (status
& BIT(18)) >> 18);
504 seq_printf(s
, "Bit 19: WWAN is blocked: %lu\n",
505 (status
& BIT(19)) >> 19);
507 seq_printf(s
, "\nhwswitch_state:\t0x%X\n", hwswitch_state
);
508 seq_printf(s
, "Bit 0 : Wifi controlled by switch: %lu\n",
509 hwswitch_state
& BIT(0));
510 seq_printf(s
, "Bit 1 : Bluetooth controlled by switch: %lu\n",
511 (hwswitch_state
& BIT(1)) >> 1);
512 seq_printf(s
, "Bit 2 : WWAN controlled by switch: %lu\n",
513 (hwswitch_state
& BIT(2)) >> 2);
514 seq_printf(s
, "Bit 7 : Wireless switch config locked: %lu\n",
515 (hwswitch_state
& BIT(7)) >> 7);
516 seq_printf(s
, "Bit 8 : Wifi locator enabled: %lu\n",
517 (hwswitch_state
& BIT(8)) >> 8);
518 seq_printf(s
, "Bit 15: Wifi locator setting locked: %lu\n",
519 (hwswitch_state
& BIT(15)) >> 15);
524 static int dell_debugfs_open(struct inode
*inode
, struct file
*file
)
526 return single_open(file
, dell_debugfs_show
, inode
->i_private
);
529 static const struct file_operations dell_debugfs_fops
= {
530 .owner
= THIS_MODULE
,
531 .open
= dell_debugfs_open
,
534 .release
= single_release
,
537 static void dell_update_rfkill(struct work_struct
*ignored
)
542 dell_send_request(buffer
, 17, 11);
543 status
= buffer
->output
[1];
546 dell_rfkill_update_hw_state(wifi_rfkill
, 1, status
);
547 dell_rfkill_update_sw_state(wifi_rfkill
, 1, status
);
549 if (bluetooth_rfkill
) {
550 dell_rfkill_update_hw_state(bluetooth_rfkill
, 2, status
);
551 dell_rfkill_update_sw_state(bluetooth_rfkill
, 2, status
);
554 dell_rfkill_update_hw_state(wwan_rfkill
, 3, status
);
555 dell_rfkill_update_sw_state(wwan_rfkill
, 3, status
);
560 static DECLARE_DELAYED_WORK(dell_rfkill_work
, dell_update_rfkill
);
562 static bool dell_laptop_i8042_filter(unsigned char data
, unsigned char str
,
565 static bool extended
;
570 if (unlikely(data
== 0xe0)) {
573 } else if (unlikely(extended
)) {
576 schedule_delayed_work(&dell_rfkill_work
,
577 round_jiffies_relative(HZ
/ 4));
586 static int __init
dell_setup_rfkill(void)
588 int status
, ret
, whitelisted
;
592 * rfkill support causes trouble on various models, mostly Inspirons.
593 * So we whitelist certain series, and don't support rfkill on others.
596 product
= dmi_get_system_info(DMI_PRODUCT_NAME
);
597 if (product
&& (strncmp(product
, "Latitude", 8) == 0 ||
598 strncmp(product
, "Precision", 9) == 0))
600 if (!force_rfkill
&& !whitelisted
)
604 dell_send_request(buffer
, 17, 11);
605 status
= buffer
->output
[1];
606 buffer
->input
[0] = 0x2;
607 dell_send_request(buffer
, 17, 11);
608 hwswitch_state
= buffer
->output
[1];
611 if (!(status
& BIT(0))) {
613 /* No hwsitch, clear all hw-controlled bits */
614 hwswitch_state
&= ~7;
616 /* rfkill is only tested on laptops with a hwswitch */
621 if ((status
& (1<<2|1<<8)) == (1<<2|1<<8)) {
622 wifi_rfkill
= rfkill_alloc("dell-wifi", &platform_device
->dev
,
624 &dell_rfkill_ops
, (void *) 1);
629 ret
= rfkill_register(wifi_rfkill
);
634 if ((status
& (1<<3|1<<9)) == (1<<3|1<<9)) {
635 bluetooth_rfkill
= rfkill_alloc("dell-bluetooth",
636 &platform_device
->dev
,
637 RFKILL_TYPE_BLUETOOTH
,
638 &dell_rfkill_ops
, (void *) 2);
639 if (!bluetooth_rfkill
) {
643 ret
= rfkill_register(bluetooth_rfkill
);
648 if ((status
& (1<<4|1<<10)) == (1<<4|1<<10)) {
649 wwan_rfkill
= rfkill_alloc("dell-wwan",
650 &platform_device
->dev
,
652 &dell_rfkill_ops
, (void *) 3);
657 ret
= rfkill_register(wwan_rfkill
);
662 ret
= i8042_install_filter(dell_laptop_i8042_filter
);
664 pr_warn("Unable to install key filter\n");
671 rfkill_unregister(wwan_rfkill
);
673 rfkill_destroy(wwan_rfkill
);
674 if (bluetooth_rfkill
)
675 rfkill_unregister(bluetooth_rfkill
);
677 rfkill_destroy(bluetooth_rfkill
);
679 rfkill_unregister(wifi_rfkill
);
681 rfkill_destroy(wifi_rfkill
);
686 static void dell_cleanup_rfkill(void)
689 rfkill_unregister(wifi_rfkill
);
690 rfkill_destroy(wifi_rfkill
);
692 if (bluetooth_rfkill
) {
693 rfkill_unregister(bluetooth_rfkill
);
694 rfkill_destroy(bluetooth_rfkill
);
697 rfkill_unregister(wwan_rfkill
);
698 rfkill_destroy(wwan_rfkill
);
702 static int dell_send_intensity(struct backlight_device
*bd
)
707 buffer
->input
[0] = find_token_location(BRIGHTNESS_TOKEN
);
708 buffer
->input
[1] = bd
->props
.brightness
;
710 if (buffer
->input
[0] == -1) {
715 if (power_supply_is_system_supplied() > 0)
716 dell_send_request(buffer
, 1, 2);
718 dell_send_request(buffer
, 1, 1);
725 static int dell_get_intensity(struct backlight_device
*bd
)
730 buffer
->input
[0] = find_token_location(BRIGHTNESS_TOKEN
);
732 if (buffer
->input
[0] == -1) {
737 if (power_supply_is_system_supplied() > 0)
738 dell_send_request(buffer
, 0, 2);
740 dell_send_request(buffer
, 0, 1);
742 ret
= buffer
->output
[1];
749 static const struct backlight_ops dell_ops
= {
750 .get_brightness
= dell_get_intensity
,
751 .update_status
= dell_send_intensity
,
754 static void touchpad_led_on(void)
758 i8042_command(&data
, command
| 1 << 12);
761 static void touchpad_led_off(void)
765 i8042_command(&data
, command
| 1 << 12);
768 static void touchpad_led_set(struct led_classdev
*led_cdev
,
769 enum led_brightness value
)
777 static struct led_classdev touchpad_led
= {
778 .name
= "dell-laptop::touchpad",
779 .brightness_set
= touchpad_led_set
,
780 .flags
= LED_CORE_SUSPENDRESUME
,
783 static int touchpad_led_init(struct device
*dev
)
785 return led_classdev_register(dev
, &touchpad_led
);
788 static void touchpad_led_exit(void)
790 led_classdev_unregister(&touchpad_led
);
793 static int __init
dell_init(void)
795 int max_intensity
= 0;
798 if (!dmi_check_system(dell_device_table
))
802 /* find if this machine support other functions */
803 dmi_check_system(dell_quirks
);
805 dmi_walk(find_tokens
, NULL
);
808 pr_info("Unable to find dmi tokens\n");
812 ret
= platform_driver_register(&platform_driver
);
814 goto fail_platform_driver
;
815 platform_device
= platform_device_alloc("dell-laptop", -1);
816 if (!platform_device
) {
818 goto fail_platform_device1
;
820 ret
= platform_device_add(platform_device
);
822 goto fail_platform_device2
;
825 * Allocate buffer below 4GB for SMI data--only 32-bit physical addr
826 * is passed to SMI handler.
828 bufferpage
= alloc_page(GFP_KERNEL
| GFP_DMA32
);
833 buffer
= page_address(bufferpage
);
835 ret
= dell_setup_rfkill();
838 pr_warn("Unable to setup rfkill\n");
842 if (quirks
&& quirks
->touchpad_led
)
843 touchpad_led_init(&platform_device
->dev
);
845 dell_laptop_dir
= debugfs_create_dir("dell_laptop", NULL
);
846 if (dell_laptop_dir
!= NULL
)
847 debugfs_create_file("rfkill", 0444, dell_laptop_dir
, NULL
,
851 /* In the event of an ACPI backlight being available, don't
852 * register the platform controller.
854 if (acpi_video_backlight_support())
859 buffer
->input
[0] = find_token_location(BRIGHTNESS_TOKEN
);
860 if (buffer
->input
[0] != -1) {
861 dell_send_request(buffer
, 0, 2);
862 max_intensity
= buffer
->output
[3];
867 struct backlight_properties props
;
868 memset(&props
, 0, sizeof(struct backlight_properties
));
869 props
.type
= BACKLIGHT_PLATFORM
;
870 props
.max_brightness
= max_intensity
;
871 dell_backlight_device
= backlight_device_register("dell_backlight",
872 &platform_device
->dev
,
877 if (IS_ERR(dell_backlight_device
)) {
878 ret
= PTR_ERR(dell_backlight_device
);
879 dell_backlight_device
= NULL
;
883 dell_backlight_device
->props
.brightness
=
884 dell_get_intensity(dell_backlight_device
);
885 backlight_update_status(dell_backlight_device
);
891 i8042_remove_filter(dell_laptop_i8042_filter
);
892 cancel_delayed_work_sync(&dell_rfkill_work
);
893 dell_cleanup_rfkill();
895 free_page((unsigned long)bufferpage
);
897 platform_device_del(platform_device
);
898 fail_platform_device2
:
899 platform_device_put(platform_device
);
900 fail_platform_device1
:
901 platform_driver_unregister(&platform_driver
);
902 fail_platform_driver
:
907 static void __exit
dell_exit(void)
909 debugfs_remove_recursive(dell_laptop_dir
);
910 if (quirks
&& quirks
->touchpad_led
)
912 i8042_remove_filter(dell_laptop_i8042_filter
);
913 cancel_delayed_work_sync(&dell_rfkill_work
);
914 backlight_device_unregister(dell_backlight_device
);
915 dell_cleanup_rfkill();
916 if (platform_device
) {
917 platform_device_unregister(platform_device
);
918 platform_driver_unregister(&platform_driver
);
921 free_page((unsigned long)buffer
);
924 module_init(dell_init
);
925 module_exit(dell_exit
);
927 MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>");
928 MODULE_DESCRIPTION("Dell laptop driver");
929 MODULE_LICENSE("GPL");