Add patches accepted for 2.6.26-rc1
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / releases / upstream / 2.6.26-rc1 / 0005-ACPI-thinkpad-acpi-rate-limit-CMOS-EC-unsynced-err.patch
blob9c4cf5b1dc91edf02ff504bbda43d1056ce0d54c
1 From 2d5e94d7ca315f859a0eee1366838e8ad34dd7b2 Mon Sep 17 00:00:00 2001
2 From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
3 Date: Sat, 26 Apr 2008 01:02:20 -0300
4 Subject: ACPI: thinkpad-acpi: rate-limit CMOS/EC unsynced error messages
6 If userspace applications mess with the CMOS NVRAM, or something causes
7 both the ACPI firmware and thinkpad-acpi to try to change the brightness at
8 the same time, it is possible to have the CMOS and EC registers for the
9 current brightness go out of sync.
11 Should that happen, thinkpad-acpi could be really obnoxious when using a
12 brightness_mode of 3 (both EC and CMOS). Instead of complaining a massive
13 number of times, make sure to complain only once until EC and CMOS are back
14 in sync.
16 Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
17 Cc: Joerg Platte <lists@naasa.net>
18 Signed-off-by: Len Brown <len.brown@intel.com>
19 ---
20 drivers/misc/thinkpad_acpi.c | 22 +++++++++++++++-------
21 1 files changed, 15 insertions(+), 7 deletions(-)
23 diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
24 index 601dbe8..7dc6b73 100644
25 --- a/drivers/misc/thinkpad_acpi.c
26 +++ b/drivers/misc/thinkpad_acpi.c
27 @@ -239,6 +239,7 @@ static struct {
29 static struct {
30 u16 hotkey_mask_ff:1;
31 + u16 bright_cmos_ec_unsync:1;
32 } tp_warned;
34 struct thinkpad_id_data {
35 @@ -4323,13 +4324,20 @@ static int brightness_get(struct backlight_device *bd)
36 level = lcmos;
39 - if (brightness_mode == 3 && lec != lcmos) {
40 - printk(TPACPI_ERR
41 - "CMOS NVRAM (%u) and EC (%u) do not agree "
42 - "on display brightness level\n",
43 - (unsigned int) lcmos,
44 - (unsigned int) lec);
45 - return -EIO;
46 + if (brightness_mode == 3) {
47 + if (lec == lcmos)
48 + tp_warned.bright_cmos_ec_unsync = 0;
49 + else {
50 + if (!tp_warned.bright_cmos_ec_unsync) {
51 + printk(TPACPI_ERR
52 + "CMOS NVRAM (%u) and EC (%u) do not "
53 + "agree on display brightness level\n",
54 + (unsigned int) lcmos,
55 + (unsigned int) lec);
56 + tp_warned.bright_cmos_ec_unsync = 1;
57 + }
58 + return -EIO;
59 + }
62 return level;
63 --
64 1.5.4.4