aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLee, Chun-Yi <jlee@novell.com>2010-01-09 08:16:52 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-07 20:04:52 -0500
commit46d0e9e091ba5dd29cac7543e97084540da9c4b7 (patch)
treeeffdff9c981e20d56ce156562ff6ce19e44e67c0 /drivers
parent8e9394ce2412254ec69fd2a4f3e44a66eade2297 (diff)
msi-laptop: Support standard ec 66/62 command on MSI notebook and nebook
Suppport standard ec 66/62 command on MSI notebook and nebook. MSI netbook and notebook already support 66/62 command, so, add new get_state function, and put the old model to non-standard model, but driver still support those old model. Signed-off-by: Lee, Chun-Yi <jlee@novell.com> Cc: Lennart Poettering <mzxreary@0pointer.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/platform/x86/msi-laptop.c43
1 files changed, 39 insertions, 4 deletions
diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c
index 759763d18e4c..323e99460c9f 100644
--- a/drivers/platform/x86/msi-laptop.c
+++ b/drivers/platform/x86/msi-laptop.c
@@ -66,6 +66,11 @@
66#define MSI_EC_COMMAND_WIRELESS 0x10 66#define MSI_EC_COMMAND_WIRELESS 0x10
67#define MSI_EC_COMMAND_LCD_LEVEL 0x11 67#define MSI_EC_COMMAND_LCD_LEVEL 0x11
68 68
69#define MSI_STANDARD_EC_COMMAND_ADDRESS 0x2e
70#define MSI_STANDARD_EC_BLUETOOTH_MASK (1 << 0)
71#define MSI_STANDARD_EC_WEBCAM_MASK (1 << 1)
72#define MSI_STANDARD_EC_WLAN_MASK (1 << 3)
73
69static int force; 74static int force;
70module_param(force, bool, 0); 75module_param(force, bool, 0);
71MODULE_PARM_DESC(force, "Force driver load, ignore DMI data"); 76MODULE_PARM_DESC(force, "Force driver load, ignore DMI data");
@@ -74,6 +79,9 @@ static int auto_brightness;
74module_param(auto_brightness, int, 0); 79module_param(auto_brightness, int, 0);
75MODULE_PARM_DESC(auto_brightness, "Enable automatic brightness control (0: disabled; 1: enabled; 2: don't touch)"); 80MODULE_PARM_DESC(auto_brightness, "Enable automatic brightness control (0: disabled; 1: enabled; 2: don't touch)");
76 81
82static bool old_ec_model;
83static int wlan_s, bluetooth_s;
84
77/* Hardware access */ 85/* Hardware access */
78 86
79static int set_lcd_level(int level) 87static int set_lcd_level(int level)
@@ -148,6 +156,22 @@ static int get_wireless_state(int *wlan, int *bluetooth)
148 return 0; 156 return 0;
149} 157}
150 158
159static int get_wireless_state_ec_standard(void)
160{
161 u8 rdata;
162 int result;
163
164 result = ec_read(MSI_STANDARD_EC_COMMAND_ADDRESS, &rdata);
165 if (result < 0)
166 return -1;
167
168 wlan_s = !!(rdata & MSI_STANDARD_EC_WLAN_MASK);
169
170 bluetooth_s = !!(rdata & MSI_STANDARD_EC_BLUETOOTH_MASK);
171
172 return 0;
173}
174
151/* Backlight device stuff */ 175/* Backlight device stuff */
152 176
153static int bl_get_brightness(struct backlight_device *b) 177static int bl_get_brightness(struct backlight_device *b)
@@ -176,7 +200,12 @@ static ssize_t show_wlan(struct device *dev,
176 200
177 int ret, enabled; 201 int ret, enabled;
178 202
179 ret = get_wireless_state(&enabled, NULL); 203 if (old_ec_model) {
204 ret = get_wireless_state(&enabled, NULL);
205 } else {
206 ret = get_wireless_state_ec_standard();
207 enabled = wlan_s;
208 }
180 if (ret < 0) 209 if (ret < 0)
181 return ret; 210 return ret;
182 211
@@ -189,7 +218,12 @@ static ssize_t show_bluetooth(struct device *dev,
189 218
190 int ret, enabled; 219 int ret, enabled;
191 220
192 ret = get_wireless_state(NULL, &enabled); 221 if (old_ec_model) {
222 ret = get_wireless_state(NULL, &enabled);
223 } else {
224 ret = get_wireless_state_ec_standard();
225 enabled = bluetooth_s;
226 }
193 if (ret < 0) 227 if (ret < 0)
194 return ret; 228 return ret;
195 229
@@ -339,8 +373,8 @@ static int __init msi_init(void)
339 if (acpi_disabled) 373 if (acpi_disabled)
340 return -ENODEV; 374 return -ENODEV;
341 375
342 if (!force && !dmi_check_system(msi_dmi_table)) 376 if (force || dmi_check_system(msi_dmi_table))
343 return -ENODEV; 377 old_ec_model = 1;
344 378
345 if (auto_brightness < 0 || auto_brightness > 2) 379 if (auto_brightness < 0 || auto_brightness > 2)
346 return -EINVAL; 380 return -EINVAL;
@@ -435,3 +469,4 @@ MODULE_ALIAS("dmi:*:svnMICRO-STARINT'LCO.,LTD:pnMS-1013:pvr0131*:cvnMICRO-STARIN
435MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1058:pvr0581:rvnMSI:rnMS-1058:*:ct10:*"); 469MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1058:pvr0581:rvnMSI:rnMS-1058:*:ct10:*");
436MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1412:*:rvnMSI:rnMS-1412:*:cvnMICRO-STARINT'LCO.,LTD:ct10:*"); 470MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1412:*:rvnMSI:rnMS-1412:*:cvnMICRO-STARINT'LCO.,LTD:ct10:*");
437MODULE_ALIAS("dmi:*:svnNOTEBOOK:pnSAM2000:pvr0131*:cvnMICRO-STARINT'LCO.,LTD:ct10:*"); 471MODULE_ALIAS("dmi:*:svnNOTEBOOK:pnSAM2000:pvr0131*:cvnMICRO-STARINT'LCO.,LTD:ct10:*");
472MODULE_ALIAS("dmi:*:svnMICRO-STARINTERNATIONAL*:pnMS-N034:*");