Skip to content

iio: aop_sensors: bind als-temp and devmotion6 wherever the AOP offers them - #2264

Open
RyanTheTide wants to merge 1 commit into
integration/aurorafrom
drvgap/aop-services-all
Open

RyanTheTide wants to merge 1 commit into
integration/aurorafrom
drvgap/aop-services-all

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem. On every Mac whose AOP firmware announces the als-temp and devmotion6 services, the AOP core creates als-temp.N.auto and devmotion6.N.auto. The two drivers bind only through the compatibles apple,aop-als-temp / apple,aop-devmotion6, and only the T6040/T6041 and T8132 device trees have those nodes. On the M1 Pro (T6000, j316s) and the M2 (T8112, j413), both devices are created but stay unbound.

Change. Each driver now registers under its AOP service name. The platform bus binds it by name to the device the AOP core created for that service. So the firmware's service announcement decides whether the driver binds, and no per-SoC device tree list is needed. The module aliases become the device modaliases (platform:als-temp, platform:devmotion6), so the modules load on their own. The OF tables stay, so T6040/T6041/T8132 bind as before. devmotion6 needs nothing from DT. als-temp reads its optional calibration from the node when one exists and falls back to sensor defaults otherwise. That is also what it does today when the bootloader supplies no calibration. The drivers come from #1054/#1247.

Testing. M2 (j413, 7.3.0-aurora-fleet74, no DT node for either service): both modules bind by name. devmotion6 streams at 47.57 Hz with |q|^2 = 1.000000. als-temp reads 20.0 C at 1 Hz. Unbind is clean. W=1 + CLIPPY are clean, and so are rustfmt and checkpatch --strict.

Still to run. J616s regression row (OF path, expected unchanged).

Old gate, hardware property, evidence per generation
  • Old gate: binding needed an apple,aop-als-temp / apple,aop-devmotion6 child node of the AOP. Only t6040.dtsi, t6041-j614c-j616c.dtsi and t8132.dtsi had one.
  • Hardware property now used: the AOP firmware's announcement of the service. register_service() creates the device only for an announced service, named after it. With no announcement there is no device and nothing binds.
  • Generation rows:
    • G14G M2 (T8112, j413): PROVEN. Before the change, als-temp.4.auto and devmotion6.5.auto had driver=none and of_node=none. After insmod they are bound to drivers als-temp and devmotion6, and the IIO devices aop-sensors-devmotion6 and aop-sensors-als-temp appear. Buffered 10 s: 476 samples, 47.57 Hz, |q|^2 min/max/mean 1.000000. Raw quaternion (W,X,Y,Z Q30) 1073701504 -605297 9283776 5233, with the machine flat and still. in_temp_input reads 20000, 20000, 20062, 20062, 20000 m°C at 1 Hz. rmmod is clean and both devices are unbound again. The kernel log shows no errors.
    • G13S M1 Pro (T6000, j316s): both services announced; als-temp.4.auto and devmotion6.5.auto are present and unbound on 7.3.0-aurora-fleet74. With the change (insmod/rmmod, no reboot): both bound by name; devmotion6 476 samples in 10 s = 47.56 Hz, |q|^2 1.000000 min/max/mean; als-temp 20.187 C; rmmod clean.
    • T6040/T6041 (J616s) and T8132: unchanged. They keep binding through the existing OF nodes, and the node-based calibration path is unchanged.
  • devmotion6 format on T8112 matches the decoder: type 3/4 reports, four LE singles in X,Y,Z,W order. The J616s row has the same |q|^2 = 1.0 and ~47.5 Hz host-paced rate.
How it was built and tested

The test modules were built from this commit's two files as external modules against the 7.3.0-aurora-fleet74 build tree (same source commit and config as the running kernel). They were signed with that tree's key, then loaded on the running M2 with insmod and unloaded with rmmod. There was no reboot and no suspend. The integration/aurora tip has no changes in drivers/iio/common/aop_sensors/ since fleet74.

Assisted-by: LLM (Claude:Opus 5.5)

…s them

The AOP core creates a platform device for every sensor service its
firmware announces, named after the service. The als-temp and devmotion6
drivers only matched the device tree compatibles "apple,aop-als-temp"
and "apple,aop-devmotion6", and only the T6040/T6041 and T8132 device
trees describe those services. On the M1 Pro (T6000) and the M2 (T8112)
the firmware announces both services, so als-temp.N.auto and
devmotion6.N.auto are created, but nothing binds to them.

Register each platform driver under the name of its AOP service. The
platform bus then binds it by name to the device the AOP core created,
so the firmware's announcement of the service decides whether the
driver binds, not a list of device trees. The module aliases change to
the device's modalias (platform:als-temp, platform:devmotion6) so that
the module loads automatically. The OF match tables stay, so machines
whose device tree describes the services bind as before.

devmotion6 needs nothing from the device tree. The temperature sensor
reads optional calibration from its node; without a node it now uses
the sensor defaults, which is what it does today when the bootloader
supplies no calibration.

The drivers and the T6040/T6041 description come from linux#1054 and
linux#1247.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@satchlj

satchlj commented Nov 20, 2026

Copy link
Copy Markdown
Member

Claude Opus 5.5 on @satchlj's behalf.

Hardware result on MacBook Air M2 (J413) on the macOS 27.2 (26B123) stub, with integration/aurora 61295c2 + this PR (now phellos's default): with no DT node for either service, aop-sensors-als-temp and aop-sensors-devmotion6 bound by name next to the other four AOP sensors. phellos's local DT nodes for them are no longer needed.

🤖 Generated with Claude Code

@satchlj

satchlj commented Nov 20, 2026

Copy link
Copy Markdown
Member

Claude Opus 5.5 on @satchlj's behalf: hardware run.

PR head Checked Result
d6732412 AOP sensors registered: als, als-temp, las, devmotion6, accel, gyro (presence; las read 73) Pass

Build: phellos (MacBook Air M2, J413, macOS 27.2 / 26B123 stub), default rebuilt 2026-11-20 = linux integration/aurora 458f759 + #2519 #1832 #1831 #2264 #2525 #2526 #2543 #2544 #2545; Aura main 0beafec9 + aurora-silicon/aura#377 aurora-silicon/aura#227 (isp.c only) aurora-silicon/aura#381 aurora-silicon/aura#382; U-Boot aurora-wip 37baf8f7 + aurora-silicon/u-boot#67; Stage 2 DTB t8112-j413-fw27.dtb. One-shot boot under the SoC watchdog, then made the default (two default boots healthy).

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

No blockers.

I checked that the AOP core creates each service device named after the service (drivers/soc/apple/aop.rs:1624-1625) and passes the DT child as its fwnode only when one exists (:1382-1399). Without an id_table, the platform bus falls back to the name match, so registering the drivers under "devmotion6"/"als-temp" binds them exactly where the firmware announces the service. The OF tables are still there, so the T6040/T6041/T8132 nodes bind as before. The new aliases match the modalias of devices that have no node. Previously, a node-less als-temp returned ENODEV at dev.fwnode()?. It now runs without calibration (aop_temp.rs:89-109), the same state as a node whose bootloader supplied no calibration. Nothing here is SoC-gated: the firmware's service list decides whether a driver binds.

The M2 (J413) and M1 Pro (J316s) rows plus the J413 full-kernel run in the comments cover the new path on this head (d673241). It can leave draft.

  1. Nit: both node-less Macs read about 20.0 C (20000/20062 m°C on J413, 20.187 C on J316s). If that is an uncalibrated default rather than a live reading, in_temp_input reports a value that does not track the machine. A reading under load, showing the value move, would settle this.

HW row (regression, not required to merge): J616s on this head. aop-sensors-als-temp and aop-sensors-devmotion6 should bind through the OF path, the modules should autoload at boot, and the node calibration should still be sent (dev_dbg). The run should show 0 AVC, 0 failed units and no new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide
RyanTheTide marked this pull request as ready for review November 22, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants