lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221202091111.1682-1-di.shen@unisoc.com>
Date:   Fri, 2 Dec 2022 17:11:11 +0800
From:   Di Shen <di.shen@...soc.com>
To:     <rafael@...nel.org>, <daniel.lezcano@...aro.org>,
        <amitk@...nel.org>, <rui.zhang@...el.com>
CC:     <linux-pm@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <xuewen.yan@...soc.com>, <di.shen@...soc.com>
Subject: [PATCH V2] thermal/of: Allow users to set governor for a thermal zone in DT

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@...soc.com>
---
 drivers/thermal/thermal_of.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
index d4b6335ace15..4a29ac3be2ac 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,11 @@ 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 - 1);
+		tzp->governor_name[THERMAL_NAME_LENGTH - 1] = '\0';
+	}
+
 	/*
 	 * For now, the thermal framework supports only one sensor per
 	 * thermal zone. Thus, we are considering only the first two
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ