From fef1a0702db29090d032ada950f478d7030e99f2 Mon Sep 17 00:00:00 2001 From: wangjianyu3 Date: Tue, 11 Feb 2025 15:50:39 +0800 Subject: [PATCH] drivers/thermal/dummy: Add another passive cooling device For case that CPUFreq was not enabled. Signed-off-by: wangjianyu3 --- 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 42b2ce9aada..0d96919f1cf 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 */