diff options
author | Matthew Garrett <mjg@redhat.com> | 2010-02-16 16:53:50 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2010-03-14 16:06:37 -0400 |
commit | 70287db87cfc968fe78bf82a489833cc77b84352 (patch) | |
tree | f4863a415e684c83bda0ea93655640a388c984fd /drivers/acpi | |
parent | f8b55f251012e104093e105483c45c5d85ad3040 (diff) |
ACPI video: Be more liberal in validating _BQC behaviour
Right now, if _BQC returns a value we don't understand we immediately
invalidate it. Change this behaviour so we only invalidate it if it
continues to give an invalid answer after we've already set a brightness.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Acked-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/video.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index b765790b32be..ea314a2ecd12 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -327,7 +327,7 @@ static int acpi_video_device_lcd_set_level(struct acpi_video_device *device, | |||
327 | int level); | 327 | int level); |
328 | static int acpi_video_device_lcd_get_level_current( | 328 | static int acpi_video_device_lcd_get_level_current( |
329 | struct acpi_video_device *device, | 329 | struct acpi_video_device *device, |
330 | unsigned long long *level); | 330 | unsigned long long *level, int init); |
331 | static int acpi_video_get_next_level(struct acpi_video_device *device, | 331 | static int acpi_video_get_next_level(struct acpi_video_device *device, |
332 | u32 level_current, u32 event); | 332 | u32 level_current, u32 event); |
333 | static int acpi_video_switch_brightness(struct acpi_video_device *device, | 333 | static int acpi_video_switch_brightness(struct acpi_video_device *device, |
@@ -345,7 +345,7 @@ static int acpi_video_get_brightness(struct backlight_device *bd) | |||
345 | struct acpi_video_device *vd = | 345 | struct acpi_video_device *vd = |
346 | (struct acpi_video_device *)bl_get_data(bd); | 346 | (struct acpi_video_device *)bl_get_data(bd); |
347 | 347 | ||
348 | if (acpi_video_device_lcd_get_level_current(vd, &cur_level)) | 348 | if (acpi_video_device_lcd_get_level_current(vd, &cur_level, 0)) |
349 | return -EINVAL; | 349 | return -EINVAL; |
350 | for (i = 2; i < vd->brightness->count; i++) { | 350 | for (i = 2; i < vd->brightness->count; i++) { |
351 | if (vd->brightness->levels[i] == cur_level) | 351 | if (vd->brightness->levels[i] == cur_level) |
@@ -414,7 +414,7 @@ static int video_get_cur_state(struct thermal_cooling_device *cooling_dev, unsig | |||
414 | unsigned long long level; | 414 | unsigned long long level; |
415 | int offset; | 415 | int offset; |
416 | 416 | ||
417 | if (acpi_video_device_lcd_get_level_current(video, &level)) | 417 | if (acpi_video_device_lcd_get_level_current(video, &level, 0)) |
418 | return -EINVAL; | 418 | return -EINVAL; |
419 | for (offset = 2; offset < video->brightness->count; offset++) | 419 | for (offset = 2; offset < video->brightness->count; offset++) |
420 | if (level == video->brightness->levels[offset]) { | 420 | if (level == video->brightness->levels[offset]) { |
@@ -609,7 +609,7 @@ static struct dmi_system_id video_dmi_table[] __initdata = { | |||
609 | 609 | ||
610 | static int | 610 | static int |
611 | acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, | 611 | acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, |
612 | unsigned long long *level) | 612 | unsigned long long *level, int init) |
613 | { | 613 | { |
614 | acpi_status status = AE_OK; | 614 | acpi_status status = AE_OK; |
615 | int i; | 615 | int i; |
@@ -633,10 +633,16 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, | |||
633 | device->brightness->curr = *level; | 633 | device->brightness->curr = *level; |
634 | return 0; | 634 | return 0; |
635 | } | 635 | } |
636 | /* BQC returned an invalid level. Stop using it. */ | 636 | if (!init) { |
637 | ACPI_WARNING((AE_INFO, "%s returned an invalid level", | 637 | /* |
638 | buf)); | 638 | * BQC returned an invalid level. |
639 | device->cap._BQC = device->cap._BCQ = 0; | 639 | * Stop using it. |
640 | */ | ||
641 | ACPI_WARNING((AE_INFO, | ||
642 | "%s returned an invalid level", | ||
643 | buf)); | ||
644 | device->cap._BQC = device->cap._BCQ = 0; | ||
645 | } | ||
640 | } else { | 646 | } else { |
641 | /* Fixme: | 647 | /* Fixme: |
642 | * should we return an error or ignore this failure? | 648 | * should we return an error or ignore this failure? |
@@ -892,7 +898,7 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
892 | if (!device->cap._BQC) | 898 | if (!device->cap._BQC) |
893 | goto set_level; | 899 | goto set_level; |
894 | 900 | ||
895 | result = acpi_video_device_lcd_get_level_current(device, &level_old); | 901 | result = acpi_video_device_lcd_get_level_current(device, &level_old, 1); |
896 | if (result) | 902 | if (result) |
897 | goto out_free_levels; | 903 | goto out_free_levels; |
898 | 904 | ||
@@ -903,7 +909,7 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
903 | if (result) | 909 | if (result) |
904 | goto out_free_levels; | 910 | goto out_free_levels; |
905 | 911 | ||
906 | result = acpi_video_device_lcd_get_level_current(device, &level); | 912 | result = acpi_video_device_lcd_get_level_current(device, &level, 0); |
907 | if (result) | 913 | if (result) |
908 | goto out_free_levels; | 914 | goto out_free_levels; |
909 | 915 | ||
@@ -1996,7 +2002,7 @@ acpi_video_switch_brightness(struct acpi_video_device *device, int event) | |||
1996 | goto out; | 2002 | goto out; |
1997 | 2003 | ||
1998 | result = acpi_video_device_lcd_get_level_current(device, | 2004 | result = acpi_video_device_lcd_get_level_current(device, |
1999 | &level_current); | 2005 | &level_current, 0); |
2000 | if (result) | 2006 | if (result) |
2001 | goto out; | 2007 | goto out; |
2002 | 2008 | ||