aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/video.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-19 16:12:46 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-19 16:12:46 -0400
commitc4ec20717313daafba59225f812db89595952b83 (patch)
tree253337453b1dc965c40668e4949337ed1c46cab7 /drivers/acpi/video.c
parentec2626815bf9a9922e49820b03e670e833f3ca3c (diff)
parent00a2b433557f10736e8a02de619b3e9052556c12 (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: (41 commits) ACPICA: hw: Don't carry spinlock over suspend ACPICA: hw: remove use_lock flag from acpi_hw_register_{read, write} ACPI: cpuidle: port idle timer suspend/resume workaround to cpuidle ACPI: clean up acpi_enter_sleep_state_prep Hibernation: Make sure that ACPI is enabled in acpi_hibernation_finish ACPI: suppress uninitialized var warning cpuidle: consolidate 2.6.22 cpuidle branch into one patch ACPI: thinkpad-acpi: skip blanks before the data when parsing sysfs ACPI: AC: Add sysfs interface ACPI: SBS: Add sysfs alarm ACPI: SBS: Add ACPI_PROCFS around procfs handling code. ACPI: SBS: Add support for power_supply class (and sysfs) ACPI: SBS: Make SBS reads table-driven. ACPI: SBS: Simplify data structures in SBS ACPI: SBS: Split host controller (ACPI0001) from SBS driver (ACPI0002) ACPI: EC: Add new query handler to list head. ACPI: Add acpi_bus_generate_event4() function ACPI: Battery: add sysfs alarm ACPI: Battery: Add sysfs support ACPI: Battery: Misc clean-ups, no functional changes ... Fix up conflicts in drivers/misc/thinkpad_acpi.[ch] manually
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r--drivers/acpi/video.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index b8a2095cb5ee..bac956b30c57 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -409,14 +409,17 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
409static int 409static int
410acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level) 410acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
411{ 411{
412 int status; 412 int status = AE_OK;
413 union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 413 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
414 struct acpi_object_list args = { 1, &arg0 }; 414 struct acpi_object_list args = { 1, &arg0 };
415 415
416 416
417 arg0.integer.value = level; 417 arg0.integer.value = level;
418 status = acpi_evaluate_object(device->dev->handle, "_BCM", &args, NULL);
419 418
419 if (device->cap._BCM)
420 status = acpi_evaluate_object(device->dev->handle, "_BCM",
421 &args, NULL);
422 device->brightness->curr = level;
420 return status; 423 return status;
421} 424}
422 425
@@ -424,11 +427,11 @@ static int
424acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, 427acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
425 unsigned long *level) 428 unsigned long *level)
426{ 429{
427 int status; 430 if (device->cap._BQC)
428 431 return acpi_evaluate_integer(device->dev->handle, "_BQC", NULL,
429 status = acpi_evaluate_integer(device->dev->handle, "_BQC", NULL, level); 432 level);
430 433 *level = device->brightness->curr;
431 return status; 434 return AE_OK;
432} 435}
433 436
434static int 437static int
@@ -1633,9 +1636,20 @@ static int
1633acpi_video_get_next_level(struct acpi_video_device *device, 1636acpi_video_get_next_level(struct acpi_video_device *device,
1634 u32 level_current, u32 event) 1637 u32 level_current, u32 event)
1635{ 1638{
1636 int min, max, min_above, max_below, i, l; 1639 int min, max, min_above, max_below, i, l, delta = 255;
1637 max = max_below = 0; 1640 max = max_below = 0;
1638 min = min_above = 255; 1641 min = min_above = 255;
1642 /* Find closest level to level_current */
1643 for (i = 0; i < device->brightness->count; i++) {
1644 l = device->brightness->levels[i];
1645 if (abs(l - level_current) < abs(delta)) {
1646 delta = l - level_current;
1647 if (!delta)
1648 break;
1649 }
1650 }
1651 /* Ajust level_current to closest available level */
1652 level_current += delta;
1639 for (i = 0; i < device->brightness->count; i++) { 1653 for (i = 0; i < device->brightness->count; i++) {
1640 l = device->brightness->levels[i]; 1654 l = device->brightness->levels[i];
1641 if (l < min) 1655 if (l < min)