public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <mka@chromium.org>
To: Di Shen <di.shen@unisoc.com>
Cc: rafael@kernel.org, daniel.lezcano@linaro.org, amitk@kernel.org,
	rui.zhang@intel.com, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, xuewen.yan@unisoc.com
Subject: Re: [PATCH V2] thermal/of: Allow users to set governor for a thermal zone in DT
Date: Fri, 2 Dec 2022 17:06:56 +0000	[thread overview]
Message-ID: <Y4owsFhh7OWGwrbr@google.com> (raw)
In-Reply-To: <20221202091111.1682-1-di.shen@unisoc.com>

On Fri, Dec 02, 2022 at 05:11:11PM +0800, Di Shen wrote:
> 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.

There have been other attempts in the past of adding this to the
device tree (e.g. [1]), which were rejected since the DT should
describe the hardware, not policy. Userspace can configure thermal
zones to use a non-default governor through sysfs.

[1] https://lore.kernel.org/all/3b80853abb45a9e067cf7a16754b07bb67712457.1520274879.git.amit.kucheria@linaro.org/


> 
> Signed-off-by: Di Shen <di.shen@unisoc.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
> 

      reply	other threads:[~2022-12-02 17:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y4owsFhh7OWGwrbr@google.com \
    --to=mka@chromium.org \
    --cc=amitk@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=di.shen@unisoc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=xuewen.yan@unisoc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox