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>

authored by Lee, Chun-Yi and committed by Greg Kroah-Hartman 46d0e9e0 8e9394ce

+39 -4
+39 -4
drivers/platform/x86/msi-laptop.c
··· 66 #define MSI_EC_COMMAND_WIRELESS 0x10 67 #define MSI_EC_COMMAND_LCD_LEVEL 0x11 68 69 static int force; 70 module_param(force, bool, 0); 71 MODULE_PARM_DESC(force, "Force driver load, ignore DMI data"); ··· 78 static int auto_brightness; 79 module_param(auto_brightness, int, 0); 80 MODULE_PARM_DESC(auto_brightness, "Enable automatic brightness control (0: disabled; 1: enabled; 2: don't touch)"); 81 82 /* Hardware access */ 83 ··· 156 return 0; 157 } 158 159 /* Backlight device stuff */ 160 161 static int bl_get_brightness(struct backlight_device *b) ··· 200 201 int ret, enabled; 202 203 - ret = get_wireless_state(&enabled, NULL); 204 if (ret < 0) 205 return ret; 206 ··· 218 219 int ret, enabled; 220 221 - ret = get_wireless_state(NULL, &enabled); 222 if (ret < 0) 223 return ret; 224 ··· 373 if (acpi_disabled) 374 return -ENODEV; 375 376 - if (!force && !dmi_check_system(msi_dmi_table)) 377 - return -ENODEV; 378 379 if (auto_brightness < 0 || auto_brightness > 2) 380 return -EINVAL; ··· 469 MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1058:pvr0581:rvnMSI:rnMS-1058:*:ct10:*"); 470 MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1412:*:rvnMSI:rnMS-1412:*:cvnMICRO-STARINT'LCO.,LTD:ct10:*"); 471 MODULE_ALIAS("dmi:*:svnNOTEBOOK:pnSAM2000:pvr0131*:cvnMICRO-STARINT'LCO.,LTD:ct10:*");
··· 66 #define MSI_EC_COMMAND_WIRELESS 0x10 67 #define MSI_EC_COMMAND_LCD_LEVEL 0x11 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 + 74 static int force; 75 module_param(force, bool, 0); 76 MODULE_PARM_DESC(force, "Force driver load, ignore DMI data"); ··· 73 static int auto_brightness; 74 module_param(auto_brightness, int, 0); 75 MODULE_PARM_DESC(auto_brightness, "Enable automatic brightness control (0: disabled; 1: enabled; 2: don't touch)"); 76 + 77 + static bool old_ec_model; 78 + static int wlan_s, bluetooth_s; 79 80 /* Hardware access */ 81 ··· 148 return 0; 149 } 150 151 + static int get_wireless_state_ec_standard(void) 152 + { 153 + u8 rdata; 154 + int result; 155 + 156 + result = ec_read(MSI_STANDARD_EC_COMMAND_ADDRESS, &rdata); 157 + if (result < 0) 158 + return -1; 159 + 160 + wlan_s = !!(rdata & MSI_STANDARD_EC_WLAN_MASK); 161 + 162 + bluetooth_s = !!(rdata & MSI_STANDARD_EC_BLUETOOTH_MASK); 163 + 164 + return 0; 165 + } 166 + 167 /* Backlight device stuff */ 168 169 static int bl_get_brightness(struct backlight_device *b) ··· 176 177 int ret, enabled; 178 179 + if (old_ec_model) { 180 + ret = get_wireless_state(&enabled, NULL); 181 + } else { 182 + ret = get_wireless_state_ec_standard(); 183 + enabled = wlan_s; 184 + } 185 if (ret < 0) 186 return ret; 187 ··· 189 190 int ret, enabled; 191 192 + if (old_ec_model) { 193 + ret = get_wireless_state(NULL, &enabled); 194 + } else { 195 + ret = get_wireless_state_ec_standard(); 196 + enabled = bluetooth_s; 197 + } 198 if (ret < 0) 199 return ret; 200 ··· 339 if (acpi_disabled) 340 return -ENODEV; 341 342 + if (force || dmi_check_system(msi_dmi_table)) 343 + old_ec_model = 1; 344 345 if (auto_brightness < 0 || auto_brightness > 2) 346 return -EINVAL; ··· 435 MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1058:pvr0581:rvnMSI:rnMS-1058:*:ct10:*"); 436 MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1412:*:rvnMSI:rnMS-1412:*:cvnMICRO-STARINT'LCO.,LTD:ct10:*"); 437 MODULE_ALIAS("dmi:*:svnNOTEBOOK:pnSAM2000:pvr0131*:cvnMICRO-STARINT'LCO.,LTD:ct10:*"); 438 + MODULE_ALIAS("dmi:*:svnMICRO-STARINTERNATIONAL*:pnMS-N034:*");