Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 197563
b: refs/heads/master
c: 339e753
h: refs/heads/master
i:
  197561: 4a6640c
  197559: 25d61a2
v: v3
  • Loading branch information
Lee, Chun-Yi authored and Matthew Garrett committed May 20, 2010
1 parent d691560 commit 2f69d10
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3bb970214fce6495573843e4b7b786f8ea94cd70
refs/heads/master: 339e75329a447363658d08833bf9f98909f419cd
59 changes: 58 additions & 1 deletion trunk/drivers/platform/x86/msi-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#include <linux/backlight.h>
#include <linux/platform_device.h>
#include <linux/rfkill.h>
#include <linux/i8042.h>

#define MSI_DRIVER_VERSION "0.5"

Expand Down Expand Up @@ -581,6 +582,46 @@ static void rfkill_cleanup(void)
}
}

static void msi_update_rfkill(struct work_struct *ignored)
{
get_wireless_state_ec_standard();

if (rfk_wlan)
rfkill_set_sw_state(rfk_wlan, !wlan_s);
if (rfk_bluetooth)
rfkill_set_sw_state(rfk_bluetooth, !bluetooth_s);
if (rfk_threeg)
rfkill_set_sw_state(rfk_threeg, !threeg_s);
}
static DECLARE_DELAYED_WORK(msi_rfkill_work, msi_update_rfkill);

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

if (str & 0x20)
return false;

/* 0x54 wwan, 0x62 bluetooth, 0x76 wlan*/
if (unlikely(data == 0xe0)) {
extended = true;
return false;
} else if (unlikely(extended)) {
switch (data) {
case 0x54:
case 0x62:
case 0x76:
schedule_delayed_work(&msi_rfkill_work,
round_jiffies_relative(0.5 * HZ));
break;
}
extended = false;
}

return false;
}

static void msi_init_rfkill(struct work_struct *ignored)
{
if (rfk_wlan) {
Expand Down Expand Up @@ -706,9 +747,24 @@ static int load_scm_model_init(struct platform_device *sdev)
/* initial rfkill */
result = rfkill_init(sdev);
if (result < 0)
return result;
goto fail_rfkill;

result = i8042_install_filter(msi_laptop_i8042_filter);
if (result) {
printk(KERN_ERR
"msi-laptop: Unable to install key filter\n");
goto fail_filter;
}

return 0;

fail_filter:
rfkill_cleanup();

fail_rfkill:

return result;

}

static int __init msi_init(void)
Expand Down Expand Up @@ -819,6 +875,7 @@ static void __exit msi_cleanup(void)
platform_driver_unregister(&msipf_driver);
backlight_device_unregister(msibl_device);

i8042_remove_filter(msi_laptop_i8042_filter);
rfkill_cleanup();

/* Enable automatic brightness control again */
Expand Down

0 comments on commit 2f69d10

Please sign in to comment.