All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] acpi: video: improve quirk check
@ 2013-08-02 19:37 Felipe Contreras
  2013-08-02 23:47 ` Rafael J. Wysocki
  0 siblings, 1 reply; 25+ messages in thread
From: Felipe Contreras @ 2013-08-02 19:37 UTC (permalink / raw)
  To: linux-kernel, linux-acpi
  Cc: Rafael J. Wysocki, Len Brown, Zhang Rui, Aaron Lu, Felipe Contreras

If the _BCL package is descending, the first level (br->levels[2]) will
be 0, and if the number of levels matches the number of steps, we might
confuse a returned level to mean the index.

For example:

  current_level = max_level = 100
  test_level = 0
  returned level = 100

In this case 100 means the level, not the index, and _BCM failed. But if
the _BCL package is descending, the index of level 0 is also 100, so we
assume _BQC is indexed, when it's not.

This causes all _BQC calls to return bogus values causing weird behavior
from the user's perspective. For example: xbacklight -set 10; xbacklight
-set 20; would flash to 90% and then slowly down to the desired level
(20).

The solution is simple; test anything other than the first level (e.g.
1).

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---

On top of this we might want to test yet another value, because br->levels[3]
might be the current value (although very unlikely).

 drivers/acpi/video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 0ec434d..e1284b8 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -689,7 +689,7 @@ static int acpi_video_bqc_quirk(struct acpi_video_device *device,
 	 * Some systems always report current brightness level as maximum
 	 * through _BQC, we need to test another value for them.
 	 */
-	test_level = current_level == max_level ? br->levels[2] : max_level;
+	test_level = current_level == max_level ? br->levels[3] : max_level;
 
 	result = acpi_video_device_lcd_set_level(device, test_level);
 	if (result)
-- 
1.8.4.rc1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2013-08-07  4:34 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-02 19:37 [PATCH] acpi: video: improve quirk check Felipe Contreras
2013-08-02 23:47 ` Rafael J. Wysocki
2013-08-03  1:04   ` Felipe Contreras
2013-08-03  1:16     ` Rafael J. Wysocki
2013-08-03  1:07       ` Felipe Contreras
2013-08-03  1:19         ` Rafael J. Wysocki
2013-08-03  1:30           ` Felipe Contreras
2013-08-03  8:14   ` Aaron Lu
2013-08-03 11:34     ` Rafael J. Wysocki
2013-08-03 20:24       ` Felipe Contreras
2013-08-03 21:40         ` Rafael J. Wysocki
2013-08-03 22:20           ` Felipe Contreras
2013-08-03 22:38             ` Rafael J. Wysocki
2013-08-03 22:37               ` Felipe Contreras
2013-08-04  1:47             ` Aaron Lu
2013-08-04  6:54               ` Felipe Contreras
2013-08-04 14:14                 ` Rafael J. Wysocki
2013-08-04 14:08                   ` Felipe Contreras
2013-08-04  1:18       ` Aaron Lu
2013-08-04  6:42         ` Felipe Contreras
2013-08-04 14:19           ` Rafael J. Wysocki
2013-08-04 14:19             ` Felipe Contreras
2013-08-05 14:04               ` Rafael J. Wysocki
2013-08-05 14:41                 ` Felipe Contreras
2013-08-07  4:35               ` Aaron Lu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.