Skip to content

[powersave] USB subsystem runtime PM: missing support in eUSB PHY etc.

Ever since runtime PM support was added to qcom,dwc3 it was forbidden by default, requiring manually setting power/control to auto.

I made this script for x1e80100:

#!/bin/bash
echo auto >/sys/devices/platform/soc@0/fda000.phy/power/control
echo auto >/sys/devices/platform/soc@0/fd5000.phy/power/control
echo auto >/sys/devices/platform/soc@0/88e5000.phy/power/control
echo auto >/sys/devices/platform/soc@0/88e3000.phy/power/control
echo auto >/sys/devices/platform/soc@0/a8f8800.usb/a800000.usb/power/control
echo auto >/sys/devices/platform/soc@0/a8f8800.usb/a800000.usb/xhci-hcd.*.auto/power/control
echo auto >/sys/devices/platform/soc@0/a6f8800.usb/a600000.usb/power/control
echo auto >/sys/devices/platform/soc@0/a6f8800.usb/a600000.usb/xhci-hcd.*.auto/power/control
echo auto >/sys/devices/platform/soc@0/a4f8800.usb/a400000.usb/power/control
echo auto >/sys/devices/platform/soc@0/a4f8800.usb/a400000.usb/xhci-hcd.*.auto/power/control
echo auto >/sys/devices/platform/soc@0/a2f8800.usb/a200000.usb/power/control
echo auto >/sys/devices/platform/soc@0/a2f8800.usb/a200000.usb/xhci-hcd.*.auto/power/control

# can't turn *all* of them off?
echo auto >/sys/devices/platform/soc@0/a8f8800.usb/power/control
echo auto >/sys/devices/platform/soc@0/a6f8800.usb/power/control
# echo auto >/sys/devices/platform/soc@0/a4f8800.usb/power/control
echo auto >/sys/devices/platform/soc@0/a2f8800.usb/power/control

and that seems to save close to 0.3W in screen-off idle already. But that's still missing a lot:

❯ cat /sys/kernel/debug/pm_genpd/pm_genpd_summary
[..]
gcc_usb_2_phy_gdsc              on                              0
gcc_usb_1_phy_gdsc              on                              0
    fda000.phy                      active                      0           SW
    aux_bridge.aux_bridge.1         unsupported                 0           SW
gcc_usb_0_phy_gdsc              on                              0
    fd5000.phy                      active                      0           SW
    aux_bridge.aux_bridge.0         unsupported                 0           SW
gcc_usb4_2_gdsc                 off-0                           0
gcc_usb4_1_gdsc                 off-0                           0
gcc_usb4_0_gdsc                 off-0                           0
gcc_usb3_mp_ss1_phy_gdsc        on                              0
    88e5000.phy                     active                      0           SW
gcc_usb3_mp_ss0_phy_gdsc        on                              0
    88e3000.phy                     active                      0           SW
gcc_usb30_tert_gdsc             on                              0
gcc_usb30_sec_gdsc              on                              0
    a8f8800.usb                     suspended                   0           SW
gcc_usb30_prim_gdsc             on                              0
    a6f8800.usb                     suspended                   0           SW
gcc_usb30_mp_gdsc               on                              256
    a4f8800.usb                     active                      256         SW
gcc_usb20_prim_gdsc             on                              0
    a2f8800.usb                     suspended                   0           SW

(why are the GDSCs that only have the suspended dwc3 on them still on?! I really don't understand how that works.. are there hardware-level interdependencies between GDSCs?)

But the weirdest thing is "can't turn all of them off" — as soon as I set all top-level usb nodes (qcom,dwc3 ones) to auto and the autosuspend delay passes, i2c input stops working (even as the display keeps updating) and the system promptly resets.

Monitoring dmesg -w during that reset, powering down the usb20_prim when the other ones are already suspended, I managed to see the HS-PHY not in L2 message.

If PHY runtime PM support is what's missing.. it's not good that the failure mode would be a system reset heh. But also yeah, phy-snps-eusb2 and phy-qcom-eusb2-repeater don't support runtime PM right now.

The fda000/fd5000 qmpphys aren't being suspended either possibly due to the DP aux_bridge..?

P.S. I haven't yet tested the reset thing without extra random PM related changes :) this was all with .use_rpm = true added to gcc-x1e80100.c and other stuff.

Edited by Val Packett
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information