Skip to content

iio: aop_motion: fix the M1/M2 accelerometer and gyroscope, and idle-window aop_devmotion (stacked on #2910) - #2927

Open
RyanTheTide wants to merge 5 commits into
mainfrom
aop-motion3/t6000-calibration-state
Open

RyanTheTide wants to merge 5 commits into
mainfrom
aop-motion3/t6000-calibration-state

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

#2910 is merged. This PR adds the calibration-state and device-motion follow-up.

Problem

  1. M1 Pro (T6000) and M2 (T8112) accelerometer and gyroscope read wrong values. The M1 Pro reads 0 0 0 and the M2 reads about 2% of 1 g at rest. Their AOP firmware (the 2023 generation, "v240.x built Jun 30 2023" in the AOP log) answers every calibration packet with status 0 and applies it on top of the calibration it already holds, instead of replacing it or answering "already held" as newer firmware does. Each extra set of packets rotates the samples by the mount matrix again and multiplies in the per-count scale again. Since the calibration went out on every start, the values shrank towards zero within a few reads.
  2. iio: aop_motion: calibrate once per boot and idle-stop direct reads #2910 calibrates once per bind, which fixes direct reads. A rebind of the driver still sends the packets again: on the M1 Pro, Z at rest went from -65352 to 15960 and then to -3897 counts over two rebinds.
  3. aop_devmotion has the same start/stop-per-read pattern that iio: aop_motion: calibrate once per boot and idle-stop direct reads #2910 removes from aop_motion: every direct quaternion read starts and stops the service.

Change

  • iio: aop_motion: don't calibrate a service twice in one AOP boot. After sending the packets, set the service's calibration state (property 61) to 2, the value aop_temp already writes after its packets. Before calibrating, read the state and skip the packets when it reads 2. A successful read reporting any other state, or a firmware refusal, falls back to the packet statuses. A transport or allocation error aborts before any packet is sent. After the packets complete, a failed marker update preserves the current bind's calibration. This also makes iio: aop_motion: calibrate once per boot and idle-stop direct reads #2910's conservative recalibration after firmware suspend safe when the AOP kept its state. Host selftest case and docs added.
  • iio: aop_devmotion: keep direct-read reports running for an idle window. The same DelayedWork idle-window design as iio: aop_motion: calibrate once per boot and idle-stop direct reads #2910: a direct read keeps the fast-path client open for 2 s, and back-to-back reads reuse it.
  • iio: aop_devmotion: back off direct reads after a failed open. The same failed-start backoff iio: aop_motion: calibrate once per boot and idle-stop direct reads #2910 has for aop_motion. The PM notifier parks the fast-path client before restore and resumes it afterward.

Testing

At 75c3683e81a9773c2e5048a58180629b7df32ba8, all three AOP host suites pass and both driver objects compile for arm64 with the fleet configuration. The hardware rows below used the earlier revision.

  • M1 Pro (J316s, fleet82), modules installed and loaded at boot (cold AOP): accel at rest -65309 to -65430 on Z (-1.00 g, the same sign as the J616s) over 4 fresh starts and 3 rebinds; accel and gyro buffers 100 and 98 scans per 2 s with the same values; s2idle x2 (rtc wake) with correct reads after resume; no AOP errors or crashes. Stock reads 0 0 0; iio: aop_motion: calibrate once per boot and idle-stop direct reads #2910 alone reads correctly until the first rebind.
  • M2 (J413, fleet82), same way: stock reads Z -1265; with this stack Z -65453 to -65578 at boot, across 3 rebinds, in the buffers and after s2idle x2.
  • J616s (M4 Pro, fleet81), newer firmware, same way: accel matches stock (Z about -64350; stock -64363) at boot, across 3 rebinds, in the buffers (100/98 scans per 2 s) and after s2idle x2; devmotion6 reads a unit quaternion; no AOP errors.
  • aop-motion.py selftest 11/11, aop-devmotion.py 5/5, rustfmt --check clean, checkpatch --strict clean.

Still to run

  • Default-command-line boot, buffering, rebind and short suspend at the current head on J413, M1 Pro and the available newer AOP firmware families.
How the root cause was found (M1 Pro)

Debug-only builds (not part of this PR) dumped raw reports and read the service properties back:

step accel X Y Z (counts, 1/65536 g)
stock, warm 0 0 0; reports arrive at 50 Hz, bytes 2..17 zero
cold AOP (aop_motion blacklisted for one boot), no calibration sent 72 461 65430 (real data)
then only packets 76 + 77, one start per read Z +249442, -249429, +249293 (rotation applied again each start)
then all three packets per start (old behaviour) 0 0 -57, then 0 0 0
cold, #2910 469 -75 -65352, stable over 5 starts
#2910, after rebind 1 / 2 Z 15960 / -3897
cold, this PR, after 3 rebinds Z -65418 / -65417 / -65442
  • Property 61 reads 0 on a cold AOP and keeps a written value until the AOP restarts.
  • The M2 runs the same firmware generation and reads accel Z = -1267 on stock.

Evidence: our own measurements (traces/kernel/20261123-aop-motion3-t6000 in the lab store); no Apple binaries involved.

AxxzyWasTaken and others added 4 commits November 23, 2026 02:10
Commit 9538a1d ("iio: aop_motion: run the reports only while
someone reads them") stopped the AOP accelerometer and gyroscope reports
when nobody reads them, saving ~100 AP wakeups/s on an idle desktop.
However, its direct-read path calls Control::start() and Control::stop()
around every individual sysfs axis read, and start() unconditionally
resends all three calibration packets (properties 75, 76 and 77) before
setting the report interval.

On T6041 (M4 Max, J616C), Chromium polling the raw X/Y/Z sysfs channels
at 25-60 Hz drives ~73 start/stop cycles/s (~365 EPIC RPCs/s). On every
start, properties 75 and 76 return kIOReturnUnsupported (0xe00002c7)
while property 77 is re-accepted, logging "2 of 3 calibration packets
kept from an earlier start" over 1,200 times in 17 seconds until the AOP
firmware crashes on endpoint 0x24, wedging ALS and audio for the rest of
the boot.

Keep the 0 Hz idle behaviour while eliminating both the calibration
rewrite storm and per-axis start/stop thrashing:

- Track calibration state in Stream so the three calibration packets are
  sent once at probe, and subsequent starts for buffers, direct reads
  and s2idle resume only write PROP_INTERVAL. On s2idle
  (!pm_suspend_via_firmware()), the AOP core does nothing so calibration
  stays valid. Across firmware suspend (pm_suspend_via_firmware()),
  hibernation and restore (PM_POST_HIBERNATION / PM_POST_RESTORE), clear
  calibrated and active conservatively so calibration is sent once on
  the next start (on firmwares that kept it, packets 75/76 return
  STATUS_UNSUPPORTED benignly once). Downgrade the kept-packets log
  message from dev_info! to dev_dbg!.
- Hold direct-read reports active for a 2 s idle window via a
  DelayedWork item on system_dfl_wq. Back-to-back X/Y/Z reads and
  polling callers share the running 50 Hz stream and extend the deadline
  with no extra EPIC calls, while quiet periods return the AOP to
  interval 0.
- Back off direct reads for DIRECT_IDLE_MS after a failed start so a
  polling client cannot hammer a failing service or spam refused() logs;
  buffer enable, sleep transitions and shutdown clear the backoff.
- Only clear active after stop_reports() succeeds, and park on
  PM_RESTORE_PREPARE alongside suspend/hibernation prepare. Cancel and
  join the idle work synchronously with the stream mutex dropped on
  sleep prepare (cancel_delayed_work_sync) and permanently disable it on
  unbind or a failed iio.register() in probe (disable_delayed_work_sync),
  reclaiming any pending Arc reference cleanly.
- Extend the host selftest in
  tools/testing/selftests/drivers/apple/aop-motion.py to cover the
  production Stream state machine (including failed-start backoff and
  failed-stop / reset_cal handling) and update
  Documentation/iio/aop-sensors.rst.

Fixes: 9538a1d ("iio: aop_motion: run the reports only while someone reads them")
Suggested-by: Ryan Murray <[email protected]>
Signed-off-by: AxxzyWasTaken <[email protected]>
On the M1 Pro (T6000) the accelerometer and gyroscope read 0 0 0.

The AOP firmware there takes every calibration packet it is sent with
status 0 and applies it on top of the calibration it already holds,
instead of replacing it or answering that it holds one, as newer
firmware does. A second set of packets rotates the mount matrix again
and multiplies in the per-count scale (about 0.244 for the
accelerometer) once more. With calibration sent on every start, as
before the parent commit, the matrix shrinks towards zero within a few
reads. Calibrating once per AOP boot fixes direct reads, but a rebind of
the driver sends the packets again: on the M1 Pro, Z at rest went from
-65352 to 15960 and then -3897 counts over two rebinds.

The service's calibration state (property 61) keeps the value a host
writes until the AOP restarts; on the M1 Pro it reads 0 before that.
After sending the packets, set it to 2 ("calibration loaded"), the value
aop_temp writes after its own packets, and read it before calibrating:
when it already reads 2, skip the packets. Any other value, or a failed
read, sends them as before. Firmware that answers the write with
unsupported is left as before. The state check also makes the
conservative recalibration after firmware suspend safe on such firmware
when the AOP kept its state.

The host selftest covers the state decision.

Signed-off-by: Ryan Murray <[email protected]>
With no buffer enabled, every direct read of in_rot_quaternion_raw opens
the fast-path client, writes the report interval, waits up to 500 ms for
the first sample, writes interval 0 and closes the client again. That is
4 EPIC calls per read, two of them a ClientOpen/ClientClose that hand the
shared DMA ring to the firmware and take it back, and the attribute is
world-readable, so any polling reader drives them as fast as the firmware
answers. An open or close that times out also keeps the ring mapped for
the rest of the boot.

Follow the design of "iio: aop_motion: calibrate once per boot and
idle-stop direct reads" for the direct-read path:

- The first direct read opens the client and starts the reports. The
  client then stays open for a 2 s idle window that every further direct
  read extends, so polling readers share one running client and get the
  latest polled sample with no EPIC call. A DelayedWork item on
  system_dfl_wq stops the reports and closes the client once reads have
  been quiet for the window.
- The stream lock is held across the wait for the first sample and the
  idle work closes the client under the same lock, so the client is
  never closed while a read waits on it.
- Enabling the buffer takes over a client that direct reads opened,
  without reopening it, and drops the direct hold. Disabling the buffer
  closes the client at once, as before.
- Suspend parks the stream, then cancels and joins the idle work with
  the stream mutex dropped (cancel_delayed_work_sync). Unbind disables
  it for good (disable_delayed_work_sync) before the polling work is
  disabled. Both reclaim the Arc reference of a cancelled pending work.
- The consumer state moves from separate atomics into a Stream state
  machine under the stream mutex, which the new host selftest
  tools/testing/selftests/drivers/apple/aop-devmotion.py runs. Update
  Documentation/iio/aop-sensors.rst.

The calibration-state write is already sent once at probe and does not
change.

Fixes: 091f105 ("iio: apple: devmotion: pace the fast path on the host, open it on demand")
Signed-off-by: Ryan Murray <[email protected]>
When opening the report client for a direct read fails, read_now()
forgets the request and returns the error, so the next sysfs read tries
again at once. A client polling the quaternion at 25-60 Hz then repeats
the failing ClientOpen, or the open, the refused report interval and the
close that undoes it, at its own rate, with a line in the log for each.
That is the traffic the idle window removed from the working case, in
the case where the firmware is already unhappy.

Remember a failed open for DIRECT_IDLE_MS, as aop_motion does. Direct
reads in that time return its error without calling the service, and
the first read after it tries again. This bounds the failing case as
the working one is bounded: one attempt per idle window, and with it
one set of error messages per window, so they need no rate limit of
their own.

The backoff is for polling readers only. Enabling a buffer is a new
request and tries at once, and system sleep drops the backoff in both
directions, so the first read after resume is not answered with an error
from before the sleep.

The stream selftest covers a poller on a failing service, the retry
after the window and the two ways out of the backoff.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Review at dd8d3fe.

Reviewed 64413d1..dd8d3fe against #2910's head 65ddaa0. The fix is keyed on the service's own calibration state (property 61), not on a chip, and the calibration still comes from the ADT packets, so that part looks right. Findings:

  1. aop_motion.rs:394-397: if the packets are taken but the prop-61 write fails or returns another status, calibrate() returns Err and calibrated stays false (413/425). The next start then resends all three packets, which on the v240 firmware is the compounding bug this fixes. It also turns a probe into a failure on any newer firmware that answers the new write with a status other than 0/unsupported. Once the packets have been taken, make the state write non-fatal (warn) and set calibrated anyway.
  2. aop_motion.rs:357: a transport error on the prop-61 read (timeout, -EIO) is treated as "not held" and the packets go out again, which compounds on the same firmware, for example on the conservative recalibration after firmware suspend. Only a status answer should mean "send". Return the transport error and let the start fail or back off.
  3. aop_devmotion.rs:1046-1049: the client can now stay open for up to 2 s after a read, but the notifier still parks only on SUSPEND/HIBERNATION_PREPARE. aop_motion parks on PM_RESTORE_PREPARE and resumes on PM_POST_RESTORE (aop_motion.rs:967/978); devmotion should do the same.
  4. DIRECT_IDLE_MS (aop_devmotion.rs:64, and the backoff) is a fixed 2 s host hold, and the Stream state machine, idle work and backoff are now duplicated across both drivers. Could both use runtime-PM autosuspend (pm_runtime_use_autosuspend/mark_last_busy, tunable through power/autosuspend_delay_ms), or at least one shared helper in aop_sensors? Not blocking.
  5. Buffer/trigger lifetimes look right to me: the buffer takes over a direct client, buffer-off closes at once, unbind disables the idle work before the poll work, and the cancelled-work Arc is reclaimed.
    Rows at this head, please (in_accel_*_raw + in_accel_scale + buffered scans, rebind x3, s2idle): M1 Pro at dd8d3fe (the posted M1 Pro row used an earlier != 0 variant of the state check, not the final == 2); J713 (M4 Air); and one M3 (J615) row, since this adds a GET/SET of property 61 on every firmware generation. M2 (J413) and J616s are covered at the final code.

@DjDeveloperr DjDeveloperr left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formal §1–§6 pre-PR checklist review at dd8d3fe893f5ab366fc983c8606a8fdbbec849df (auditing 64413d18..dd8d3fe8 stacked on #2910 65ddaa0a).

Checklist Summary

  • §1 No model gating: Pass — keys on the service's own calibration state (property 61), not on chip/SoC/firmware version, and calibration data continues to come from ADT packets.
  • §2 Production-ready: Pass (non-blocking: DIRECT_IDLE_MS + Stream state machine/backoff are duplicated across both drivers; runtime-PM autosuspend or a shared helper in aop_sensors would be a good follow-up).
  • §3 Safety: Blockers in property-61 error handling and aop_devmotion PM restore (see below). Note: stop_idle_sync() + Arc::from_raw refcount handling was audited against rust/kernel/workqueue.rs enqueue_delayed() and is sound.
  • §4 Clean-room & attribution: Pass — #2910 commit 65ddaa0a is carried unchanged (AxxzyWasTaken), commits 2–4 carry human author/committer (Ryan Murray <[email protected]>) and human Signed-off-by:, zero AI trailers in commits.
  • §5 Evidence: Partial — M2 (J413) and J616s are covered at final code, but M1 Pro row used an earlier != 0 check (needs re-run at final == 2 code), and J713 / M3 (J615) / J616C rows are still owed since GET/SET of property 61 runs on every firmware generation.
  • §6 Naming: Pass.
  • CI (at review time): host-tests FAILED.

Blocking Findings

  1. CI host-tests failure: tools/asahi/run-host-tests.py exits with code 2:
    not registered in run-host-tests.py: tools/testing/selftests/drivers/apple/aop-devmotion.py
    
    Register aop-devmotion.py in tools/asahi/run-host-tests.py.
  2. Prop-61 write failure leaves s.calibrated = false (drivers/iio/common/aop_sensors/aop_motion.rs:394-397): Once all three calibration packets have been sent and accepted, self.write(PROP_CALIBRATION_STATE, ...)? returns Err on a transport error or any status other than 0 | STATUS_UNSUPPORTED. That aborts calibrate() before s.calibrated = true (lines 413/425), causing the next start to resend all three calibration packets (re-triggering the compounding scale/rotation corruption on v240 firmware) and turning an unexpected prop-61 status on newer firmware into a probe failure. Once the three calibration packets succeed, log a warning on prop-61 write failure/refusal and still return Ok(()) so s.calibrated is set.
  3. Prop-61 read transport error treated as uncalibrated (drivers/iio/common/aop_sensors/aop_motion.rs:357): holds_calibration() maps Err(_) (timeout / -EIO / -ENOMEM) to false, causing calibrate() to resend all three packets blindly (again risking compounding calibration on v240, e.g. on conservative post-firmware-suspend recalibration). Return Result<bool> from holds_calibration(), propagate transport errors so start fails and backs off, and only decide to send packets on an Ok((status, value)) response.
  4. Missing hibernation restore handling in aop_devmotion (drivers/iio/common/aop_sensors/aop_devmotion.rs:1046-1049): Because the fast-path client (and its DMA ring) can now stay open for up to DIRECT_IDLE_MS (2 s) after a direct read, pm_event() must also park on PM_RESTORE_PREPARE and unpark on PM_POST_RESTORE, matching aop_motion.rs:967-978.
  5. Stacking & §5 rows: Rebase onto integration/aurora once #2910 lands, and add the M1 Pro (at final == 2 code), J713, M3 (J615), and J616C rows.

Verdict

REQUEST_CHANGES — fix the run-host-tests.py registration, the three concrete driver bugs above, rebase off #2910, and complete the §5 hardware rows.

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent source review at dd8d3fe893f5. The new read of calibration state still conflates a failed transport read with a definite unset state. The reported fix depends on avoiding a second calibration on firmware that already holds it. Please preserve that distinction, cover transient property-read failure, and add the missing restore handling for the now longer-lived devmotion stream. Re-run the J413 orientation and idle-rate measurements with both fixes.

Propagate failures reading the service calibration state. Once the calibration packets have completed, keep the current bind calibrated even when the firmware state marker update fails. Park device-motion clients on restore prepare and restart them after restore. Register the device-motion host test alongside the motion and light sensor suites.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

The follow-up at 75c3683e81a9773c2e5048a58180629b7df32ba8 propagates calibration-state read errors and keeps the current bind calibrated if the state-marker write fails after the packets have been applied. Device motion now parks during restore and resumes afterward. The host runner includes the device-motion test.

The AOP host runner passed all three suites. Motion passed 11/11 tests and device motion passed 5/5. Both driver objects compiled for arm64 against the fleet configuration. The head merges cleanly into integration with the first calibration change present.

Still to run on this head, using the default command line: boot, rebind, buffer reads and short suspend on J413, M1 Pro and the available newer AOP firmware families. The earlier hardware rows above apply to the preceding revision.

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent source review at 75c3683e81a9. The updated head now propagates calibration-state transport errors, keeps this bind calibrated after successful packets even if marker publication fails, and pairs the devmotion restore callbacks. Both fixtures passed here, 11/11 motion and 5/5 devmotion. Before merge, qualify J413 orientation and the idle rate after suspend on the assembled current stack. Include repeated probe or rebind after a marker write refusal so the locally retained state does not mask a repeated calibration across binds.

@DjDeveloperr DjDeveloperr left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formal §1–§6 pre-PR re-review at 75c3683e81a9773c2e5048a58180629b7df32ba8 (CI: host-tests green; mergeable=true, clean against integration/aurora).

Prior Blocker Verification (from dd8d3fe893f5)

  • Resolved: aop-devmotion.py registered in tools/asahi/run-host-tests.py (host-tests now green).
  • Resolved: Control::holds_calibration() returns Result<bool> and propagates transport/allocation errors before sending any calibration packets (drivers/iio/common/aop_sensors/aop_motion.rs:343-351).
  • Resolved: Control::calibrate() warns and returns Ok(()) if the post-calibration property-61 marker write fails or is refused, preserving s.calibrated = true for the current bind (aop_motion.rs:386-395).
  • Resolved: aop_devmotion pm_event() now parks on PM_RESTORE_PREPARE and resumes on PM_POST_RESTORE (drivers/iio/common/aop_sensors/aop_devmotion.rs:1046-1050).
  • Note on #2910: #2910 (65ddaa0adccc) is already merged into integration/aurora (5129ba79bc09). Because commit 1 in this branch is the exact same SHA, the diff against integration/aurora cleanly contains only the four follow-up commits (64413d18..75c3683e); dropping (stacked on #2910) from the PR title is a clean non-blocking tidy-up.

Pre-PR Checklist (§1–§6)

  • §1 No model gating: Pass — keyed on the service's own property-61 calibration state, with calibration data from ADT packets.
  • §2 Production-ready: Pass — default command line, no hacks.
  • §3 Safety: Pass on the calibration-state and idle-window paths; see the non-blocking aop_devmotion probe() unwind hardening note below.
  • §4 Clean-room & attribution: Pass — #2910 commit 65ddaa0adccc carried unchanged (AxxzyWasTaken); commits 64413d18, 7b9d4f9c, dd8d3fe8, and 75c3683e carry human author/committer (Ryan Murray <[email protected]>) and human Signed-off-by: only, zero AI trailers in commits; Assisted-by: disclosed in PR body.
  • §5 Evidence: Incomplete (blocking) — zero hardware runs at current head 75c3683e81a9.
  • §6 Naming: Pass.

Blocking Findings

  1. Missing §5 hardware evidence at current head 75c3683e81a9: All posted hardware rows are from the earlier revision (and the M1 Pro row predates the final == 2 check). Please run default-command-line boot, buffered reads, 3x driver rebind, and short s2idle at 75c3683e81a9 on M1 Pro (J316s), M2 (J413), and available newer AOP firmware families (J616s and ideally J713 / M3 J615), including the §5 regression counts (0 SELinux denials, 0 failed units, 0 new kernel errors).
  2. Contradictory duplicate sleep sentence in Documentation/iio/aop-sensors.rst:107-111: Commit 7b9d4f9c7ad2 added "Around system sleep the client is closed, and it is reopened on wake only if a buffer is still enabled." but left the old sentence immediately below it ("Around system sleep an open client is closed and reopened after resume."). Please remove the stale duplicate sentence.

Non-blocking Note

  • aop_devmotion probe() error-unwind order (drivers/iio/common/aop_sensors/aop_devmotion.rs:977-978): iio.register()? runs before PmHook::new(state.clone())?. Now that a direct read can leave idle_work and poll_work queued, if PmHook::new() fails after iio.register() succeeds, MotionIio::drop() unregisters and frees iio_dev without calling state.shutdown() or state.disable_poll(). Registering PmHook before iio.register() and unwinding with pm.unregister(); state.shutdown(); state.disable_poll(); (matching aop_motion.rs:1116-1126) closes that race cleanly.

Verdict

REQUEST_CHANGES — all four code/CI blockers from the prior review are fixed, but §5 hardware rows at 75c3683e81a9 and the stale sentence in Documentation/iio/aop-sensors.rst remain before merge.

@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) changes-requested A reviewer requested changes (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Merge readiness at 75c3683e: not ready yet

Check Detail
CI at head no failing: host-tests
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head no no line with the head SHA 75c3683e, a Mac and a result in the PR body or a comment
Conflicts no merge conflicts with main: merge it in (no force push)
PR text adopt when you next edit add a 'Tested:' line; a 'Risk:' line (door and Macs) (guide)

Areas: area:gpu

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

DjDeveloperr
DjDeveloperr previously approved these changes Nov 25, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH, then merge at 75c3683e81a9: the code is ready; it needs only a row at this head.

Blockers: none in the code. Missing row: the rows are from an earlier revision. Needed at this head on an M1 Pro (J316s) or M2 (J413): a boot, buffered reads, three driver rebinds and a short s2idle.

Checked: no Apple material, no gates. The earlier points are fixed (the test is registered, holds_calibration). Host tests green. Nit: Documentation/iio/aop-sensors.rst:107-111 keeps the old sleep sentence beside the new one.

@DjDeveloperr
DjDeveloperr dismissed stale reviews from themself November 25, 2026 04:23

Superseded by the review at 75c3683

@github-actions github-actions Bot removed the changes-requested A reviewer requested changes (bot) label Nov 25, 2026
@RyanTheTide
RyanTheTide dismissed DjDeveloperr’s stale review November 25, 2026 04:23

The merge-base changed after approval.

@aurora-silicon-review
aurora-silicon-review Bot requested review from joshuaswarren and satchlj and removed request for joshuaswarren and satchlj November 27, 2026 04:38

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: Changes requested at 75c3683e81a9.

The calibration packets can already be applied when the state-marker write is refused, unsupported or times out. Keeping the current bind calibrated helps direct reads, but a subsequent rebind with the same AOP boot sees an unset marker and can compound calibration again. Please show how the driver fails safely in the uncertain state, including an interrupted packet sequence and a marker-write failure followed by rebind. Also remove AI attribution from the PR body and attach current-head rebind and suspend evidence on the affected firmware families.

@RyanTheTide

RyanTheTide commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor Author

I exercised the exact 75c3683e81a9 calibration method across two driver binds using one mock AOP service. Three host cases reproduced the review concern:

Firmware response Calibration packet writes after both binds
Marker write succeeds 1, 1, 1
All packets apply but the marker write times out without setting the marker 2, 2, 2
The second packet applies but its reply times out 2, 2, 1

This was a host failure-injection test, so no live calibration was changed. The next revision needs to retain the completed or uncertain transaction state across a child rebind. The AOP core already retains ambiguous source-ring binding state across child teardown and is a candidate place to keep the calibration state as well. A new packet sequence should require evidence of a fresh firmware boot.

I also checked the current-main merge at a81a12c7de36. The two merge conflicts are limited to host-test registration. Keep current main's existing entries and add aop-devmotion.py once to APPLE_TESTS and once to the Apple selftests TEST_PROGS. On that resolved source preview, the existing motion and device-motion harnesses pass 11/11 and 5/5. The calibration replay cases above remain the source blocker.

@github-actions github-actions Bot added the merge-conflict Conflicts with the base branch (bot) label Nov 28, 2026
@aurora-silicon-review
aurora-silicon-review Bot requested review from DjDeveloperr and satchlj and removed request for DjDeveloperr and joshuaswarren November 29, 2026 02:52
@aurora-silicon-review
aurora-silicon-review Bot requested review from DjDeveloperr and joshuaswarren and removed request for joshuaswarren and satchlj November 30, 2026 17:52
@github-actions github-actions Bot added the ci-failing A check failed at the PR head (bot) label Dec 1, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gpu Area from CODEOWNERS (bot) ci-failing A check failed at the PR head (bot) merge-conflict Conflicts with the base branch (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants