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

thinkpad-acpi: forbid the use of HBRV on Lenovo ThinkPads

Forcing thinkpad-acpi to do EC-based brightness control (HBRV) on a
X61 has very... interesting effects, instead of doing nothing (since
it doesn't have EC-based backlight control), it causes "weirdness" in
the fan tachometer readings, for example.

This means the EC register that used to be HBRV has been reused by
Lenovo for something else, but they didn't remove it from the DSDT.

Make sure the documentation reflects this data, and forbid the user
from forcing the driver to access HBRV on Lenovo ThinkPads.
Signed-off-by: default avatarHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 8bf3d4c5
...@@ -1169,17 +1169,19 @@ may not be distinct. Later Lenovo models that implement the ACPI ...@@ -1169,17 +1169,19 @@ may not be distinct. Later Lenovo models that implement the ACPI
display backlight brightness control methods have 16 levels, ranging display backlight brightness control methods have 16 levels, ranging
from 0 to 15. from 0 to 15.
There are two interfaces to the firmware for direct brightness control, For IBM ThinkPads, there are two interfaces to the firmware for direct
EC and UCMS (or CMOS). To select which one should be used, use the brightness control, EC and UCMS (or CMOS). To select which one should be
brightness_mode module parameter: brightness_mode=1 selects EC mode, used, use the brightness_mode module parameter: brightness_mode=1 selects
brightness_mode=2 selects UCMS mode, brightness_mode=3 selects EC EC mode, brightness_mode=2 selects UCMS mode, brightness_mode=3 selects EC
mode with NVRAM backing (so that brightness changes are remembered mode with NVRAM backing (so that brightness changes are remembered across
across shutdown/reboot). shutdown/reboot).
The driver tries to select which interface to use from a table of The driver tries to select which interface to use from a table of
defaults for each ThinkPad model. If it makes a wrong choice, please defaults for each ThinkPad model. If it makes a wrong choice, please
report this as a bug, so that we can fix it. report this as a bug, so that we can fix it.
Lenovo ThinkPads only support brightness_mode=2 (UCMS).
When display backlight brightness controls are available through the When display backlight brightness controls are available through the
standard ACPI interface, it is best to use it instead of this direct standard ACPI interface, it is best to use it instead of this direct
ThinkPad-specific interface. The driver will disable its native ThinkPad-specific interface. The driver will disable its native
......
...@@ -5696,6 +5696,10 @@ static struct ibm_struct ecdump_driver_data = { ...@@ -5696,6 +5696,10 @@ static struct ibm_struct ecdump_driver_data = {
* Bit 3-0: backlight brightness level * Bit 3-0: backlight brightness level
* *
* brightness_get_raw returns status data in the HBRV layout * brightness_get_raw returns status data in the HBRV layout
*
* WARNING: The X61 has been verified to use HBRV for something else, so
* this should be used _only_ on IBM ThinkPads, and maybe with some careful
* testing on the very early *60 Lenovo models...
*/ */
enum { enum {
...@@ -5996,6 +6000,12 @@ static int __init brightness_init(struct ibm_init_struct *iibm) ...@@ -5996,6 +6000,12 @@ static int __init brightness_init(struct ibm_init_struct *iibm)
brightness_mode); brightness_mode);
} }
/* Safety */
if (thinkpad_id.vendor != PCI_VENDOR_ID_IBM &&
(brightness_mode == TPACPI_BRGHT_MODE_ECNVRAM ||
brightness_mode == TPACPI_BRGHT_MODE_EC))
return -EINVAL;
if (tpacpi_brightness_get_raw(&b) < 0) if (tpacpi_brightness_get_raw(&b) < 0)
return 1; return 1;
......
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