USB 电源管理、Autosuspend 与远程唤醒

USB 电源管理、Autosuspend 与远程唤醒

1. 层级

1
2
3
4
5
interface runtime PM
-> usb_device autosuspend
-> hub port suspend
-> root hub/HCD runtime PM
-> PHY/clock/power domain

任一活跃child都可能阻止上层suspend。

2. Autosuspend

USB Core维护usage count、last_busy、autosuspend delay和disable depth。Driver需声明supports_autosuspend并正确使用:

  • usb_autopm_get_interface*()
  • usb_autopm_put_interface*()
  • usb_mark_last_busy()

3. Sysfs

1
2
3
cat /sys/bus/usb/devices/1-1/power/control
cat /sys/bus/usb/devices/1-1/power/autosuspend_delay_ms
cat /sys/bus/usb/devices/1-1/power/wakeup

on禁用runtime autosuspend,auto允许;临时改为on只用于定位。

4. Remote wake

设备、configuration、driver、hub、HCD和平台IRQ链均需支持。启用sysfs wakeup不代表PHY/board已经满足。

5. Suspend流程

Interface drivers先suspend并停止URB;随后device/port和HCD suspend。Resume顺序反向。reset_resume用于设备掉电/失去state后的重新初始化。

6. Persist

系统休眠中供电丢失时设备会disappear/re-enumerate。CONFIG_USB_DEFAULT_PERSIST在本defconfig明确关闭;个别device可通过persist属性控制,但仅适合能保持身份/state的设备。

7. DWC3

需要协调:

-xHCI child或UDC;
-event buffers;
-UTMI/PIPE clocks;
-USB2/USB3 PHY;
-DWC3 core runtime PM;
-role switch;
-PD/Type-C;
-RK3588 USB power domain。

8. VBUS

Host suspend不等于必须关VBUS。关VBUS会导致disconnect;保留VBUS增加功耗。策略取决于wake和产品需求。

9. 常见问题

-autosuspend后设备反复reset;
-UVC/UAS高负载恢复失败;
-root hub无法suspend;
-remote wake后HC died;
-Type-C detach与runtime suspend竞态;
-PHY clock提前关闭。

10. 排查

记录每层runtime_status、usage、wakeup和DWC3/xHCI日志,避免直接全局关闭autosuspend掩盖driver引用泄漏。

文章互动

阅读 --

留言

0 条留言

正在加载留言…