aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/video.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r--drivers/acpi/video.c41
1 files changed, 34 insertions, 7 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 53a9eb015d6b..eb5141f9ef8f 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)
@@ -1505,8 +1506,34 @@ static int
1505acpi_video_get_next_level(struct acpi_video_device *device, 1506acpi_video_get_next_level(struct acpi_video_device *device,
1506 u32 level_current, u32 event) 1507 u32 level_current, u32 event)
1507{ 1508{
1508 /*Fix me */ 1509 int min, max, min_above, max_below, i, l;
1509 return level_current; 1510 max = max_below = 0;
1511 min = min_above = 255;
1512 for (i = 0; i < device->brightness->count; i++) {
1513 l = device->brightness->levels[i];
1514 if (l < min)
1515 min = l;
1516 if (l > max)
1517 max = l;
1518 if (l < min_above && l > level_current)
1519 min_above = l;
1520 if (l > max_below && l < level_current)
1521 max_below = l;
1522 }
1523
1524 switch (event) {
1525 case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS:
1526 return (level_current < max) ? min_above : min;
1527 case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS:
1528 return (level_current < max) ? min_above : max;
1529 case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS:
1530 return (level_current > min) ? max_below : min;
1531 case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS:
1532 case ACPI_VIDEO_NOTIFY_DISPLAY_OFF:
1533 return 0;
1534 default:
1535 return level_current;
1536 }
1510} 1537}
1511 1538
1512static void 1539static void