devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: AngeloGioacchino Del Regno  <angelogioacchino.delregno@somainline.org>
Cc: bjorn.andersson@linaro.org, agross@kernel.org, rjw@rjwysocki.net,
	devicetree@vger.kernel.org, robh+dt@kernel.org,
	amit.kucheria@linaro.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, phone-devel@vger.kernel.org,
	konrad.dybcio@somainline.org, marijn.suijten@somainline.org,
	martin.botka@somainline.org, jami.kettunen@somainline.org,
	paul.bouchara@somainline.org,
	~postmarketos/upstreaming@lists.sr.ht, jeffrey.l.hugo@gmail.com
Subject: Re: [PATCH v6 7/9] cpufreq: qcom-hw: Allow getting the maximum transition latency for OPPs
Date: Thu, 8 Jul 2021 14:11:17 +0530	[thread overview]
Message-ID: <20210708084117.gk2b4cfbr774xuvy@vireshk-i7> (raw)
In-Reply-To: <20210701105730.322718-8-angelogioacchino.delregno@somainline.org>

On 01-07-21, 12:57, AngeloGioacchino Del Regno wrote:
> In order to fine-tune the frequency scaling from various governors,
> allow to set a maximum transition latency from OPPs, which may be
> different depending on the SoC.

You are doing much more than just this, why ?

> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
> ---
>  drivers/cpufreq/qcom-cpufreq-hw.c | 35 +++++++++++++++++++++++--------
>  1 file changed, 26 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
> index 54b79fe772b6..0b80c65a22a8 100644
> --- a/drivers/cpufreq/qcom-cpufreq-hw.c
> +++ b/drivers/cpufreq/qcom-cpufreq-hw.c
> @@ -1331,6 +1331,7 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
>  	void __iomem *base;
>  	struct qcom_cpufreq_data *data;
>  	char fdom_resname[] = "freq-domainX";
> +	unsigned int transition_latency;
>  	int cpu_count, index, ret;
>  
>  	cpu_dev = get_cpu_device(policy->cpu);
> @@ -1381,22 +1382,31 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
>  	data->soc_data = of_device_get_match_data(&pdev->dev);
>  	data->base = base;
>  	data->res = res;
> +	policy->driver_data = data;
>  
> -	/* HW should be in enabled state to proceed */
> -	if (!(readl_relaxed(base + data->soc_data->reg_enable) & 0x1)) {
> -		dev_err(dev, "Domain-%d cpufreq hardware not enabled\n", index);
> -		ret = -ENODEV;
> -		goto error;
> -	}
> -
> -	qcom_get_related_cpus(index, policy->cpus);
> +	cpu_count = qcom_get_related_cpus(index, policy->cpus);
>  	if (!cpumask_weight(policy->cpus)) {
>  		dev_err(dev, "Domain-%d failed to get related CPUs\n", index);
>  		ret = -ENOENT;
>  		goto error;
>  	}
>  
> -	policy->driver_data = data;
> +	if (!data->soc_data->uses_tz) {
> +		ret = qcom_cpufreq_hw_osm_setup(cpu_dev, policy,
> +						cpu_count, index);
> +		if (ret) {
> +			dev_err(dev, "Cannot setup the OSM for CPU%d: %d\n",
> +				policy->cpu, ret);
> +			goto error;
> +		}
> +	}
> +
> +	/* HW should be in enabled state to proceed */
> +	if (!(readl_relaxed(base + data->soc_data->reg_enable) & 0x1)) {
> +		dev_err(dev, "Domain-%d cpufreq hardware not enabled\n", index);
> +		ret = -ENODEV;
> +		goto error;
> +	}

The commit log doesn't speak about any of the above.

>  
>  	ret = qcom_cpufreq_hw_read_lut(cpu_dev, policy);
>  	if (ret) {
> @@ -1411,6 +1421,12 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
>  		goto error;
>  	}
>  
> +	transition_latency = dev_pm_opp_get_max_transition_latency(cpu_dev);
> +	if (!transition_latency)
> +		transition_latency = CPUFREQ_ETERNAL;
> +
> +	policy->cpuinfo.transition_latency = transition_latency;
> +
>  	dev_pm_opp_of_register_em(cpu_dev, policy->cpus);
>  
>  	if (policy_has_boost_freq(policy)) {
> @@ -1421,6 +1437,7 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
>  
>  	return 0;
>  error:
> +	policy->driver_data = NULL;
>  	kfree(data);
>  unmap_base:
>  	iounmap(base);
> -- 
> 2.32.0

-- 
viresh

  reply	other threads:[~2021-07-08  8:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-01 10:57 [PATCH v6 0/9] cpufreq-qcom-hw: Implement full OSM programming AngeloGioacchino Del Regno
2021-07-01 10:57 ` [PATCH v6 1/9] cpufreq: blacklist SDM630/636/660 in cpufreq-dt-platdev AngeloGioacchino Del Regno
2021-07-01 10:57 ` [PATCH v6 2/9] cpufreq: blacklist MSM8998 " AngeloGioacchino Del Regno
2021-07-01 10:57 ` [PATCH v6 3/9] dt-bindings: arm: cpus: Document 'qcom,freq-domain' property AngeloGioacchino Del Regno
2021-07-08  8:37   ` Viresh Kumar
2021-07-01 10:57 ` [PATCH v6 4/9] dt-bindings: cpufreq: cpufreq-qcom-hw: Convert to YAML bindings AngeloGioacchino Del Regno
2021-07-14 21:34   ` Rob Herring
2021-07-01 10:57 ` [PATCH v6 5/9] cpufreq: qcom-hw: Add kerneldoc to some functions AngeloGioacchino Del Regno
2021-07-01 10:57 ` [PATCH v6 6/9] cpufreq: qcom-hw: Implement CPRh aware OSM programming AngeloGioacchino Del Regno
2021-07-01 10:57 ` [PATCH v6 7/9] cpufreq: qcom-hw: Allow getting the maximum transition latency for OPPs AngeloGioacchino Del Regno
2021-07-08  8:41   ` Viresh Kumar [this message]
2021-07-01 10:57 ` [PATCH v6 8/9] dt-bindings: cpufreq: qcom-hw: Add bindings for 8998 AngeloGioacchino Del Regno
2021-07-14 21:39   ` Rob Herring
2021-07-21 10:48     ` AngeloGioacchino Del Regno
2021-07-01 10:57 ` [PATCH v6 9/9] dt-bindings: cpufreq: qcom-hw: Make reg-names a required property AngeloGioacchino Del Regno
2021-07-13 22:42   ` Rob Herring
2021-07-29 13:28     ` AngeloGioacchino Del Regno

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=20210708084117.gk2b4cfbr774xuvy@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=agross@kernel.org \
    --cc=amit.kucheria@linaro.org \
    --cc=angelogioacchino.delregno@somainline.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jami.kettunen@somainline.org \
    --cc=jeffrey.l.hugo@gmail.com \
    --cc=konrad.dybcio@somainline.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=martin.botka@somainline.org \
    --cc=paul.bouchara@somainline.org \
    --cc=phone-devel@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=robh+dt@kernel.org \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /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;
as well as URLs for NNTP newsgroup(s).