Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 367605
b: refs/heads/master
c: a89803d
h: refs/heads/master
i:
  367603: 1d26946
v: v3
  • Loading branch information
Danny Baumann authored and Rafael J. Wysocki committed Mar 24, 2013
1 parent 6911658 commit 1e06b08
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 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: e4f5224464739a89e6a6c9169211ef4f76165056
refs/heads/master: a89803df9c9b2d023227c48503066a728f1fed36
43 changes: 26 additions & 17 deletions trunk/drivers/acpi/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ static int acpi_video_device_lcd_set_level(struct acpi_video_device *device,
int level);
static int acpi_video_device_lcd_get_level_current(
struct acpi_video_device *device,
unsigned long long *level, int init);
unsigned long long *level, bool raw);
static int acpi_video_get_next_level(struct acpi_video_device *device,
u32 level_current, u32 event);
static int acpi_video_switch_brightness(struct acpi_video_device *device,
Expand All @@ -236,7 +236,7 @@ static int acpi_video_get_brightness(struct backlight_device *bd)
struct acpi_video_device *vd =
(struct acpi_video_device *)bl_get_data(bd);

if (acpi_video_device_lcd_get_level_current(vd, &cur_level, 0))
if (acpi_video_device_lcd_get_level_current(vd, &cur_level, false))
return -EINVAL;
for (i = 2; i < vd->brightness->count; i++) {
if (vd->brightness->levels[i] == cur_level)
Expand Down Expand Up @@ -281,7 +281,7 @@ static int video_get_cur_state(struct thermal_cooling_device *cooling_dev, unsig
unsigned long long level;
int offset;

if (acpi_video_device_lcd_get_level_current(video, &level, 0))
if (acpi_video_device_lcd_get_level_current(video, &level, false))
return -EINVAL;
for (offset = 2; offset < video->brightness->count; offset++)
if (level == video->brightness->levels[offset]) {
Expand Down Expand Up @@ -460,7 +460,7 @@ static struct dmi_system_id video_dmi_table[] __initdata = {

static int
acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
unsigned long long *level, int init)
unsigned long long *level, bool raw)
{
acpi_status status = AE_OK;
int i;
Expand All @@ -471,6 +471,15 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
status = acpi_evaluate_integer(device->dev->handle, buf,
NULL, level);
if (ACPI_SUCCESS(status)) {
if (raw) {
/*
* Caller has indicated he wants the raw
* value returned by _BQC, so don't furtherly
* mess with the value.
*/
return 0;
}

if (device->brightness->flags._BQC_use_index) {
if (device->brightness->flags._BCL_reversed)
*level = device->brightness->count
Expand All @@ -484,16 +493,14 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
device->brightness->curr = *level;
return 0;
}
if (!init) {
/*
* BQC returned an invalid level.
* Stop using it.
*/
ACPI_WARNING((AE_INFO,
"%s returned an invalid level",
buf));
device->cap._BQC = device->cap._BCQ = 0;
}
/*
* BQC returned an invalid level.
* Stop using it.
*/
ACPI_WARNING((AE_INFO,
"%s returned an invalid level",
buf));
device->cap._BQC = device->cap._BCQ = 0;
} else {
/* Fixme:
* should we return an error or ignore this failure?
Expand Down Expand Up @@ -711,7 +718,8 @@ acpi_video_init_brightness(struct acpi_video_device *device)
if (!device->cap._BQC)
goto set_level;

result = acpi_video_device_lcd_get_level_current(device, &level_old, 1);
result = acpi_video_device_lcd_get_level_current(device,
&level_old, true);
if (result)
goto out_free_levels;

Expand All @@ -722,7 +730,7 @@ acpi_video_init_brightness(struct acpi_video_device *device)
if (result)
goto out_free_levels;

result = acpi_video_device_lcd_get_level_current(device, &level, 0);
result = acpi_video_device_lcd_get_level_current(device, &level, true);
if (result)
goto out_free_levels;

Expand Down Expand Up @@ -1276,7 +1284,8 @@ acpi_video_switch_brightness(struct acpi_video_device *device, int event)
goto out;

result = acpi_video_device_lcd_get_level_current(device,
&level_current, 0);
&level_current,
false);
if (result)
goto out;

Expand Down

0 comments on commit 1e06b08

Please sign in to comment.