diff options
-rw-r--r-- | drivers/acpi/video.c | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 56666a982476..9200a46c38bd 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -3,6 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2004 Luming Yu <luming.yu@intel.com> | 4 | * Copyright (C) 2004 Luming Yu <luming.yu@intel.com> |
5 | * Copyright (C) 2004 Bruno Ducrot <ducrot@poupinou.org> | 5 | * Copyright (C) 2004 Bruno Ducrot <ducrot@poupinou.org> |
6 | * Copyright (C) 2006 Thomas Tuttle <linux-kernel@ttuttle.net> | ||
6 | * | 7 | * |
7 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 8 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
8 | * | 9 | * |
@@ -47,11 +48,11 @@ | |||
47 | #define ACPI_VIDEO_NOTIFY_NEXT_OUTPUT 0x83 | 48 | #define ACPI_VIDEO_NOTIFY_NEXT_OUTPUT 0x83 |
48 | #define ACPI_VIDEO_NOTIFY_PREV_OUTPUT 0x84 | 49 | #define ACPI_VIDEO_NOTIFY_PREV_OUTPUT 0x84 |
49 | 50 | ||
50 | #define ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS 0x82 | 51 | #define ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS 0x85 |
51 | #define ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS 0x83 | 52 | #define ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS 0x86 |
52 | #define ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS 0x84 | 53 | #define ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS 0x87 |
53 | #define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x85 | 54 | #define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x88 |
54 | #define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x86 | 55 | #define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x89 |
55 | 56 | ||
56 | #define ACPI_VIDEO_HEAD_INVALID (~0u - 1) | 57 | #define ACPI_VIDEO_HEAD_INVALID (~0u - 1) |
57 | #define ACPI_VIDEO_HEAD_END (~0u) | 58 | #define ACPI_VIDEO_HEAD_END (~0u) |
@@ -1509,8 +1510,34 @@ static int | |||
1509 | acpi_video_get_next_level(struct acpi_video_device *device, | 1510 | acpi_video_get_next_level(struct acpi_video_device *device, |
1510 | u32 level_current, u32 event) | 1511 | u32 level_current, u32 event) |
1511 | { | 1512 | { |
1512 | /*Fix me */ | 1513 | int min, max, min_above, max_below, i, l; |
1513 | return level_current; | 1514 | max = max_below = 0; |
1515 | min = min_above = 255; | ||
1516 | for (i = 0; i < device->brightness->count; i++) { | ||
1517 | l = device->brightness->levels[i]; | ||
1518 | if (l < min) | ||
1519 | min = l; | ||
1520 | if (l > max) | ||
1521 | max = l; | ||
1522 | if (l < min_above && l > level_current) | ||
1523 | min_above = l; | ||
1524 | if (l > max_below && l < level_current) | ||
1525 | max_below = l; | ||
1526 | } | ||
1527 | |||
1528 | switch (event) { | ||
1529 | case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: | ||
1530 | return (level_current < max) ? min_above : min; | ||
1531 | case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS: | ||
1532 | return (level_current < max) ? min_above : max; | ||
1533 | case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS: | ||
1534 | return (level_current > min) ? max_below : min; | ||
1535 | case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS: | ||
1536 | case ACPI_VIDEO_NOTIFY_DISPLAY_OFF: | ||
1537 | return 0; | ||
1538 | default: | ||
1539 | return level_current; | ||
1540 | } | ||
1514 | } | 1541 | } |
1515 | 1542 | ||
1516 | static void | 1543 | static void |