Repository navigation
iio: aop_sensors: publish the CT720 color channels - #2155
Conversation
The CT720 (FireFish2) report already carries four channel counts and a correlated color temperature beside the lux float at +0x1d. The driver registered one channel for that part, so those fields never reached sysfs. Publish red, green, blue, and clear counts plus color temperature on aop-sensors-als when the part is the CT720. Color is accepted only when both integration-time copies match, are non-zero, and are at most 10000000. A report that fails that gate still publishes lux, and the color channels then read ENODATA rather than a stale sample. VD6286, CT817, and the lid-angle sensor keep the channels they had. Covered J313 readings still had the firmware CCT byte set at clear counts of 11 and below, and the published temperatures were 788 K, 1288 K, 2904 K and 6781 K. Publish the temperature only when clear is at least 12. Red, green, blue, and clear stay published. Checked against three captured J313 reports with an offline mirror of the integer conversion. Not run on hardware. Based on a patch by Lucas Goossen (omacom/linux-aurora#220), commits b5677f7 and 88c4f98 there, rewritten for this tree. [7.3 base: rewritten on this tree's N-channel helper, which already publishes the VD6286's color temperature, in place of the seqlock slot table the original added. The helper gains a per-channel spec (modifier and info mask) for the four intensity channels, and a channel_withdrawn() hook so a report can take a channel's last reading back; the decode, the gates and the offsets are the original's. Each channel is published on its own, so a reader can see counts from two adjacent reports. aop-als-channel-tests.py covers the CT720 layout, the gates and six mutants. Built; not run on hardware.] Signed-off-by: Scott Jones <scottajones@gmail.com>
|
Blockers: 2.
The plumbing is sound. HW row: a CT720 Mac (J313) on this commit: Assisted-by: LLM (Claude:Opus 5.5) |
|
Merge-train adversarial review (MERGETRAIN-LINUX2) at fdb999e: BLOCKERS. Not merging until the blockers below are fixed or answered; the details give file:line and a failure case. Full review#2155 iio: aop_sensors: publish the CT720 color channels @fdb999e5VERDICT: BLOCKERS Blockers:
Nits:
Missing rows:
|
|
Clarification to my merge-train review above: the commit-trailer point is a nit, not a blocker (already-pushed history stays as it is, no force push). The other blockers listed there still stand. |
There was a problem hiding this comment.
Formal §1–§6 pre-PR review at verified live head fdb999e5a5043108abf4a6fc2dba51f7b7e082e5 (base integration/aurora 70a00e583b03; not superseded; MERGEABLE/clean; live CI 7/7 PASS: Host tests run 44113819593, SEP source checks run 44113819784).
Technical Assessment
- IIO / Rust plumbing (
rust/kernel/iio/common/aop_sensors.rs,rust/bindings/bindings_helper.h): Sound.ChannelSpec+IIORegistration::new_specs()preserve the channel-type check againstdata.ty, setmodifiedonly whenmodifierisSome, mapIIO_CHAN_INFO_RAWback asIIO_VAL_INT, andchannel_withdrawn()only clearsvalid[channel]when the same report carries a valid lux reading (leaving VD6286, CT817, and lid-angle behavior unchanged). The extendedtools/asahi/aop-als-channel-tests.pycases and 6 mutants are solid.
Blockers Before APPROVE
- §2 / §3 Untested magic threshold overriding firmware validity (
drivers/iio/common/aop_sensors/aop_als.rs:190-193, 232-234):CT720_CCT_MIN_CLEAR: u32 = 12overrides the sensor firmware's own CCT validity byte (+0x2a) using a magic constant fitted to three covered-sensor captures from one J313, with its own doc comment stating"Not hardware-tested". Hardcoding an uncalibrated threshold uncoupled from integration time or gain violates §2 (no magic constants) and will misbehave across optical stacks or integration-time changes. Either dropCT720_CCT_MIN_CLEARand trust the firmware validity flag (+0x2a) + positive finite float check, or derive the threshold from report metadata and prove it on hardware.
- §4 Clean-room & attribution (hard rules):
- Provenance hygiene (
drivers/iio/common/aop_sensors/aop_als.rs:177-179): The comment quotes unused sensor calibration gains ("the calibration gains are 8, 8, 8, 4"). Remove those unused calibration values and describe the channels by role only.
- Provenance hygiene (
- §5 Exact-head hardware & regression evidence missing:
- The commit message and PR body explicitly state
"Not run on hardware", and the stacked boot set (J613/J700/M1 Pro) did not include a CT720 Mac (J313). - Please boot the exact updated head on default cmdline on a CT720 Mac (e.g., J313 M1 Air) and record:
in_intensity_{red,green,blue,clear}_rawandin_colortemp_input(under room light and covered),in_illuminance_inputunchanged vs base, no regression on a non-CT720 ALS part if available (or request one per §1), and the §5 regression triad (0 SELinux denials[orN/A],0 failed units,0 new kernel errors).
- The commit message and PR body explicitly state
fdb999e to
0acda1c
Compare
The CT720 report comment quoted the part's calibration gains and the ranking of the counts under one captured light. The driver uses neither. Name the four counts and say which one is wideband. No code change. Signed-off-by: Scott Jones <scottajones@gmail.com>
103cdff to
ad63582
Compare
|
Thanks for the careful review. The provenance point is fixed in ad63582: the comment no longer quotes the calibration gains or the channel ranking, and names the four counts by role only. On the clear threshold, I'd like to keep it for now. Trusting +0x2a alone is what we started with, and it doesn't hold up on hardware. In malik-na's covered-sensor run on a J313 (omacom/linux-aurora#220), the firmware's CCT-valid byte was still set on noise at clear counts of 11 and below, and in_colortemp_input read 788 K, 1288 K, 2904 K and 6781 K with the sensor covered. The clear >= 12 gate is there to drop exactly those readings, so going back to the flag would publish them again. You're right that 12 is fitted to one machine and isn't tied to integration time or gain. If you have a source for deriving it from the report metadata, I'm happy to switch to that. In the meantime I can do a J313 run at the exact head on the default cmdline that covers your §5 list: in_intensity_{red,green,blue,clear}_raw and in_colortemp_input in room light and covered, in_illuminance_input against base, SELinux denials, failed units and new kernel errors. I'll add a check on a non-CT720 ALS part if one is available. Would that be enough to settle this item? |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at ad63582f81ac
Blockers:
drivers/iio/common/aop_sensors/aop_als.rs:190-193, 232-234:CT720_CCT_MIN_CLEAR = 12overrides the firmware's CCT-valid byte with a number fitted to one J313's covered-sensor captures. As you said, it isn't tied to integration time or gain, so on another unit or setting it may hide real readings or let noise through. Fix: scale the floor from the report's own integration time and gain. If that can't be done, say so in the commit message with the captures, and the J313 run you offered (room light and covered) shows what it does.- Missing row: that J313 run at this head.
Checked: thank you for the careful follow-up. No Apple material; ad63582f names the four counts by role only, which fixes the provenance point.
Superseded by the review at ad63582
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
One point is left. |
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 <hey@djdev.me>
There was a problem hiding this comment.
Verdict: HOLD at 2a406f7bc385
Blockers:
- Hosted CI workflows (
apple-build,host-tests,pr-text,KUnit) have not yet executed on this fork head (2a406f7bc385;readinessis queued, other checksSKIPPED) — wait for CI to be dispatched and pass green (includingaop-als-channel-tests.py). - Unaddressed review item from
2026-11-26(CHANGES_REQUESTEDonad63582f):CT720_CCT_MIN_CLEAR = 12is still a hardcoded constant inaop_als.rs— either scale from integration time/gain or explain why not in the commit message, and post an exact-head2a406f7bc385J313 room-light + covered-sensor run exercising the newAlsIioDev(#3473) integration.
Checked:
- Audited merge commit
2a406f7bc385(MERGEABLEagainstmain, 4 files+279/-35): cleanly adapts CT720 color channels ontomain's on-demandAlsIioDev(#3473), expandingMAX_CHANNELStoCT720_CHANS(6), registering the four RGBC channels asIIO_CHAN_INFO_RAWwhole counts while keeping lux and CCT processed, withdrawing unavailable color channels (channel_withdrawn()) on lux-only reports so callers read-ENODATArather than stale values, and leaving VD6286/CT817 unchanged.
Evidence
- Head:
2a406f7bc3850f43e2576a6bc2c9b4712f11b2ab(basemain,MERGEABLE). - Status checks at review time:
readiness / readinessQUEUED; 7 checks SKIPPED.
RyanTheTide
left a comment
There was a problem hiding this comment.
Reviewed the conflict-pass merge commit 2a406f7 only: aop_als ported to main's ChannelSpec API (processed/raw channel specs, withdrawn-channel handling); the PR's behaviour is kept. The resolution keeps what each side had and adds nothing outside the conflict. Approved for the merge-up; merging still waits on CI and the rows at this head.
DjDeveloperr
left a comment
There was a problem hiding this comment.
The CT720 colour channels are new, and the clear-count floor only affects them, so I'm treating the floor as a follow-up rather than a blocker.
Main replaced the ALS IIO device while this was open (#3473), so the merge at 2a406f7b registers these channels on the new device. The counts are raw, lux and colour temperature are processed, and a report without a colour channel withdraws it. The AOP sensor drivers typecheck, and the ALS host tests pass.
Left before merge: a J313 row at this head with room light and covered readings.
There was a problem hiding this comment.
Verdict: MERGE at 2a406f7bc385
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: - Audited merge commit 2a406f7bc385 (MERGEABLE against main, 4 files +279/-35): cleanly adapts CT720 color channels onto main's on-demand AlsIioDev (#3473), expanding MAX_CHANNELS to CT720_CHANS (6), registering the four RGBC channels as IIO_CHAN_INFO_RAW whole counts while keeping lux and CCT processed, withdrawing unavailable color channels (channel_withdrawn()) on lux-only reports so callers read -ENODATA rather than stale values, and leaving VD6286/CT817 unchanged.
Follow-ups (not blocking): CI dispatch; explain/scale CT720_CCT_MIN_CLEAR; J313 room-light + covered row
|
At I ran the exact-head |
|
Merge-tree check of
Hosted CI at this head: apple-build, rust-build, host-tests and pr-text passed. The KUnit and DWC3 jobs still queued don't cover these files. The covered J313 reading from our 12-01 review is now a follow-up. Main moved to |
Summary
The CT720 report already carries red, green, blue and clear counts and a color temperature next to lux, but the driver registered only lux for that part. This publishes them on aop-sensors-als when the part is the CT720, gated on matching integration times. A report that fails the gate still publishes lux, and the color channels read ENODATA. Color temperature is published only when clear is at least 12. VD6286, CT817 and the lid-angle sensor keep the channels they had.
This is Lucas Goossen's patch (omacom/linux-aurora#220) rewritten for this tree's N-channel helper; the commit message says what changed in the rewrite.
Evidence
a7dd26e6d60ewith the 7.3 package config, LLVM 18 and Rust 1.85:make W=1 rust/ drivers/iio/common/aop_sensors/: buildsa7dd26e6plus all 13 branches of this set (before the three small fix-up commits) booted on an M3 MacBook Air (J613), a Neo (J700) and an M1 Pro with no regressions against their baselines (on the M1 Pro, only the checks already known to differ: GPU name and DRAM OPP), and a 25-minute GPU soak was clean on all three. No M3 Pro, M3 Max, J504, J615 or M4 Pro ran this kernel.Merge Danger
Door: two-way
Blast Radius: ambient light
CT720 ambient-light sensors only.