linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: dawei.chien@mediatek.com (dawei chien)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 3/3] thermal: mediatek: Add cpu dynamic power cooling model.
Date: Mon, 30 Nov 2015 18:21:24 +0800	[thread overview]
Message-ID: <1448878884.29031.49.camel@mtksdaap41> (raw)
In-Reply-To: <20151130093042.GA8556@ubuntu>

On Mon, 2015-11-30 at 15:00 +0530, Viresh Kumar wrote:
> On 30-11-15, 17:26, dawei chien wrote:
> > On Mon, 2015-11-30 at 11:08 +0530, Viresh Kumar wrote:
> > > On 27-11-15, 17:32, Dawei Chien wrote:
> > > > MT8173 cpufreq driver use of_cpufreq_power_cooling_register registering
> > > > cooling devices with dynamic power coefficient.
> > > > 
> > > > Signed-off-by: Dawei Chien <dawei.chien@mediatek.com>
> > > > ---
> > > > This patch is base on patchset:
> > > > https://lkml.org/lkml/2015/11/17/251
> > > > ---
> > > >  drivers/cpufreq/mt8173-cpufreq.c |   28 ++++++++++++++++++++--------
> > > >  1 file changed, 20 insertions(+), 8 deletions(-)
> > > > 
> > > > diff --git a/drivers/cpufreq/mt8173-cpufreq.c b/drivers/cpufreq/mt8173-cpufreq.c
> > > > index 83001dc..4d39468 100644
> > > > --- a/drivers/cpufreq/mt8173-cpufreq.c
> > > > +++ b/drivers/cpufreq/mt8173-cpufreq.c
> > > > @@ -263,24 +263,34 @@ static int mtk_cpufreq_set_target(struct cpufreq_policy *policy,
> > > >  	return 0;
> > > >  }
> > > >  
> > > > +#define DYNAMIC_POWER "dynamic-power-coefficient"
> > > > +
> > > >  static void mtk_cpufreq_ready(struct cpufreq_policy *policy)
> > > >  {
> > > >  	struct mtk_cpu_dvfs_info *info = policy->driver_data;
> > > >  	struct device_node *np = of_node_get(info->cpu_dev->of_node);
> > > > +	u32 capacitance;
> > > >  
> > > >  	if (WARN_ON(!np))
> > > >  		return;
> > > >  
> > > >  	if (of_find_property(np, "#cooling-cells", NULL)) {
> > > > -		info->cdev = of_cpufreq_cooling_register(np,
> > > > -							 policy->related_cpus);
> > > > +		if (!info->cdev) {
> > > 
> > > Why will info->cdev be non-NULL here ?
> > 
> > This is a error-checking to avoid user or any script by command line hotplug CPU
> > more than two times, we don't need to register cooling device on this case.
> 
> Why?
As far as I know, user or shell script has the right for using command online/offline cpu.
Either user by console or shell script could make cpu2 online even cpu2 already onlined.
That could cause of_cpufreq_cooling_register execute many times for the
same cooling device.

"echo 1 > /sys/devices/system/cpu/cpu2/online"

With above hotplug command, mtk_cpufreq_ready will register cooling
device again as well, but fail since the cooling device already created,
so we might need not register cooling device again on this case.

> > I will remove it if you don't agree it.
> 
> No, my agreeing or not doesn't matter. If what you are doing is useful
> (and I am not able to understand it), then you should make me
> understand that and don't change your code.
> 
> But, I really do not get the reasoning behind the logic. Please
> elaborate that step by step.

Please refer to above explaining, thank you.

> > > > @@ -460,7 +470,9 @@ static int mtk_cpufreq_exit(struct cpufreq_policy *policy)
> > > >  {
> > > >  	struct mtk_cpu_dvfs_info *info = policy->driver_data;
> > > >  
> > > > -	cpufreq_cooling_unregister(info->cdev);
> > > > +	if (info->cdev)
> > > > +		cpufreq_cooling_unregister(info->cdev);
> > > > +
> > > 
> > > Why do you need to update this?
> > 
> > This is a error-checking to avoid user or any script by command line
> > unplug CPU more than two times, we don't need to unregister cooling
> > device on this case.
> > 
> > I will remove it if you don't agree it.
> 
> Same here.
Please refer to the same reason as above. thank you.

  reply	other threads:[~2015-11-30 10:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-27  9:32 [PATCH v4 0/3] thermal: mediatek: Add cpu power cooling model Dawei Chien
2015-11-27  9:32 ` [PATCH v4 1/3] arm64: dts: mt8173: Add thermal zone node Dawei Chien
2015-11-27  9:32 ` [PATCH v4 2/3] arm64: dts: mt8173: Add dynamic power node Dawei Chien
2015-11-27  9:32 ` [PATCH v4 3/3] thermal: mediatek: Add cpu dynamic power cooling model Dawei Chien
2015-11-30  5:38   ` Viresh Kumar
2015-11-30  9:26     ` dawei chien
2015-11-30  9:30       ` Viresh Kumar
2015-11-30 10:21         ` dawei chien [this message]
2015-11-30 10:34           ` Viresh Kumar
2015-11-30 12:16             ` dawei chien

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=1448878884.29031.49.camel@mtksdaap41 \
    --to=dawei.chien@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.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).