linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Cc: linux-pm@vger.kernel.org, Zhang Rui <rui.zhang@intel.com>,
	Eduardo Valentin <edubezval@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Magnus Damm <magnus.damm@gmail.com>,
	linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH/RFT] thermal: rcar_gen3_thermal: Update calculation formula due to HW evaluation
Date: Mon, 1 Apr 2019 15:37:57 +0200	[thread overview]
Message-ID: <20190401133753.5luent76gyzygtcb@verge.net.au> (raw)
In-Reply-To: <1553201273-16757-1-git-send-email-ykaneko0929@gmail.com>

On Fri, Mar 22, 2019 at 05:47:53AM +0900, Yoshihiro Kaneko wrote:
> From: Dien Pham <dien.pham.ry@renesas.com>
> 
> 1/ As evaluation of hardware team, temperature calculation formula
>  of M3-W is difference from all other SoCs as below:
>  - M3-W: Tj_1: 116 (so Tj_1 - Tj_3 = 157)
>  - Others: Tj_1: 126 (so Tj_1 - Tj_3 = 167)
> 
> 2/ Update the formula to calculate CTEMP:
>   Currently, the CTEMP is average of val1 (is calculated by
>   formula 1) and val2 (is calculated by formula 2). But,
>   as description in HWM (chapter 10A.3.1.1 Setting of Normal Mode)
> 
>   If (STEMP < Tj_T) CTEMP value should be val1.
>   If (STEMP > Tj_T) CTEMP value should be val2.
> 
> 3/ Update the formula to calculate temperature:
>   Currently, current TEMP is calculated as
>   average of val1 (is calculated by formula 1)
>   and val2 (is calculated by formula 2). But,
>   as description in HWM (chapter 10A.3.1.2 Normal Mode.)
> 
>   If (TEMP_CODE < THCODE2[11:0]) CTEMP value should be val1.
>   If (TEMP_CODE > THCODE2[11:0]) CTEMP value should be val2.
> 
> Signed-off-by: Dien Pham <dien.pham.ry@renesas.com>
> [ykaneko0929@gmail.com: use the data field of the of_device_id for Tj_1]
> [ykaneko0929@gmail.com: revise a description of case 1 of the commit log]
> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>

I'm wondering if we could split this up into three patches,
one for each problem it solves? Partly because I think it is good to fix
one problem per patch. And partly because am having trouble
verifying this patch - the new if statement in rcar_gen3_thermal_get_temp()
seems to result in 0 temperature readings when the else case is used.

> ---
>  drivers/thermal/rcar_gen3_thermal.c | 86 +++++++++++++++++++++++++------------
>  1 file changed, 58 insertions(+), 28 deletions(-)
> 
> This patch is based on the master branch of Linus Torvalds's linux tree.
> 
> diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c
> index 88fa41c..de6f244 100644
> --- a/drivers/thermal/rcar_gen3_thermal.c
> +++ b/drivers/thermal/rcar_gen3_thermal.c
> @@ -63,6 +63,15 @@
>  
>  #define TSC_MAX_NUM	3
>  
> +static int tj_2;

We need to avoid global variables. There can be multiple
instances of this driver. (Although they will all get the same
value for tj_2.

Perhaps it can be added to struct rcar_gen3_thermal_tsc?

...

  reply	other threads:[~2019-04-01 13:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-21 20:47 [PATCH/RFT] thermal: rcar_gen3_thermal: Update calculation formula due to HW evaluation Yoshihiro Kaneko
2019-04-01 13:37 ` Simon Horman [this message]
2019-04-03  9:22   ` Simon Horman
2019-04-16 17:56     ` Yoshihiro Kaneko
2019-04-11 16:50   ` Niklas Söderlund
2019-04-16 17:58     ` Yoshihiro Kaneko

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=20190401133753.5luent76gyzygtcb@verge.net.au \
    --to=horms@verge.net.au \
    --cc=edubezval@gmail.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=ykaneko0929@gmail.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 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).