Skip to contentSkip to conversation

TrackPoint doubletap enablement and user control

PATCH Superseded Vishnu Sankar 3 participants 14 messages Feb 9 – Mar 10

Subsystems (6)

v7 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v7 cover TrackPoint doubletap enablement and user control

This patch series adds support for TrackPoint doubletap with a clear and simple separation of responsibilities between drivers:

1. Firmware enablement (trackpoint.c):
Automatically enables doubletap on capable hardware during device detection.

2. User control (thinkpad_acpi.c):
Provides a sysfs interface to enable or disable delivery of doubletap events to userspace.

The approach follows the KISS principle:
- The TrackPoint driver enables hardware functionality by default.
- The thinkpad_acpi driver controls whether ACPI doubletap events are delivered, using existing hotkey filtering infrastructure.
- No cross-driver APIs or dual filtering paths are introduced.

Changes in v7:
- Removed unwanted comments and logs

Changes in v6:
- Documentation: fix formatting of the doubletap_enable sysfs attribute description (separate "Values" list)

Changes in v5:
- Rename sysfs attribute from doubletap_filter to doubletap_enable to reflect actual behavior.
- Fix inverted logic so events are delivered only when doubletap is enabled.
- Suppress ACPI hotkey delivery instead of injecting or filtering input events.
- Register the sysfs attribute via hotkey_attributes[] instead of device_create_file().
- Drop unnecessary helper wrappers and debug logging.
- Update Documentation to reflect the new naming and semantics.

Changes in v4:
- Complete redesign based on reviewer feedback.
- trackpoint.c: Simplified to only enable doubletap by default.
- trackpoint.c: Removed all sysfs attributes and global variables.
- trackpoint.c: Uses firmware ID detection with deny list.
- thinkpad_acpi.c: Added sysfs interface for kernel-level event control.
- thinkpad_acpi.c: No cross-driver dependencies.
- Documentation: Updated to reflect simplified sysfs approach.

Changes in v3:
- No changes.

Changes in v2:
- Improved commit messages.
- Removed unnecessary comments and debug messages.
- Switched to strstarts() usage.
- Simplified firmware capability detection logic.

This version addresses the remaining review feedback by correcting the naming and logic inversion, aligning sysfs semantics with behavior, and fully integrating with existing thinkpad_acpi hotkey handling.

Vishnu Sankar (3):
input: trackpoint - Enable doubletap by default on capable devices platform/x86: thinkpad_acpi: Add sysfs control for TrackPoint
double-tap
Documentation: thinkpad-acpi - Document doubletap_enable attribute

 .../admin-guide/laptops/thinkpad-acpi.rst     | 21 +++++++++
 drivers/input/mouse/trackpoint.c              | 45 +++++++++++++++++++
 drivers/input/mouse/trackpoint.h              |  5 +++
 drivers/platform/x86/lenovo/thinkpad_acpi.c   | 42 ++++++++++++++---
 4 files changed, 106 insertions(+), 7 deletions(-)
Signature · 1 line
2.51.0
#1 lore raw

PATCH v7 1/3 input: trackpoint - Enable doubletap by default on capable devices

Enable doubletap functionality by default on TrackPoint devices that support it. The feature is detected using firmware ID pattern matching (PNP: LEN03xxx) with a deny list of incompatible devices.

This provides immediate doubletap functionality without requiring userspace configuration. The hardware is enabled during device detection, while event filtering continues to be handled by the thinkpad_acpi driver as before.

---
Changes in v7:
- Removed unwanted comments
- Removed psmouse_info ()

Changes in v6:
- No Changes

Changes in v5:
- Renamed function to trackpoint_is_dt_capable()
- Simplified string comparison without sscanf()
- Removed wrapper function as suggested
- Fixed missing period in comment

Changes in v4:
- Simplified approach: removed all sysfs attributes and user interface
- Enable doubletap by default during device detection
- Removed global variables and complex attribute infrastructure
- Uses minimal firmware ID detection with deny list
- Follows KISS principle as suggested by reviewers

Changes in v3:
- No changes

Changes in v2:
- Improve commit messages
- Sysfs attributes moved to trackpoint.c
- Removed unnecessary comments
- Removed unnecessary debug messages
- Using strstarts() instead of strcmp()
- is_trackpoint_dt_capable() modified
- Removed _BIT suffix and used BIT() define
- Reverse the trackpoint_doubletap_status() logic to return error first
- Removed export functions as a result of the design change
- Changed trackpoint_dev->psmouse to parent_psmouse
- The path of trackpoint.h is not changed

---
 drivers/input/mouse/trackpoint.c | 45 ++++++++++++++++++++++++++++++++
 drivers/input/mouse/trackpoint.h |  5 ++++
 2 files changed, 50 insertions(+)
drivers/input/mouse/trackpoint.c +45 -0
index 5f6643b69a2c..e12d76350252 100644
@@ -393,6 +393,45 @@ static int trackpoint_reconnect(struct psmouse *psmouse)
 	return 0;
 }
 
+/* List of known incapable device PNP IDs */
+static const char * const dt_incompatible_devices[] = {
+	"LEN0304",
+	"LEN0306",
+	"LEN0317",
+	"LEN031A",
+	"LEN031B",
+	"LEN031C",
+	"LEN031D",
+};
+
+/*
+ * Checks if it's a doubletap capable device.
+ * The PNP ID format is "PNP: LEN030d PNP0f13".
+ */
+static bool trackpoint_is_dt_capable(const char *pnp_id)
+{
+	size_t i;
+
+	if (!pnp_id)
+		return false;
+
+	/* Must start with "PNP: LEN03" */
+	if (!strstarts(pnp_id, "PNP: LEN03"))
+		return false;
+
+	/* Ensure enough length before comparing */
+	if (strlen(pnp_id) < 12)
+		return false;
+
+	/* Check deny-list */
+	for (i = 0; i < ARRAY_SIZE(dt_incompatible_devices); i++) {
+		if (!strncmp(pnp_id + 5,
+			     dt_incompatible_devices[i], 7))
+			return false;
+	}
+	return true;
+}
+
 int trackpoint_detect(struct psmouse *psmouse, bool set_properties)
 {
 	struct ps2dev *ps2dev = &psmouse->ps2dev;
@@ -470,6 +509,12 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties)
 		     psmouse->vendor, firmware_id,
 		     (button_info & 0xf0) >> 4, button_info & 0x0f);
 
+	if (trackpoint_is_dt_capable(ps2dev->serio->firmware_id)) {
+		error = trackpoint_write(ps2dev, TP_DOUBLETAP, TP_DOUBLETAP_ENABLE);
+		if (error)
+			psmouse_warn(psmouse, "Failed to enable doubletap: %d\n", error);
+	}
+
 	return 0;
 }
 
drivers/input/mouse/trackpoint.h +5 -0
index eb5412904fe0..3e03cdb39449 100644
@@ -69,6 +69,8 @@
 					/* (how hard it is to drag */
 					/* with Z-axis pressed) */
 
+#define TP_DOUBLETAP		0x58	/* TrackPoint doubletap register */
+
 #define TP_MINDRAG		0x59	/* Minimum amount of force needed */
 					/* to trigger dragging */
 
@@ -110,6 +112,9 @@
 					   external device will be forced to 1 */
 #define TP_MASK_EXT_TAG			0x04
 
+/* Doubletap register values */
+#define TP_DOUBLETAP_ENABLE	0xFF	/* Enable value */
+#define TP_DOUBLETAP_DISABLE	0xFE	/* Disable value */
 
 /* Power on Self Test Results */
 #define TP_POR_SUCCESS		0x3B
Signature · 1 line
2.51.0
maintainer
#2 lore raw

Re: [PATCH v7 1/3] input: trackpoint - Enable doubletap by default on capable devices

Quoted 75 lines · Vishnu Sankar

Enable doubletap functionality by default on TrackPoint devices that support it. The feature is detected using firmware ID pattern matching (PNP: LEN03xxx) with a deny list of incompatible devices.

This provides immediate doubletap functionality without requiring userspace configuration. The hardware is enabled during device detection, while event filtering continues to be handled by the thinkpad_acpi driver as before.

---
Changes in v7:
- Removed unwanted comments
- Removed psmouse_info ()

Changes in v6:
- No Changes

Changes in v5:
- Renamed function to trackpoint_is_dt_capable()
- Simplified string comparison without sscanf()
- Removed wrapper function as suggested
- Fixed missing period in comment

Changes in v4:
- Simplified approach: removed all sysfs attributes and user interface
- Enable doubletap by default during device detection
- Removed global variables and complex attribute infrastructure
- Uses minimal firmware ID detection with deny list
- Follows KISS principle as suggested by reviewers

Changes in v3:
- No changes

Changes in v2:
- Improve commit messages
- Sysfs attributes moved to trackpoint.c
- Removed unnecessary comments
- Removed unnecessary debug messages
- Using strstarts() instead of strcmp()
- is_trackpoint_dt_capable() modified
- Removed _BIT suffix and used BIT() define
- Reverse the trackpoint_doubletap_status() logic to return error first
- Removed export functions as a result of the design change
- Changed trackpoint_dev->psmouse to parent_psmouse
- The path of trackpoint.h is not changed

---
 drivers/input/mouse/trackpoint.c | 45 ++++++++++++++++++++++++++++++++
 drivers/input/mouse/trackpoint.h |  5 ++++
 2 files changed, 50 insertions(+)
drivers/input/mouse/trackpoint.c +14 -0
index 5f6643b69a2c..e12d76350252 100644
@@ -393,6 +393,45 @@ static int trackpoint_reconnect(struct psmouse *psmouse)
 	return 0;
 }
 
+/* List of known incapable device PNP IDs */
+static const char * const dt_incompatible_devices[] = {
+	"LEN0304",
+	"LEN0306",
+	"LEN0317",
+	"LEN031A",
+	"LEN031B",
+	"LEN031C",
+	"LEN031D",
+};
+
+/*
+ * Checks if it's a doubletap capable device.
+ * The PNP ID format is "PNP: LEN030d PNP0f13".

drivers/input/mouse/trackpoint.c static int trackpoint_reconnect(struct psmouse *psmouse) · line 419

Quoted 10 lines
drivers/input/mouse/trackpoint.c +10 -0
+ */
+static bool trackpoint_is_dt_capable(const char *pnp_id)
+{
+	size_t i;
+
+	if (!pnp_id)
+		return false;
+
+	/* Must start with "PNP: LEN03" */
+	if (!strstarts(pnp_id, "PNP: LEN03"))

Missing include.

drivers/input/mouse/trackpoint.c static int trackpoint_reconnect(struct psmouse *psmouse) · line 427

Quoted 8 lines
drivers/input/mouse/trackpoint.c +8 -0
+		return false;
+
+	/* Ensure enough length before comparing */
+	if (strlen(pnp_id) < 12)
+		return false;
+
+	/* Check deny-list */
+	for (i = 0; i < ARRAY_SIZE(dt_incompatible_devices); i++) {

Missing include for ARRAY_SIZE().

drivers/input/mouse/trackpoint.c static int trackpoint_reconnect(struct psmouse *psmouse) · line 429

Quoted 2 lines
drivers/input/mouse/trackpoint.c +2 -0
+		if (!strncmp(pnp_id + 5,
+			     dt_incompatible_devices[i], 7))

Fits to one line.

Quoted 45 lines
drivers/input/mouse/trackpoint.c +11 -0
+			return false;
+	}
+	return true;
+}
+
 int trackpoint_detect(struct psmouse *psmouse, bool set_properties)
 {
 	struct ps2dev *ps2dev = &psmouse->ps2dev;
@@ -470,6 +509,12 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties)
 		     psmouse->vendor, firmware_id,
 		     (button_info & 0xf0) >> 4, button_info & 0x0f);
 
+	if (trackpoint_is_dt_capable(ps2dev->serio->firmware_id)) {
+		error = trackpoint_write(ps2dev, TP_DOUBLETAP, TP_DOUBLETAP_ENABLE);
+		if (error)
+			psmouse_warn(psmouse, "Failed to enable doubletap: %d\n", error);
+	}
+
 	return 0;
 }
 
drivers/input/mouse/trackpoint.h +5 -0
index eb5412904fe0..3e03cdb39449 100644
@@ -69,6 +69,8 @@
 					/* (how hard it is to drag */
 					/* with Z-axis pressed) */
 
+#define TP_DOUBLETAP		0x58	/* TrackPoint doubletap register */
+
 #define TP_MINDRAG		0x59	/* Minimum amount of force needed */
 					/* to trigger dragging */
 
@@ -110,6 +112,9 @@
 					   external device will be forced to 1 */
 #define TP_MASK_EXT_TAG			0x04
 
+/* Doubletap register values */
+#define TP_DOUBLETAP_ENABLE	0xFF	/* Enable value */
+#define TP_DOUBLETAP_DISABLE	0xFE	/* Disable value */
 
 /* Power on Self Test Results */
 #define TP_POR_SUCCESS		0x3B
Signature · 1 line
 i.
#3 lore raw

Re: [PATCH v7 1/3] input: trackpoint - Enable doubletap by default on capable devices

Hi Ilpo,

Thank you so much for the review.

Quoted 82 lines · Ilpo Järvinen
Quoted 79 lines · Vishnu Sankar

Enable doubletap functionality by default on TrackPoint devices that support it. The feature is detected using firmware ID pattern matching (PNP: LEN03xxx) with a deny list of incompatible devices.

This provides immediate doubletap functionality without requiring userspace configuration. The hardware is enabled during device detection, while event filtering continues to be handled by the thinkpad_acpi driver as before.

---
Changes in v7:
- Removed unwanted comments
- Removed psmouse_info ()

Changes in v6:
- No Changes

Changes in v5:
- Renamed function to trackpoint_is_dt_capable()
- Simplified string comparison without sscanf()
- Removed wrapper function as suggested
- Fixed missing period in comment

Changes in v4:
- Simplified approach: removed all sysfs attributes and user interface
- Enable doubletap by default during device detection
- Removed global variables and complex attribute infrastructure
- Uses minimal firmware ID detection with deny list
- Follows KISS principle as suggested by reviewers

Changes in v3:
- No changes

Changes in v2:
- Improve commit messages
- Sysfs attributes moved to trackpoint.c
- Removed unnecessary comments
- Removed unnecessary debug messages
- Using strstarts() instead of strcmp()
- is_trackpoint_dt_capable() modified
- Removed _BIT suffix and used BIT() define
- Reverse the trackpoint_doubletap_status() logic to return error first
- Removed export functions as a result of the design change
- Changed trackpoint_dev->psmouse to parent_psmouse
- The path of trackpoint.h is not changed

---
 drivers/input/mouse/trackpoint.c | 45 ++++++++++++++++++++++++++++++++
 drivers/input/mouse/trackpoint.h |  5 ++++
 2 files changed, 50 insertions(+)
drivers/input/mouse/trackpoint.c +18 -0
index 5f6643b69a2c..e12d76350252 100644
@@ -393,6 +393,45 @@ static int trackpoint_reconnect(struct psmouse *psmouse)
      return 0;
 }
 
+/* List of known incapable device PNP IDs */
+static const char * const dt_incompatible_devices[] = {
+     "LEN0304",
+     "LEN0306",
+     "LEN0317",
+     "LEN031A",
+     "LEN031B",
+     "LEN031C",
+     "LEN031D",
+};
+
+/*
+ * Checks if it's a doubletap capable device.
+ * The PNP ID format is "PNP: LEN030d PNP0f13".
+ */
+static bool trackpoint_is_dt_capable(const char *pnp_id)
+{
+     size_t i;
Quoted 8 lines

drivers/input/mouse/trackpoint.c static int trackpoint_reconnect(struct psmouse *psmouse) · line 419

Quoted 6 lines
drivers/input/mouse/trackpoint.c +6 -0
+
+     if (!pnp_id)
+             return false;
+
+     /* Must start with "PNP: LEN03" */
+     if (!strstarts(pnp_id, "PNP: LEN03"))

Missing include.

Sorry, I am a bit confused here:
strstarts() is already available through the existing #include <linux/string.h> in thinkpad_acpi.c.

Do you think I should do anything else here?

Quoted 11 lines

drivers/input/mouse/trackpoint.c static int trackpoint_reconnect(struct psmouse *psmouse) · line 427

Quoted 9 lines
drivers/input/mouse/trackpoint.c +8 -0
+             return false;
+
+     /* Ensure enough length before comparing */
+     if (strlen(pnp_id) < 12)
+             return false;
+
+     /* Check deny-list */
+     for (i = 0; i < ARRAY_SIZE(dt_incompatible_devices); i++) {

Missing include for ARRAY_SIZE().

Acked.
Will add linux/array_size.h to the include list.

Quoted 5 lines

drivers/input/mouse/trackpoint.c static int trackpoint_reconnect(struct psmouse *psmouse) · line 429

Quoted 3 lines
drivers/input/mouse/trackpoint.c +2 -0
+             if (!strncmp(pnp_id + 5,
+                          dt_incompatible_devices[i], 7))

Fits to one line.

Understood.
will come up with v8 soon.

Quoted 50 lines
Quoted 37 lines
drivers/input/mouse/trackpoint.c +11 -0
+                     return false;
+     }
+     return true;
+}
+
 int trackpoint_detect(struct psmouse *psmouse, bool set_properties)
 {
      struct ps2dev *ps2dev = &psmouse->ps2dev;
@@ -470,6 +509,12 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties)
                   psmouse->vendor, firmware_id,
                   (button_info & 0xf0) >> 4, button_info & 0x0f);
 
+     if (trackpoint_is_dt_capable(ps2dev->serio->firmware_id)) {
+             error = trackpoint_write(ps2dev, TP_DOUBLETAP, TP_DOUBLETAP_ENABLE);
+             if (error)
+                     psmouse_warn(psmouse, "Failed to enable doubletap: %d\n", error);
+     }
+
      return 0;
 }
 
drivers/input/mouse/trackpoint.h +2 -0
index eb5412904fe0..3e03cdb39449 100644
@@ -69,6 +69,8 @@
                                      /* (how hard it is to drag */
                                      /* with Z-axis pressed) */
 
+#define TP_DOUBLETAP         0x58    /* TrackPoint doubletap register */
+
 #define TP_MINDRAG           0x59    /* Minimum amount of force needed */
                                      /* to trigger dragging */
 

drivers/input/mouse/trackpoint.h line 120

Quoted 9 lines
drivers/input/mouse/trackpoint.h +3 -0
@@ -110,6 +112,9 @@
                                         external device will be forced to 1 */
 #define TP_MASK_EXT_TAG                      0x04
 
+/* Doubletap register values */
+#define TP_DOUBLETAP_ENABLE  0xFF    /* Enable value */
+#define TP_DOUBLETAP_DISABLE 0xFE    /* Disable value */
 
 /* Power on Self Test Results */
 #define TP_POR_SUCCESS               0x3B

--
i.

Signature · 3 lines
Regards,

      Vishnu Sankar
maintainer
#4 lore raw

Re: [PATCH v7 1/3] input: trackpoint - Enable doubletap by default on capable devices

Quoted 71 lines · Vishnu Sankar

Hi Ilpo,

Thank you so much for the review.

Quoted 65 lines · Ilpo Järvinen
Quoted 61 lines · Vishnu Sankar

Enable doubletap functionality by default on TrackPoint devices that support it. The feature is detected using firmware ID pattern matching (PNP: LEN03xxx) with a deny list of incompatible devices.

This provides immediate doubletap functionality without requiring userspace configuration. The hardware is enabled during device detection, while event filtering continues to be handled by the thinkpad_acpi driver as before.

---
Changes in v7:
- Removed unwanted comments
- Removed psmouse_info ()

Changes in v6:
- No Changes

Changes in v5:
- Renamed function to trackpoint_is_dt_capable()
- Simplified string comparison without sscanf()
- Removed wrapper function as suggested
- Fixed missing period in comment

Changes in v4:
- Simplified approach: removed all sysfs attributes and user interface
- Enable doubletap by default during device detection
- Removed global variables and complex attribute infrastructure
- Uses minimal firmware ID detection with deny list
- Follows KISS principle as suggested by reviewers

Changes in v3:
- No changes

Changes in v2:
- Improve commit messages
- Sysfs attributes moved to trackpoint.c
- Removed unnecessary comments
- Removed unnecessary debug messages
- Using strstarts() instead of strcmp()
- is_trackpoint_dt_capable() modified
- Removed _BIT suffix and used BIT() define
- Reverse the trackpoint_doubletap_status() logic to return error first
- Removed export functions as a result of the design change
- Changed trackpoint_dev->psmouse to parent_psmouse
- The path of trackpoint.h is not changed

---
 drivers/input/mouse/trackpoint.c | 45 ++++++++++++++++++++++++++++++++
 drivers/input/mouse/trackpoint.h |  5 ++++
 2 files changed, 50 insertions(+)
drivers/input/mouse/trackpoint.c +2 -0
index 5f6643b69a2c..e12d76350252 100644
 
+     /* Must start with "PNP: LEN03" */
+     if (!strstarts(pnp_id, "PNP: LEN03"))
Quoted 7 lines
Quoted 1 line

Missing include.

Sorry, I am a bit confused here:
strstarts() is already available through the existing #include <linux/string.h> in thinkpad_acpi.c.

Do you think I should do anything else here?

Yes.

The file you're modifying in this patch is trackpoint.c which doesn't have that include so please add it also there. :-)

Signature · 1 line
 i.
#5 lore raw

Re: [PATCH v7 1/3] input: trackpoint - Enable doubletap by default on capable devices

Hi Ilpo,

Thank you.

Quoted 80 lines · Ilpo Järvinen
Quoted 77 lines · Vishnu Sankar

Hi Ilpo,

Thank you so much for the review.

Quoted 62 lines · Ilpo Järvinen
Quoted 58 lines · Vishnu Sankar

Enable doubletap functionality by default on TrackPoint devices that support it. The feature is detected using firmware ID pattern matching (PNP: LEN03xxx) with a deny list of incompatible devices.

This provides immediate doubletap functionality without requiring userspace configuration. The hardware is enabled during device detection, while event filtering continues to be handled by the thinkpad_acpi driver as before.

---
Changes in v7:
- Removed unwanted comments
- Removed psmouse_info ()

Changes in v6:
- No Changes

Changes in v5:
- Renamed function to trackpoint_is_dt_capable()
- Simplified string comparison without sscanf()
- Removed wrapper function as suggested
- Fixed missing period in comment

Changes in v4:
- Simplified approach: removed all sysfs attributes and user interface
- Enable doubletap by default during device detection
- Removed global variables and complex attribute infrastructure
- Uses minimal firmware ID detection with deny list
- Follows KISS principle as suggested by reviewers

Changes in v3:
- No changes

Changes in v2:
- Improve commit messages
- Sysfs attributes moved to trackpoint.c
- Removed unnecessary comments
- Removed unnecessary debug messages
- Using strstarts() instead of strcmp()
- is_trackpoint_dt_capable() modified
- Removed _BIT suffix and used BIT() define
- Reverse the trackpoint_doubletap_status() logic to return error first
- Removed export functions as a result of the design change
- Changed trackpoint_dev->psmouse to parent_psmouse
- The path of trackpoint.h is not changed

---
 drivers/input/mouse/trackpoint.c | 45 ++++++++++++++++++++++++++++++++
 drivers/input/mouse/trackpoint.h |  5 ++++
 2 files changed, 50 insertions(+)
drivers/input/mouse/trackpoint.c +0 -0
index 5f6643b69a2c..e12d76350252 100644
Quoted 4 lines

drivers/input/mouse/trackpoint.c static int trackpoint_reconnect(struct psmouse *psmouse) · line 419

Quoted 2 lines
drivers/input/mouse/trackpoint.c +2 -0
+     /* Must start with "PNP: LEN03" */
+     if (!strstarts(pnp_id, "PNP: LEN03"))

Missing include.

Sorry, I am a bit confused here:
strstarts() is already available through the existing #include <linux/string.h> in thinkpad_acpi.c.

Quoted 6 lines
Quoted 1 line

Do you think I should do anything else here?

Yes.

The file you're modifying in this patch is trackpoint.c which doesn't have that include so please add it also there. :-)

Aaah, Sorry!!. Got it.
I’ll add the missing #include <linux/string.h>
Thank you for pointing it out.

Quoted 3 lines

--
i.

Signature · 3 lines
Regards,

      Vishnu Sankar
maintainer
#6 lore raw

Re: [PATCH v7 1/3] input: trackpoint - Enable doubletap by default on capable devices

Quoted 88 lines · Vishnu Sankar

Hi Ilpo,

Thank you.

Quoted 82 lines · Ilpo Järvinen
Quoted 78 lines · Vishnu Sankar

Hi Ilpo,

Thank you so much for the review.

Quoted 62 lines · Ilpo Järvinen
Quoted 58 lines · Vishnu Sankar

Enable doubletap functionality by default on TrackPoint devices that support it. The feature is detected using firmware ID pattern matching (PNP: LEN03xxx) with a deny list of incompatible devices.

This provides immediate doubletap functionality without requiring userspace configuration. The hardware is enabled during device detection, while event filtering continues to be handled by the thinkpad_acpi driver as before.

---
Changes in v7:
- Removed unwanted comments
- Removed psmouse_info ()

Changes in v6:
- No Changes

Changes in v5:
- Renamed function to trackpoint_is_dt_capable()
- Simplified string comparison without sscanf()
- Removed wrapper function as suggested
- Fixed missing period in comment

Changes in v4:
- Simplified approach: removed all sysfs attributes and user interface
- Enable doubletap by default during device detection
- Removed global variables and complex attribute infrastructure
- Uses minimal firmware ID detection with deny list
- Follows KISS principle as suggested by reviewers

Changes in v3:
- No changes

Changes in v2:
- Improve commit messages
- Sysfs attributes moved to trackpoint.c
- Removed unnecessary comments
- Removed unnecessary debug messages
- Using strstarts() instead of strcmp()
- is_trackpoint_dt_capable() modified
- Removed _BIT suffix and used BIT() define
- Reverse the trackpoint_doubletap_status() logic to return error first
- Removed export functions as a result of the design change
- Changed trackpoint_dev->psmouse to parent_psmouse
- The path of trackpoint.h is not changed

---
 drivers/input/mouse/trackpoint.c | 45 ++++++++++++++++++++++++++++++++
 drivers/input/mouse/trackpoint.h |  5 ++++
 2 files changed, 50 insertions(+)
drivers/input/mouse/trackpoint.c +0 -0
index 5f6643b69a2c..e12d76350252 100644
Quoted 4 lines

drivers/input/mouse/trackpoint.c static int trackpoint_reconnect(struct psmouse *psmouse) · line 419

Quoted 2 lines
drivers/input/mouse/trackpoint.c +2 -0
+     /* Must start with "PNP: LEN03" */
+     if (!strstarts(pnp_id, "PNP: LEN03"))

Missing include.

Sorry, I am a bit confused here:
strstarts() is already available through the existing #include <linux/string.h> in thinkpad_acpi.c.

Do you think I should do anything else here?

Quoted 7 lines
Quoted 4 lines

Yes.

The file you're modifying in this patch is trackpoint.c which doesn't have that include so please add it also there. :-)

Aaah, Sorry!!. Got it.
I’ll add the missing #include <linux/string.h>
Thank you for pointing it out.

Thanks. Please also double check you added inux/array_size.h into the correct file in case you were confused what file this patch modifies.

Signature · 1 line
 i.
#7 lore raw

Re: [PATCH v7 1/3] input: trackpoint - Enable doubletap by default on capable devices

Hi Ilpo,

Thanks again.

Quoted 93 lines · Ilpo Järvinen
Quoted 90 lines · Vishnu Sankar

Hi Ilpo,

Thank you.

Quoted 84 lines · Ilpo Järvinen
Quoted 71 lines · Vishnu Sankar

Hi Ilpo,

Thank you so much for the review.

Quoted 65 lines · Ilpo Järvinen
Quoted 61 lines · Vishnu Sankar

Enable doubletap functionality by default on TrackPoint devices that support it. The feature is detected using firmware ID pattern matching (PNP: LEN03xxx) with a deny list of incompatible devices.

This provides immediate doubletap functionality without requiring userspace configuration. The hardware is enabled during device detection, while event filtering continues to be handled by the thinkpad_acpi driver as before.

---
Changes in v7:
- Removed unwanted comments
- Removed psmouse_info ()

Changes in v6:
- No Changes

Changes in v5:
- Renamed function to trackpoint_is_dt_capable()
- Simplified string comparison without sscanf()
- Removed wrapper function as suggested
- Fixed missing period in comment

Changes in v4:
- Simplified approach: removed all sysfs attributes and user interface
- Enable doubletap by default during device detection
- Removed global variables and complex attribute infrastructure
- Uses minimal firmware ID detection with deny list
- Follows KISS principle as suggested by reviewers

Changes in v3:
- No changes

Changes in v2:
- Improve commit messages
- Sysfs attributes moved to trackpoint.c
- Removed unnecessary comments
- Removed unnecessary debug messages
- Using strstarts() instead of strcmp()
- is_trackpoint_dt_capable() modified
- Removed _BIT suffix and used BIT() define
- Reverse the trackpoint_doubletap_status() logic to return error first
- Removed export functions as a result of the design change
- Changed trackpoint_dev->psmouse to parent_psmouse
- The path of trackpoint.h is not changed

---
 drivers/input/mouse/trackpoint.c | 45 ++++++++++++++++++++++++++++++++
 drivers/input/mouse/trackpoint.h |  5 ++++
 2 files changed, 50 insertions(+)
drivers/input/mouse/trackpoint.c +2 -0
index 5f6643b69a2c..e12d76350252 100644
 
+     /* Must start with "PNP: LEN03" */
+     if (!strstarts(pnp_id, "PNP: LEN03"))
Quoted 7 lines
Quoted 1 line

Missing include.

Sorry, I am a bit confused here:
strstarts() is already available through the existing #include <linux/string.h> in thinkpad_acpi.c.

Do you think I should do anything else here?

Yes.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

The file you're modifying in this patch is trackpoint.c which doesn't have that include so please add it also there. :-)

Aaah, Sorry!!. Got it.
I’ll add the missing #include <linux/string.h>
Thank you for pointing it out.

Thanks. Please also double check you added inux/array_size.h into the correct file in case you were confused what file this patch modifies.

Thanks, and yes — I got mixed up earlier and checked the includes in the wrong file, which led to my confusion.
Sorry about that.

Quoted 3 lines

--
i.

Signature · 3 lines
Regards,

      Vishnu Sankar
#8 lore raw

PATCH v7 2/3 platform/x86: thinkpad_acpi: Add sysfs control for TrackPoint double-tap

In reply to Vishnu Sankar

Add a sysfs attribute to enable or disable TrackPoint double-tap hotkey events at the kernel level.

The TrackPoint firmware enables double-tap support automatically. This interface allows userspace to control whether double-tap events are forwarded to userspace.

The attribute is available at:

/sys/devices/platform/thinkpad_acpi/doubletap_enable

0 - Disable double-tap hotkey events
1 - Enable double-tap hotkey events (default)

Filtering is implemented by suppressing ACPI hotkey delivery without injecting synthetic input events.

---
Changes in v2:
- Updated commit message to clarify dependency on trackpoint driver
- Now handling sysfs read/write of trackpoint driver using file read/write
- Removed sysfs attribute creation of trackpoint double tap here
- Reversed the logic and return false right away
- Dropped unnecessary debug messages
- Using dev_dbg() instead of pr_xxxx()

Changes in v3:
- No changes

Changes in v4:
- Simplified approach: single sysfs attribute for user control
- Clear naming: doubletap_filter instead of doubletap_enabled
- Intuitive behavior: 0=process events, 1=filter events
- No cross-driver dependencies or complex interactions
- Minimal code changes using existing thinkpad_acpi infrastructure

Changes in v5:
- Rename doubletap_filter to doubletap_enable to match actual behavior
- Fix inverted logic so events are emitted only when doubletap is enabled
- Register sysfs attribute via hotkey_attributes[] (no device_create_file)
---

---
 drivers/platform/x86/lenovo/thinkpad_acpi.c | 42 +++++++++++++++++----
 1 file changed, 35 insertions(+), 7 deletions(-)
drivers/platform/x86/lenovo/thinkpad_acpi.c +35 -7
index cc19fe520ea9..ca01323c990a 100644
@@ -373,7 +373,7 @@ static struct {
 	u32 hotkey_poll_active:1;
 	u32 has_adaptive_kbd:1;
 	u32 kbd_lang:1;
-	u32 trackpoint_doubletap:1;
+	u32 trackpoint_doubletap_enable:1;
 	struct quirk_entry *quirks;
 } tp_features;
 
@@ -3018,6 +3018,31 @@ static const struct attribute_group adaptive_kbd_attr_group = {
 	.attrs = adaptive_kbd_attributes,
 };
 
+/* sysfs doubletap enable --------------------------------------------- */
+static ssize_t doubletap_enable_show(struct device *dev,
+				     struct device_attribute *attr,
+				     char *buf)
+{
+	return sysfs_emit(buf, "%d\n", tp_features.trackpoint_doubletap_enable);
+}
+
+static ssize_t doubletap_enable_store(struct device *dev,
+				      struct device_attribute *attr,
+				      const char *buf, size_t count)
+{
+	bool enable;
+	int err;
+
+	err = kstrtobool(buf, &enable);
+	if (err)
+		return err;
+
+	tp_features.trackpoint_doubletap_enable = enable;
+	return count;
+}
+
+static DEVICE_ATTR_RW(doubletap_enable);
+
 /* --------------------------------------------------------------------- */
 
 static struct attribute *hotkey_attributes[] = {
@@ -3032,6 +3057,7 @@ static struct attribute *hotkey_attributes[] = {
 	&dev_attr_hotkey_recommended_mask.attr,
 	&dev_attr_hotkey_tablet_mode.attr,
 	&dev_attr_hotkey_radio_sw.attr,
+	&dev_attr_doubletap_enable.attr,
 #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL
 	&dev_attr_hotkey_source_mask.attr,
 	&dev_attr_hotkey_poll_freq.attr,
@@ -3557,8 +3583,8 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
 
 	hotkey_poll_setup_safe(true);
 
-	/* Enable doubletap by default */
-	tp_features.trackpoint_doubletap = 1;
+	/* Enable TrackPoint doubletap event reporting by default. */
+	tp_features.trackpoint_doubletap_enable = 1;
 
 	return 0;
 }
@@ -3863,9 +3889,9 @@ static bool hotkey_notify_8xxx(const u32 hkey, bool *send_acpi_ev)
 {
 	switch (hkey) {
 	case TP_HKEY_EV_TRACK_DOUBLETAP:
-		if (tp_features.trackpoint_doubletap)
-			tpacpi_input_send_key(hkey, send_acpi_ev);
-
+		/* Only send event if doubletap is enabled */
+		if (!tp_features.trackpoint_doubletap_enable)
+			*send_acpi_ev = false;
 		return true;
 	default:
 		return false;
@@ -11285,7 +11311,9 @@ static bool tpacpi_driver_event(const unsigned int hkey_event)
 		mutex_unlock(&tpacpi_inputdev_send_mutex);
 		return true;
 	case TP_HKEY_EV_DOUBLETAP_TOGGLE:
-		tp_features.trackpoint_doubletap = !tp_features.trackpoint_doubletap;
+		/* Toggle kernel-level doubletap event filtering */
+		tp_features.trackpoint_doubletap_enable =
+			!tp_features.trackpoint_doubletap_enable;
 		return true;
 	case TP_HKEY_EV_PROFILE_TOGGLE:
 	case TP_HKEY_EV_PROFILE_TOGGLE2:
Signature · 1 line
2.51.0
#9 lore raw

PATCH v7 3/3 Documentation: thinkpad-acpi - Document doubletap_enable attribute

In reply to Vishnu Sankar

Document the doubletap_enable sysfs attribute for ThinkPad ACPI driver.

---
Changes in v6:
- Fix formatting of doubletap_enable sysfs documentation (separate Values list)

---
 .../admin-guide/laptops/thinkpad-acpi.rst     | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)
Documentation/admin-guide/laptops/thinkpad-acpi.rst +21 -0
index 4ab0fef7d440..9a660724648b 100644
@@ -1521,6 +1521,27 @@ Currently 2 antenna types are supported as mentioned below:
 The property is read-only. If the platform doesn't have support the sysfs
 class is not created.
 
+doubletap_enable
+----------------
+
+sysfs: doubletap_enable
+
+Controls whether TrackPoint doubletap events are filtered out. Doubletap is a
+feature where quickly tapping the TrackPoint twice triggers a special function key event.
+
+The available commands are::
+
+                cat /sys/devices/platform/thinkpad_acpi/doubletap_enable
+                echo 1 | sudo tee /sys/devices/platform/thinkpad_acpi/doubletap_enable
+                echo 0 | sudo tee /sys/devices/platform/thinkpad_acpi/doubletap_enable
+
+Values:
+
+        * 1 - doubletap events are processed (default)
+	* 0 - doubletap events are filtered out (ignored)
+
+	This setting can also be toggled via the Fn+doubletap hotkey.
+
 Auxmac
 ------
 
Signature · 1 line
2.51.0
maintainer
#10 lore raw

Re: [PATCH v7 3/3] Documentation: thinkpad-acpi - Document doubletap_enable attribute

Documentation/admin-guide/laptops/thinkpad-acpi.rst Currently 2 antenna types are supported as mentioned below: · line 1541

Quoted 7 lines · Vishnu Sankar

Document the doubletap_enable sysfs attribute for ThinkPad ACPI driver.

---

Documentation/admin-guide/laptops/thinkpad-acpi.rst +2 -0
+        * 1 - doubletap events are processed (default)
+	* 0 - doubletap events are filtered out (ignored)

There's something odd in space vs tab here.

Signature · 1 line
 i.
#11 lore raw

Re: [PATCH v7 3/3] Documentation: thinkpad-acpi - Document doubletap_enable attribute

Ilpo,

Thank you for the review comments.

Quoted 5 lines · Ilpo Järvinen
Quoted 2 lines · Vishnu Sankar

Document the doubletap_enable sysfs attribute for ThinkPad ACPI driver.

Quoted 7 lines

Documentation/admin-guide/laptops/thinkpad-acpi.rst Currently 2 antenna types are supported as mentioned below: · line 1541

Quoted 5 lines

---

Documentation/admin-guide/laptops/thinkpad-acpi.rst +2 -0
+        * 1 - doubletap events are processed (default)
+     * 0 - doubletap events are filtered out (ignored)

There's something odd in space vs tab here.

I will check this.

Quoted 4 lines

--
i.

Signature · 3 lines
Regards,

      Vishnu Sankar
#12 lore raw
In reply to Vishnu Sankar

Hi,

Gentle ping on this series.

This is v7 addressing all previous review comments. Please let me know if any further changes are needed.

Thanks,
Vishnu

Quoted 65 lines · Vishnu Sankar

This patch series adds support for TrackPoint doubletap with a clear and simple separation of responsibilities between drivers:

1. Firmware enablement (trackpoint.c):
Automatically enables doubletap on capable hardware during device detection.

2. User control (thinkpad_acpi.c):
Provides a sysfs interface to enable or disable delivery of doubletap events to userspace.

The approach follows the KISS principle:
- The TrackPoint driver enables hardware functionality by default.
- The thinkpad_acpi driver controls whether ACPI doubletap events are delivered, using existing hotkey filtering infrastructure.
- No cross-driver APIs or dual filtering paths are introduced.

Changes in v7:
- Removed unwanted comments and logs

Changes in v6:
- Documentation: fix formatting of the doubletap_enable sysfs attribute description (separate "Values" list)

Changes in v5:
- Rename sysfs attribute from doubletap_filter to doubletap_enable to reflect actual behavior.
- Fix inverted logic so events are delivered only when doubletap is enabled.
- Suppress ACPI hotkey delivery instead of injecting or filtering input events.
- Register the sysfs attribute via hotkey_attributes[] instead of device_create_file().
- Drop unnecessary helper wrappers and debug logging.
- Update Documentation to reflect the new naming and semantics.

Changes in v4:
- Complete redesign based on reviewer feedback.
- trackpoint.c: Simplified to only enable doubletap by default.
- trackpoint.c: Removed all sysfs attributes and global variables.
- trackpoint.c: Uses firmware ID detection with deny list.
- thinkpad_acpi.c: Added sysfs interface for kernel-level event control.
- thinkpad_acpi.c: No cross-driver dependencies.
- Documentation: Updated to reflect simplified sysfs approach.

Changes in v3:
- No changes.

Changes in v2:
- Improved commit messages.
- Removed unnecessary comments and debug messages.
- Switched to strstarts() usage.
- Simplified firmware capability detection logic.

This version addresses the remaining review feedback by correcting the naming and logic inversion, aligning sysfs semantics with behavior, and fully integrating with existing thinkpad_acpi hotkey handling.

Vishnu Sankar (3):
input: trackpoint - Enable doubletap by default on capable devices platform/x86: thinkpad_acpi: Add sysfs control for TrackPoint
double-tap
Documentation: thinkpad-acpi - Document doubletap_enable attribute

Quoted 9 lines
 .../admin-guide/laptops/thinkpad-acpi.rst     | 21 +++++++++
 drivers/input/mouse/trackpoint.c              | 45 +++++++++++++++++++
 drivers/input/mouse/trackpoint.h              |  5 +++
 drivers/platform/x86/lenovo/thinkpad_acpi.c   | 42 ++++++++++++++---
 4 files changed, 106 insertions(+), 7 deletions(-)

--
2.51.0

--

Regards,

Vishnu Sankar

maintainer
#13 lore raw
Quoted 88 lines · Vishnu Sankar

Hi,

Gentle ping on this series.

This is v7 addressing all previous review comments. Please let me know if any further changes are needed.

Thanks,
Vishnu

Quoted 65 lines · Vishnu Sankar

This patch series adds support for TrackPoint doubletap with a clear and simple separation of responsibilities between drivers:

1. Firmware enablement (trackpoint.c):
Automatically enables doubletap on capable hardware during device detection.

2. User control (thinkpad_acpi.c):
Provides a sysfs interface to enable or disable delivery of doubletap events to userspace.

The approach follows the KISS principle:
- The TrackPoint driver enables hardware functionality by default.
- The thinkpad_acpi driver controls whether ACPI doubletap events are delivered, using existing hotkey filtering infrastructure.
- No cross-driver APIs or dual filtering paths are introduced.

Changes in v7:
- Removed unwanted comments and logs

Changes in v6:
- Documentation: fix formatting of the doubletap_enable sysfs attribute description (separate "Values" list)

Changes in v5:
- Rename sysfs attribute from doubletap_filter to doubletap_enable to reflect actual behavior.
- Fix inverted logic so events are delivered only when doubletap is enabled.
- Suppress ACPI hotkey delivery instead of injecting or filtering input events.
- Register the sysfs attribute via hotkey_attributes[] instead of device_create_file().
- Drop unnecessary helper wrappers and debug logging.
- Update Documentation to reflect the new naming and semantics.

Changes in v4:
- Complete redesign based on reviewer feedback.
- trackpoint.c: Simplified to only enable doubletap by default.
- trackpoint.c: Removed all sysfs attributes and global variables.
- trackpoint.c: Uses firmware ID detection with deny list.
- thinkpad_acpi.c: Added sysfs interface for kernel-level event control.
- thinkpad_acpi.c: No cross-driver dependencies.
- Documentation: Updated to reflect simplified sysfs approach.

Changes in v3:
- No changes.

Changes in v2:
- Improved commit messages.
- Removed unnecessary comments and debug messages.
- Switched to strstarts() usage.
- Simplified firmware capability detection logic.

This version addresses the remaining review feedback by correcting the naming and logic inversion, aligning sysfs semantics with behavior, and fully integrating with existing thinkpad_acpi hotkey handling.

Vishnu Sankar (3):
input: trackpoint - Enable doubletap by default on capable devices platform/x86: thinkpad_acpi: Add sysfs control for TrackPoint
double-tap
Documentation: thinkpad-acpi - Document doubletap_enable attribute

Quoted 9 lines
 .../admin-guide/laptops/thinkpad-acpi.rst     | 21 +++++++++
 drivers/input/mouse/trackpoint.c              | 45 +++++++++++++++++++
 drivers/input/mouse/trackpoint.h              |  5 +++
 drivers/platform/x86/lenovo/thinkpad_acpi.c   | 42 ++++++++++++++---
 4 files changed, 106 insertions(+), 7 deletions(-)

--
2.51.0

Quoted 5 lines

--

Regards,

Vishnu Sankar

Hi Ilpo,

I was just discussing this with Vishnu and wanted to check if anything else was needed from your perspective for this patch?

I assume at this point we're waiting for the 7.1 merge window to open. Please do let us know if there's anything you need from us in the meantime.
We can't get this pulled into the distro's until it's accepted upstream - and while it's not a critical feature, we'd love it to be in place for the Linux preloads for the 2026 platforms (coming up soon)

Thanks
Mark