From 16a3d9f5aa1c9e0ecddd48bdfcf44445c9dbb601 Mon Sep 17 00:00:00 2001 From: Manoj Iyer Date: Mon, 24 Sep 2012 11:57:40 -0500 Subject: thinkpad-acpi: enable loading module with new B-series Lenovo BIOS The new B series BIOS has version string 43CN46WW. The driver requires that 2nd and 3rd characters be 'E' and 'T' respectively, where as the newer BIOS has 'C' and 'N' respectively. Failing to load the module causes some of the hotkeys to not work. Before the patch ================ sudo modprobe thinkpad_acpi FATAL: Error inserting thinkpad_acpi (/lib/modules/3.5.0-15-generic/kernel/drivers/platform/x86/thinkpad_acpi.ko): No such device After the patch =============== [44937.265438] thinkpad_acpi: ThinkPad ACPI Extras v0.24 [44937.265445] thinkpad_acpi: http://ibm-acpi.sf.net/ [44937.265449] thinkpad_acpi: ThinkPad BIOS 43CN46WW, EC unknown [44937.265453] thinkpad_acpi: Lenovo Lenovo B470e, model HuronRiver Platform [44937.266479] thinkpad_acpi: detected a 8-level brightness capable ThinkPad [44937.266557] thinkpad_acpi: Standard ACPI backlight interface available, not loading native one [44937.267846] thinkpad_acpi: Console audio control enabled, mode: monitor (read only) [44937.268131] input: ThinkPad Extra Buttons as /devices/platform/thinkpad_acpi/input/input17 Signed-off-by: Manoj Iyer Tested-by: James Ferguson Signed-off-by: Matthew Garrett --- drivers/platform/x86/thinkpad_acpi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/platform/x86/thinkpad_acpi.c') diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index ebcb461bb2b0..22d893654d28 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -8574,7 +8574,8 @@ static bool __pure __init tpacpi_is_valid_fw_id(const char* const s, return s && strlen(s) >= 8 && tpacpi_is_fw_digit(s[0]) && tpacpi_is_fw_digit(s[1]) && - s[2] == t && s[3] == 'T' && + s[2] == t && + (s[3] == 'T' || s[3] == 'N') && tpacpi_is_fw_digit(s[4]) && tpacpi_is_fw_digit(s[5]); } @@ -8607,7 +8608,8 @@ static int __must_check __init get_thinkpad_model_data( return -ENOMEM; /* Really ancient ThinkPad 240X will fail this, which is fine */ - if (!tpacpi_is_valid_fw_id(tp->bios_version_str, 'E')) + if (!(tpacpi_is_valid_fw_id(tp->bios_version_str, 'E') || + tpacpi_is_valid_fw_id(tp->bios_version_str, 'C'))) return 0; tp->bios_model = tp->bios_version_str[0] -- cgit v1.2.3 From 6f62bc3e8d2410b538bde9677552270055f8595a Mon Sep 17 00:00:00 2001 From: Richard Hartmann Date: Sat, 29 Dec 2012 22:51:49 +0100 Subject: drivers/platform/x86/thinkpad_acpi.c: Handle HKEY event 0x6040 Handle HKEY event generated on AC power change. The current message asks users to submit data related to this event which leads to a lot of confusion and noise on the mailing list. The following is a list affected models and 'Message-Id' from ibm-acpi-devel@lists.sourceforge.net of people who saw this event when either plugging or unplugging the AC adapter or docking or undocking their laptop. X120e - CAAAujb5v9dHdbdxDVvhNJoG4UrZC1TgKqeB_zGpAy7q8kZHMEQ@mail.gmail.com X121e - 20120817143459.GB3462@x1.osrc.amd.com X220 - Confirmed by Richard Hartmann X220i - 4F406274.7070807@gmail.com X220t - 4F489F5B.9040705@cs.tu-berlin.de X230 - CAKx4u7kqvVH0-gstomsiVYdGC0i6=bGxzaQ8sq9gbg76TGme3w@mail.gmail.com T420 - 9c848ee30b006737d0534d906bab0cf6@niklaas-baudet.net T420s - 20120608080824.GS25324@hexapodia.org W520 - 20121008181050.GF2549@ericlaptop.home.christensenplace.us Signed-off-by: Richard Hartmann Signed-off-by: Matthew Garrett --- drivers/platform/x86/thinkpad_acpi.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'drivers/platform/x86/thinkpad_acpi.c') diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 22d893654d28..be9379923a99 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -209,9 +209,8 @@ enum tpacpi_hkey_event_t { TP_HKEY_EV_ALARM_SENSOR_XHOT = 0x6022, /* sensor critically hot */ TP_HKEY_EV_THM_TABLE_CHANGED = 0x6030, /* thermal table changed */ - TP_HKEY_EV_UNK_6040 = 0x6040, /* Related to AC change? - some sort of APM hint, - W520 */ + /* AC-related events */ + TP_HKEY_EV_AC_CHANGED = 0x6040, /* AC status changed */ /* Misc */ TP_HKEY_EV_RFKILL_CHANGED = 0x7000, /* rfkill switch changed */ @@ -3629,6 +3628,12 @@ static bool hotkey_notify_6xxx(const u32 hkey, "a sensor reports something is extremely hot!\n"); /* recommended action: immediate sleep/hibernate */ break; + case TP_HKEY_EV_AC_CHANGED: + /* X120e, X121e, X220, X220i, X220t, X230, T420, T420s, W520: + * AC status changed; can be triggered by plugging or + * unplugging AC adapter, docking or undocking. */ + + /* fallthrough */ case TP_HKEY_EV_KEY_NUMLOCK: case TP_HKEY_EV_KEY_FN: -- cgit v1.2.3