Re: [PATCH v4 3/4] thermal/drivers/cpuidle_cooling: Change the registration function
From: Konrad Dybcio
Date: Fri Apr 11 2025 - 16:14:33 EST
On 4/29/20 12:36 PM, Daniel Lezcano wrote:
> Today, there is no user for the cpuidle cooling device. The targetted
> platform is ARM and ARM64.
>
> The cpuidle and the cpufreq cooling device are based on the device tree.
>
> As the cpuidle cooling device can have its own configuration depending
> on the platform and the available idle states. The DT node description
> will give the optional properties to set the cooling device up.
>
> Do no longer rely on the CPU node which is prone to error and will
> lead to a confusion in the DT because the cpufreq cooling device is
> also using it. Let initialize the cpuidle cooling device with the DT
> binding.
[...]
> -int cpuidle_cooling_register(struct cpuidle_driver *drv)
> +void cpuidle_cooling_register(struct cpuidle_driver *drv)
> {
> - return cpuidle_of_cooling_register(NULL, drv);
> + struct device_node *cooling_node;
> + struct device_node *cpu_node;
> + int cpu, ret;
> +
> + for_each_cpu(cpu, drv->cpumask) {
> +
> + cpu_node = of_cpu_device_node_get(cpu);
> +
> + cooling_node = of_get_child_by_name(cpu_node, "thermal-idle");
> +
> + of_node_put(cpu_node);
> +
> + if (!cooling_node) {
> + pr_debug("'thermal-idle' node not found for cpu%d\n", cpu);
> + continue;
> + }
> +
> + ret = __cpuidle_cooling_register(cooling_node, drv);
[5 years later, adding some folks & linux-arm-msm]
So this commit changed the driver so that idle injection cooling is
only initialized if the dt configuration is present - should we not
always register it, with some sane defaults?
Konrad