Repository navigation
iio: aop_als: stop the reports at unbind, arm the CT817 from zero - #3393
Conversation
The light sensor reports on its own every 200 ms, and every report is an AOP mailbox interrupt. unbind() only dropped the listener, so the sensor went on reporting to nobody: on the J700 (T8140, CT817) the AOP mailbox kept taking 5 interrupts a second after the driver was unbound, the same rate as with the driver bound. Write the interval to zero at unbind, before the listener goes, as the motion driver already stops its sensor at unbind. A failure is logged and unbind goes on; the AOP transport refuses calls once it is closing. The CT817 arms only on a zero to non-zero transition of its interval. Probe assumed the interval was zero, which holds at a cold boot but not after a previous instance of the driver (or a kexec) left the sensor running. Make the zero write the first step of arm_ct817(), so probe and the wake path share one sequence; the wake path already wrote zero first, so its behaviour does not change. This takes over the unbind part of #2713 by Kyle Arrington, who handed the branch over. Its suspend and resume part is left out: #2528 now arms the CT817 again after a sleep, and whether reports still wake the CPU in suspend-to-idle needs its own measurement. Link: #2713 Signed-off-by: Ryan Murray <[email protected]>
There was a problem hiding this comment.
Code approved. The patch unregisters the CT817 PM callback before the stop write and keeps the listener in place until after that write. CT817 probe and resume share the same zero-to-active sequencing. The author handoff on #2713 scopes this to unbind. Reported J700 and J413 runs cover stop, rebind and restore. Keep hosted CI and a CT720 check for the shared stop path before merge.
|
Build check at |
|
On the CT720 check for the shared stop path:
@DjDeveloperr, if any Mac you can reach has a FireFish2/CT720 (a light channel but no colortemp channel), a one-line unbind/bind check would close this out. Otherwise we'll go with the VD6286 row as stated. |
|
Merged as |
What:
iio_aop_alsnow writes the report interval to zero at unbind, so the light sensor stops sending AOP mailbox interrupts to a driver that is gone. On the CT817 (T8140) the arming sequence now always starts from interval zero, so a probe still arms the sensor if a previous driver instance or a kexec left it running. This takes over the unbind part of #2713, which its author handed over.Tested: at
7f1220a1(aop_als.rsblob401f4f2b), built as a module against the fleet89 tree (645f7cd3, same config and toolchain, identical symbol table) and loaded on the running fleet89 kernel. No reboot.Risk: two-way · Macs with an AOP light sensor (T8140 CT817, VD6286/CT720 parts). Non-CT817 parts change only at unbind.
Not yet: both lab rooms were dark at night, so lux read 0.000 throughout and these rows don't show readings following light changes. The new CT817 sequence (zero, then verbosity/batch/raw, then interval) is byte-for-byte the wake sequence that #2528 already verified with lux following light. No row yet on a cold boot of a kernel built from this head, or on a CT720 Mac.
Details
aop_motion, which already shuts its sensor down at unbind. A failed write is logged and unbind continues; the AOP transport refuses calls withENODEVonce it is closing, and EPIC calls are bounded by its timeouts.arm_ct817()now writes interval 0 first. Before this change only the wake path did; now probe and wake share one sequence, and the wake path's behaviour is unchanged.Evidence
310608000.mailbox-recv, J41324a408000.mbox-recv). On J413 that mailbox also carries the other AOP sensors.645f7cd3589d(tree0394077990b0), kit config byte-identical after olddefconfig, clang/LLD 22.1.6, rustc 1.97.1, bindgen 0.73.2. The kernel symbol set matches the shippedSystem.mapexcept two linker erratum veneers. The test module's undefined symbols are the stock module's plusregister_pm_notifier/unregister_pm_notifierand two atomic helpers, all exported by fleet89. The test.kowas unsigned (taint E until next boot on both Macs).rustfmt --checkclean;checkpatch.pl0 errors / 0 warnings.J700 row:
J413 row:
No new kernel warnings in either run (apart from the unsigned-module taint line).
Revert:
git revertof the merge commit; the driver goes back to leaving the sensor running at unbind.