diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-09 14:55:14 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-09 14:55:14 -0500 |
commit | a3a798c88a14b35e5d4ca30716dbc9eb9a1ddfe2 (patch) | |
tree | 393969a0f1405237483c8c29b904690f2bb90559 /drivers/acpi/video.c | |
parent | efcb3cf7f00c3c424db012380a8a974c2676a3c8 (diff) | |
parent | d97c0defba25a959a990f6d4759f43075540832e (diff) |
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (94 commits)
ACPICA: hide private headers
ACPICA: create acpica/ directory
ACPI: fix build warning
ACPI : Use RSDT instead of XSDT by adding boot option of "acpi=rsdt"
ACPI: Avoid array address overflow when _CST MWAIT hint bits are set
fujitsu-laptop: Simplify SBLL/SBL2 backlight handling
fujitsu-laptop: Add BL power, LED control and radio state information
ACPICA: delete utcache.c
ACPICA: delete acdisasm.h
ACPICA: Update version to 20081204.
ACPICA: FADT: Update error msgs for consistency
ACPICA: FADT: set acpi_gbl_use_default_register_widths to TRUE by default
ACPICA: FADT parsing changes and fixes
ACPICA: Add ACPI_MUTEX_TYPE configuration option
ACPICA: Fixes for various ACPI data tables
ACPICA: Restructure includes into public/private
ACPI: remove private acpica headers from driver files
ACPI: reboot.c: use new acpi_reset interface
ACPICA: New: acpi_reset interface - write to reset register
ACPICA: Move all public H/W interfaces to new hwxface
...
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r-- | drivers/acpi/video.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index baa441929720..f261737636da 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/backlight.h> | 36 | #include <linux/backlight.h> |
37 | #include <linux/thermal.h> | 37 | #include <linux/thermal.h> |
38 | #include <linux/video_output.h> | 38 | #include <linux/video_output.h> |
39 | #include <linux/sort.h> | ||
39 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
40 | 41 | ||
41 | #include <acpi/acpi_bus.h> | 42 | #include <acpi/acpi_bus.h> |
@@ -481,6 +482,7 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level) | |||
481 | int status = AE_OK; | 482 | int status = AE_OK; |
482 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; | 483 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; |
483 | struct acpi_object_list args = { 1, &arg0 }; | 484 | struct acpi_object_list args = { 1, &arg0 }; |
485 | int state; | ||
484 | 486 | ||
485 | 487 | ||
486 | arg0.integer.value = level; | 488 | arg0.integer.value = level; |
@@ -489,6 +491,10 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level) | |||
489 | status = acpi_evaluate_object(device->dev->handle, "_BCM", | 491 | status = acpi_evaluate_object(device->dev->handle, "_BCM", |
490 | &args, NULL); | 492 | &args, NULL); |
491 | device->brightness->curr = level; | 493 | device->brightness->curr = level; |
494 | for (state = 2; state < device->brightness->count; state++) | ||
495 | if (level == device->brightness->levels[state]) | ||
496 | device->backlight->props.brightness = state - 2; | ||
497 | |||
492 | return status; | 498 | return status; |
493 | } | 499 | } |
494 | 500 | ||
@@ -626,6 +632,16 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) | |||
626 | } | 632 | } |
627 | 633 | ||
628 | /* | 634 | /* |
635 | * Simple comparison function used to sort backlight levels. | ||
636 | */ | ||
637 | |||
638 | static int | ||
639 | acpi_video_cmp_level(const void *a, const void *b) | ||
640 | { | ||
641 | return *(int *)a - *(int *)b; | ||
642 | } | ||
643 | |||
644 | /* | ||
629 | * Arg: | 645 | * Arg: |
630 | * device : video output device (LCD, CRT, ..) | 646 | * device : video output device (LCD, CRT, ..) |
631 | * | 647 | * |
@@ -676,6 +692,10 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
676 | count++; | 692 | count++; |
677 | } | 693 | } |
678 | 694 | ||
695 | /* don't sort the first two brightness levels */ | ||
696 | sort(&br->levels[2], count - 2, sizeof(br->levels[2]), | ||
697 | acpi_video_cmp_level, NULL); | ||
698 | |||
679 | if (count < 2) | 699 | if (count < 2) |
680 | goto out_free_levels; | 700 | goto out_free_levels; |
681 | 701 | ||