aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/thinkpad_acpi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/platform/x86/thinkpad_acpi.c')
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index c3d11fabc46f..3b8ceee7c5cb 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -196,6 +196,7 @@ enum tpacpi_hkey_event_t {
196 /* Key-related user-interface events */ 196 /* Key-related user-interface events */
197 TP_HKEY_EV_KEY_NUMLOCK = 0x6000, /* NumLock key pressed */ 197 TP_HKEY_EV_KEY_NUMLOCK = 0x6000, /* NumLock key pressed */
198 TP_HKEY_EV_KEY_FN = 0x6005, /* Fn key pressed? E420 */ 198 TP_HKEY_EV_KEY_FN = 0x6005, /* Fn key pressed? E420 */
199 TP_HKEY_EV_KEY_FN_ESC = 0x6060, /* Fn+Esc key pressed X240 */
199 200
200 /* Thermal events */ 201 /* Thermal events */
201 TP_HKEY_EV_ALARM_BAT_HOT = 0x6011, /* battery too hot */ 202 TP_HKEY_EV_ALARM_BAT_HOT = 0x6011, /* battery too hot */
@@ -3456,7 +3457,7 @@ enum ADAPTIVE_KEY_MODE {
3456 LAYFLAT_MODE 3457 LAYFLAT_MODE
3457}; 3458};
3458 3459
3459const int adaptive_keyboard_modes[] = { 3460static const int adaptive_keyboard_modes[] = {
3460 HOME_MODE, 3461 HOME_MODE,
3461/* WEB_BROWSER_MODE = 2, 3462/* WEB_BROWSER_MODE = 2,
3462 WEB_CONFERENCE_MODE = 3, */ 3463 WEB_CONFERENCE_MODE = 3, */
@@ -3712,6 +3713,7 @@ static bool hotkey_notify_6xxx(const u32 hkey,
3712 3713
3713 case TP_HKEY_EV_KEY_NUMLOCK: 3714 case TP_HKEY_EV_KEY_NUMLOCK:
3714 case TP_HKEY_EV_KEY_FN: 3715 case TP_HKEY_EV_KEY_FN:
3716 case TP_HKEY_EV_KEY_FN_ESC:
3715 /* key press events, we just ignore them as long as the EC 3717 /* key press events, we just ignore them as long as the EC
3716 * is still reporting them in the normal keyboard stream */ 3718 * is still reporting them in the normal keyboard stream */
3717 *send_acpi_ev = false; 3719 *send_acpi_ev = false;
@@ -8883,17 +8885,31 @@ static bool __pure __init tpacpi_is_fw_digit(const char c)
8883 return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z'); 8885 return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z');
8884} 8886}
8885 8887
8886/* Most models: xxyTkkWW (#.##c); Ancient 570/600 and -SL lacks (#.##c) */
8887static bool __pure __init tpacpi_is_valid_fw_id(const char * const s, 8888static bool __pure __init tpacpi_is_valid_fw_id(const char * const s,
8888 const char t) 8889 const char t)
8889{ 8890{
8890 return s && strlen(s) >= 8 && 8891 /*
8892 * Most models: xxyTkkWW (#.##c)
8893 * Ancient 570/600 and -SL lacks (#.##c)
8894 */
8895 if (s && strlen(s) >= 8 &&
8891 tpacpi_is_fw_digit(s[0]) && 8896 tpacpi_is_fw_digit(s[0]) &&
8892 tpacpi_is_fw_digit(s[1]) && 8897 tpacpi_is_fw_digit(s[1]) &&
8893 s[2] == t && 8898 s[2] == t &&
8894 (s[3] == 'T' || s[3] == 'N') && 8899 (s[3] == 'T' || s[3] == 'N') &&
8895 tpacpi_is_fw_digit(s[4]) && 8900 tpacpi_is_fw_digit(s[4]) &&
8896 tpacpi_is_fw_digit(s[5]); 8901 tpacpi_is_fw_digit(s[5]))
8902 return true;
8903
8904 /* New models: xxxyTkkW (#.##c); T550 and some others */
8905 return s && strlen(s) >= 8 &&
8906 tpacpi_is_fw_digit(s[0]) &&
8907 tpacpi_is_fw_digit(s[1]) &&
8908 tpacpi_is_fw_digit(s[2]) &&
8909 s[3] == t &&
8910 (s[4] == 'T' || s[4] == 'N') &&
8911 tpacpi_is_fw_digit(s[5]) &&
8912 tpacpi_is_fw_digit(s[6]);
8897} 8913}
8898 8914
8899/* returns 0 - probe ok, or < 0 - probe error. 8915/* returns 0 - probe ok, or < 0 - probe error.