Commit 2d5e94d7 authored by Henrique de Moraes Holschuh's avatar Henrique de Moraes Holschuh Committed by Len Brown

ACPI: thinkpad-acpi: rate-limit CMOS/EC unsynced error messages

If userspace applications mess with the CMOS NVRAM, or something causes
both the ACPI firmware and thinkpad-acpi to try to change the brightness at
the same time, it is possible to have the CMOS and EC registers for the
current brightness go out of sync.

Should that happen, thinkpad-acpi could be really obnoxious when using a
brightness_mode of 3 (both EC and CMOS).  Instead of complaining a massive
number of times, make sure to complain only once until EC and CMOS are back
in sync.
Signed-off-by: default avatarHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Joerg Platte <lists@naasa.net>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 8c74adbc
...@@ -239,6 +239,7 @@ static struct { ...@@ -239,6 +239,7 @@ static struct {
static struct { static struct {
u16 hotkey_mask_ff:1; u16 hotkey_mask_ff:1;
u16 bright_cmos_ec_unsync:1;
} tp_warned; } tp_warned;
struct thinkpad_id_data { struct thinkpad_id_data {
...@@ -4323,13 +4324,20 @@ static int brightness_get(struct backlight_device *bd) ...@@ -4323,13 +4324,20 @@ static int brightness_get(struct backlight_device *bd)
level = lcmos; level = lcmos;
} }
if (brightness_mode == 3 && lec != lcmos) { if (brightness_mode == 3) {
printk(TPACPI_ERR if (lec == lcmos)
"CMOS NVRAM (%u) and EC (%u) do not agree " tp_warned.bright_cmos_ec_unsync = 0;
"on display brightness level\n", else {
(unsigned int) lcmos, if (!tp_warned.bright_cmos_ec_unsync) {
(unsigned int) lec); printk(TPACPI_ERR
return -EIO; "CMOS NVRAM (%u) and EC (%u) do not "
"agree on display brightness level\n",
(unsigned int) lcmos,
(unsigned int) lec);
tp_warned.bright_cmos_ec_unsync = 1;
}
return -EIO;
}
} }
return level; return level;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment