From: Wolfram Sang <wsa@the-dreams.de>
To: Eduardo Valentin <edubezval@gmail.com>
Cc: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
linux-pm@vger.kernel.org,
"Wolfram Sang" <wsa+renesas@sang-engineering.com>,
"Khiem Nguyen" <khiem.nguyen.xt@renesas.com>,
"Kuninori Morimoto" <kuninori.morimoto.gx@gmail.com>,
linux-renesas-soc@vger.kernel.org,
"Zhang Rui" <rui.zhang@intel.com>,
"Geert Uytterhoeven" <geert@linux-m68k.org>,
"Hien Dang" <hien.dang.eb@renesas.com>,
"Thao Nguyen" <thao.nguyen.yb@rvc.renesas.com>,
"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Subject: Re: [PATCHv5 2/5] thermal: rcar_gen3_thermal: Add R-Car Gen3 thermal driver
Date: Tue, 13 Dec 2016 06:38:36 +0100 [thread overview]
Message-ID: <20161213053835.GA1439@katana> (raw)
In-Reply-To: <20161213035052.GA22105@localhost.localdomain>
[-- Attachment #1: Type: text/plain, Size: 1701 bytes --]
Hi,
> > + *
> > + * The constants a and b are calculated using two triplets of int values PTAT
> > + * and THCODE. PTAT and THCODE can either be read from hardware or use hard
> > + * coded values from driver. The formula to calculate a and b are taken from
> > + * BSP and sparsely documented and understood.
> > + *
>
> hmmm.. OK. that gets a bit more interesting.
>
> So you can get a and b queried from hardware. cool.
>
> but you can also get those hardcoded in the code. In that case, I would
> suggest hardcode them in DT, instead, using the coefficients property.
It is only the engineering samples which have the coeffs hardcoded. All
future revisions of the same SoC will have the values as fuses from
registers. Sadly, we won't have access to newer versions for a while. To
avoid having seperate DTSI per engineering sample revision, I planned
for using the new soc_device_match() mechanism which was introduced for
exactly such use cases.
> > +static int rcar_gen3_thermal_get_temp(void *devdata, int *temp)
> > +{
> > + struct rcar_gen3_thermal_tsc *tsc = devdata;
> > + int mcelsius, val1, val2;
> > + u32 reg;
> > +
> > + /* Read register and convert to mili Celsius */
> > + mutex_lock(&tsc->lock);
> > +
> > + reg = rcar_gen3_thermal_read(tsc, REG_GEN3_TEMP) & CTEMP_MASK;
> > +
> > + val1 = SCALE_DIV(SCALE_INT(reg) - tsc->coef.b1, tsc->coef.a1);
> > + val2 = SCALE_DIV(SCALE_INT(reg) - tsc->coef.b2, tsc->coef.a2);
>
> I see. there are actually two sensors here, and
Really? val1 and val2 are both based on 'reg'. Also, the datasheet
explicitly mentions 'three sensors in the LSI'.
Thanks for the fast response!
Wolfram
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-12-13 5:38 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-12 14:18 [PATCHv5 0/5] thermal: add driver for R-Car Gen3 Niklas Söderlund
2016-12-12 14:18 ` [PATCHv5 1/5] thermal: rcar_gen3_thermal: Document the " Niklas Söderlund
2016-12-12 14:18 ` [PATCHv5 2/5] thermal: rcar_gen3_thermal: Add R-Car Gen3 thermal driver Niklas Söderlund
2016-12-12 21:45 ` Wolfram Sang
2016-12-13 8:25 ` Geert Uytterhoeven
2016-12-13 8:39 ` Wolfram Sang
2016-12-13 10:07 ` Niklas Söderlund
2016-12-13 3:50 ` Eduardo Valentin
2016-12-13 5:38 ` Wolfram Sang [this message]
2016-12-13 9:43 ` Niklas Söderlund
2016-12-14 4:38 ` Eduardo Valentin
2016-12-13 8:19 ` Geert Uytterhoeven
2016-12-13 9:53 ` Niklas Söderlund
2016-12-13 10:09 ` Geert Uytterhoeven
2016-12-12 14:18 ` [PATCHv5 3/5] arm64: dts: r8a7795: Add R-Car Gen3 thermal support Niklas Söderlund
2016-12-12 14:18 ` [PATCHv5 4/5] arm64: dts: r8a7796: " Niklas Söderlund
2016-12-12 14:18 ` [PATCHv5 5/5] thermal: rcar_gen3_thermal: Add delay in .thermal_init on r8a7795 Niklas Söderlund
2016-12-13 3:31 ` Eduardo Valentin
2016-12-13 9:15 ` Niklas Söderlund
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=20161213053835.GA1439@katana \
--to=wsa@the-dreams.de \
--cc=edubezval@gmail.com \
--cc=geert@linux-m68k.org \
--cc=hien.dang.eb@renesas.com \
--cc=khiem.nguyen.xt@renesas.com \
--cc=kuninori.morimoto.gx@gmail.com \
--cc=linux-pm@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=niklas.soderlund+renesas@ragnatech.se \
--cc=niklas.soderlund@ragnatech.se \
--cc=rui.zhang@intel.com \
--cc=thao.nguyen.yb@rvc.renesas.com \
--cc=wsa+renesas@sang-engineering.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).