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
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>
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 {
31 + u16 bright_cmos_ec_unsync:1;
34 struct thinkpad_id_data {
35 @@ -4323,13 +4324,20 @@ static int brightness_get(struct backlight_device *bd)
39 - if (brightness_mode == 3 && lec != lcmos) {
41 - "CMOS NVRAM (%u) and EC (%u) do not agree "
42 - "on display brightness level\n",
43 - (unsigned int) lcmos,
44 - (unsigned int) lec);
46 + if (brightness_mode == 3) {
48 + tp_warned.bright_cmos_ec_unsync = 0;
50 + if (!tp_warned.bright_cmos_ec_unsync) {
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;