linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephan Gerhold <stephan@gerhold.net>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Viresh Kumar <vireshk@kernel.org>, Nishanth Menon <nm@ti.com>,
	Stephen Boyd <sboyd@kernel.org>,
	linux-pm@vger.kernel.org,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Rafael Wysocki <rjw@rjwysocki.net>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] opp: Allow opp-level to be set to 0
Date: Mon, 14 Sep 2020 22:11:32 +0200	[thread overview]
Message-ID: <20200914201132.GA163547@gerhold.net> (raw)
In-Reply-To: <40b676a1e261d1cfd12788d88e0d2026dbbe226b.1599817789.git.viresh.kumar@linaro.org>

On Fri, Sep 11, 2020 at 03:19:53PM +0530, Viresh Kumar wrote:
> The DT bindings don't put such a constraint, nor should the kernel. It
> is perfectly fine for opp-level to be set to 0, if we need to put the
> performance state votes for a domain for a particular OPP.
> 
> Reported-by: Stephan Gerhold <stephan@gerhold.net>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

I tried adding an opp-level = <0> and voting for it using required-opps
for some of the OPPs in the CPU OPP table and it seems to work fine now.

Tested-by: Stephan Gerhold <stephan@gerhold.net>

Just need to solve the "enable power domains" problem now :)

Thanks!
Stephan

> ---
>  drivers/opp/core.c |  3 ---
>  drivers/opp/of.c   | 20 +++++++-------------
>  2 files changed, 7 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index 214c1619b445..2483e765318a 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -2117,9 +2117,6 @@ int dev_pm_opp_xlate_performance_state(struct opp_table *src_table,
>  	int dest_pstate = -EINVAL;
>  	int i;
>  
> -	if (!pstate)
> -		return 0;
> -
>  	/*
>  	 * Normally the src_table will have the "required_opps" property set to
>  	 * point to one of the OPPs in the dst_table, but in some cases the
> diff --git a/drivers/opp/of.c b/drivers/opp/of.c
> index e72753be7dc7..87f839a1899a 100644
> --- a/drivers/opp/of.c
> +++ b/drivers/opp/of.c
> @@ -842,7 +842,7 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table,
>  static int _of_add_opp_table_v2(struct device *dev, struct opp_table *opp_table)
>  {
>  	struct device_node *np;
> -	int ret, count = 0, pstate_count = 0;
> +	int ret, count = 0;
>  	struct dev_pm_opp *opp;
>  
>  	/* OPP table is already initialized for the device */
> @@ -876,20 +876,14 @@ static int _of_add_opp_table_v2(struct device *dev, struct opp_table *opp_table)
>  		goto remove_static_opp;
>  	}
>  
> -	list_for_each_entry(opp, &opp_table->opp_list, node)
> -		pstate_count += !!opp->pstate;
> -
> -	/* Either all or none of the nodes shall have performance state set */
> -	if (pstate_count && pstate_count != count) {
> -		dev_err(dev, "Not all nodes have performance state set (%d: %d)\n",
> -			count, pstate_count);
> -		ret = -ENOENT;
> -		goto remove_static_opp;
> +	list_for_each_entry(opp, &opp_table->opp_list, node) {
> +		/* Any non-zero performance state would enable the feature */
> +		if (opp->pstate) {
> +			opp_table->genpd_performance_state = true;
> +			break;
> +		}
>  	}
>  
> -	if (pstate_count)
> -		opp_table->genpd_performance_state = true;
> -
>  	return 0;
>  
>  remove_static_opp:
> -- 
> 2.25.0.rc1.19.g042ed3e048af
> 

      reply	other threads:[~2020-09-14 20:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-11  9:49 [PATCH] opp: Allow opp-level to be set to 0 Viresh Kumar
2020-09-14 20:11 ` Stephan Gerhold [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=20200914201132.GA163547@gerhold.net \
    --to=stephan@gerhold.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=rjw@rjwysocki.net \
    --cc=sboyd@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    --cc=vireshk@kernel.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 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).