Modify how known_ev event is handled in preparation for adding new keycode
range.
Signed-off-by: Mark Pearson <[email protected]>
---
Changes in v2:
- New addition to series based on recommendations from review.
- Note previous input patch was dropped so in numbering gets replaced by this.
drivers/platform/x86/thinkpad_acpi.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 82429e59999d..3b48d893280f 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -4026,6 +4026,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
send_acpi_ev = true;
ignore_acpi_ev = false;
+ known_ev = false;
switch (hkey >> 12) {
case 1:
@@ -4051,8 +4052,6 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
/* FIXME: kick libata if SATA link offline */
known_ev = true;
break;
- default:
- known_ev = false;
}
break;
case 4:
@@ -4078,11 +4077,8 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
tpacpi_send_radiosw_update();
send_acpi_ev = 0;
known_ev = true;
- break;
}
- fallthrough; /* to default */
- default:
- known_ev = false;
+ break;
}
if (!known_ev) {
pr_notice("unhandled HKEY event 0x%04x\n", hkey);
--
2.44.0
New Lenovo platforms are adding the FN+N key to generate system debug
details that support can use for collecting important details on any
customer cases for Windows.
Add the infrastructure so we can do the same on Linux by generating a
SYS_VENDOR keycode to userspace.
Signed-off-by: Mark Pearson <[email protected]>
Signed-off-by: Nitin Joshi <[email protected]>
---
Changes in v2:
- Improved comments on keycodes in init function.
- Filled in missing gaps
drivers/platform/x86/thinkpad_acpi.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 6d04d45e8d45..a2f21e958d39 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -1789,6 +1789,10 @@ enum { /* hot key scan codes (derived from ACPI DSDT) */
TP_ACPI_HOTKEYSCAN_NOTIFICATION_CENTER,
TP_ACPI_HOTKEYSCAN_PICKUP_PHONE,
TP_ACPI_HOTKEYSCAN_HANGUP_PHONE,
+ TP_ACPI_HOTKEYSCAN_AMT_TOGGLE,
+ TP_ACPI_HOTKEYSCAN_CAMERA_SHUTTER,
+ TP_ACPI_HOTKEYSCAN_DOUBLETAP_TOGGLE,
+ TP_ACPI_HOTKEYSCAN_SYS_DEBUG_INFO,
TP_ACPI_HOTKEYSCAN_DOUBLETAP,
/* Hotkey keymap size */
@@ -3340,6 +3344,10 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
KEY_NOTIFICATION_CENTER, /* Notification Center */
KEY_PICKUP_PHONE, /* Answer incoming call */
KEY_HANGUP_PHONE, /* Decline incoming call */
+ KEY_UNKNOWN, /* AMT_TOGGLE handled in driver, 0x31a */
+ KEY_UNKNOWN, /* Camera Shutter Switch, 0X31b */
+ KEY_UNKNOWN, /* DOUBLETAP_TOGGLE, 0x31c */
+ KEY_VENDOR, /* System debug info, 0x31D */
KEY_PROG1, /* Trackpoint doubletap */
},
};
--
2.44.0
The hotkey combination FN+G can be used to disable the trackpoint
doubletap feature on Windows.
Add matching functionality for Linux.
Signed-off-by: Mark Pearson <[email protected]>
Signed-off-by: Vishnu Sankar <[email protected]>
---
Changes in v2:
- Improved comments on keycodes in init function
drivers/platform/x86/thinkpad_acpi.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index a2f21e958d39..370b9285156c 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -167,6 +167,7 @@ enum tpacpi_hkey_event_t {
TP_HKEY_EV_VOL_MUTE = 0x1017, /* Mixer output mute */
TP_HKEY_EV_PRIVACYGUARD_TOGGLE = 0x130f, /* Toggle priv.guard on/off */
TP_HKEY_EV_AMT_TOGGLE = 0x131a, /* Toggle AMT on/off */
+ TP_HKEY_EV_DOUBLETAP_TOGGLE = 0x131c, /* Toggle trackpoint doubletap on/off */
TP_HKEY_EV_PROFILE_TOGGLE = 0x131f, /* Toggle platform profile */
/* Reasons for waking up from S3/S4 */
@@ -356,6 +357,7 @@ static struct {
u32 hotkey_poll_active:1;
u32 has_adaptive_kbd:1;
u32 kbd_lang:1;
+ u32 trackpoint_doubletap:1;
struct quirk_entry *quirks;
} tp_features;
@@ -3346,7 +3348,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
KEY_HANGUP_PHONE, /* Decline incoming call */
KEY_UNKNOWN, /* AMT_TOGGLE handled in driver, 0x31a */
KEY_UNKNOWN, /* Camera Shutter Switch, 0X31b */
- KEY_UNKNOWN, /* DOUBLETAP_TOGGLE, 0x31c */
+ KEY_UNKNOWN, /* DOUBLETAP_TOGGLE handled in driver, 0x31c */
KEY_VENDOR, /* System debug info, 0x31D */
KEY_PROG1, /* Trackpoint doubletap */
},
@@ -3606,6 +3608,9 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
hotkey_poll_setup_safe(true);
+ /* Enable doubletap by default */
+ tp_features.trackpoint_doubletap = 1;
+
return 0;
}
@@ -3747,6 +3752,7 @@ static bool hotkey_notify_extended_hotkey(const u32 hkey)
case TP_HKEY_EV_PRIVACYGUARD_TOGGLE:
case TP_HKEY_EV_AMT_TOGGLE:
case TP_HKEY_EV_PROFILE_TOGGLE:
+ case TP_HKEY_EV_DOUBLETAP_TOGGLE:
tpacpi_driver_event(hkey);
return true;
}
@@ -4011,7 +4017,7 @@ static bool hotkey_notify_6xxx(const u32 hkey,
static bool hotkey_notify_8xxx(const u32 hkey)
{
- if (hkey == TP_HKEY_EV_TRACK_DOUBLETAP) {
+ if (hkey == TP_HKEY_EV_TRACK_DOUBLETAP && tp_features.trackpoint_doubletap) {
tpacpi_input_send_key(TP_ACPI_HOTKEYSCAN_DOUBLETAP);
return true;
}
@@ -11229,6 +11235,8 @@ static void tpacpi_driver_event(const unsigned int hkey_event)
/* Notify user space the profile changed */
platform_profile_notify();
}
+ if (hkey_event == TP_HKEY_EV_DOUBLETAP_TOGGLE)
+ tp_features.trackpoint_doubletap = !tp_features.trackpoint_doubletap;
}
static void hotkey_driver_event(const unsigned int scancode)
--
2.44.0