static struct led_classdev kbd_led = {
.name = "dell::kbd_backlight",
+ .flags = LED_BRIGHT_HW_CHANGED,
.brightness_set_blocking = kbd_led_level_set,
.brightness_get = kbd_led_level_get,
.groups = kbd_led_groups,
static int __init kbd_led_init(struct device *dev)
{
+ int ret;
+
kbd_init();
if (!kbd_led_present)
return -ENODEV;
if (kbd_led.max_brightness)
kbd_led.max_brightness--;
}
- return led_classdev_register(dev, &kbd_led);
+ ret = led_classdev_register(dev, &kbd_led);
+ if (ret)
+ kbd_led_present = false;
+
+ return ret;
}
static void brightness_set_exit(struct led_classdev *led_cdev,
led_classdev_unregister(&kbd_led);
}
+static int dell_laptop_notifier_call(struct notifier_block *nb,
+ unsigned long action, void *data)
+{
+ switch (action) {
+ case DELL_LAPTOP_KBD_BACKLIGHT_BRIGHTNESS_CHANGED:
+ if (!kbd_led_present)
+ break;
+
+ led_classdev_notify_brightness_hw_changed(&kbd_led,
+ kbd_led_level_get(&kbd_led));
+ break;
+ }
+
+ return NOTIFY_OK;
+}
+
+static struct notifier_block dell_laptop_notifier = {
+ .notifier_call = dell_laptop_notifier_call,
+};
+
static int __init dell_init(void)
{
struct calling_interface_buffer *buffer;
debugfs_create_file("rfkill", 0444, dell_laptop_dir, NULL,
&dell_debugfs_fops);
+ dell_laptop_register_notifier(&dell_laptop_notifier);
+
if (acpi_video_get_backlight_type() != acpi_backlight_vendor)
return 0;
static void __exit dell_exit(void)
{
+ dell_laptop_unregister_notifier(&dell_laptop_notifier);
debugfs_remove_recursive(dell_laptop_dir);
if (quirks && quirks->touchpad_led)
touchpad_led_exit();