This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit fef1a0702db29090d032ada950f478d7030e99f2
Author: wangjianyu3 <wangjian...@xiaomi.com>
AuthorDate: Tue Feb 11 15:50:39 2025 +0800

    drivers/thermal/dummy: Add another passive cooling device
    
    For case that CPUFreq was not enabled.
    
    Signed-off-by: wangjianyu3 <wangjian...@xiaomi.com>
---
 drivers/thermal/thermal_dummy.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/thermal/thermal_dummy.c b/drivers/thermal/thermal_dummy.c
index 42b2ce9aad..0d96919f1c 100644
--- a/drivers/thermal/thermal_dummy.c
+++ b/drivers/thermal/thermal_dummy.c
@@ -138,6 +138,13 @@ static const struct thermal_zone_map_s g_dummy_maps[] =
     .high   = 2,
     .weight = 20
   },
+  {
+    .trip_name = "cpu_alert0",
+    .cdev_name = "passive_dev",
+    .low    = THERMAL_NO_LIMIT,
+    .high   = THERMAL_NO_LIMIT,
+    .weight = 20
+  },
 };
 
 static const struct thermal_zone_params_s g_dummy_params =
@@ -206,6 +213,12 @@ static struct dummy_cpufreq_driver_s 
g_dummy_cpufreq_driver =
   .table = g_dummy_cpufreq_table,
   .table_len = nitems(g_dummy_cpufreq_table),
 };
+#else
+static struct dummy_cooling_device_s g_dummy_passive =
+{
+  .cur_state = 0,
+  .max_state = 1,
+};
 #endif /* CONFIG_THERMAL_DUMMY_CPUFREQ */
 
 /****************************************************************************
@@ -334,6 +347,14 @@ int thermal_dummy_init(void)
       therr("Dummy cpufreq driver init failed!\n");
       return ret;
     }
+#else
+  cdev = thermal_cooling_device_register("passive_dev", &g_dummy_passive,
+                                         &g_dummy_cooling_ops);
+  if (cdev == NULL)
+    {
+      therr("Register cooling device passive_dev failed!\n");
+      return -ENOTSUP;
+    }
 #endif /* CONFIG_THERMAL_DUMMY_CPUFREQ */
 
   /* Cooling Device */

Reply via email to