![]() |
RT-Thread RTOS
An open source embedded real-time operating system
|
**components/drivers/power/reset/** — drivers that hook system-wide power off or CPU reset, not per-IP reset lines (Reset controller).
Kconfig: **RT_USING_POWER_RESET**, plus **RT_POWER_RESET_GPIO_*** or **RT_POWER_RESET_SYSCON_***.
API header: **components/drivers/include/drivers/core/power.h** — details in System power off and reboot (core).
These drivers are platform drivers whose **probe** registers a callback with the DM power core. They do not register a char device for normal I/O.
mode | When invoked |
|---|---|
**RT_DM_POWER_OFF_MODE_SHUTDOWN** | System power off (**rt_hw_cpu_shutdown**) |
**RT_DM_POWER_OFF_MODE_RESET** | Warm reset path (**rt_hw_cpu_reset**) |
priority (low → high) | Typical use |
|---|---|
**RT_DM_POWER_OFF_PRIO_PLATFORM** | SoC flush |
**RT_DM_POWER_OFF_PRIO_LOW / DEFAULT / HIGH** | Drivers, filesystem sync |
**RT_DM_POWER_OFF_PRIO_FIRMWARE** | Last handoff |
Callbacks run in order; non-**RT_EOK** is logged but later handlers still run.
**dev**: passed to callback as **dev->user_data** context holder (GPIO drivers store private struct in **user_data**).
| Driver | Compatible / binding | Registration |
|---|---|---|
**gpio-poweroff** | **gpio-poweroff** | **RT_DM_POWER_OFF_MODE_SHUTDOWN**, **rt_pin_get_named_pin** |
**gpio-restart** | **gpio-restart** | **RT_DM_POWER_OFF_MODE_RESET** |
**syscon-poweroff** | syscon reg | MMIO write in callback |
**syscon-reboot** | syscon reg | reset trigger |
**syscon-reboot-mode** | NVMEM + syscon | **rt_dm_reboot_mode_register** |
All use **RT_PLATFORM_DRIVER_EXPORT** except some syscon drivers use **INIT_SUBSYS_EXPORT + rt_platform_driver_register** (same binding, different init level — see Platform bus).
DT:
**syscon-reboot-mode** persists mode to NVMEM/syscon so the next boot loader can read it. See **reboot-mode.h**, System power off and reboot (core).
BSP sets after handlers:
Without these, callbacks may run but SoC never powers off.
| Issue | Mitigation |
|---|---|
| Wrong GPIO polarity | Match **gpios** flags and **active_value** from **rt_pin_get_named_pin** |
**RT_USING_PINCTRL off** for gpio-poweroff | Kconfig depends on pinctrl for pad mux |
Confuse with **rt_reset_control** | IP reset lines ≠ system poweroff |
| Handler sleeps in IRQ context | GPIO driver uses **rt_thread_mdelay** — ensure thread context |
No **rt_dm_machine_shutdown** | Set BSP hook |
components/drivers/power/reset/