[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240110072906.7vnqykkcw3rkhoxa@vireshk-i7>
Date: Wed, 10 Jan 2024 12:59:06 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Sibi Sankar <quic_sibis@...cinc.com>
Cc: sudeep.holla@....com, cristian.marussi@....com, rafael@...nel.org,
linux-arm-kernel@...ts.infradead.org, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org, quic_mdtipton@...cinc.com,
linux-arm-msm@...r.kernel.org
Subject: Re: [PATCH 2/3] firmware: arm_scmi: Add perf_opp_xlate interface
On 08-01-24, 19:31, Sibi Sankar wrote:
> Add a new perf_opp_xlate interface to the existing perf_ops to translate
> a given perf index to frequency.
>
> This can be used by the cpufreq driver and framework to determine the
> throttled frequency from a given perf index and apply HW pressure
> accordingly.
>
> Signed-off-by: Sibi Sankar <quic_sibis@...cinc.com>
> ---
> drivers/firmware/arm_scmi/perf.c | 21 +++++++++++++++++++++
> include/linux/scmi_protocol.h | 3 +++
> 2 files changed, 24 insertions(+)
>
> diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
> index c167bb5e3607..f26390924e1c 100644
> --- a/drivers/firmware/arm_scmi/perf.c
> +++ b/drivers/firmware/arm_scmi/perf.c
> @@ -964,6 +964,26 @@ static int scmi_notify_support(const struct scmi_protocol_handle *ph, u32 domain
> return 0;
> }
>
> +static int scmi_perf_opp_xlate(const struct scmi_protocol_handle *ph, u32 domain,
> + int idx, unsigned long *freq)
> +{
> + struct perf_dom_info *dom;
> +
> + dom = scmi_perf_domain_lookup(ph, domain);
> + if (IS_ERR(dom))
> + return PTR_ERR(dom);
> +
> + if (idx >= dom->opp_count)
> + return -ERANGE;
> +
> + if (!dom->level_indexing_mode)
> + *freq = dom->opp[idx].perf * dom->mult_factor;
> + else
> + *freq = dom->opp[idx].indicative_freq * dom->mult_factor;
> +
> + return 0;
> +}
> +
> static const struct scmi_perf_proto_ops perf_proto_ops = {
> .num_domains_get = scmi_perf_num_domains_get,
> .info_get = scmi_perf_info_get,
> @@ -979,6 +999,7 @@ static const struct scmi_perf_proto_ops perf_proto_ops = {
> .fast_switch_possible = scmi_fast_switch_possible,
> .power_scale_get = scmi_power_scale_get,
> .perf_notify_support = scmi_notify_support,
> + .perf_opp_xlate = scmi_perf_opp_xlate,
The use of "opp" here is a bit confusing as this doesn't have anything to do
with the OPP framework and you are only getting the frequency out of it after
all.
--
viresh
Powered by blists - more mailing lists