Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 187098
b: refs/heads/master
c: 46d0e9e
h: refs/heads/master
v: v3
  • Loading branch information
Lee, Chun-Yi authored and Greg Kroah-Hartman committed Mar 8, 2010
1 parent fd038eb commit 827e700
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 5 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: 8e9394ce2412254ec69fd2a4f3e44a66eade2297
refs/heads/master: 46d0e9e091ba5dd29cac7543e97084540da9c4b7
43 changes: 39 additions & 4 deletions trunk/drivers/platform/x86/msi-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
#define MSI_EC_COMMAND_WIRELESS 0x10
#define MSI_EC_COMMAND_LCD_LEVEL 0x11

#define MSI_STANDARD_EC_COMMAND_ADDRESS 0x2e
#define MSI_STANDARD_EC_BLUETOOTH_MASK (1 << 0)
#define MSI_STANDARD_EC_WEBCAM_MASK (1 << 1)
#define MSI_STANDARD_EC_WLAN_MASK (1 << 3)

static int force;
module_param(force, bool, 0);
MODULE_PARM_DESC(force, "Force driver load, ignore DMI data");
Expand All @@ -74,6 +79,9 @@ static int auto_brightness;
module_param(auto_brightness, int, 0);
MODULE_PARM_DESC(auto_brightness, "Enable automatic brightness control (0: disabled; 1: enabled; 2: don't touch)");

static bool old_ec_model;
static int wlan_s, bluetooth_s;

/* Hardware access */

static int set_lcd_level(int level)
Expand Down Expand Up @@ -148,6 +156,22 @@ static int get_wireless_state(int *wlan, int *bluetooth)
return 0;
}

static int get_wireless_state_ec_standard(void)
{
u8 rdata;
int result;

result = ec_read(MSI_STANDARD_EC_COMMAND_ADDRESS, &rdata);
if (result < 0)
return -1;

wlan_s = !!(rdata & MSI_STANDARD_EC_WLAN_MASK);

bluetooth_s = !!(rdata & MSI_STANDARD_EC_BLUETOOTH_MASK);

return 0;
}

/* Backlight device stuff */

static int bl_get_brightness(struct backlight_device *b)
Expand Down Expand Up @@ -176,7 +200,12 @@ static ssize_t show_wlan(struct device *dev,

int ret, enabled;

ret = get_wireless_state(&enabled, NULL);
if (old_ec_model) {
ret = get_wireless_state(&enabled, NULL);
} else {
ret = get_wireless_state_ec_standard();
enabled = wlan_s;
}
if (ret < 0)
return ret;

Expand All @@ -189,7 +218,12 @@ static ssize_t show_bluetooth(struct device *dev,

int ret, enabled;

ret = get_wireless_state(NULL, &enabled);
if (old_ec_model) {
ret = get_wireless_state(NULL, &enabled);
} else {
ret = get_wireless_state_ec_standard();
enabled = bluetooth_s;
}
if (ret < 0)
return ret;

Expand Down Expand Up @@ -339,8 +373,8 @@ static int __init msi_init(void)
if (acpi_disabled)
return -ENODEV;

if (!force && !dmi_check_system(msi_dmi_table))
return -ENODEV;
if (force || dmi_check_system(msi_dmi_table))
old_ec_model = 1;

if (auto_brightness < 0 || auto_brightness > 2)
return -EINVAL;
Expand Down Expand Up @@ -435,3 +469,4 @@ MODULE_ALIAS("dmi:*:svnMICRO-STARINT'LCO.,LTD:pnMS-1013:pvr0131*:cvnMICRO-STARIN
MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1058:pvr0581:rvnMSI:rnMS-1058:*:ct10:*");
MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1412:*:rvnMSI:rnMS-1412:*:cvnMICRO-STARINT'LCO.,LTD:ct10:*");
MODULE_ALIAS("dmi:*:svnNOTEBOOK:pnSAM2000:pvr0131*:cvnMICRO-STARINT'LCO.,LTD:ct10:*");
MODULE_ALIAS("dmi:*:svnMICRO-STARINTERNATIONAL*:pnMS-N034:*");

0 comments on commit 827e700

Please sign in to comment.