diff options
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/msi-laptop.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c index 323e99460c9f..1784d5588d41 100644 --- a/drivers/platform/x86/msi-laptop.c +++ b/drivers/platform/x86/msi-laptop.c | |||
@@ -70,6 +70,7 @@ | |||
70 | #define MSI_STANDARD_EC_BLUETOOTH_MASK (1 << 0) | 70 | #define MSI_STANDARD_EC_BLUETOOTH_MASK (1 << 0) |
71 | #define MSI_STANDARD_EC_WEBCAM_MASK (1 << 1) | 71 | #define MSI_STANDARD_EC_WEBCAM_MASK (1 << 1) |
72 | #define MSI_STANDARD_EC_WLAN_MASK (1 << 3) | 72 | #define MSI_STANDARD_EC_WLAN_MASK (1 << 3) |
73 | #define MSI_STANDARD_EC_3G_MASK (1 << 4) | ||
73 | 74 | ||
74 | static int force; | 75 | static int force; |
75 | module_param(force, bool, 0); | 76 | module_param(force, bool, 0); |
@@ -80,7 +81,7 @@ 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 | MODULE_PARM_DESC(auto_brightness, "Enable automatic brightness control (0: disabled; 1: enabled; 2: don't touch)"); |
81 | 82 | ||
82 | static bool old_ec_model; | 83 | static bool old_ec_model; |
83 | static int wlan_s, bluetooth_s; | 84 | static int wlan_s, bluetooth_s, threeg_s; |
84 | 85 | ||
85 | /* Hardware access */ | 86 | /* Hardware access */ |
86 | 87 | ||
@@ -169,6 +170,8 @@ static int get_wireless_state_ec_standard(void) | |||
169 | 170 | ||
170 | bluetooth_s = !!(rdata & MSI_STANDARD_EC_BLUETOOTH_MASK); | 171 | bluetooth_s = !!(rdata & MSI_STANDARD_EC_BLUETOOTH_MASK); |
171 | 172 | ||
173 | threeg_s = !!(rdata & MSI_STANDARD_EC_3G_MASK); | ||
174 | |||
172 | return 0; | 175 | return 0; |
173 | } | 176 | } |
174 | 177 | ||
@@ -230,6 +233,23 @@ static ssize_t show_bluetooth(struct device *dev, | |||
230 | return sprintf(buf, "%i\n", enabled); | 233 | return sprintf(buf, "%i\n", enabled); |
231 | } | 234 | } |
232 | 235 | ||
236 | static ssize_t show_threeg(struct device *dev, | ||
237 | struct device_attribute *attr, char *buf) | ||
238 | { | ||
239 | |||
240 | int ret; | ||
241 | |||
242 | /* old msi ec not support 3G */ | ||
243 | if (old_ec_model) | ||
244 | return -1; | ||
245 | |||
246 | ret = get_wireless_state_ec_standard(); | ||
247 | if (ret < 0) | ||
248 | return ret; | ||
249 | |||
250 | return sprintf(buf, "%i\n", threeg_s); | ||
251 | } | ||
252 | |||
233 | static ssize_t show_lcd_level(struct device *dev, | 253 | static ssize_t show_lcd_level(struct device *dev, |
234 | struct device_attribute *attr, char *buf) | 254 | struct device_attribute *attr, char *buf) |
235 | { | 255 | { |
@@ -292,6 +312,7 @@ static DEVICE_ATTR(lcd_level, 0644, show_lcd_level, store_lcd_level); | |||
292 | static DEVICE_ATTR(auto_brightness, 0644, show_auto_brightness, store_auto_brightness); | 312 | static DEVICE_ATTR(auto_brightness, 0644, show_auto_brightness, store_auto_brightness); |
293 | static DEVICE_ATTR(bluetooth, 0444, show_bluetooth, NULL); | 313 | static DEVICE_ATTR(bluetooth, 0444, show_bluetooth, NULL); |
294 | static DEVICE_ATTR(wlan, 0444, show_wlan, NULL); | 314 | static DEVICE_ATTR(wlan, 0444, show_wlan, NULL); |
315 | static DEVICE_ATTR(threeg, 0444, show_threeg, NULL); | ||
295 | 316 | ||
296 | static struct attribute *msipf_attributes[] = { | 317 | static struct attribute *msipf_attributes[] = { |
297 | &dev_attr_lcd_level.attr, | 318 | &dev_attr_lcd_level.attr, |
@@ -412,6 +433,12 @@ static int __init msi_init(void) | |||
412 | if (ret) | 433 | if (ret) |
413 | goto fail_platform_device2; | 434 | goto fail_platform_device2; |
414 | 435 | ||
436 | if (!old_ec_model) { | ||
437 | ret = device_create_file(&msipf_device->dev, &dev_attr_threeg); | ||
438 | if (ret) | ||
439 | goto fail_platform_device2; | ||
440 | } | ||
441 | |||
415 | /* Disable automatic brightness control by default because | 442 | /* Disable automatic brightness control by default because |
416 | * this module was probably loaded to do brightness control in | 443 | * this module was probably loaded to do brightness control in |
417 | * software. */ | 444 | * software. */ |
@@ -446,6 +473,8 @@ static void __exit msi_cleanup(void) | |||
446 | { | 473 | { |
447 | 474 | ||
448 | sysfs_remove_group(&msipf_device->dev.kobj, &msipf_attribute_group); | 475 | sysfs_remove_group(&msipf_device->dev.kobj, &msipf_attribute_group); |
476 | if (!old_ec_model) | ||
477 | device_remove_file(&msipf_device->dev, &dev_attr_threeg); | ||
449 | platform_device_unregister(msipf_device); | 478 | platform_device_unregister(msipf_device); |
450 | platform_driver_unregister(&msipf_driver); | 479 | platform_driver_unregister(&msipf_driver); |
451 | backlight_device_unregister(msibl_device); | 480 | backlight_device_unregister(msibl_device); |