All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Andy Gross <agross@kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org,
	Thara Gopinath <thara.gopinath@gmail.com>
Subject: Re: [PATCH v2 4/4] cpufreq: qcom-hw: provide online/offline operations
Date: Thu, 24 Mar 2022 09:08:10 -0700	[thread overview]
Message-ID: <YjyXatXzL8GDrcw0@ripper> (raw)
In-Reply-To: <20220309223938.3819715-5-dmitry.baryshkov@linaro.org>

On Wed 09 Mar 14:39 PST 2022, Dmitry Baryshkov wrote:

> Provide lightweight online and offline operations. This saves us from
> parsing all the resources each time the CPU is put online.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

I think the other 3 patches are -rc material, this seems like v5.19.

Regards,
Bjorn

> ---
>  drivers/cpufreq/qcom-cpufreq-hw.c | 39 +++++++++++++++++++++++++------
>  1 file changed, 32 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
> index fe638e141003..d38b1552ec13 100644
> --- a/drivers/cpufreq/qcom-cpufreq-hw.c
> +++ b/drivers/cpufreq/qcom-cpufreq-hw.c
> @@ -403,11 +403,12 @@ static const struct of_device_id qcom_cpufreq_hw_match[] = {
>  };
>  MODULE_DEVICE_TABLE(of, qcom_cpufreq_hw_match);
>  
> +static int qcom_cpufreq_hw_lmh_online(struct cpufreq_policy *policy);
> +
>  static int qcom_cpufreq_hw_lmh_init(struct cpufreq_policy *policy, int index)
>  {
>  	struct qcom_cpufreq_data *data = policy->driver_data;
>  	struct platform_device *pdev = cpufreq_get_driver_data();
> -	int ret;
>  
>  	/*
>  	 * Look for LMh interrupt. If no interrupt line is specified /
> @@ -419,12 +420,21 @@ static int qcom_cpufreq_hw_lmh_init(struct cpufreq_policy *policy, int index)
>  	if (data->throttle_irq < 0)
>  		return data->throttle_irq;
>  
> -	data->cancel_throttle = false;
> -	data->policy = policy;
> -
>  	mutex_init(&data->throttle_lock);
>  	INIT_DEFERRABLE_WORK(&data->throttle_work, qcom_lmh_dcvs_poll);
>  
> +	return qcom_cpufreq_hw_lmh_online(policy);
> +}
> +
> +static int qcom_cpufreq_hw_lmh_online(struct cpufreq_policy *policy)
> +{
> +	struct qcom_cpufreq_data *data = policy->driver_data;
> +	struct platform_device *pdev = cpufreq_get_driver_data();
> +	int ret;
> +
> +	data->cancel_throttle = false;
> +	data->policy = policy;
> +
>  	snprintf(data->irq_name, sizeof(data->irq_name), "dcvsh-irq-%u", policy->cpu);
>  	ret = request_threaded_irq(data->throttle_irq, NULL, qcom_lmh_dcvs_handle_irq,
>  				   IRQF_ONESHOT | IRQF_NO_AUTOEN, data->irq_name, data);
> @@ -441,10 +451,12 @@ static int qcom_cpufreq_hw_lmh_init(struct cpufreq_policy *policy, int index)
>  	return 0;
>  }
>  
> -static void qcom_cpufreq_hw_lmh_exit(struct qcom_cpufreq_data *data)
> +static int qcom_cpufreq_hw_lmh_offline(struct cpufreq_policy *policy)
>  {
> +	struct qcom_cpufreq_data *data = policy->driver_data;
> +
>  	if (data->throttle_irq <= 0)
> -		return;
> +		return 0;
>  
>  	mutex_lock(&data->throttle_lock);
>  	data->cancel_throttle = true;
> @@ -453,6 +465,8 @@ static void qcom_cpufreq_hw_lmh_exit(struct qcom_cpufreq_data *data)
>  	cancel_delayed_work_sync(&data->throttle_work);
>  	irq_set_affinity_hint(data->throttle_irq, NULL);
>  	free_irq(data->throttle_irq, data);
> +
> +	return 0;
>  }
>  
>  static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
> @@ -567,6 +581,16 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
>  	return ret;
>  }
>  
> +static int qcom_cpufreq_hw_cpu_online(struct cpufreq_policy *policy)
> +{
> +	return qcom_cpufreq_hw_lmh_online(policy);
> +}
> +
> +static int qcom_cpufreq_hw_cpu_offline(struct cpufreq_policy *policy)
> +{
> +	return qcom_cpufreq_hw_lmh_offline(policy);
> +}
> +
>  static int qcom_cpufreq_hw_cpu_exit(struct cpufreq_policy *policy)
>  {
>  	struct device *cpu_dev = get_cpu_device(policy->cpu);
> @@ -576,7 +600,6 @@ static int qcom_cpufreq_hw_cpu_exit(struct cpufreq_policy *policy)
>  
>  	dev_pm_opp_remove_all_dynamic(cpu_dev);
>  	dev_pm_opp_of_cpumask_remove_table(policy->related_cpus);
> -	qcom_cpufreq_hw_lmh_exit(data);
>  	kfree(policy->freq_table);
>  	kfree(data);
>  	iounmap(base);
> @@ -608,6 +631,8 @@ static struct cpufreq_driver cpufreq_qcom_hw_driver = {
>  	.get		= qcom_cpufreq_hw_get,
>  	.init		= qcom_cpufreq_hw_cpu_init,
>  	.exit		= qcom_cpufreq_hw_cpu_exit,
> +	.online		= qcom_cpufreq_hw_cpu_online,
> +	.offline	= qcom_cpufreq_hw_cpu_offline,
>  	.register_em	= cpufreq_register_em_with_opp,
>  	.fast_switch    = qcom_cpufreq_hw_fast_switch,
>  	.name		= "qcom-cpufreq-hw",
> -- 
> 2.34.1
> 

      parent reply	other threads:[~2022-03-24 16:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-09 22:39 [PATCH v2 0/4] cpufreq: qcom-hw: Fixes for cpu hotplug support Dmitry Baryshkov
2022-03-09 22:39 ` [PATCH v2 1/4] cpufreq: qcom-hw: drop affinity hint before freeing the IRQ Dmitry Baryshkov
2022-03-11  8:03   ` Vladimir Zapolskiy
2022-03-17 23:03   ` Vladimir Zapolskiy
2022-03-24 16:05   ` Bjorn Andersson
2022-03-09 22:39 ` [PATCH v2 2/4] cpufreq: qcom-hw: fix the race between LMH worker and cpuhp Dmitry Baryshkov
2022-03-17 23:10   ` Vladimir Zapolskiy
2022-03-17 23:21     ` Dmitry Baryshkov
2022-03-24 16:00   ` Bjorn Andersson
2022-03-25 18:52     ` Dmitry Baryshkov
2022-03-09 22:39 ` [PATCH v2 3/4] cpufreq: qcom-hw: fix the opp entries refcounting Dmitry Baryshkov
2022-03-17 23:04   ` Vladimir Zapolskiy
2022-03-24 16:06   ` Bjorn Andersson
2022-03-09 22:39 ` [PATCH v2 4/4] cpufreq: qcom-hw: provide online/offline operations Dmitry Baryshkov
2022-03-17 23:05   ` Vladimir Zapolskiy
2022-03-24 16:08   ` Bjorn Andersson [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=YjyXatXzL8GDrcw0@ripper \
    --to=bjorn.andersson@linaro.org \
    --cc=agross@kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=thara.gopinath@gmail.com \
    --cc=viresh.kumar@linaro.org \
    /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 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.