ACPI: Skip the first two elements in the _BCL package

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>

authored by Zhao Yakui and committed by Len Brown 0a3db1ce 18e352e4

+4 -4
+4 -4
drivers/acpi/video.c
··· 1020 } 1021 1022 seq_printf(seq, "levels: "); 1023 - for (i = 0; i < dev->brightness->count; i++) 1024 seq_printf(seq, " %d", dev->brightness->levels[i]); 1025 seq_printf(seq, "\ncurrent: %d\n", dev->brightness->curr); 1026 ··· 1059 return -EFAULT; 1060 1061 /* validate through the list of available levels */ 1062 - for (i = 0; i < dev->brightness->count; i++) 1063 if (level == dev->brightness->levels[i]) { 1064 if (ACPI_SUCCESS 1065 (acpi_video_device_lcd_set_level(dev, level))) ··· 1712 max = max_below = 0; 1713 min = min_above = 255; 1714 /* Find closest level to level_current */ 1715 - for (i = 0; i < device->brightness->count; i++) { 1716 l = device->brightness->levels[i]; 1717 if (abs(l - level_current) < abs(delta)) { 1718 delta = l - level_current; ··· 1722 } 1723 /* Ajust level_current to closest available level */ 1724 level_current += delta; 1725 - for (i = 0; i < device->brightness->count; i++) { 1726 l = device->brightness->levels[i]; 1727 if (l < min) 1728 min = l;
··· 1020 } 1021 1022 seq_printf(seq, "levels: "); 1023 + for (i = 2; i < dev->brightness->count; i++) 1024 seq_printf(seq, " %d", dev->brightness->levels[i]); 1025 seq_printf(seq, "\ncurrent: %d\n", dev->brightness->curr); 1026 ··· 1059 return -EFAULT; 1060 1061 /* validate through the list of available levels */ 1062 + for (i = 2; i < dev->brightness->count; i++) 1063 if (level == dev->brightness->levels[i]) { 1064 if (ACPI_SUCCESS 1065 (acpi_video_device_lcd_set_level(dev, level))) ··· 1712 max = max_below = 0; 1713 min = min_above = 255; 1714 /* Find closest level to level_current */ 1715 + for (i = 2; i < device->brightness->count; i++) { 1716 l = device->brightness->levels[i]; 1717 if (abs(l - level_current) < abs(delta)) { 1718 delta = l - level_current; ··· 1722 } 1723 /* Ajust level_current to closest available level */ 1724 level_current += delta; 1725 + for (i = 2; i < device->brightness->count; i++) { 1726 l = device->brightness->levels[i]; 1727 if (l < min) 1728 min = l;