Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 181837
b: refs/heads/master
c: 814cb8a
h: refs/heads/master
i:
  181835: 069888a
v: v3
  • Loading branch information
Matthew Garrett committed Feb 25, 2010
1 parent da305af commit 7108b20
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 493e91433e966a50964e221db92756eeb90dd54e
refs/heads/master: 814cb8adbe2fb49302ac65bc31fa749143823860
1 change: 1 addition & 0 deletions trunk/drivers/platform/x86/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ config DELL_LAPTOP
depends on BACKLIGHT_CLASS_DEVICE
depends on RFKILL || RFKILL = n
depends on POWER_SUPPLY
depends on SERIO_I8042
default n
---help---
This driver adds support for rfkill and backlight control to Dell
Expand Down
48 changes: 48 additions & 0 deletions trunk/drivers/platform/x86/dell-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <linux/rfkill.h>
#include <linux/power_supply.h>
#include <linux/acpi.h>
#include <linux/i8042.h>
#include "../../firmware/dcdbas.h"

#define BRIGHTNESS_TOKEN 0x7d
Expand Down Expand Up @@ -214,6 +215,18 @@ static const struct rfkill_ops dell_rfkill_ops = {
.query = dell_rfkill_query,
};

static void dell_update_rfkill(struct work_struct *ignored)
{
if (wifi_rfkill)
dell_rfkill_query(wifi_rfkill, (void *)1);
if (bluetooth_rfkill)
dell_rfkill_query(bluetooth_rfkill, (void *)2);
if (wwan_rfkill)
dell_rfkill_query(wwan_rfkill, (void *)3);
}
static DECLARE_DELAYED_WORK(dell_rfkill_work, dell_update_rfkill);


static int __init dell_setup_rfkill(void)
{
struct calling_interface_buffer buffer;
Expand Down Expand Up @@ -338,6 +351,30 @@ static struct backlight_ops dell_ops = {
.update_status = dell_send_intensity,
};

bool dell_laptop_i8042_filter(unsigned char data, unsigned char str,
struct serio *port)
{
static bool extended;

if (str & 0x20)
return false;

if (unlikely(data == 0xe0)) {
extended = true;
return false;
} else if (unlikely(extended)) {
switch (data) {
case 0x8:
schedule_delayed_work(&dell_rfkill_work,
round_jiffies_relative(HZ));
break;
}
extended = false;
}

return false;
}

static int __init dell_init(void)
{
struct calling_interface_buffer buffer;
Expand Down Expand Up @@ -373,6 +410,13 @@ static int __init dell_init(void)
goto fail_rfkill;
}

ret = i8042_install_filter(dell_laptop_i8042_filter);
if (ret) {
printk(KERN_WARNING
"dell-laptop: Unable to install key filter\n");
goto fail_filter;
}

#ifdef CONFIG_ACPI
/* In the event of an ACPI backlight being available, don't
* register the platform controller.
Expand Down Expand Up @@ -410,6 +454,8 @@ static int __init dell_init(void)
return 0;

fail_backlight:
i8042_remove_filter(dell_laptop_i8042_filter);
fail_filter:
dell_cleanup_rfkill();
fail_rfkill:
platform_device_del(platform_device);
Expand All @@ -424,6 +470,8 @@ static int __init dell_init(void)

static void __exit dell_exit(void)
{
cancel_delayed_work_sync(&dell_rfkill_work);
i8042_remove_filter(dell_laptop_i8042_filter);
backlight_device_unregister(dell_backlight_device);
dell_cleanup_rfkill();
}
Expand Down

0 comments on commit 7108b20

Please sign in to comment.