Skip to content

RK3566: keep the rtw88 driver loaded across sleep - #3324

Open
Jacob-Matthew-Cook wants to merge 1 commit into
ROCKNIX:nextfrom
Jacob-Matthew-Cook:rk3566-sleep-wifi
Open

RK3566: keep the rtw88 driver loaded across sleep#3324
Jacob-Matthew-Cook wants to merge 1 commit into
ROCKNIX:nextfrom
Jacob-Matthew-Cook:rk3566-sleep-wifi

Conversation

@Jacob-Matthew-Cook

@Jacob-Matthew-Cook Jacob-Matthew-Cook commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • What is the goal of this PR? Cut the RK3566 deep-sleep drain. The global modules.bad unloads rtw88_8821cs before suspend, but on these boards the SDIO card keeps power through sleep (keep-power-in-suspend, vcc_wifi always on), so the RTL8821CS sits fully awake all night with nothing managing it. sleep.sh now honours a platform/device modules.keep list of modules it must not unload, and RK3566 gets one with rtw88_8821cs, so the driver's own suspend path leaves the chip in its power-save state.

Testing

  • How was this tested? Built and tested on an RG353M (kernel 7.0.2). 60 s RTC sleep through the logind path with Wi-Fi on: driver stays loaded, wlan0 re-associates 4 s after resume, suspend_stats clean, no rtw/mmc errors. Overnight drain on this build pending.
  • Test results: Baseline before the change: 88 % → 63 % over a 10 h 9 min deep sleep, unplugged, ≈ 87 mA average. The RK817 sleep-enable registers (0xb5/0xb6) match the DT regulator-state-mem exactly (CPU/GPU/logic/boost/1v8 off; DDR, 3v3 and PMU rails on), so the excess is peripherals on the rails that stay up, dominated by the undriven Wi-Fi/BT module.
  • Artifacts: none published. The RG353M test above ran the first form of this change (a full per-platform modules.bad override yielding the same unload list); the modules.keep form is built and is being re-verified on the same device.

Additional Context

  • Affects every RK3566 device; only the RG353M was tested. The unload dates from Allwinner/sleep: implement sleep to freeze #1004 (Dec 2024), the H700 s2idle bring-up, and applies everywhere only because modules.bad is global; nothing on RK3566 ever needed it, and resume with the driver loaded is clean on 7.0.2.
  • Why a keep-list rather than a per-platform copy of modules.bad: the global list stays the single source of truth. A platform override would silently shadow any module added to the global list later, and the diff should show only what differs — one module on one platform.
  • Still on the sleeping rails and not addressed here: the BT half of the module (hci_h5 keeps it powered for BT wake) and the status LED.
  • @porschemad911 — could you take a look?

AI Usage

Did you use AI tools to help write this code? YES

🤖 Generated with Claude Code

The global modules.bad unloads rtw88_8821cs before suspend. On the
RK3566 boards the SDIO card keeps power through sleep (keep-power-in-
suspend, vcc_wifi always on), so with the driver gone the RTL8821CS sits
fully awake for the whole sleep. Measured on an RG353M: ~2.5 %/h over a
10 h deep sleep, three times the SoC's own draw, while the PMIC sleep
configuration is exactly as the DT asks.

Let a platform or device modules.keep list modules the sleep hook must
not unload, and give RK3566 one with rtw88_8821cs so the driver's own
suspend path parks the chip in its power-save state.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.

1 participant