All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Stuebner <heiko@sntech.de>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>,
	Finlye Xiao <finley.xiao@rock-chips.com>,
	srinivas.kandagatla@linaro.org, maxime.ripard@free-electrons.com,
	robh+dt@kernel.org, frowand.list@gmail.com, sre@kernel.org,
	dbaryshkov@gmail.com, dwmw2@infradead.org, mark.rutland@arm.com,
	khilman@kernel.org, nm@ti.com, rjw@rjwysocki.net,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	wxt@rock-chips.com, jay.xu@rock-chips.com,
	rocky.hao@rock-chips.com, tim.chen@rock-chips.com,
	tony.xie@rock-chips.com, ulysses.huang@rock-chips.com,
	lin.huang@rock-chips.com
Subject: Re: [PATCH v2 4/4] PM / AVS: rockchip-cpu-avs: add driver handling Rockchip cpu avs
Date: Mon, 26 Sep 2016 10:05:13 +0200	[thread overview]
Message-ID: <20776501.pZ2NDOzLK3@phil> (raw)
In-Reply-To: <20160926035511.GG17336@vireshk-i7>

Am Montag, 26. September 2016, 09:25:11 CEST schrieb Viresh Kumar:
> On 12-09-16, 14:55, Stephen Boyd wrote:
> > On 08/29, Viresh Kumar wrote:
> > > On 18-08-16, 16:52, Finlye Xiao wrote:
> > > > +static int rockchip_adjust_opp_table(struct device *cpu_dev,
> > > > +				     struct cpufreq_frequency_table *table,
> > > > +				     int volt)
> > > > +{
> > > > +	struct opp_table *opp_table;
> > > > +	struct cpufreq_frequency_table *pos;
> > > > +	struct dev_pm_opp *opp;
> > > > +
> > > > +	if (!volt)
> > > > +		return 0;
> > > > +
> > > > +	rcu_read_lock();
> > > > +
> > > > +	opp_table = _find_opp_table(cpu_dev);
> > > > +	if (IS_ERR(opp_table)) {
> > > > +		rcu_read_unlock();
> > > > +		return PTR_ERR(opp_table);
> > > > +	}
> > > > +
> > > > +	cpufreq_for_each_valid_entry(pos, table) {
> > > > +		opp = dev_pm_opp_find_freq_exact(cpu_dev, pos->frequency * 1000,
> > > > +						 true);
> > > > +		if (IS_ERR(opp))
> > > > +			continue;
> > > > +
> > > > +		opp->u_volt += volt;
> > > > +		opp->u_volt_min += volt;
> > > > +		opp->u_volt_max += volt;
> > > > +	}
> > > > +
> > > > +	rcu_read_unlock();
> > > > +
> > > > +	return 0;
> > > > +}
> > > 
> > > I wouldn't prefer altering the opp tables from individual drivers at
> > > all. At the least, it should be done via some helpers exposed by the
> > > core.
> > > 
> > > But before that I would like to hear from Stephen a bit as I recall he
> > > was also working on something similar.
> > 
> > I had a patch to modify the voltage at runtime for the "current"
> > OPP. Now that we have regulator and clk control inside OPP that
> > became a little easier to do without having to do some notifier
> > from the OPP layer to the consumers. I haven't had time to revive
> > those patches though. Should we do that?
> 
> Perhaps yes, we should have a common place for doing all that.
> 
> > Does this need to modify
> > anything besides the OPP the device is currently running at?
> 
> Finlye, can you please answer this ?

If I understand it correctly, depending on the leakage value stored in an 
efuse, all opp voltages are reduced by a certain value. Right now the driver 
does it in one go for the full opp table, but of course could also do it for 
each new opp individually before it gets set.

WARNING: multiple messages have this Message-ID (diff)
From: heiko@sntech.de (Heiko Stuebner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 4/4] PM / AVS: rockchip-cpu-avs: add driver handling Rockchip cpu avs
Date: Mon, 26 Sep 2016 10:05:13 +0200	[thread overview]
Message-ID: <20776501.pZ2NDOzLK3@phil> (raw)
In-Reply-To: <20160926035511.GG17336@vireshk-i7>

Am Montag, 26. September 2016, 09:25:11 CEST schrieb Viresh Kumar:
> On 12-09-16, 14:55, Stephen Boyd wrote:
> > On 08/29, Viresh Kumar wrote:
> > > On 18-08-16, 16:52, Finlye Xiao wrote:
> > > > +static int rockchip_adjust_opp_table(struct device *cpu_dev,
> > > > +				     struct cpufreq_frequency_table *table,
> > > > +				     int volt)
> > > > +{
> > > > +	struct opp_table *opp_table;
> > > > +	struct cpufreq_frequency_table *pos;
> > > > +	struct dev_pm_opp *opp;
> > > > +
> > > > +	if (!volt)
> > > > +		return 0;
> > > > +
> > > > +	rcu_read_lock();
> > > > +
> > > > +	opp_table = _find_opp_table(cpu_dev);
> > > > +	if (IS_ERR(opp_table)) {
> > > > +		rcu_read_unlock();
> > > > +		return PTR_ERR(opp_table);
> > > > +	}
> > > > +
> > > > +	cpufreq_for_each_valid_entry(pos, table) {
> > > > +		opp = dev_pm_opp_find_freq_exact(cpu_dev, pos->frequency * 1000,
> > > > +						 true);
> > > > +		if (IS_ERR(opp))
> > > > +			continue;
> > > > +
> > > > +		opp->u_volt += volt;
> > > > +		opp->u_volt_min += volt;
> > > > +		opp->u_volt_max += volt;
> > > > +	}
> > > > +
> > > > +	rcu_read_unlock();
> > > > +
> > > > +	return 0;
> > > > +}
> > > 
> > > I wouldn't prefer altering the opp tables from individual drivers at
> > > all. At the least, it should be done via some helpers exposed by the
> > > core.
> > > 
> > > But before that I would like to hear from Stephen a bit as I recall he
> > > was also working on something similar.
> > 
> > I had a patch to modify the voltage at runtime for the "current"
> > OPP. Now that we have regulator and clk control inside OPP that
> > became a little easier to do without having to do some notifier
> > from the OPP layer to the consumers. I haven't had time to revive
> > those patches though. Should we do that?
> 
> Perhaps yes, we should have a common place for doing all that.
> 
> > Does this need to modify
> > anything besides the OPP the device is currently running at?
> 
> Finlye, can you please answer this ?

If I understand it correctly, depending on the leakage value stored in an 
efuse, all opp voltages are reduced by a certain value. Right now the driver 
does it in one go for the full opp table, but of course could also do it for 
each new opp individually before it gets set.

  reply	other threads:[~2016-09-26  8:05 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-18  8:52 [PATCH v2 0/4] PM / AVS: add Rockchip cpu avs Finlye Xiao
2016-08-18  8:52 ` Finlye Xiao
2016-08-18  8:52 ` Finlye Xiao
2016-08-18  8:52 ` [PATCH v2 1/4] nvmem: rockchip-efuse: Change initcall to subsys Finlye Xiao
2016-08-18  8:52   ` Finlye Xiao
2016-08-18  8:52   ` Finlye Xiao
2016-08-18 18:28   ` Kevin Hilman
2016-08-18 18:28     ` Kevin Hilman
2016-08-18 18:28     ` Kevin Hilman
2016-08-18 22:29     ` Heiko Stuebner
2016-08-18 22:29       ` Heiko Stuebner
2016-08-18 22:29       ` Heiko Stuebner
2016-08-19 16:19       ` Kevin Hilman
2016-08-19 16:19         ` Kevin Hilman
2016-08-19 16:19         ` Kevin Hilman
2016-08-18  8:52 ` [PATCH v2 2/4] of: introduce of_property_read_s32_index Finlye Xiao
2016-08-18  8:52   ` Finlye Xiao
2016-08-18  8:52   ` Finlye Xiao
2016-08-18  8:52 ` [PATCH v2 3/4] dt-bindings: add binding document for Rockchip cpu avs Finlye Xiao
2016-08-18  8:52   ` Finlye Xiao
2016-08-18  8:52   ` Finlye Xiao
2016-08-18  8:52 ` [PATCH v2 4/4] PM / AVS: rockchip-cpu-avs: add driver handling " Finlye Xiao
2016-08-18  8:52   ` Finlye Xiao
2016-08-18  8:52   ` Finlye Xiao
2016-08-18 19:02   ` Kevin Hilman
2016-08-18 19:02     ` Kevin Hilman
2016-08-18 19:02     ` Kevin Hilman
2016-08-29  6:08   ` Viresh Kumar
2016-08-29  6:08     ` Viresh Kumar
2016-08-29  6:08     ` Viresh Kumar
2016-09-12 21:55     ` Stephen Boyd
2016-09-12 21:55       ` Stephen Boyd
2016-09-26  3:55       ` Viresh Kumar
2016-09-26  3:55         ` Viresh Kumar
2016-09-26  3:55         ` Viresh Kumar
2016-09-26  8:05         ` Heiko Stuebner [this message]
2016-09-26  8:05           ` Heiko Stuebner
2016-09-27  8:40           ` Finley Xiao
2016-09-27  8:40             ` Finley Xiao
2016-09-27  8:40             ` Finley Xiao
2016-09-27 22:14           ` Stephen Boyd
2016-09-27 22:14             ` Stephen Boyd

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=20776501.pZ2NDOzLK3@phil \
    --to=heiko@sntech.de \
    --cc=dbaryshkov@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=finley.xiao@rock-chips.com \
    --cc=frowand.list@gmail.com \
    --cc=jay.xu@rock-chips.com \
    --cc=khilman@kernel.org \
    --cc=lin.huang@rock-chips.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=maxime.ripard@free-electrons.com \
    --cc=nm@ti.com \
    --cc=rjw@rjwysocki.net \
    --cc=robh+dt@kernel.org \
    --cc=rocky.hao@rock-chips.com \
    --cc=sboyd@codeaurora.org \
    --cc=sre@kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=tim.chen@rock-chips.com \
    --cc=tony.xie@rock-chips.com \
    --cc=ulysses.huang@rock-chips.com \
    --cc=viresh.kumar@linaro.org \
    --cc=wxt@rock-chips.com \
    /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.