aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/video.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r--drivers/acpi/video.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index f0e6eb534161..52f52b32b63f 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -322,12 +322,12 @@ static int acpi_video_get_brightness(struct backlight_device *bd)
322 322
323static int acpi_video_set_brightness(struct backlight_device *bd) 323static int acpi_video_set_brightness(struct backlight_device *bd)
324{ 324{
325 int request_level = bd->props.brightness+2; 325 int request_level = bd->props.brightness + 2;
326 struct acpi_video_device *vd = 326 struct acpi_video_device *vd =
327 (struct acpi_video_device *)bl_get_data(bd); 327 (struct acpi_video_device *)bl_get_data(bd);
328 acpi_video_device_lcd_set_level(vd, 328
329 vd->brightness->levels[request_level]); 329 return acpi_video_device_lcd_set_level(vd,
330 return 0; 330 vd->brightness->levels[request_level]);
331} 331}
332 332
333static struct backlight_ops acpi_backlight_ops = { 333static struct backlight_ops acpi_backlight_ops = {
@@ -482,23 +482,29 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
482static int 482static int
483acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level) 483acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
484{ 484{
485 int status = AE_OK; 485 int status;
486 union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 486 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
487 struct acpi_object_list args = { 1, &arg0 }; 487 struct acpi_object_list args = { 1, &arg0 };
488 int state; 488 int state;
489 489
490
491 arg0.integer.value = level; 490 arg0.integer.value = level;
492 491
493 if (device->cap._BCM) 492 status = acpi_evaluate_object(device->dev->handle, "_BCM",
494 status = acpi_evaluate_object(device->dev->handle, "_BCM", 493 &args, NULL);
495 &args, NULL); 494 if (ACPI_FAILURE(status)) {
495 ACPI_ERROR((AE_INFO, "Evaluating _BCM failed"));
496 return -EIO;
497 }
498
496 device->brightness->curr = level; 499 device->brightness->curr = level;
497 for (state = 2; state < device->brightness->count; state++) 500 for (state = 2; state < device->brightness->count; state++)
498 if (level == device->brightness->levels[state]) 501 if (level == device->brightness->levels[state]) {
499 device->backlight->props.brightness = state - 2; 502 device->backlight->props.brightness = state - 2;
503 return 0;
504 }
500 505
501 return status; 506 ACPI_ERROR((AE_INFO, "Current brightness invalid"));
507 return -EINVAL;
502} 508}
503 509
504static int 510static int
@@ -1082,13 +1088,12 @@ acpi_video_device_write_brightness(struct file *file,
1082 /* validate through the list of available levels */ 1088 /* validate through the list of available levels */
1083 for (i = 2; i < dev->brightness->count; i++) 1089 for (i = 2; i < dev->brightness->count; i++)
1084 if (level == dev->brightness->levels[i]) { 1090 if (level == dev->brightness->levels[i]) {
1085 if (ACPI_SUCCESS 1091 if (!acpi_video_device_lcd_set_level(dev, level))
1086 (acpi_video_device_lcd_set_level(dev, level))) 1092 return count;
1087 dev->brightness->curr = level;
1088 break; 1093 break;
1089 } 1094 }
1090 1095
1091 return count; 1096 return -EINVAL;
1092} 1097}
1093 1098
1094static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset) 1099static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset)
@@ -1786,7 +1791,7 @@ acpi_video_switch_brightness(struct acpi_video_device *device, int event)
1786 1791
1787 level_next = acpi_video_get_next_level(device, level_current, event); 1792 level_next = acpi_video_get_next_level(device, level_current, event);
1788 1793
1789 acpi_video_device_lcd_set_level(device, level_next); 1794 result = acpi_video_device_lcd_set_level(device, level_next);
1790 1795
1791out: 1796out:
1792 if (result) 1797 if (result)