Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH RFC 0/2] Input: Maxim MAX11936 touchscreen (NVIDIA Tegra Note 7)
@ 2026-11-29 18:54 Patrick Fischer via B4 Relay
  2026-11-29 18:54 ` [PATCH RFC 1/2] dt-bindings: input: touchscreen: Add Maxim MAX11936 Patrick Fischer via B4 Relay
  2026-11-29 18:54 ` [PATCH RFC 2/2] Input: add Maxim MAX11936 touchscreen driver Patrick Fischer via B4 Relay
  0 siblings, 2 replies; 4+ messages in thread
From: Patrick Fischer via B4 Relay @ 2026-11-29 18:54 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: Henrik Rydberg, Svyatoslav Ryhel, linux-input, devicetree,
	linux-tegra, linux-kernel, Patrick Fischer

The NVIDIA Tegra Note 7 is a tablet with a Tegra 4 (T114); it came in two
production board revisions, P1640 and P1988. Its touchscreen has a Maxim
MAX11936 controller on SPI. Four names belong to this setup; below each
is used in one role only:

- SmartTouch: Maxim's name for the controller family;
- DirectTouch: NVIDIA's name for touch processing on the SoC;
- touch_fusion: the closed vendor daemon on Android that did that
  processing;
- maxim_sti: NVIDIA's Android kernel driver that passed the frames to
  touch_fusion and its touches on to the input layer.

The controller does not compute touches. It delivers raw frames, 224 per
second, which touch_fusion turned into touches; without the daemon there
is no touch on this tablet. This RFC finds the touches in the kernel.
There is no daemon, no netlink and no firmware file: the controller runs
from its own flash, which the driver never writes, and the two tables it
needs before scanning are generated from a few constants. The start and
idle sequences were taken from recordings of touch_fusion running on
mainline; nothing was decompiled. Patch 2 has the details and the
numbers.

Questions:

1. The main question: is evaluating raw frames in the kernel acceptable
   for an input driver, or should this be a userspace program feeding
   uinput (a daemon again, but an open one)?

   The evaluation is about 500 lines of integer code (max11936-algo.c).
   While the controller scans, the interrupt thread takes 14 to 15 % of
   one CPU (measured). Of that, the evaluation is about 3 % (0.14 ms per
   frame, as timed by the driver); the rest is reading the frames over
   SPI, which a userspace variant needs as well. After 10 s without a
   contact the controller goes into its idle mode and the driver sees
   nothing until the next touch. Over 12 minutes with a few touches the
   interrupt thread averaged 1 % of one CPU.

   Part of the evaluation are a few rules: it tells pen from finger
   (MT_TOOL_PEN) by the size and strength of a contact in its first
   frames, keeps a contact that vanished for 3 frames, and takes two
   contacts closer than 48 pixels as one. Are such rules fine in an input
   driver?

   The question came up in 2014 for DirectTouch in "Touch processing on
   host CPU" [1]. Dmitry, you advised thinking long and hard before doing
   the processing in userspace [2]: it either goes back into the kernel
   through uinput with added latency, or needs device-specific drivers
   again in X, Wayland, Chrome and Android. Alan Cox suggested that basic
   processing might be better in the kernel, providing it can be simple
   enough, and that the raw data would otherwise belong in IIO [3]. As far
   as I can see, no driver came out of that thread.

2. The panel and tuning data (lines, drive code, thresholds, mapping to
   the screen, the pen rule) are match data of the compatible, not DT
   properties. The matrix geometry (40 x 24) is fixed for this tablet: I
   know of no other production device with this controller (the Nexus 9
   shipped with a Synaptics controller; Maxim parts appear only on its
   early prototypes). Is match data the right place? Patch 1 has the
   questions on the binding itself.

3. Slots come from input_mt_assign_slots(). A new contact is not reported
   before its tool is decided (up to 6 frames), so the core sees its slot
   as free; a small helper (max11936_slots_match()) moves such contacts
   back to the slot they had in the previous frame. Is that acceptable
   next to input_mt_assign_slots(), or is there a better way to hold back
   a contact for a few frames?

4. There is no debugfs in this version. For tuning another panel a dump
   of the last raw and decoded frame helped a lot. Would that rather be a
   V4L2 touch device, as atmel_mxt_ts and rmi4 F54 do for their raw data,
   or should it stay out of tree?

Testing: on a Tegra Note 7 (P1640) with avdd at 3.0 V, the driver built as
a module for v7.4-rc3 with the board's device tree; the series is based on
input next. Patch 2 lists what was tested. Not tested: system suspend, pen
and finger on the screen at the same time, the power-off after a fault,
and a long run (the longest stretch of continuous scanning was 70 s).
Svyatoslav Ryhel tested the out-of-tree predecessor of this driver on his
P1988 in early November: touch and pen worked.

avdd needs to be 3.0 V: at 2.85 V the controller flagged about 11 % of
the frames as bad (status bit 0x04) and the driver dropped them; at
3.0 V it was 24 of about 60000, all during pen strokes. NVIDIA's board
file uses 3.0 to 3.3 V, and Svyatoslav's board series [4] sets it to
3.0 V.

The device tree node is not part of this series. Svyatoslav posted the
board support for the Tegra Note 7 as a work-in-progress series [4],
which does not have the touchscreen node yet.

[1] https://lore.kernel.org/all/5440F282.8040306@itdev.co.uk/
[2] https://lore.kernel.org/all/20141017171756.GA22238@dtor-ws/
[3] https://lore.kernel.org/all/20141021132229.37a1197c@alan.etchedpixels.co.uk/
[4] https://lore.kernel.org/all/20261122201407.23742-1-clamor95@gmail.com/

Tool use (see Documentation/process/generated-content.rst): Claude Code
(Anthropic) wrote the code and the analysis of the recorded traffic,
and an independent review by another Claude Code session went over the
driver before this posting; I reviewed it, ran the tests on the device
and take responsibility for it.

---
Patrick Fischer (2):
      dt-bindings: input: touchscreen: Add Maxim MAX11936
      Input: add Maxim MAX11936 touchscreen driver

 .../bindings/input/touchscreen/maxim,max11936.yaml |   73 ++
 drivers/input/touchscreen/Kconfig                  |   14 +
 drivers/input/touchscreen/Makefile                 |    2 +
 drivers/input/touchscreen/max11936-algo.c          |  508 +++++++++
 drivers/input/touchscreen/max11936-core.c          | 1155 ++++++++++++++++++++
 drivers/input/touchscreen/max11936.h               |  141 +++
 6 files changed, 1893 insertions(+)
---
base-commit: 0d4a5266e498ac7c25511cb1fa40d5f3c0a600bc
change-id: 20261120-upstream-touch-max11936-1f707a7f1511

Best regards,
--  
Patrick Fischer <admin@tsv-stahl-riesa.de>



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-29 19:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29 18:54 [PATCH RFC 0/2] Input: Maxim MAX11936 touchscreen (NVIDIA Tegra Note 7) Patrick Fischer via B4 Relay
2026-11-29 18:54 ` [PATCH RFC 1/2] dt-bindings: input: touchscreen: Add Maxim MAX11936 Patrick Fischer via B4 Relay
2026-11-29 18:54 ` [PATCH RFC 2/2] Input: add Maxim MAX11936 touchscreen driver Patrick Fischer via B4 Relay
2026-11-29 19:07   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox