All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] thermal/of: Allow users to set governor for a thermal zone in DT
@ 2022-12-01  8:54 Di Shen
  2022-12-01 18:42 ` kernel test robot
  0 siblings, 1 reply; 4+ messages in thread
From: Di Shen @ 2022-12-01  8:54 UTC (permalink / raw)
  To: rafael, daniel.lezcano, amitk, rui.zhang
  Cc: linux-pm, linux-kernel, xuewen.yan

The governor of all thermal zones can be initialized in
thermal_zone_device_register_with_trips(), but it is always the
def_governor, this means the governor of all thermal zones are
the same.

Allow users to set governor for a specific thermal zone in DT, in
this way, users can use different policies for thermal management.

Signed-off-by: Di Shen <di.shen@unisoc.com>
---
 drivers/thermal/thermal_of.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
index d4b6335ace15..5dd4101dffb6 100644
--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -355,6 +355,7 @@ static struct thermal_zone_params *thermal_of_parameters_init(struct device_node
 	int coef[2];
 	int ncoef = ARRAY_SIZE(coef);
 	int prop, ret;
+	const char *governor_name;
 
 	tzp = kzalloc(sizeof(*tzp), GFP_KERNEL);
 	if (!tzp)
@@ -365,6 +366,9 @@ static struct thermal_zone_params *thermal_of_parameters_init(struct device_node
 	if (!of_property_read_u32(np, "sustainable-power", &prop))
 		tzp->sustainable_power = prop;
 
+	if (!of_property_read_string(np, "policy", &governor_name))
+		strncpy(tzp->governor_name, governor_name, THERMAL_NAME_LENGTH);
+
 	/*
 	 * For now, the thermal framework supports only one sensor per
 	 * thermal zone. Thus, we are considering only the first two
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-02 17:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-01  8:54 [PATCH] thermal/of: Allow users to set governor for a thermal zone in DT Di Shen
2022-12-01 18:42 ` kernel test robot
2022-12-02  9:11   ` [PATCH V2] " Di Shen
2022-12-02 17:06     ` Matthias Kaehlcke

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.