summaryrefslogtreecommitdiff
path: root/components/drivers/pm/pm.c
diff options
context:
space:
mode:
Diffstat (limited to 'components/drivers/pm/pm.c')
-rw-r--r--components/drivers/pm/pm.c22
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);
}
}