linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Chanwoo Choi <cw00.choi@samsung.com>
Cc: Hsin-Yi Wang <hsinyi@chromium.org>,
	"Viresh Kumar )" <vireshk@kernel.org>, Nishanth Menon <nm@ti.com>,
	Stephen Boyd <sboyd@kernel.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	"andrew-sh . cheng" <andrew-sh.cheng@mediatek.com>
Subject: Re: [PATCH] opp: of: Allow lazy-linking of required-opps to non genpd
Date: Wed, 16 Jun 2021 14:39:45 +0530	[thread overview]
Message-ID: <20210616090945.sn337tftdcp7y7y6@vireshk-i7> (raw)
In-Reply-To: <b9310754-2105-2a93-ecbf-513d9a80a91a@samsung.com>

On 16-06-21, 17:47, Chanwoo Choi wrote:
> On 6/16/21 4:55 PM, Viresh Kumar wrote:
> > On 16-06-21, 13:33, Hsin-Yi Wang wrote:
> >> Don't limit required_opp_table to genpd only. One possible use case is
> >> cpufreq based devfreq governor, which can use required-opps property to
> >> derive devfreq from cpufreq.
> >>
> >> Suggested-by: Chanwoo Choi <cw00.choi@samsung.com>
> >> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> >> ---
> >> This is tested with the non genpd case mt8183-cci with passive
> >> governor[1].
> >> [1] https://patchwork.kernel.org/project/linux-mediatek/patch/1616499241-4906-2-git-send-email-andrew-sh.cheng@mediatek.com/
> >> ---
> >>  drivers/opp/of.c | 20 +-------------------
> >>  1 file changed, 1 insertion(+), 19 deletions(-)
> >>
> >> diff --git a/drivers/opp/of.c b/drivers/opp/of.c
> >> index aa75a1caf08a3..9573facce53a5 100644
> >> --- a/drivers/opp/of.c
> >> +++ b/drivers/opp/of.c
> >> @@ -201,17 +201,6 @@ static void _opp_table_alloc_required_tables(struct opp_table *opp_table,
> >>  			lazy = true;
> >>  			continue;
> >>  		}
> >> -
> >> -		/*
> >> -		 * We only support genpd's OPPs in the "required-opps" for now,
> >> -		 * as we don't know how much about other cases. Error out if the
> >> -		 * required OPP doesn't belong to a genpd.
> >> -		 */
> >> -		if (!required_opp_tables[i]->is_genpd) {
> >> -			dev_err(dev, "required-opp doesn't belong to genpd: %pOF\n",
> >> -				required_np);
> >> -			goto free_required_tables;
> >> -		}
> >>  	}
> >>  
> >>  	/* Let's do the linking later on */
> >> @@ -379,13 +368,6 @@ static void lazy_link_required_opp_table(struct opp_table *new_table)
> >>  	struct dev_pm_opp *opp;
> >>  	int i, ret;
> >>  
> >> -	/*
> >> -	 * We only support genpd's OPPs in the "required-opps" for now,
> >> -	 * as we don't know much about other cases.
> >> -	 */
> >> -	if (!new_table->is_genpd)
> >> -		return;
> >> -
> >>  	mutex_lock(&opp_table_lock);
> >>  
> >>  	list_for_each_entry_safe(opp_table, temp, &lazy_opp_tables, lazy) {
> >> @@ -873,7 +855,7 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table,
> >>  		return ERR_PTR(-ENOMEM);
> >>  
> >>  	ret = _read_opp_key(new_opp, opp_table, np, &rate_not_available);
> >> -	if (ret < 0 && !opp_table->is_genpd) {
> >> +	if (ret < 0) {
> >>  		dev_err(dev, "%s: opp key field not found\n", __func__);
> >>  		goto free_opp;
> >>  	}
> > 
> > Plus this and few changes to commit log.
> > 
> > diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> > index e366218d6736..b335c077f215 100644
> > --- a/drivers/opp/core.c
> > +++ b/drivers/opp/core.c
> > @@ -893,6 +893,16 @@ static int _set_required_opps(struct device *dev,
> >         if (!required_opp_tables)
> >                 return 0;
> >  
> > +       /*
> > +        * We only support genpd's OPPs in the "required-opps" for now, as we
> > +        * don't know much about other use cases. Error out if the required OPP
> > +        * doesn't belong to a genpd.
> > +        */
> > +       if (unlikely(!required_opp_tables[0]->is_genpd)) {
> > +               dev_err(dev, "required-opps don't belong to a genpd\n");
> > +               return -ENOENT;
> > +       }
> > +
> 
> If you add this checking statement, I think that 
> when using dev_pm_opp_set_rate with required-opp property, it will be failed.

Yes, that is exactly what I am trying to do here. Hsin already
confirmed that you guys won't use this API, isn't ?

The point here is that the _set_required_opps() function only updates
the performance state of genpds today. So it won't work for you guys
anyway.

-- 
viresh

  reply	other threads:[~2021-06-16  9:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-16  5:33 [PATCH] opp: of: Allow lazy-linking of required-opps to non genpd Hsin-Yi Wang
2021-06-16  5:58 ` Viresh Kumar
2021-06-16  6:25   ` Hsin-Yi Wang
2021-06-16  7:09     ` Viresh Kumar
2021-06-16  7:55 ` Viresh Kumar
2021-06-16  8:47   ` Chanwoo Choi
2021-06-16  9:09     ` Viresh Kumar [this message]
2021-06-16  9:20       ` Hsin-Yi Wang
2021-06-17  1:13       ` Chanwoo Choi
2021-06-17  3:33         ` Viresh Kumar
2021-06-17  4:09           ` Chanwoo Choi
2021-06-17  4:00             ` Viresh Kumar
2021-06-17  4:27               ` Chanwoo Choi

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=20210616090945.sn337tftdcp7y7y6@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=andrew-sh.cheng@mediatek.com \
    --cc=cw00.choi@samsung.com \
    --cc=hsinyi@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=sboyd@kernel.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).