Skip to content

iio: aop_als: Stop the reports for a system sleep and on unbind - #2713

Draft
gig3m wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
gig3m:j813/aop-als-sleep-v2
Draft

gig3m wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
gig3m:j813/aop-als-sleep-v2

Conversation

@gig3m

@gig3m gig3m commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

The ALS reports on its own at the interval the driver sets at probe (200 ms), and each report is an AOP mailbox interrupt. Nothing set the interval back to zero, so:

  • after an unbind the sensor kept reporting to nobody
  • in suspend-to-idle it woke a CPU five times a second

This sets the interval to zero on unbind and in .suspend. In .resume the CT817 (T8140) gets the probe's whole sequence (verbosity, batch, raw, then the interval), since it arms only on the zero to non-zero transition after its batch and raw properties are written. The other parts need only the interval.

Replaces #1876: adds the CT817 replay from the review, on current integration/aurora, without the commit trailer.

Draft, because I can test one machine and this driver serves several. I have only a J813 (VD6286), so the CT817 path has not run. Feedback wanted on:

  • a real sleep. aop.rs stops the endpoints in suspend_late for a firmware sleep; this runs before that, in .suspend. I could only test s2idle.
  • whether macOS stops the ALS for a sleep the same way. I have no trace of it.

Tested on J813 (Mac17,3, 27.0 stub, VD6286) with #1876's head, integration/aurora 5d112b1 merged with #1532. The J813 row on this head is to follow:

  • awake, AOP mailbox interrupts per 10 s: bound 60, unbound 10 (59 before this change), rebound 60
  • s2idle test suspends, 20 trials: 1.15 to 1.2 interrupts per second in the sleep, 5.9 to 6.0 before
  • the channel reads again after every resume and rebind
  • one lid-close sleep, 181 s on battery: 1.02 interrupts per second in the sleep (it was 3.6 on an earlier kernel), the channel reads again after it, no warning
  • no measurable power change in s2idle here (1.90 W against 1.93 W, 20 s trials): the cores only clock-gate. It should count once T8142 has a real sleep.

Not tested: any other Mac (so not the CT817 replay), a failed write on resume (it warns).

Assisted-by: LLM (Anthropic:Claude Fable 5.2)

The sensor reports on its own at the interval the driver sets at probe,
and each report is an AOP mailbox interrupt. Nothing set the interval back
to zero: the sensor kept reporting after the driver was unbound, and
through suspend-to-idle, where it woke a CPU five times a second.

Set the interval to zero on unbind and on system suspend. On resume the
CT817 gets the probe's whole sequence (verbosity, batch, raw, then the
interval), since it arms only on the zero to non-zero interval
transition after its batch and raw properties are written, and they may
not survive the sleep. The other parts need only the interval.

Signed-off-by: Kyle Arrington <kyle@arrington.co>
@RyanTheTide

Copy link
Copy Markdown
Contributor

Looks right to me. The drvdata cast matches what platform::Adapter stores (Pin<KBox<IIOAopAlsDriver>>). The epic_call in .suspend is bounded by the AOP's own timeouts, so a wedged AOP costs one timeout and doesn't hang the sleep. Picking the CT817 replay by the report layout keys it on the sensor part, not the board.

On your firmware-sleep question: .suspend runs before aop.rs stops the endpoints in suspend_late, so the interval write goes out while the service is still up. The open question is the resume. If the AOP comes back from a firmware-driven sleep with its sensor state reset, the non-CT817 parts may also need more than the interval. A T8140 (Neo, CT817) deep-sleep row would settle both: 3 sleeps, then the AOP mailbox IRQ rate in sleep and awake, and in_illuminance changing after each wake.

Small: if set_interval(0) fails in .suspend, the CT817 replay on resume writes the interval non-zero to non-zero, which doesn't re-arm per your comment. That's harmless (it was still reporting), but a dev_dbg on the suspend failure would make it visible.

Assisted-by: LLM (Claude:Opus 5.5)

@gig3m

gig3m commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

I'm stepping back from this one. The branch stays up and maintainer edits are enabled, so take it, rework it, or close it as you see fit. The code is GPL-2.0 under my Signed-off-by; use it however helps.

Assisted-by: LLM (Claude:Opus 5.5)

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