Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 141913
b: refs/heads/master
c: 24450c7
h: refs/heads/master
i:
  141911: e7d9b5d
v: v3
  • Loading branch information
Zhang Rui authored and Len Brown committed Mar 28, 2009
1 parent 94152ff commit 5a0e6f7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c8890f903a6fdf5711726e8e8d65cb13423f8833
refs/heads/master: 24450c7add575cef53097738f16a4c1a720fa5cb
37 changes: 21 additions & 16 deletions trunk/drivers/acpi/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,12 @@ static int acpi_video_get_brightness(struct backlight_device *bd)

static int acpi_video_set_brightness(struct backlight_device *bd)
{
int request_level = bd->props.brightness+2;
int request_level = bd->props.brightness + 2;
struct acpi_video_device *vd =
(struct acpi_video_device *)bl_get_data(bd);
acpi_video_device_lcd_set_level(vd,
vd->brightness->levels[request_level]);
return 0;

return acpi_video_device_lcd_set_level(vd,
vd->brightness->levels[request_level]);
}

static struct backlight_ops acpi_backlight_ops = {
Expand Down Expand Up @@ -482,23 +482,29 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
static int
acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
{
int status = AE_OK;
int status;
union acpi_object arg0 = { ACPI_TYPE_INTEGER };
struct acpi_object_list args = { 1, &arg0 };
int state;


arg0.integer.value = level;

if (device->cap._BCM)
status = acpi_evaluate_object(device->dev->handle, "_BCM",
&args, NULL);
status = acpi_evaluate_object(device->dev->handle, "_BCM",
&args, NULL);
if (ACPI_FAILURE(status)) {
ACPI_ERROR((AE_INFO, "Evaluating _BCM failed"));
return -EIO;
}

device->brightness->curr = level;
for (state = 2; state < device->brightness->count; state++)
if (level == device->brightness->levels[state])
if (level == device->brightness->levels[state]) {
device->backlight->props.brightness = state - 2;
return 0;
}

return status;
ACPI_ERROR((AE_INFO, "Current brightness invalid"));
return -EINVAL;
}

static int
Expand Down Expand Up @@ -1082,13 +1088,12 @@ acpi_video_device_write_brightness(struct file *file,
/* validate through the list of available levels */
for (i = 2; i < dev->brightness->count; i++)
if (level == dev->brightness->levels[i]) {
if (ACPI_SUCCESS
(acpi_video_device_lcd_set_level(dev, level)))
dev->brightness->curr = level;
if (!acpi_video_device_lcd_set_level(dev, level))
return count;
break;
}

return count;
return -EINVAL;
}

static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset)
Expand Down Expand Up @@ -1786,7 +1791,7 @@ acpi_video_switch_brightness(struct acpi_video_device *device, int event)

level_next = acpi_video_get_next_level(device, level_current, event);

acpi_video_device_lcd_set_level(device, level_next);
result = acpi_video_device_lcd_set_level(device, level_next);

out:
if (result)
Expand Down

0 comments on commit 5a0e6f7

Please sign in to comment.