aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/platform/x86/msi-laptop.c39
1 files changed, 27 insertions, 12 deletions
diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c
index 28bcbb21d120..6b2293875672 100644
--- a/drivers/platform/x86/msi-laptop.c
+++ b/drivers/platform/x86/msi-laptop.c
@@ -546,8 +546,6 @@ static DEVICE_ATTR(turbo_cooldown, 0444, show_turbo_cooldown, NULL);
546static DEVICE_ATTR(auto_fan, 0644, show_auto_fan, store_auto_fan); 546static DEVICE_ATTR(auto_fan, 0644, show_auto_fan, store_auto_fan);
547 547
548static struct attribute *msipf_attributes[] = { 548static struct attribute *msipf_attributes[] = {
549 &dev_attr_lcd_level.attr,
550 &dev_attr_auto_brightness.attr,
551 &dev_attr_bluetooth.attr, 549 &dev_attr_bluetooth.attr,
552 &dev_attr_wlan.attr, 550 &dev_attr_wlan.attr,
553 &dev_attr_touchpad.attr, 551 &dev_attr_touchpad.attr,
@@ -558,10 +556,20 @@ static struct attribute *msipf_attributes[] = {
558 NULL 556 NULL
559}; 557};
560 558
559static struct attribute *msipf_old_attributes[] = {
560 &dev_attr_lcd_level.attr,
561 &dev_attr_auto_brightness.attr,
562 NULL
563};
564
561static struct attribute_group msipf_attribute_group = { 565static struct attribute_group msipf_attribute_group = {
562 .attrs = msipf_attributes 566 .attrs = msipf_attributes
563}; 567};
564 568
569static struct attribute_group msipf_old_attribute_group = {
570 .attrs = msipf_old_attributes
571};
572
565static struct platform_driver msipf_driver = { 573static struct platform_driver msipf_driver = {
566 .driver = { 574 .driver = {
567 .name = "msi-laptop-pf", 575 .name = "msi-laptop-pf",
@@ -1062,7 +1070,7 @@ static int __init msi_init(void)
1062 1070
1063 /* Register backlight stuff */ 1071 /* Register backlight stuff */
1064 1072
1065 if (acpi_video_backlight_support()) { 1073 if (!quirks->old_ec_model || acpi_video_backlight_support()) {
1066 pr_info("Brightness ignored, must be controlled by ACPI video driver\n"); 1074 pr_info("Brightness ignored, must be controlled by ACPI video driver\n");
1067 } else { 1075 } else {
1068 struct backlight_properties props; 1076 struct backlight_properties props;
@@ -1108,14 +1116,19 @@ static int __init msi_init(void)
1108 &dev_attr_threeg); 1116 &dev_attr_threeg);
1109 if (ret) 1117 if (ret)
1110 goto fail_platform_device2; 1118 goto fail_platform_device2;
1111 } 1119 } else {
1120 ret = sysfs_create_group(&msipf_device->dev.kobj,
1121 &msipf_old_attribute_group);
1122 if (ret)
1123 goto fail_platform_device2;
1112 1124
1113 /* Disable automatic brightness control by default because 1125 /* Disable automatic brightness control by default because
1114 * this module was probably loaded to do brightness control in 1126 * this module was probably loaded to do brightness control in
1115 * software. */ 1127 * software. */
1116 1128
1117 if (auto_brightness != 2) 1129 if (auto_brightness != 2)
1118 set_auto_brightness(auto_brightness); 1130 set_auto_brightness(auto_brightness);
1131 }
1119 1132
1120 pr_info("driver " MSI_DRIVER_VERSION " successfully loaded\n"); 1133 pr_info("driver " MSI_DRIVER_VERSION " successfully loaded\n");
1121 1134
@@ -1163,9 +1176,11 @@ static void __exit msi_cleanup(void)
1163 platform_driver_unregister(&msipf_driver); 1176 platform_driver_unregister(&msipf_driver);
1164 backlight_device_unregister(msibl_device); 1177 backlight_device_unregister(msibl_device);
1165 1178
1166 /* Enable automatic brightness control again */ 1179 if (quirks->old_ec_model) {
1167 if (auto_brightness != 2) 1180 /* Enable automatic brightness control again */
1168 set_auto_brightness(1); 1181 if (auto_brightness != 2)
1182 set_auto_brightness(1);
1183 }
1169 1184
1170 pr_info("driver unloaded\n"); 1185 pr_info("driver unloaded\n");
1171} 1186}