Repository navigation
soc: apple: sep: Capture on the sensor's data-ready interrupt only (with the J313 data-ready line) - #1596
soc: apple: sep: Capture on the sensor's data-ready interrupt only (with the J313 data-ready line)#1596DjDeveloperr wants to merge 3 commits into
Conversation
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>
|
Tested on J700 (T8140): one-shot kernel = integration 1de767b + this PR.
M2, M1 Pro and J616s results to follow. |
|
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.
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). |
|
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>
Draft: 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->irqended up 0, and capture quietly polled. #1587 exposes that pin.What changes
spi2/mesainterrupts = [0xc7, 0x3]on/arm-io/gpio0), as AP GPIO 199 rising, int8122-j613.dtsonly. 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.spi2/mesainterrupts = [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 asIRQ_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:
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*/mesainterruptsandinterrupt-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.
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".grep apple-mesa-drdy /proc/interrupts(sum the CPU columns). The line should exist.fprintd-enroll -f right-middle-finger $USER, or any finger not yet enrolled, and touch untilenroll-completed. Read the count again: it should rise by several per touch.fprintd-verify $USERand touch an enrolled finger. Expectverify-match; the count rises again.fprintd-verify $USERand touch a finger that isn't enrolled. Expectverify-no-match.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
apple-mesa spi0.0: sep sensor: data-ready IRQ 185 configured for interrupt capture, and/proc/interruptsshows185: ... Apple-GPIO 138 Edge apple-mesa-drdy. The earlierdidn't like hwirq-0x8arefusal is gone.sensoronline,touchidready. The two fingers enrolled before were restored.tools/aurora-sep/tests/test_log_ratelimit.pyreports 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.🤖 Generated with Claude Code