Skip to content

HID: apple-mtp-kiwi: the K114c touch screen (needs #1568) - #1605

Open
joshuaswarren wants to merge 5 commits into
aurora-silicon:integration/aurorafrom
joshuaswarren:w7c/up-k114c-kiwi
Open

joshuaswarren wants to merge 5 commits into
aurora-silicon:integration/aurorafrom
joshuaswarren:w7c/up-k114c-kiwi

Conversation

@joshuaswarren

@joshuaswarren joshuaswarren commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Adds the touch screen of the 14-inch PROLED MacBook Pro (K114c, M5 Max). The panel's touch controller is a "kiwi" interface on the same dockchannel MTP transport as the trackpad. It has its own reset and power lines and wants a 24 MHz clock pad and a display-sync pad.

What is in the stack, oldest first:

  1. HID: apple-mtp-kiwi: add the MTP touch screen driver, with its MAINTAINERS entry and CONFIG_HID_APPLE_MTP_KIWI=m in asahi.config.
  2. HID: dockchannel-hid: bring up the kiwi (touch screen) interface: the reset, power and clock bring-up, and skipping announced GPIOs the device tree does not wire.
  3. dt-bindings: input: apple,dockchannel-hid: document the kiwi interface properties.
  4. arm64: dts: apple: t6050-k114c: enable the kiwi touch screen interface, including the pad functions: clock on NUB pin 22, display sync on AP pin 11, reset on NUB pin 25 (active low), power on NUB pin 26.

It needs #1737 (the report-size clamp for this MTP firmware, and the short-report pad) underneath it, and #2004 (pinctrl: apple: clear bit 4 of the GPIO mode on the T6050, split out of this PR as its own fix): without it the touch reset never took effect on the K114c (see #2004).

Status, measured on the machine: the firmware is accepted, Kiwi interface ready with status:0 appears, /dev/hidraw2 streams 17861-byte frames at about 123 Hz, and the input device "Apple MTP touch screen" registers. Finger events are not verified yet: I have not had a person at the panel since the interface came up. I will update this with a libinput debug-events capture. Marked draft until then.

Firmware image: the image as macOS ships it fails to load at operations 26, 29 and 30 of the kiwi sequence, which are optional placeholder writes to address 0, and the driver stops at the first one. That is fixed where the image is made, not in this driver: m5max-touch-fw.py in https://github.com/joshuaswarren/m5max-touch-firmware removes those three operations when it writes tpkiwifw-k114c.bin, after checking that each still has that shape. The driver here is unchanged for it, so an image installed by anything else needs the same three operations dropped.

Validated on, and reach

Validated on: 14-inch M5 Max MacBook Pro (K114c, T6050): the firmware is accepted, Kiwi interface ready with status:0 appears, /dev/hidraw2 streams 17861-byte frames at about 123 Hz, and the input device registers. Finger events are not verified.

Applies beyond the M4: No. The touch screen is specific to the K114c panel. This PR no longer touches pinctrl (that is #2004). The touch measurement above was taken with #2004 applied; this head, without it, was not booted. Other models were not run.

m tester run (omarchy-m-testing.org): feature rows none (no touch-screen feature row). The tester needs the hardware; no tester run is linked to this change.

Changed after review (RevAne421), head 93c2cae

  • kiwi_input_open reset have_base while kiwi_raw_event could be parsing a frame. One spinlock (kiwi->lock) now covers the frame parser and the reset.
  • A GPIO announced after the first GPIO command was never requested, because one flag ended the lookup. The driver now counts how many announced GPIOs it has looked up and requests the rest at their first command.
  • Commit 1 said five taps landed at the matching points, while this body says finger events are not verified. The message now says that run was an earlier revision of the parser with another transport, that it is not repeated on this series, and that finger events with this series are not verified.
  • The binding said apple,reset-gpios is required with power method 2, but the driver falls back to the parent's apple,afe-reset-gpios. The binding text now says it should be given and what the fallback does. The code is unchanged there.

Checked: hid-apple-mtp-kiwi.o and dockchannel-hid.o compile with gcc 16.1.1 and W=1, no warnings, as filed and with the fixes, on a depth-1 checkout of the previous head, on a 13-inch M1 MacBook (an object build only, not booted). The binding file parses as YAML; dt_binding_check was not run. Nothing from this round was booted on the 14-inch M5 Max, and no other Mac was used.

Rebased onto integration/aurora 514ae1f (head a7b2feb)

The branch conflicted with the base. The only conflict was t6050-k114c.dts: the base and this PR both append a block at the end of the file, and the PR also adds one include line near the top. I kept both blocks (the base first) and added the include after the dtsi include. The other files merged without conflict. The commits, messages and authors are unchanged, so the review notes above still apply to the same code.

Built on the 13-inch M1 MacBook at this head, gcc 16.1.1 with W=1: dockchannel-hid.o and hid-apple-mtp-kiwi.o (no warnings), and the K114c, K114s, K116c and K116s dtbs. dtc prints the same seven warnings for the K114c dtb on the base alone and with this PR (six reserved-memory unit-name warnings from t6050-k114c-gpu.dtsi and one for pmp@284e00000 from t6050-peripherals.dtsi); none come from this PR. This head was not booted. CHECK_DTBS was not run.

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Joshua, this is a big step for the K114c, and the kiwi driver reads well. Two things before it can merge:

  1. integration/aurora now defines ps_nub_gpio in t6050-peripherals.dtsi (pmgr2, the always-on PMGR at 0x288300000, @88, disabled by default; added with the J714s Touch ID in 4b9a171), and nub_gpio0 already points its power-domains at it. With this branch merged, dtc stops on a duplicate ps_nub_gpio label (your node is in pmgr0 at 0x280600000). Please drop the t6050-die0.dtsi node and enable the shared one from t6050-k114c.dts the way J714s does: &ps_nub_gpio { status = "okay"; }; and &nub_gpio0 { status = "okay"; ... }. That also leaves out the gpio-controller/gpio-ranges/npins lines, which the base node already has.
  2. #1603/#1604 are merged, so t6050-k114c.dts conflicts. Keep both: the N1/GPU/sound nodes from integration first, then the kiwi nodes. The new gpio-reserved-ranges on pinctrl_ap only limits GPIO lines, so the pin 11 pad function still works.

After the rebase a touch row on the K114c (libinput debug-events with one finger) would let us drop draft. We've run the shared parts of this stack (Apple GPIO mode field, dockchannel-hid GPIO handling) on our M2 and M1 Pro with no change in GPIO state, input devices or errors; the J616s, Neo and J714s rows are in progress.

The touch screen of the 14 inch M5 Max MacBook Pro (K114c) sits behind
the kiwi interface of the dockchannel MTP. The interface has a 29-byte
HID descriptor with one opaque input item and no description of the
contacts. The chip reports a raw 82 column by 54 row capacitance image
every 8.3 ms and does no contact detection itself.

Claim the interface by name (hid-apple and hid-magicmouse already refuse
BUS_HOST Apple interfaces that are not a keyboard or mouse), keep the
raw pipe on hidraw, and register a direct multi-touch input device with
10 slots over the 3024x1986 panel. The driver:

 - clamps the Report Size of the descriptor, which is 0x80000 bits and
   above the 16384 that hid-core accepts, in report_fixup,
 - skips the whole-image shift frames the chip sends every 2 s and
   removes a per-row mean from the others,
 - keeps a fixed-point baseline per cell (fast up when a finger left,
   slow drift otherwise),
 - takes 3x3 local maxima 250 counts below baseline, centroids them and
   tracks them frame to frame with a 2 frame miss debounce.

Row 0 of the sensor is the bottom edge of the panel, so y is mirrored;
this is a fixed fact of the hardware, there is no option for it. The grid
and the panel size are K114 only, and frames that are not 17861 bytes
long are ignored.

Tested: an earlier revision of this parser ran on a K114c with a transport
that clamped the descriptor and a module option for the mirror: five taps
at the corners and the centre, in that order, landed at the matching points
on a test page, and evtest showed X/Y changing under a finger. That run is
not repeated on this series, and finger events with this series are not
verified. The clamp in this patch is checked in a userland test only. The
firmware load and power sequence of the interface are in a separate patch.
Compile tested with W=1; the lock between the frame parser and the baseline
reset in open() was not booted.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
The touch screen ("kiwi") of the 14 inch M5 Max MacBook Pro rides the
same dockchannel MTP as the multi-touch interface and announces itself
the same way, but it owns its reset and power lines instead of sharing
the AFE reset, and its 1.3 MB firmware image is written by the MTP
bootloader over the touch IC SPI, which takes seconds rather than the
1 s the comm timeout allows.

- A power method 2 interface may decode its own reset and power lines
  from its device node; without its own reset line it keeps falling back
  to the shared AFE reset, so existing multi-touch boards are unchanged.
- Announced GPIOs are tracked per interface (the MTP announces
  clock_24MHz_enable, display_sync, power and reset for kiwi) instead
  of failing on the second one, and a GPIO command is matched to its
  announced id. The kiwi clock and display_sync pads are pad functions
  in the device tree, not host GPIOs: they are left unset and a command
  for them is refused. A GPIO announced after the first GPIO command is
  requested at its own first command: the driver counts how many it has
  looked up instead of keeping one flag.
- While the kiwi firmware load is running, comm commands use a 10 s
  timeout, and the kiwi interface waits 10 s for its ready message.
- The kiwi start sequence, taken only when kiwi has a reset line of its
  own, power-cycles the chip with a reset pulse (the reset line is active
  low in the device tree), settles 50 ms, sends the firmware and then runs
  the normal power method 2 transitions. The power line is raised on the
  way up and left alone on the way down. The sequence is fixed code, not
  tunables.

It needs the device tree side (the kiwi node, its reset and power lines
and the two pad functions), which is a separate patch.

The image installed as apple/tpkiwifw-k114c.bin fails to load at its
operations 26, 29 and 30, which are optional property placeholders
(address 0, not required). The verified runs used an image with those
three operations removed, so whatever installs the firmware needs to
drop them.

Compile tested against this tree with W=1. The start sequence, the
timeouts and the pad function settings are verified on hardware on a
7.2.11 based tree.

Booted on a K114c on this base with the first revision of this series: the
interface binds, reports ready with status 0 and streams 17861-byte frames
at about 123 Hz.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
…e properties

The kiwi (touch screen) interface of the dockchannel MTP owns its power
sequencing lines instead of sharing the multi-touch analog front end
reset. Document apple,power-method, apple,reset-gpios and
apple,power-gpios on the kiwi child node, mirroring how the multi-touch
child documents its power method. Without apple,reset-gpios the driver
falls back to the shared AFE reset of the parent and does not power-cycle
the touchscreen itself; the text says so.

The 24 MHz clock and display sync pads are pad functions selected by the
transport node pinctrl, not GPIO properties, so they need no binding
entries.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
@joshuaswarren

Copy link
Copy Markdown
Contributor Author

[Joshua's agent] Reworked for both points; the branch is now 81435c7, five commits rebased on integration/aurora de6a8d4.

  1. Duplicate ps_nub_gpio: the t6050-die0.dtsi node is dropped. t6050-k114c.dts now enables the shared one the way J714s does (&ps_nub_gpio { status = "okay"; };) and &nub_gpio0 { status = "okay"; ... }, with no gpio-controller, gpio-ranges or npins lines. The only other lines in that node are /delete-property/ interrupts and the clock pin group. I kept the interrupt delete because the touch result on the K114c was obtained without them; I have no K114c run that covers the base node's seven interrupts, so say so if you would rather inherit them.
  2. Rebase: the N1, GPU and sound nodes from integration come first in t6050-k114c.dts, then the kiwi nodes. The pin 11 pad function is set through the pinctrl_ap pinmux, so the new gpio-reserved-ranges does not touch it.

Checks on this head, run locally: make ARCH=arm64 W=1 builds apple/t6050-k114c.dtb and apple/t6050-j714s.dtb with no warning from these nodes (the unit-address warnings in the gpu and pmp dtsi files were already on integration), and checkpatch --strict reports 0 errors, 0 warnings, 0 checks on all five commits. The dts commit message no longer says it adds the power domain.

Not yet run on this base: a K114c boot with libinput debug-events. That touch row comes after the next K114c boot slot; the first revision of the series was booted on this machine and streamed 17861-byte frames at about 123 Hz.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks Joshua, the rework is what we asked for. The pinctrl, dockchannel-hid and asahi.config changes are byte-identical to the head we ran on the M2, J616s and M1 Pro, so those rows still apply. Only the K114c DT moved, and the die0 node is gone.

On the interrupts: please inherit them and drop the /delete-property/ interrupts. The J714s, same SoC and same base node, enables nub_gpio0 with all seven and runs that way. The kiwi only uses NUB 25 and 26 as outputs, so the touch path doesn't depend on them either way. With the delete, the node still says interrupt-controller but the driver finds no parent IRQs and registers no irqchip, so any later NUB GPIO interrupt user on K114c would fail to map. If the touch row on your next boot comes out the same with them inherited, I'll approve and merge.

The touch screen of the 14 inch MacBook Pro with the M5 Max rides the
dockchannel MTP as its own "kiwi" interface. It sequences its own power:
with power method 2 the host drives the touchscreen reset (nub GPIO 25,
active low) and its optional supply enable (nub GPIO 26), instead of the
shared multi-touch AFE reset on the SMC.

Enable the shared always-on NUB GPIO power domain and controller the way
J714s does, with its seven interrupts, mux the 24 MHz clock (nub pin
22) and display sync (AP pin 11) pads through the transport node pinctrl,
and enable the interface with its k114c firmware name.

The reset polarity, the GPIO numbers and the two pad function values
(pin 22 and pin 11, function 1) are those of the device tree that gave
touch on the hardware on a kernel based on v7.2.11.

Booted on a K114c on an earlier base with the first revision of this
series: the interface binds, reports ready with status 0 and streams
17861-byte frames at about 123 Hz.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
@DjDeveloperr

Copy link
Copy Markdown
Contributor

J714s (M5 Pro) validation of 81435c7 on top of #1568 (1e06558): PASS.

  • The test kernel is intg3 plus [Joshua's agent] HID: magicmouse: parse the 0x5a MTP report of the K114c #1568 plus this PR's 5 commits. The one conflict was in the K114c-only dts; I took the PR head's version.
  • The J714s DTB is byte-identical to intg3's.
  • Keyboard binds to hid-apple and trackpad to hid-magicmouse, and Hyprland lists both. There are 0 pinctrl and 0 dockchannel-hid errors.
  • Speaker amp GPIOs 106/107 are in the same state as on intg3. 6/6 SN012776 bound, with 0 fault IRQs in 10 s. Nothing was played.
  • Wi-Fi 5/5 ping, glmark2-es2 4440 (intg3 4464), 0 oops.
  • Not exercised: physical key or touch input, since nobody was at the machine.

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

Thanks, Ryan. The K114c touch row is coming: once the unit is back from the touch hardware fix, I’ll run libinput debug-events with one finger and add the result here.

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

GREEN on 57a87a9
Model: zai/glm-5.3

Verified the re-split at blob level, not message level: the four carry-commits of this head are patch-for-patch byte-identical to their counterparts in the old ea00ed3 stack (compared the API patches for all four pairs), the stack base is back to the original de6a8d4 (the old stack had the pinctrl commit facb551 inserted at the bottom), and the pinctrl file at this head carries GENMASK(3, 1) again - the pre-change line - while ea00ed3 carried GENMASK(4, 1). So this head is exactly the old stack minus the pinctrl commit, with no other content change, and #2004 supplies the removed line as a dependency.

Model: zai/glm-5.3 (live from lane_models.py this turn).

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

GREEN on 57a87a9
Model: anthropic/claude-sonnet

Independent review. After the split this PR is one feature (the K114c touch screen) in four commits: driver, bring-up, binding, device tree. The pinctrl change is gone from the diff, and #2004 carries it. The diff has no hostnames, home paths, lab names or Apple data.

What I checked:

  • The binding file at this head passes dt-doc-validate with no errors.
  • The device tree labels the new nodes reference (ps_nub_gpio, nub_gpio0, pinctrl_ap, mtp_hid, kiwi) all exist in the T6050 files at this head.
  • I read the dockchannel-hid.c changes against the existing multi-touch path. With no apple,reset-gpios on the node, reset falls back to the AFE reset and dchid_set_own_lines() drives it exactly as before. The 50 ms settle still runs for it. The kiwi_loading flag is cleared on both exits of dchid_start_interface().
  • I read hid-apple-mtp-kiwi.c for overflow, a divide by zero and the descriptor clamp. A peak always has sig >= 250, so the centroid weight is never zero. The report_fixup item walk handles the four-byte Report Size item.

I did not build or boot this. No blocking items.

Non-blocking notes:

  1. The installed firmware image fails. The commit message for the bring-up patch says apple/tpkiwifw-k114c.bin as installed fails at operations 26, 29 and 30, and that the verified runs used an image with those removed. The device tree names exactly that file in firmware-name. Whoever installs the firmware needs to strip those operations, so please say where that happens, or the board will fail on a stock install.
  2. The binding and the code disagree on apple,reset-gpios. The binding text says power method 2 "requires" it (apple,dockchannel-hid.yaml, kiwi apple,power-method). The code in dchid_get_interface() falls back to the AFE reset when it is absent, and nothing in the schema enforces it. Either make the text say "may", or add a schema rule if the fallback is not meant for kiwi.
  3. Commit 1 and the PR body disagree. The commit says five taps landed at the matching points. The PR body says finger events are not verified. The commit does say the run used a different transport, but a reader of the log only sees the claim. Say "on an earlier tree" there.
  4. Data race on open. In kiwi_input_open() the write k->have_base = false is not ordered against kiwi_raw_event() when hidraw is already open. A frame can see a half-reset baseline. It is not worth a lock. A flag consumed inside kiwi_load() would do.
  5. Late-announced GPIOs. dchid_request_gpio() returns early once gpios_requested is set. A GPIO announced after the first GPIO command would never be requested. All four are announced at init today, so this does not matter now.
  6. kiwi_match() ignores its ignore_special_drivers argument, so hid.ignore_special_drivers=1 cannot release the interface.
  7. The Signed-off-by lines use a users.noreply.github.com address and match the author.

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

GREEN on 93c2cae
Model: zai/glm-5.3

Re-review at the new head; I diffed the three changed files between this and 57a87a9 directly and they match the description exactly. The kiwi spinlock serializes the frame parser against the baseline reset in open() (lock taken around the have_base path in kiwi_raw_event and around the reset, initialized at probe, irqsave form) - closing the race where a frame could parse against a half-reset baseline. The gpios_requested bool-to-count change is the correct fix for a GPIO that appears later: the lookup resumes from the already-requested entries instead of treating any partial success as complete, and complete means count equality. The binding text now says should with the actual fallback named (the parent's apple,afe-reset-gpios, no power-cycling of the touchscreen itself), which matches the driver's behavior instead of overstating a requirement. The commit 1 message now states its evidence precisely: an earlier revision of the parser ran the five-tap corner-and-centre check on a K114c with a clamped descriptor and the mirror option - the earlier-revision caveat is the honest form. Everything verified at 57a87a9 (the four carry commits, byte-identical patches) is unchanged below these three files.

Model: zai/glm-5.3 (live from lane_models.py this turn).

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

GREEN on 93c2cae
Model: anthropic/claude-sonnet

Re-review after my earlier notes. The four items in the PR's "Changed after review" section are fixed as described. No blocking items.

What I checked:

  • The have_base race. kiwi->lock is initialised in kiwi_probe() before hid_hw_start(). kiwi_raw_event() takes it around kiwi_frame(), and kiwi_input_open() takes it around the reset. A frame can no longer see a half-reset baseline. Calling the input core from under spin_lock_irqsave is fine here.
  • Late GPIOs. gpios_requested now counts how many announced GPIOs have been looked up. dchid_request_gpio() starts the loop at that count and skips any gpios[g] already set. A failed lookup in the middle (a deferred probe, for example) leaves the count where it was, so the next pass retries cleanly. A GPIO announced after the first command is picked up on the next command.
  • Existing multi-touch boards. With no apple,reset-gpios on the node, reset still falls back to the AFE reset and the 50 ms settle still runs for it.
  • Binding wording. It now says apple,reset-gpios "should be given" and describes the fallback, which matches the driver. The commit message for the binding says the same.
  • Commit 1 message. It now says the taps ran on an earlier revision with another transport, that this is not repeated on this series, and that finger events with this series are not verified. That matches the PR body.
  • The diff has no hostnames, home paths, lab names or Apple data, and the pinctrl change is not in it.

I did not build or boot this.

Non-blocking notes:

  1. The installed firmware image still fails. My earlier note stands: the commit message says apple/tpkiwifw-k114c.bin as installed fails at operations 26, 29 and 30, and the device tree names that file. The PR does not say where the image is fixed before a stock install gets it.
  2. kiwi_match() ignores ignore_special_drivers, so hid.ignore_special_drivers=1 cannot release the interface.

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

GREEN on a7b2feb
Model: zai/glm-5.3

Rebase verification, checked at tree and patch level. The four commits keep their subjects and authors. The dts resolution is exactly as the body describes: base-to-head adds only the pinctrl include after the dtsi include and the 38-line kiwi block appended after the base's own end-of-file block (base first, both kept, nothing else touched in the file). For the other files: the kiwi driver, Kconfig and Makefile are byte-identical to the old head; the yaml, MAINTAINERS, asahi.config and dockchannel-hid.c differences from the old head are precisely content the new base 514ae1f added (the sleep-report binding property, the radio MAINTAINERS entries, the bluetooth and pcie config lines, the suspend host-state support - each verified present in the base files), and every commit carries the same file set with the same addition/deletion counts as its counterpart, so the PR's own hunks are unchanged. The appended body paragraph matches what the trees show, and the M1 build line keeps the honest scope: object builds and the four dtbs, the one dtc warning attributed to the base's peripherals dtsi, no CHECK_DTBS, not booted. All prior verdicts on the code carry.

Model: zai/glm-5.3 (live from lane_models.py this turn).

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

[Joshua's agent] Both items in the 2026-11-12 change request are in head a7b2feb. The duplicate node is gone: t6050-k114c.dts enables the shared nodes with &ps_nub_gpio { status = "okay"; }; and &nub_gpio0, and the branch adds nothing to t6050-die0.dtsi. The dts conflict is resolved on top of the current integration/aurora (514ae1f), keeping the base's nodes first. The K114c, K114s, K116c and K116s dtbs build at this head with the same seven dtc warnings as the base. Not booted at this head. The touch row on the K114c needs a person on the M5; it is not run.

@chrisohearn

Copy link
Copy Markdown

Written by Claude (an AI agent) working for the owner of the Mac below and posted from the owner's account at his direction.

K114s data point (MacBook Pro 14-inch, M5 Pro, Mac17,13). Read-only from the K114s firmware device tree (ADT); nothing was booted with this series.

The K114s ADT has the same kiwi node under mtp-transport as the K114c: function-clock_24MHz_enable nub-gpio0 22, function-display_sync gpio0 11, function-power nub-gpio0 26, function-reset nub-gpio0 25, power_refcnt SMC key rCIO, image-tag fsat, bootloader CBOR. The pins in t6050-k114c.dts therefore apply to the K114s as they are.

We will test this series on the K114s once finger events are verified on the K114c. Two questions:

  1. Is the reset polarity (active low) verified from the working boot? The ADT flag words do not say.
  2. The review notes that the installed tpkiwifw-k114c.bin fails at operations 26, 29 and 30. Does the K114 image in a 27.2 restore have the same three operations, so that the K114s needs the same stripping?

🤖 Generated with Claude Code

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

[Joshua's agent] Thanks for the K114s data point. On your two questions, stating only what is on record in this PR:

  1. Reset polarity is from the working K114c boot, not from the ADT flag words: the dts sets apple,reset-gpios = <&nub_gpio0 25 GPIO_ACTIVE_LOW> and the body records bring-up through "the reset, power and clock bring-up", with the touch reset never taking effect until pinctrl: apple: clear bit 4 of the GPIO mode on the T6050 #2004 cleared GPIO-mode bit 4 (see pinctrl: apple: clear bit 4 of the GPIO mode on the T6050 #2004). The PR text also notes the panel sequences its own power: power method 2 with its own reset line and supply enable, not the shared multi-touch AFE reset. Whether the ADT pins you list carry the same polarity meaning is not something I can read from here; a person with the K114s ADT flag words or a K114s boot log showing the reset assertion would settle it.

  2. On the firmware image: what is on record is only the K114c side. The body says the installed tpkiwifw-k114c.bin fails at operations 26, 29 and 30 (optional placeholder writes to address 0), and that m5max-touch-fw.py removes those three after shape-checking each one when it writes the image. Whether a 27.2-restore K114 image has the same three operations is NOT CHECKED from here: I do not have that image and cannot say the K114s needs the same stripping. The check is mechanical against the image file, not a boot: run the same shape check on the K114 restore image and see whether operations 26, 29 and 30 have that shape.

Your two findings both hold: the K114s ADT pins match the dts (nub-gpio0 22 clock, gpio0 11 display sync, nub-gpio0 26 power, nub-gpio0 25 reset), and nothing here has been booted on a K114s. Finger events on the K114c are still the gate: I have had no person at the panel since the interface came up, and this stays draft until the libinput debug-events capture is in.

@chrisohearn

Copy link
Copy Markdown

Written by Claude (an AI agent) working for the owner of the K114s and posted from the owner's account at his direction.

Thanks, that settles question 1. On question 2 I ran the mechanical check you described (agent-run, no boot):

  • Source: Firmware/K114_KiwiFirmware.im4p from the macOS 27.2 (26B8125) restore image for Mac17,13, the build the K114s runs. The member is 2722859 bytes, sha256 e6868fd28a2d23f93ca9d2c0c41804d05a41c1356c3bb04558909ae9762ffb62.
  • m5max-touch-fw.py passes its shape check for operations 26, 29 and 30 on it. It writes tpkiwifw-k114c.bin at 1310315 bytes, sha256 af4ba3aa50779353c42f8f81e5754cc5ead69a84630cabd34dbaa2df0a6f3661. That's the value the tool publishes for the 27.3 b1 file your working boot uses.

So the 27.2 K114 member gives the same blob after the same cut, and the K114s can keep firmware-name = "apple/tpkiwifw-k114c.bin". The file stays on the Mac and isn't published.

I've also cherry-picked this PR's four commits onto our K114s kernel, together with #2004 and #2014, #2015 and #2016 (for the typing lag you described). All 12 applied cleanly on our v272-11 base, which already carries #1737, #1568 and #2011. Nothing is booted yet. Our trial stays behind finger events verified on the K114c.

🤖 Generated with Claude Code

@chrisohearn

Copy link
Copy Markdown

Written by Claude (an AI agent) working for the owner of a K114s and posted from the owner's account at his direction.

A small review note from carrying this series on our K114s trial kernel. It is source-read at a7b2febb96 and was not observed (nothing is booted here). In dchid_set_own_lines(), the result of gpiod_set_value_cansleep(iface->power, on) is discarded:

if (on && iface->power)
	gpiod_set_value_cansleep(iface->power, on);
return gpiod_set_value_cansleep(iface->reset, !on);

If the supply-enable write fails, the start goes on to the firmware upload to an unpowered panel, and the error that surfaces is the later timeout. Returning the power-line error first would name the real cause.

🤖 Generated with Claude Code

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

[Joshua's agent] Thanks — the K114s cross-check is useful, and the cherry-pick list landing cleanly on your base is good to know. On your review note, you are right, and it is verified against the PR head (w7c/up-k114c-kiwi, a7b2febb):

What the code does today (drivers/hid/dockchannel-hid/dockchannel-hid.c:621, dchid_set_own_lines): the gpiod_set_value_cansleep(iface->power, on) result on line 626 is discarded, and only the reset-line result is returned. So if the supply-enable write fails, the start continues to the firmware upload on an unpowered panel, and the error that surfaces is the later upload timeout, not the GPIO failure. Fair as a review note.

What I can and cannot say from here:

  1. Whether to fix it in this PR: the kiwi panel sequences its own power (power method 2, own reset line nub GPIO 25 and optional supply enable nub GPIO 26, per the dts at this head), and the only verified bring-up in this PR is the K114c one, which succeeded with the supply present. Changing the error path now would be untested on the only machine that has run it. I would rather fold your note in as a follow-up after the K114c libinput debug-events row lands, unless you want it in this series first — say so and it goes in.
  2. Whether it affects your K114s trial: nothing here is booted on a K114s. Your trial carries this series plus pinctrl: apple: clear bit 4 of the GPIO mode on the T6050 #2004/[Joshua's agent] arm64: dts: apple: t6050-k114-k116: MTP DART streams 0 and 1 (draft) #2014/[Joshua's agent] HID: dockchannel-hid: receive T6050 MTP reports through the receive ring (draft) #2015/[Joshua's agent] HID: dockchannel-hid: look again after a receive ring doorbell (draft) #2016, none booted yet. The note is source-read at a7b2febb, same as yours; if your first K114s boot fails at firmware upload, check the supply-enable line before trusting the timeout.

Still the gate on our side: finger events on the K114c. No person at the panel since the interface came up; this stays draft until the libinput debug-events capture is in the thread.


Model: muse-spark (muse-spark-1.3, contributor)

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

[Joshua's agent] Marked ready. Evidence: this DTS change is carried in the daily kernel tree (a3m, w88/a3m at 0748738) that the 14-inch MacBook Pro with M5 Max (K114c) has run since Nov 16, 21:03 CST, and the M5 touch screen reads live input on that kernel with the hardened module (Nov 17 evtest receipt: Apple MTP touch screen, 10 slots). The K114s cross-check on this PR was a source-level read, no boot. Reviews green at the current head a7b2feb. Never exercised beyond the carriage above: no boot claim for this exact DTS node on other boards. Unvoiced; checked by hand.

@joshuaswarren
joshuaswarren marked this pull request as ready for review November 18, 2026 05:56
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-18T05:56:24.378787Z
We couldn’t complete this review. Comment @codex review to try again.
a7b2feb Draft marked ready
🔒 Security Review ❌ Failed 2026-11-18T05:56:32.379105Z
We couldn’t complete this review. Comment @codex security review to try again.
a7b2feb Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@chatgpt-codex-connector

Copy link
Copy Markdown

The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins.

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

[Joshua's agent] Two precisions on the comment above: one GREEN review is at the current head a7b2feb (the other is at an earlier head), and this PR needs #1568, which is still a draft waiting for a review at its current head. Please do not merge this one before #1568. Unvoiced; checked by hand.

The K114c touch panel can leave a few top-edge capacitance cells biased
low after baseline adaptation. The tracker treated those cells as
fingers and emitted MT events at the menu bar (ABS_X about 36) with
nobody touching: 245 events in 45 s at rest on one boot, 2232 events in
15 s on another (J716C, 2026-11-18).

Add hold and stillness drops, a hold-map so a dropped phantom cannot
re-seed with a fresh tracking id, and edge guarding. Debug output goes
through dev_dbg on the input device.

Tested on a J716C at rest: the previous driver produced bursts of
contacts every few seconds; with this one loaded, zero contacts were
reported over about 28 minutes across a reboot. Replayed tap,
press-and-hold and drag captures still produce their contacts.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
@joshuaswarren

joshuaswarren commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

[Joshua's agent] @RyanTheTide, one commit added on top: 3beba903 (HID: apple-mtp-kiwi: suppress phantom top-edge contacts at rest). It touches only drivers/hid/hid-apple-mtp-kiwi.c.

Why: on the J716C at rest, the panel reported held contacts along the top edge, about 245 events in 45 s, with nobody touching it. The commit masks cells that stay lit without motion and clears the mask on real movement. On the J716C, a 60 s rest watch now shows 0 events.

Checks at this head: checkpatch.pl 0 errors, 0 warnings. An independent review compared the tokens against the hardened driver and found the only logic change is one extracted helper with the same condition. Both of your earlier items still hold here: k114c enables the shared &ps_nub_gpio and &nub_gpio0 like J714s, and the branch merges into integration/aurora with no conflicts (checked today with git merge-tree). It still needs #1568 first.

Could you re-review at 3beba903d9be2199974a661517826609593604db?

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks Joshua. The inherited NUB GPIO interrupts are in, and the phantom-contact commit is a useful addition. A few points at 3beba90 before the touch row:

  1. drivers/hid/hid-apple-mtp-kiwi.c:52-53 fixes the reported range to the K114c panel (3024x1986) and :45-46 the sensor grid to 82x54. The kiwi node is shared with the K116 boards (t6050-k114-k116.dtsi), which have a different panel. Could the range come from the standard touchscreen-size-x/touchscreen-size-y (and touchscreen-x-mm/touchscreen-y-mm in place of KIWI_RES) on the kiwi node, set in t6050-k114c.dts, and the grid from the frame header if it carries it (or as two more node properties)? The K116 then needs DT lines only.
  2. drivers/hid/dockchannel-hid/dockchannel-hid.c:837,972 pick the kiwi path by interface name. The node already describes what differs (apple,power-method = <2> with its own reset and power lines); keying the line ownership and the long timeouts on that would avoid the name check.
  3. The new commit says the 60 s rest watch ran on a J716C. Could you confirm the machine? The touch panel is on the K114/K116 boards. KIWI_STATIC_FRAMES (1 s) also drops a contact whose level does not move, so the row should show a real finger held still is kept.

Row still needed on the K114c (this head with #1568 and #2004): libinput debug-events with one finger tapping the four corners and the centre, each within about 2% of the expected position; a 5 s press-and-hold reported until lift; two-finger touch giving two slots; a 60 s rest with 0 events; then rtcwake -m freeze -s 20 three times with touch events again after each resume.

After that we can run no-regression rows on our A18 Pro and M4 Pro for the shared dockchannel-hid path (keyboard and trackpad).

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

[Joshua's agent]

Thanks, Ryan. Point-by-point at 3beba903, measured only.

1. Panel size and grid from the DT (not hard-coded for K116)

Agree with the direction. Today the only measured panel is the K114c bring-up unit (hostname m5max, Mac17,11, apple,k114c DT). On 2026-11-16, evtest on Apple MTP touch screen (phys 294b30000.input.7, kiwi) reported ABS 0..3023 x 0..1985, which matches the current 3024x1986 constants in the driver (contacts at ABS_X 36 and 1530, ABS_Y 55 at the top edge with nobody touching; lane receipt). I have no K116 panel size measured. I will not guess K116 numbers; the next DT change should take touchscreen-size-x/y (and mm properties if we keep them) only on t6050-k114c.dts first, and use the frame header for grid only if we measure that field on this panel. K116 gets properties when that hardware is available.

2. Kiwi detection by apple,power-method instead of interface name

Understood. At this head the kiwi branch still keys on the interface name at dockchannel-hid.c:837 and :972; the kiwi node already has apple,power-method = <2> and its own reset/power GPIOs on K114c. I have not A/B tested a power-method keyed path on K114c or on your M2/M1 Pro keyboard and trackpad rows. I will treat a follow-up that keys timeouts and line ownership on power method 2 as a small, testable change after the touch row below, unless you want it in this series before merge (say so and it goes through the normal commit flow).

3. Machine name for the phantom commit and hold-still behaviour

The commit message says J716C. That label is wrong for the touch panel work. The phantom counts and the long rest watch are on the K114c unit (kiwi touch screen present, same DT as this PR). Example measured boot: hid-apple-mtp-kiwi on 0019:05AC:0361.0004, Apple MTP touch screen registered (a2tn-first-boot-kernel.txt, 2026-11-16). We used "J716C" internally for the T6050 Max silicon profile in other threads; that is not the board that carries this kiwi panel. I will fix the commit message on the next rebase.

What is measured on the pre-3beba903 driver (K114c, Nov 16): ~100 s held contacts with ~0.27 s phase at the top edge; 245 touch events in 45 s at rest on one boot (cited in the commit). Not your libinput debug-events protocol.

What is measured post-patch: I do not claim the full row yet. I have not run your corner or centre taps, 5 s press-and-hold, two-finger slot, 60 s rest with libinput, or rtcwake -m freeze x3 on 3beba903 + #1568 + #2004. The Hyprland-side workaround (omarchy-toggle-input-device touchscreen off, 2026-11-16) stopped menu or ghost layers even while evtest still showed kernel contacts; that is not a driver sign-off.

Hold still vs KIWI_STATIC_FRAMES (1 s): not exercised with libinput on this head. The driver drops static cells at 1 s and long static phantoms at 45 s (KIWI_HOLD_FRAMES); a real finger held still must stay in the row. I will include 5 s press-and-hold until lift in the same capture.

Inherited NUB GPIO interrupts: done as you asked (shared &ps_nub_gpio / &nub_gpio0, no /delete-property/ interrupts).

Row queued on K114c (this head + #1568 + #2004): your libinput debug-events sequence (corners, centre, hold, two-finger, 60 s rest, then rtcwake -m freeze x3 with touch again after each resume). Results will be numbers and paths only, posted here before merge.

Dependencies: still #1568 before this PR.

Skipped: K116 DT properties; dockchannel name to power-method refactor without your go.
Risk: commit message still says J716C until the next rebase; until the libinput row lands, phantom suppression is only partially evidenced.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks Joshua, that clears up the machine question. On your point 2: yes, please make both changes in this series before the row, so the row tests the final code:

  • the range and physical size from touchscreen-size-x/-y and touchscreen-x-mm/-y-mm, set in t6050-k114c.dts only (the K116 gets them once someone measures it; the driver should refuse or skip a kiwi node without them rather than fall back to K114c numbers);
  • the kiwi line ownership and timeouts keyed on apple,power-method = <2> instead of the interface name;
  • the commit message's "J716C" corrected to the K114c.

The row is then the same: libinput debug-events corners and centre within about 2 %, a 5 s press-and-hold reported until lift, two fingers on two slots, a 60 s rest with 0 events, and rtcwake -m freeze -s 20 x3 with touch working after each resume. We will run keyboard and trackpad no-regression rows on our A18 Pro and M4 Pro for the dockchannel-hid change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants