diff options
| author | GuEe-GUI <[email protected]> | 2026-06-15 11:21:24 +0800 |
|---|---|---|
| committer | Rbb666 <[email protected]> | 2026-06-23 08:02:09 +0800 |
| commit | e280f213bfba8de1b6dd0da45c4cd04e647bb56e (patch) | |
| tree | 2e31d355635a2495210e23b6a31175578adc23c9 /components/drivers/pm/pm.c | |
| parent | 1870d83956783a17b126206d92dee90ee7784c34 (diff) | |
[dm][dvfs] support Dynamic Voltage and Frequency Scaling (DVFS)
1. Support DVFS and finsh cmd, there are 6 governors:
- conservative
- freedom
- performance
- powersave
- schedutil
2. Support DVFS for SCMI.
3. Port the Cooling device for DVFS.
4. Port the PM with DVFS.
Signed-off-by: GuEe-GUI <[email protected]>
Diffstat (limited to 'components/drivers/pm/pm.c')
| -rw-r--r-- | components/drivers/pm/pm.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/components/drivers/pm/pm.c b/components/drivers/pm/pm.c index b4ad3b2bbd..9acbf00147 100644 --- a/components/drivers/pm/pm.c +++ b/components/drivers/pm/pm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2024 RT-Thread Development Team + * Copyright (c) 2006-2026 RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -11,11 +11,15 @@ * 2020-11-23 zhangsz update pm mode select * 2020-11-27 zhangsz update pm 2.0 * 2024-07-04 wdfk-prog The device is registered and uninstalled by linked list + * 2026-06-12 GuEe-GUI port DVFS support */ #include <rthw.h> #include <rtthread.h> #include <drivers/pm.h> +#ifdef RT_USING_DVFS +#include <drivers/dvfs.h> +#endif #include <stdlib.h> #ifdef RT_USING_PM @@ -119,6 +123,14 @@ static rt_err_t _pm_device_suspend(rt_uint8_t mode) device_pm = rt_slist_entry(node, struct rt_device_pm, list); if (device_pm->ops != RT_NULL && device_pm->ops->suspend != RT_NULL) { + #ifdef RT_USING_DVFS + ret = rt_dvfs_scaling_pm_suspend(device_pm, mode); + if (ret != RT_EOK) + { + break; + } + #endif /* RT_USING_DVFS */ + ret = device_pm->ops->suspend(device_pm->device, mode); if(ret != RT_EOK) { @@ -144,6 +156,10 @@ static void _pm_device_resume(rt_uint8_t mode) if (device_pm->ops != RT_NULL && device_pm->ops->resume != RT_NULL) { device_pm->ops->resume(device_pm->device, mode); + + #ifdef RT_USING_DVFS + rt_dvfs_scaling_pm_resume(device_pm, mode); + #endif } } } @@ -161,6 +177,10 @@ static void _pm_device_frequency_change(rt_uint8_t mode) device_pm = rt_slist_entry(node, struct rt_device_pm, list); if (device_pm->ops->frequency_change != RT_NULL) { + #ifdef RT_USING_DVFS + rt_dvfs_scaling_pm_frequency_change(device_pm, mode); + #endif + device_pm->ops->frequency_change(device_pm->device, mode); } } |
