RK356x: lazy PMIC pinctrl for RK817/RK809 SLPPIN + ON/OFF source logging#2440
RK356x: lazy PMIC pinctrl for RK817/RK809 SLPPIN + ON/OFF source logging#2440aenertia wants to merge 3 commits intoROCKNIX:nextfrom
Conversation
|
The usb port on rgb30 is still powered while off with this patch... |
|
yeah it doesn't fix everything on every device. It's a contributor to a multi-faceted set of issues. |
|
I was not able to properly shutdown without "SLPPIN_NULL_FUN → SLPPOL_H → pinctrl ". Are you sure a delay is enough there? |
I tried a couple of different iterations with different behavior in ordering - this one was the one that seemed to consistently shutdown all 3 devices I tested on. But I can have another poke at it and see if there are improvements that can be made based on your feedback. I didn't dig into i.e rgb30's specific bag of issues - probably would need each specific device on BSP / Known loads which work ; and tapping the various kernel and i2c / pmic call orders to build a definitive per device quirks list to nail all the drain-whilst-off issues. |
3235fe3 to
153872c
Compare
Sync updated 0029 patch from nert-next/rk356x-powerpin-additions: - Add SLPPOL_H step before pinctrl mux (Zetarancio feedback) - Disable OTG switch before SLPPIN sequence (sydarn RGB30 USB drain) - Full BSP ordering: OTG_OFF → NULL_FUN → SLPPOL_H → pinctrl → DN_FUN
|
I've been running this all day and it seems to work fine. Haven't been looking for anything other than 'does it shutdown' and does it power on tho. CI https://github.com/aenertia/distribution/actions/runs/23290369178 |
I think we really need to understand if they shutdown any different with this patch than they were doing before. Probably a longer "power off drain test" can actually tells us, unless you other meter benchmarks XD |
|
Well the 353p I have it on at the moment has been draining whilst off to
dead pretty reliably on nightlies for months now. I'll leave it off at 100%
tonight and see what it is in the morning. It's one of those ; how many
things can you actually test reliably things. It's not exhaustive but it's
something.
…On Thu, 19 Mar 2026 at 23:39, Zetarancio ***@***.***> wrote:
*Zetarancio* left a comment (ROCKNIX/distribution#2440)
<#2440 (comment)>
I've been running this all day and it seems to work fine. Haven't been
looking for anything other than 'does it shutdown' and does it power on
tho. CI https://github.com/aenertia/distribution/actions/runs/23290369178
I think we really need to understand if they shutdown any different with
this patch than they were doing before. Probably a longer "power off drain
test" can actually tells us, unless you other meter benchmarks XD
—
Reply to this email directly, view it on GitHub
<#2440 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACF5LYFNMOHBDGZI6BIL3L4RPE5BAVCNFSM6AAAAACWVTO4AKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DAOBZGIYDOOBTGQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
I hope you had some kind of table benchmark or something XD. Anyway we are really behind on this to merge it as of now. Currently the miyoo does not drain while off but cannot reliably resume from sleep (The opposite of what was happening before). So I guess it's too early for any of this. Edit: It was unrelated to this but rather to the wifi driver I was patching. |
Well it was still at 100% this morning which is one datapoint. I will put a build on the rgb30 today and leave it for a day or so. |
153872c to
1ab415d
Compare
|
Have revised significantly based on setting up some probes on the RGDS from gamma's android build and dumping i2c/pmic writes to logs over several reboot cycle. Still a WIP but current notes attached. |
Revised based on ADB register tracing of Android/GammaOS shutdown
on the RG-DS. Android does NOT manipulate SLPPIN — it relies solely
on DEV_OFF (bit 0 of SYS_CFG(3)) via the standard pm_power_off().
Key findings from i2c register tracing during Android shutdown:
- SLPPIN function stays RST(3), polarity stays LOW(0)
- No SYS_CFG(3) writes until the final DEV_OFF
- OFF_SOURCE and INT_STS persist across reboot (never cleared)
- OTG disabled by Android before shutdown
Changes:
Patch 0029 (REVISED): OTG switch disable + INT_STS flag clearing
- Disable OTG (BIT(2)|BIT(6) of POWER_EN(3)) before poweroff
- Clear stale INT_STS(0-2) registers (W1C) to prevent
UVLO/OVP/HOTDIE flags persisting across reboots
- REMOVED: SLPPIN manipulation, SLPPOL_H override, pinctrl
- REMOVED: Lazy pinctrl acquisition, rk808.h struct changes
Patch 0030 (UNCHANGED): ON/OFF_SOURCE logging at probe
Patch 0031 (REMOVED): DTS SLPPIN pinctrl states no longer needed
Our previous SLPPOL_H=1 was WRONG — Android uses SLPPOL=0 (LOW).
Setting HIGH polarity interfered with the PMIC power state machine,
causing unreliable soft shutdown and power button wake issues.
1ab415d to
389505d
Compare
LCD panels hold their last framebuffer content after shutdown because no backlight-off signal is sent. Add ExecStopPost that writes 4 (off) to all bl_power sysfs nodes when sway stops.
After a PMIC OCP brownout (no clean shutdown), stale INT_STS flags persist and can leave the PMIC confused on next boot. Clear all three INT_STS registers (W1C) at probe time, before interrupt handlers register, alongside the existing ON/OFF_SOURCE logging.
9dbd7c0 to
24f92b1
Compare
Sync updated 0029 patch from nert-next/rk356x-powerpin-additions: - Add SLPPOL_H step before pinctrl mux (Zetarancio feedback) - Disable OTG switch before SLPPIN sequence (sydarn RGB30 USB drain) - Full BSP ordering: OTG_OFF → NULL_FUN → SLPPOL_H → pinctrl → DN_FUN
This fixes a source of phantom drain on 353(m/p/v) and RGB30 whilst off many users encounter. Original testing done by @Zetarancio targeting the miyoo flip and then adapted to mainline compatible patchset for both rk3566 and rk3568 targets by myself with LLM assistance.
Tested on miyoo flip (out of tree), rgb30,353p, rgds (with -next branch).
Lazy pinctrl acquisition for RK817/RK809 SLPPIN (GPIO0_PA2):
DTS changes for Anbernic RG-DS and Powkiddy RK2023:
ON/OFF source logging reads RK817_ON_SOURCE_REG and RK817_OFF_SOURCE_REG at probe time for power-cycle debugging (cold-start, watchdog, RTC wake, clean shutdown vs under-voltage).