diff options
| -rw-r--r-- | drivers/platform/x86/msi-laptop.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c index b08a108c9776..5822d0ac68d2 100644 --- a/drivers/platform/x86/msi-laptop.c +++ b/drivers/platform/x86/msi-laptop.c | |||
| @@ -119,7 +119,8 @@ static int set_lcd_level(int level) | |||
| 119 | buf[0] = 0x80; | 119 | buf[0] = 0x80; |
| 120 | buf[1] = (u8) (level*31); | 120 | buf[1] = (u8) (level*31); |
| 121 | 121 | ||
| 122 | return ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, buf, sizeof(buf), NULL, 0, 1); | 122 | return ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, buf, sizeof(buf), |
| 123 | NULL, 0, 1); | ||
| 123 | } | 124 | } |
| 124 | 125 | ||
| 125 | static int get_lcd_level(void) | 126 | static int get_lcd_level(void) |
| @@ -127,7 +128,8 @@ static int get_lcd_level(void) | |||
| 127 | u8 wdata = 0, rdata; | 128 | u8 wdata = 0, rdata; |
| 128 | int result; | 129 | int result; |
| 129 | 130 | ||
| 130 | result = ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, &wdata, 1, &rdata, 1, 1); | 131 | result = ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, &wdata, 1, |
| 132 | &rdata, 1, 1); | ||
| 131 | if (result < 0) | 133 | if (result < 0) |
| 132 | return result; | 134 | return result; |
| 133 | 135 | ||
| @@ -139,7 +141,8 @@ static int get_auto_brightness(void) | |||
| 139 | u8 wdata = 4, rdata; | 141 | u8 wdata = 4, rdata; |
| 140 | int result; | 142 | int result; |
| 141 | 143 | ||
| 142 | result = ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, &wdata, 1, &rdata, 1, 1); | 144 | result = ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, &wdata, 1, |
| 145 | &rdata, 1, 1); | ||
| 143 | if (result < 0) | 146 | if (result < 0) |
| 144 | return result; | 147 | return result; |
| 145 | 148 | ||
| @@ -153,14 +156,16 @@ static int set_auto_brightness(int enable) | |||
| 153 | 156 | ||
| 154 | wdata[0] = 4; | 157 | wdata[0] = 4; |
| 155 | 158 | ||
| 156 | result = ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, wdata, 1, &rdata, 1, 1); | 159 | result = ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, wdata, 1, |
| 160 | &rdata, 1, 1); | ||
| 157 | if (result < 0) | 161 | if (result < 0) |
| 158 | return result; | 162 | return result; |
| 159 | 163 | ||
| 160 | wdata[0] = 0x84; | 164 | wdata[0] = 0x84; |
| 161 | wdata[1] = (rdata & 0xF7) | (enable ? 8 : 0); | 165 | wdata[1] = (rdata & 0xF7) | (enable ? 8 : 0); |
| 162 | 166 | ||
| 163 | return ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, wdata, 2, NULL, 0, 1); | 167 | return ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, wdata, 2, |
| 168 | NULL, 0, 1); | ||
| 164 | } | 169 | } |
| 165 | 170 | ||
| 166 | static ssize_t set_device_state(const char *buf, size_t count, u8 mask) | 171 | static ssize_t set_device_state(const char *buf, size_t count, u8 mask) |
| @@ -255,7 +260,7 @@ static int bl_update_status(struct backlight_device *b) | |||
| 255 | return set_lcd_level(b->props.brightness); | 260 | return set_lcd_level(b->props.brightness); |
| 256 | } | 261 | } |
| 257 | 262 | ||
| 258 | static struct backlight_ops msibl_ops = { | 263 | static const struct backlight_ops msibl_ops = { |
| 259 | .get_brightness = bl_get_brightness, | 264 | .get_brightness = bl_get_brightness, |
| 260 | .update_status = bl_update_status, | 265 | .update_status = bl_update_status, |
| 261 | }; | 266 | }; |
| @@ -354,7 +359,8 @@ static ssize_t store_lcd_level(struct device *dev, | |||
| 354 | 359 | ||
| 355 | int level, ret; | 360 | int level, ret; |
| 356 | 361 | ||
| 357 | if (sscanf(buf, "%i", &level) != 1 || (level < 0 || level >= MSI_LCD_LEVEL_MAX)) | 362 | if (sscanf(buf, "%i", &level) != 1 || |
| 363 | (level < 0 || level >= MSI_LCD_LEVEL_MAX)) | ||
| 358 | return -EINVAL; | 364 | return -EINVAL; |
| 359 | 365 | ||
| 360 | ret = set_lcd_level(level); | 366 | ret = set_lcd_level(level); |
| @@ -394,7 +400,8 @@ static ssize_t store_auto_brightness(struct device *dev, | |||
| 394 | } | 400 | } |
| 395 | 401 | ||
| 396 | static DEVICE_ATTR(lcd_level, 0644, show_lcd_level, store_lcd_level); | 402 | static DEVICE_ATTR(lcd_level, 0644, show_lcd_level, store_lcd_level); |
| 397 | static DEVICE_ATTR(auto_brightness, 0644, show_auto_brightness, store_auto_brightness); | 403 | static DEVICE_ATTR(auto_brightness, 0644, show_auto_brightness, |
| 404 | store_auto_brightness); | ||
| 398 | static DEVICE_ATTR(bluetooth, 0444, show_bluetooth, NULL); | 405 | static DEVICE_ATTR(bluetooth, 0444, show_bluetooth, NULL); |
| 399 | static DEVICE_ATTR(wlan, 0444, show_wlan, NULL); | 406 | static DEVICE_ATTR(wlan, 0444, show_wlan, NULL); |
| 400 | static DEVICE_ATTR(threeg, 0444, show_threeg, NULL); | 407 | static DEVICE_ATTR(threeg, 0444, show_threeg, NULL); |
| @@ -425,8 +432,9 @@ static struct platform_device *msipf_device; | |||
| 425 | 432 | ||
| 426 | static int dmi_check_cb(const struct dmi_system_id *id) | 433 | static int dmi_check_cb(const struct dmi_system_id *id) |
| 427 | { | 434 | { |
| 428 | printk("msi-laptop: Identified laptop model '%s'.\n", id->ident); | 435 | printk(KERN_INFO "msi-laptop: Identified laptop model '%s'.\n", |
| 429 | return 0; | 436 | id->ident); |
| 437 | return 0; | ||
| 430 | } | 438 | } |
| 431 | 439 | ||
| 432 | static struct dmi_system_id __initdata msi_dmi_table[] = { | 440 | static struct dmi_system_id __initdata msi_dmi_table[] = { |
| @@ -436,7 +444,8 @@ static struct dmi_system_id __initdata msi_dmi_table[] = { | |||
| 436 | DMI_MATCH(DMI_SYS_VENDOR, "MICRO-STAR INT'L CO.,LTD"), | 444 | DMI_MATCH(DMI_SYS_VENDOR, "MICRO-STAR INT'L CO.,LTD"), |
| 437 | DMI_MATCH(DMI_PRODUCT_NAME, "MS-1013"), | 445 | DMI_MATCH(DMI_PRODUCT_NAME, "MS-1013"), |
| 438 | DMI_MATCH(DMI_PRODUCT_VERSION, "0131"), | 446 | DMI_MATCH(DMI_PRODUCT_VERSION, "0131"), |
| 439 | DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-STAR INT'L CO.,LTD") | 447 | DMI_MATCH(DMI_CHASSIS_VENDOR, |
| 448 | "MICRO-STAR INT'L CO.,LTD") | ||
| 440 | }, | 449 | }, |
| 441 | .callback = dmi_check_cb | 450 | .callback = dmi_check_cb |
| 442 | }, | 451 | }, |
| @@ -466,7 +475,8 @@ static struct dmi_system_id __initdata msi_dmi_table[] = { | |||
| 466 | DMI_MATCH(DMI_SYS_VENDOR, "NOTEBOOK"), | 475 | DMI_MATCH(DMI_SYS_VENDOR, "NOTEBOOK"), |
| 467 | DMI_MATCH(DMI_PRODUCT_NAME, "SAM2000"), | 476 | DMI_MATCH(DMI_PRODUCT_NAME, "SAM2000"), |
| 468 | DMI_MATCH(DMI_PRODUCT_VERSION, "0131"), | 477 | DMI_MATCH(DMI_PRODUCT_VERSION, "0131"), |
| 469 | DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-STAR INT'L CO.,LTD") | 478 | DMI_MATCH(DMI_CHASSIS_VENDOR, |
| 479 | "MICRO-STAR INT'L CO.,LTD") | ||
| 470 | }, | 480 | }, |
| 471 | .callback = dmi_check_cb | 481 | .callback = dmi_check_cb |
| 472 | }, | 482 | }, |
| @@ -823,7 +833,8 @@ static int __init msi_init(void) | |||
| 823 | goto fail_platform_device1; | 833 | goto fail_platform_device1; |
| 824 | } | 834 | } |
| 825 | 835 | ||
| 826 | ret = sysfs_create_group(&msipf_device->dev.kobj, &msipf_attribute_group); | 836 | ret = sysfs_create_group(&msipf_device->dev.kobj, |
| 837 | &msipf_attribute_group); | ||
| 827 | if (ret) | 838 | if (ret) |
| 828 | goto fail_platform_device2; | 839 | goto fail_platform_device2; |
| 829 | 840 | ||
