Repository navigation
iio: aop_als: run ambient light reports on demand with idle stop - #3473
Conversation
The AOP ambient light sensor driver enables 5 Hz (200 ms) fake-HID reports at probe and keeps them streaming continuously until system sleep or unbind, generating 5 AOP mailbox interrupts per second on an idle desktop even when nothing reads in_illuminance_input or in_colortemp_input. Follow the on-demand idle-stop pattern used by aop_motion, aop_temp, and aop_las: - Load apple/aop-als-cal.bin once at probe into memory for VD6286 and CT720 so on-demand wakes and resume never re-request firmware from the filesystem. Send calibration once per AOP boot (and conservatively again after firmware suspend, hibernation, or restore). - Verify calibration, arming (including the full 0 -> verbosity -> batch_interval -> raw_interval -> interval sequence on CT817), and stopping once at probe, then leave reports stopped at idle. - Start reports on demand on read_raw, invalidate stale cached samples before starting from Stopped or Unknown, track in-flight direct_readers, hold reports warm for 5 s via DelayedWork, back off for 5 s after a failed start, and retry idle stops if an unacknowledged write leaves RunState::Unknown. - Stop active streams on PM_SUSPEND_PREPARE / PM_HIBERNATION_PREPARE / PM_RESTORE_PREPARE without waking an idle stopped sensor on resume. - Free the IIO device via devres and tear down IIO, PM, delayed work (disable_delayed_work_sync), reports, and fake-HID listener in both unbind and Drop. - Add a host regression test (aop-als.py) covering the on-demand stream state machine and register it in run-host-tests.py. Signed-off-by: AxxzyWasTaken <[email protected]>
There was a problem hiding this comment.
Verdict: FINISH, then merge at b11717dd
Blockers:
- CI has not finished yet (
apple-build,host-tests, KUnit suites,pr-text,readinessare queued; CI must be green atb11717dd). - Confirm that the J616C
7.3.0-j616c-parity5+integrated boot row carriesb11717ddbyte-identically (or run an exact-head boot), and add a regression row covering at least one other sensor variant (CT720 or CT817) sinceaop_als.rschanges the probe/sleep/on-demand lifecycle for all three ALS variants.
Checked: no Apple material, no AI attribution, no new chip/board/firmware gates, no cmdline hacks, human Signed-off-by, Stream state machine (Stopped/Running/Unknown, DirectReadGuard, idle-stop retry, backoff), stop_idle_sync Arc accounting (matches aop_motion.rs), probe-failure and unbind teardown order, probe-time aop-als-cal.bin RAM caching (no filesystem access on wake/resume), and PM_SUSPEND_PREPARE/PM_POST_SUSPEND/PM_POST_HIBERNATION transitions.
Evidence
- Inspected
drivers/iio/common/aop_sensors/aop_als.rsagainstmainand comparedstop_idle_syncwithaop_motion.rs:395. - Verified probe error paths: if
control.probe_init()fails,pm.unregister(),control.shutdown(), andlistenerdrop cleanly; ifdrv.iio.register()fails,IIOAopAlsDriver::drop()runsteardown()in reverse order (IIO -> PM ->control.shutdown()-> fake-HID listener). - Verified
PM_SUSPEND_PREPAREsetsparked = true, clearsdirect_until, stops reports understream.lock(), and callsstop_idle_sync(false); any concurrentread_now()waiting onFIRST_SAMPLE_MSobservesparkedand returnsEBUSYcleanly. - Verified
read_now()warm-read fast path (already_seen && sample.seen_report) avoids 1 s stalls when a channel is validly absent on a live report (e.g. dark CCT). - J616C integrated boot row (
7.3.0-j616c-parity5+) reports AOP mailbox IRQs reduced5.75/s -> 1.00/s, cold read214 ms, clean idle-stop back to1.00/s.
|
Confirmed against the booted |
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
J700 MacBook Neo, CT817, at the exact #3473 ALS source blob
The panel was under night conditions; these checks cover sensor availability, sample latency and report stopping. The saved boot, next-entry state, Enforcing, zero failed units and installed ALS module were verified before and after. The unsigned trial modules leave the usual runtime taint until the next saved reboot. This was a live module row; the combined boot/regression and deep-wake rows are still pending. code-owner ping @aurora-silicon/core @aurora-silicon/omarchy-mac @aurora-silicon/aurora-maintainers Please review this CT817 evidence alongside the author's J616C VD6286 evidence and assess the remaining merge coverage. |
There was a problem hiding this comment.
The source review and alternate ALS variant request are satisfied at this head. The J616C integrated VD6286 row uses byte-identical driver source. The J700 CT817 live-module row uses the exact ALS blob and shows 30 receive IRQs per six seconds at stock idle falling to zero, a 0.23 s cold read, and a return to zero after stopping. Both rows exercise on-demand reporting. Keep hosted CI and the combined integrated boot and deep-wake regression as landing gates.
|
Additional J700 CT817 wake row on saved fleet89, same exact ALS source blob Also checked composition with #3409. The distinct driver blobs compile and run together, but the source PR heads conflict in the host-test runner list and selftest Makefile. Whichever lands second should forward-merge and keep all of the ALS, LAS, motion and temperature entries. No driver source resolution is needed between those two heads. |
|
Independent J316s M1 Pro peer row on saved fleet89. Loaded the exact #3473 ALS blob Input and ALSA devices registered, the headless connector baseline was unchanged, Wi-Fi gateway was 3/3, and hardware EGL passed 32/32 on Apple M1 Pro G13S. Saved GRUB boot and stock modules restored in the same boot, Enforcing, 0 failed units. This is a live module regression on a third SoC family alongside the existing J616C integrated and J700 CT817 rows. |
|
Integrated J316s regression, in one guarded Nightly kernel boot based on J316s returned lux, lid angle 107 and board temperature 19.312 °C. SPI keyboard and trackpad and ALSA endpoints registered. DRM stayed in the usual headless state. Gateway ping passed 3/3, hardware EGL passed 32/32, SELinux was Enforcing, and there were zero failed units, kernel errors or AVCs. Restored and byte-compared the saved fleet89 receipt, including the default entry, command line and boot-stage hash. Removed the trial entry, modules and dead-man. |
|
Merged under the six-point rule at |
Main replaced the IIORegistration-based ALS device with its own on-demand AlsIioDev (aurora-silicon#3473), so register the CT720 channels there: AlsIioDev::new() takes a ChannelSpec per channel (type, modifier, info mask), the four colour counts answer IIO_CHAN_INFO_RAW as whole counts, lux and colour temperature stay processed, and a CT720 report that carries lux but not a colour channel withdraws that channel, as channel_withdrawn() says. MAX_CHANNELS grows to the six CT720 channels; VD6286, CT817 and the other parts keep the channels they had. Signed-off-by: DjDeveloperr <[email protected]>
What: Switch
aop_als(drivers/iio/common/aop_sensors/aop_als.rs) from continuous 5 Hz fake-HID streaming at probe to on-demand start onread_rawwith a 5 sDelayedWorkidle-stop window (matchingaop_motion,aop_temp, andaop_las), cachingapple/aop-als-cal.binin RAM at probe, preservingRunState::Unknownacross firmware sleep, keeping probe stop failures recoverable, and addingaop-als.pyhost regression tests.Tested:
rustfmt --checkclean; host testsrun-host-tests.py --only aop-als:3/3PASS (aop-als-channel-tests,aop-als-calibration-tests,apple/aop-als); ARM64 cross-compile (ARCH=arm64 LLVM=1):0warnings;scripts/checkpatch.pl --strict:0errors,0warnings.RedbirdALS) integrated boot (7.3.0-j616c-parity5+carrying this commit,aurora-kbd-light.servicepaused for idle measurement):510608000.mailbox-recv):5.75/s -> 1.00/s(5IRQs in 5 s, eliminating the 5 Hz ALS stream at idle).lux=1.776817,cct=2898.17 Kin214 ms; warm 4 s window5.75/s(23IRQs); cleanly re-stopped to1.00/s(5IRQs in 5 s) after the 5 s idle timeout.Risk: two-way · AOP ambient light sensor driver (
aop_als.rs) covering VD6286, CT720, and CT817.Not yet: Standalone exact-head bare-metal boot row on
b11717dde674and CT720 / CT817 hardware rows.