summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorZhao Yakui <yakui.zhao@intel.com>2009-02-02 11:33:41 +0800
committerGreg Kroah-Hartman <gregkh@suse.de>2009-02-12 09:50:33 -0800
commitd72c92a4e3c9f1ef8ee48196dcc3d8f54a816cb4 (patch)
tree993739c0a4f3607946a99709cf712668e2be25df /drivers
parentec778e2c921546e55e914033b3fe112b33708381 (diff)
ACPI: Skip the first two elements in the _BCL package
commit 0a3db1cec5d476804185114ff5d1845aed3936b3 upstream. According to the Spec the first two elements in the _BCL package won't be regarded as the available brightness level. The first is the brightness when full power is connected to the box(It means that the AC adapter is plugged). The second is the brightness level when the box is on battery. If the first two elements are still used while finding the next brightness level, it will fall back to the lowest level when keeping on pressing hotkey. (On some boxes the brightness will be changed twice when hotkey is pressed once. One is in the ACPI video driver. The other is changed by sys I/F. In the ACPI video driver the first two elements will be used while changing the brightness. But the first two elements is skipped while using sys I/F. In such case there exists the inconsistency). So he first two elements had better be skipped while showing the available brightness or finding the next brightness level. http://bugzilla.kernel.org/show_bug.cgi?id=12450 Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Signed-off-by: Len Brown <len.brown@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/video.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 66a610d0e2f5..baaff815bbc1 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -1005,7 +1005,7 @@ acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset)
}
seq_printf(seq, "levels: ");
- for (i = 0; i < dev->brightness->count; i++)
+ for (i = 2; i < dev->brightness->count; i++)
seq_printf(seq, " %d", dev->brightness->levels[i]);
seq_printf(seq, "\ncurrent: %d\n", dev->brightness->curr);
@@ -1044,7 +1044,7 @@ acpi_video_device_write_brightness(struct file *file,
return -EFAULT;
/* validate through the list of available levels */
- for (i = 0; i < dev->brightness->count; i++)
+ 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)))
@@ -1697,7 +1697,7 @@ acpi_video_get_next_level(struct acpi_video_device *device,
max = max_below = 0;
min = min_above = 255;
/* Find closest level to level_current */
- for (i = 0; i < device->brightness->count; i++) {
+ for (i = 2; i < device->brightness->count; i++) {
l = device->brightness->levels[i];
if (abs(l - level_current) < abs(delta)) {
delta = l - level_current;
@@ -1707,7 +1707,7 @@ acpi_video_get_next_level(struct acpi_video_device *device,
}
/* Ajust level_current to closest available level */
level_current += delta;
- for (i = 0; i < device->brightness->count; i++) {
+ for (i = 2; i < device->brightness->count; i++) {
l = device->brightness->levels[i];
if (l < min)
min = l;