Skip to content

soc: apple: sep: Capture on the sensor's data-ready interrupt only (with the J313 data-ready line) - #1596

Merged
RyanTheTide merged 3 commits into
mainfrom
m5-parity/sep-capture-irq-only
Dec 1, 2026
Merged

RyanTheTide merged 3 commits into
mainfrom
m5-parity/sep-capture-irq-only

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Validation pending (M5 lab boot queued). J313 testers are welcome now; the recipe is below.

Touch ID capture now waits on the sensor's data-ready interrupt only. The SPI polling fallback is gone, and there's no parameter to bring it back.

Until now the driver used the interrupt where the board described one and otherwise polled status every 2 ms (20 ms while waiting for a lift). That poll hid a broken description on the M5 Pro (J714s). Pin 138 was reserved in the DT, so gpiolib refused the mapping (didn't like hwirq-0x8a ... (rc=-6)), spi->irq ended up 0, and capture quietly polled. #1587 exposes that pin.

What changes

  • Bring-up. Sensor bring-up now fails, with "the device tree must describe the sensor's data-ready line", instead of falling back to polling.
  • Capture and finger-lift waits. They block only on the interrupt. Status is still read after each wake to gate every frame, and each wait is bounded (250 ms in capture, 20 ms for the lift), so a missed edge costs one wait.
  • J613. The data-ready line is now described, from satchlj's J613 ADT (J613AP, 25G83: spi2/mesa interrupts = [0xc7, 0x3] on /arm-io/gpio0), as AP GPIO 199 rising, in t8122-j613.dts only. The power line (NUB GPIO 29) already matched. Untested on a J613 so far: J613 Touch ID works today on the poll path with arm64: dts: apple: t8122: SPI2 and SPI4 run from the 24 MHz reference, not 200 MHz #1598, and this PR moves it to the interrupt.
  • J313. The data-ready line is now described, from its ADT (27.0.1, spi2/mesa interrupts = [104, 3] on the AP GPIO bank). Type 3 is the type every mesa node carries; the tree already describes J616c's and J713's as IRQ_TYPE_EDGE_RISING.

Boards whose data-ready pin is still pending

These have a mesa node but no interrupt in their DT, and no ADT is available yet. Touch ID won't come up on them with this change until their pin is described:

  • J293 (MacBook Pro 13", M1)
  • J493 (MacBook Pro 13", M2)
  • J615 (MacBook Air 15", M3). It shares the J613 file, but its own pin isn't confirmed, so the J613 pin is deliberately not applied to it.

There is no polling fallback for these boards: the owner's call is that polling isn't an option in the driver. Each one needs its ADT's spi*/mesa interrupts and interrupt-parent; with those it's a two-line DT change.

Every other board with a mesa node describes its line: T600x, T602x, J413, J415, T604x, T6041, J700, T8132, J313, J613 and, with #1587, the J714s.

Testing on a J313 (MacBook Air M1) or J613 (MacBook Air 13", M3)

Use a kernel with both commits of this PR. Load apple_sep the way your install already does, with Touch ID set up as before.

  1. Open the reader once (fprintd-list $USER), then check the kernel log: dmesg | grep -E 'apple_sep|apple-mesa' | grep -i -E 'interrupt|sensor'. Expect "sensor: data-ready interrupt configured" and no "no data-ready interrupt".
  2. Read the line's count: grep apple-mesa-drdy /proc/interrupts (sum the CPU columns). The line should exist.
  3. Enrol: run fprintd-enroll -f right-middle-finger $USER, or any finger not yet enrolled, and touch until enroll-completed. Read the count again: it should rise by several per touch.
  4. Match: run fprintd-verify $USER and touch an enrolled finger. Expect verify-match; the count rises again.
  5. Reject: run fprintd-verify $USER and touch a finger that isn't enrolled. Expect verify-no-match.
  6. Please post the step 1 log lines, the counts before and after steps 3 to 5, and the three results here.

If step 1 says "no data-ready interrupt", the line isn't mapping. Post dmesg | grep -i 'hwirq\|pinctrl' so it can be traced; with this change the sensor won't capture without it.

Validation

  • M5 (J714s), partial (no fingers; lab boot i3, 11-11 18:45, intg2 kernel with this module and arm64: dts: apple: t6050-j714s: Add the Touch ID sensor (and read its factory seal) #1587's DT):
    • The sensor's data-ready line maps: apple-mesa spi0.0: sep sensor: data-ready IRQ 185 configured for interrupt capture, and /proc/interrupts shows 185: ... Apple-GPIO 138 Edge apple-mesa-drdy. The earlier didn't like hwirq-0x8a refusal is gone.
    • Bring-up completes: diag sensor online, touchid ready. The two fingers enrolled before were restored.
    • The module has no polling path: no "falls back to SPI polling" string and no poll interval. Each capture blocks on the interrupt; the count rose by 12 per capture window (sensor registration at each window's start).
    • Enrol, match and reject with a finger were not run: no finger was available, by the owner's choice. That check moves to the J313 testers and to a later owner-attended run on the M5.
  • J313: offered by two testers; see the recipe above.
  • J613: IRQ path verified at probe; matching pending. satchlj ran one J613 boot with this PR at 85a964e, plus arm64: dts: apple: t8122: SPI2 and SPI4 run from the 24 MHz reference, not 200 MHz #1598 and a matching boot-loader DT. The data-ready interrupt is requested, and the sensor comes up without the polling fallback. The IRQ count went 3 → 13 over the probe transfers, with no storm. Enrol, match and reject on the interrupt path are still to run (no finger yet); the attended rows are planned for Thursday morning ET.
  • Done so far: tools/aurora-sep/tests/test_log_ratelimit.py reports no new failures; its two existing ones are soc: apple: sep: bring the Touch ID sensor up afresh for each prompt #1536's lines, fixed by soc: apple: sep: rate-limit the two verify messages from the fresh bring-up #1590. The J313 DTB compiles, and the interrupt sits on the same controller as the sensor's power line.

Not yet

  • Run enrolment, matching and suspend/resume on the targeted Touch ID boards. Confirm the data-ready interrupt on J313 and a compatible second board.

Touch ID capture waited on the data-ready interrupt where the board
described one, and otherwise polled the sensor's status over SPI every
2 ms (20 ms while waiting for a lift). The poll hid broken interrupt
descriptions: on the J714s the line was reserved in the device tree,
gpiolib refused the mapping, and capture silently polled.

Make the interrupt a requirement. Sensor bring-up fails with an error
naming the missing data-ready line instead of falling back, and the
capture and finger-lift waits block only on the interrupt. Status is
still read after each wake to gate every frame, and each wait is
bounded so a missed edge costs one wait.

Signed-off-by: Diljit Singh <hey@djdev.me>
The J313 ADT (27.0.1) gives spi2/mesa interrupts [104, 3] on the AP
GPIO bank, the same bank as its power line (pin 108). Describe it so
the sensor's capture can wait on it.

ADT GPIO interrupt type 3 is the type every mesa node carries (J714s
138, J616c 116, J713 199), and the tree describes the J616c and J713
lines as IRQ_TYPE_EDGE_RISING; on the same J313 ADT, type 1 lines
(speaker 182, jack codec 183, PD controllers 106) are described as
IRQ_TYPE_LEVEL_LOW. The driver requests the line rising-edge.

Signed-off-by: Diljit Singh <hey@djdev.me>
@RyanTheTide

Copy link
Copy Markdown
Contributor

Tested on J700 (T8140): one-shot kernel = integration 1de767b + this PR.

  • DT has fingerprint@0 interrupts = <135 1>; driver logs data-ready interrupt configured; IRQ 169 (Apple-GPIO 135, edge) fires on each touch.
  • No poll-path messages, no data-ready timeouts, no refused hwirq. SELinux enforcing, 0 AVC.
  • Enrolled finger: verify-match (IRQ count 68 -> 84 over the touch). Different finger: verify-no-match (48 -> 67).

M2, M1 Pro and J616s results to follow.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Tested @ b40c9d8 on J616s, M2 and M1 Pro. Nobody touched the sensor on these three.

Test kernel: integration/aurora 990e00b with this PR's two commits cherry-picked. They don't apply to 1de767b, which lacks #1340 and #1536 in sbio.rs; 990e00b's sbio.rs, sep.rs and sensor_shim.c match this PR's base. Baseline: each Mac's production kernel (integration c6c15ac), same rows.

  • J616s (T6040): DT has interrupts = <116 1>. The driver logs "sensor: data-ready interrupt configured", and apple-mesa-drdy sits on Apple-GPIO 116, edge.
  • M2 (J413, T8112) and M1 Pro (J316s, T6000): the DT describes the line (<177 1> and <195 1>) and the GPIO controller maps it as an edge interrupt with no hwirq refusal. These two finish sensor bring-up, and request the interrupt, only at the first verify after a password, so the interrupt request and IRQ-only capture are still untested on them.
  • All three on the test kernel: no polling messages, no "no data-ready interrupt", fprintd-list works, SEP no-finger self-tests 15/15, aurora-sep matches the baseline, s2idle 3/3 with fprintd-list after each resume and the self-tests 15/15 again, 0 SEP errors, 0 AVC, 0 failed units.

Two corrections to the J700 comment above. The J700 kernel was also 990e00b + this PR, not 1de767b. The "different finger" no-match came from fprintd: the enclave matched an enrolled finger, and fprintd rejected it because a different finger was requested. A non-enrolled finger hasn't been tried yet. The interrupt count rose on every touch (0 to 85 over five).

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Held on purpose (draft): the IRQ-only Touch ID capture driver is waiting for J313 testers to confirm the data-ready line on hardware.

The J613 ADT (J613AP, 25G83, shared by satchlj) gives spi2/mesa
interrupts [0xc7, 0x3] with interrupt-parent /arm-io/gpio0, the AP GPIO
bank. Describe it on the J613 so the sensor's capture can wait on it.
Its power line, NUB GPIO 29, already matches the shared J613/J615 file;
the J615's data-ready pin is not confirmed, so it stays out of there.

Type 3 is the type every mesa node carries, and the tree describes the
J616c, J713 and J313 lines as IRQ_TYPE_EDGE_RISING. Not yet tested on
a J613.

Signed-off-by: Diljit Singh <hey@djdev.me>
@RyanTheTide

Copy link
Copy Markdown
Contributor

integration/aurora 110861f still has the SPI polling fallback (sbio.rs logs "capture falls back to SPI polling" when no data-ready line is described), so this change is still needed, and the three commits apply cleanly to 110861f. Since this was opened, #2678 describes the J613/J615 data-ready line (AP GPIO 199, rising) in the shared t8122-j613-j615.dtsi with a J615 run behind it; if that lands first, the J613 hunk here can be dropped. What is still open is the J313 hardware row the draft is waiting for, and the data-ready pins for J293 and J493, which lose Touch ID with this change until their lines are described.

Build check of 110861f plus this change (arm64, LLVM=1, Image, dtbs and every directory it touches, Fedora config plus asahi.config): builds, no warnings in the files it touches; CHECK_DTBS over every Apple DTB: no new warnings against the tip.

@DjDeveloperr
DjDeveloperr marked this pull request as ready for review November 30, 2026 20:45
@DjDeveloperr
DjDeveloperr requested review from a team as code owners November 30, 2026 20:45
@github-actions github-actions Bot added area:platform Area from CODEOWNERS (bot) ci-failing A check failed at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 30, 2026
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Merge readiness at 85a964ef: not ready yet

Check Detail
CI at head ok 11 checks passed
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok in the PR body at 85a964ef
Conflicts ok none
PR text adopt when you next edit add a 'Tested:' line; a 'Risk:' line (door and Macs) (guide)

Areas: area:platform

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@github-actions github-actions Bot removed the ci-failing A check failed at the PR head (bot) label Nov 30, 2026

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: HOLD at 85a964ef

Blockers:

  1. Missing exact-head hardware verification across the affected Touch ID boards. Removing the SPI polling fallback turns a missing or unmapped data-ready IRQ into a hard sensor bring-up failure. No hardware boot/capture rows have been posted at 85a964ef on M5 (J714s with #1587), J313 (t8103-j313.dts AP GPIO 104), or J613 (t8122-j613.dts AP GPIO 199) confirming Touch ID bring-up, interrupt-driven capture, and finger-lift wait.

Checked:

  • Full 5-file diff (t8103-j313.dts, t8122-j613.dts, drivers/soc/apple/sbio.rs, sensor_shim.c, sep.rs, +42/-48), MERGEABLE against main.
  • CI runs at 85a964ef: SEP source checks, Host tests, Device tree checks, pr-text, and pr-readiness passed.
Evidence
  • sbio.rs removes the polling branch from finger-lift and capture waits and requires sensor::irq_available() during bring-up; t8103-j313.dts adds interrupts = <104 IRQ_TYPE_EDGE_RISING> and t8122-j613.dts adds interrupts = <199 IRQ_TYPE_EDGE_RISING>.
  • PR body still marks validation pending (Validation pending (M5 lab boot queued)), and pr-readiness shows hwok=.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: MERGE at 85a964ef5587

Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.

Checked: - Full 5-file diff (t8103-j313.dts, t8122-j613.dts, drivers/soc/apple/sbio.rs, sensor_shim.c, sep.rs, +42/-48), MERGEABLE against main.

  • CI runs at 85a964ef: SEP source checks, Host tests, Device tree checks, pr-text, and pr-readiness passed.

Follow-ups (not blocking): exact-head Touch ID rows on J714s, J313, J613

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merging at 85a964ef5587 (B2 merge train, 12-01 merge bar). Approval at this head: aurora-silicon-review[bot]. Row: the hardware row at 85a964e that the readiness check found (PR body or comment). CI: linux train L3 = main 429e7e1 + 28 approved PRs (candidate 45c2fa4b): Apple driver compile pass, Apple DTBs W=1 pass, planned KUnit dcp-fabric/dcp-topology/dcp-display/macsmc/spi-hid-apple/mt7932/asahi/sep pass; ave failed to build only because of #3153 (unused static helper under -Werror; #3153 held out) and passes with #3153 reverted from the candidate; host tests apple-dcp and apple-scaler-recovery pass. The rest of the hosted run is queued behind the backlog. Revert: git revert -m 1 <merge commit>.

@RyanTheTide
RyanTheTide merged commit be7c337 into main Dec 1, 2026
15 of 16 checks passed
@RyanTheTide
RyanTheTide deleted the m5-parity/sep-capture-irq-only branch December 1, 2026 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:platform Area from CODEOWNERS (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants