lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190206004837.GC19687@localhost.localdomain>
Date:   Tue, 5 Feb 2019 16:48:51 -0800
From:   Eduardo Valentin <edubezval@...il.com>
To:     Matthias Brugger <matthias.bgg@...il.com>
Cc:     michael.kao@...iatek.com, =Zhang Rui <rui.zhang@...el.com>,
        =Daniel Lezcano <daniel.lezcano@...aro.org>,
        =Rob Herring <robh+dt@...nel.org>,
        =Mark Rutland <mark.rutland@....com>, linux-pm@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org,
        linux-mediatek@...ts.infradead.org, srv_heupstream@...iatek.com
Subject: Re: [PATCH 3/7] thermal: mediatek: add calibration item

On Mon, Feb 04, 2019 at 06:31:41PM +0100, Matthias Brugger wrote:
> 
> 
> On 01/02/2019 08:38, michael.kao@...iatek.com wrote:
> > From: Michael Kao <michael.kao@...iatek.com>
> > 
> > Add calibration item in thermal_data to support
> > the project with different calibration coefficient.
> > 
> > Signed-off-by: Michael Kao <michael.kao@...iatek.com>
> > ---
> >  drivers/thermal/mtk_thermal.c | 19 ++++++++++++++++++-
> >  1 file changed, 18 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c
> > index 07f8ad7..45c6587 100644
> > --- a/drivers/thermal/mtk_thermal.c
> > +++ b/drivers/thermal/mtk_thermal.c
> > @@ -105,6 +105,9 @@
> >  /* The number of sensing points per bank */
> >  #define MT8173_NUM_SENSORS_PER_ZONE	4
> >  
> > +/* The calibration coefficient of sensor  */
> > +#define MT8173_CALIBRATION	165
> > +
> 
> Calibration value is the same for all SoCs (including mt8183), we can define it
> once and use it in all mtk_thermal structs.

Well, on patch 7 we have:

+#define MT8183_CALIBRATION	153

> 
> Regards,
> Matthias
> 
> 
> >  /*
> >   * Layout of the fuses providing the calibration data
> >   * These macros could be used for MT8173, MT2701, and MT2712.
> > @@ -147,6 +150,9 @@ enum {
> >  /* The number of sensing points per bank */
> >  #define MT2701_NUM_SENSORS_PER_ZONE	3
> >  
> > +/* The calibration coefficient of sensor  */
> > +#define MT2701_CALIBRATION	165
> > +
> >  /* MT2712 thermal sensors */
> >  #define MT2712_TS1	0
> >  #define MT2712_TS2	1
> > @@ -162,12 +168,18 @@ enum {
> >  /* The number of sensing points per bank */
> >  #define MT2712_NUM_SENSORS_PER_ZONE	4
> >  
> > +/* The calibration coefficient of sensor  */
> > +#define MT2712_CALIBRATION	165
> > +
> >  #define MT7622_TEMP_AUXADC_CHANNEL	11
> >  #define MT7622_NUM_SENSORS		1
> >  #define MT7622_NUM_ZONES		1
> >  #define MT7622_NUM_SENSORS_PER_ZONE	1
> >  #define MT7622_TS1	0
> >  
> > +/* The calibration coefficient of sensor  */
> > +#define MT7622_CALIBRATION	165
> > +
> >  struct mtk_thermal;
> >  
> >  struct thermal_bank_cfg {
> > @@ -188,6 +200,7 @@ struct mtk_thermal_data {
> >  	const int *sensor_mux_values;
> >  	const int *msr;
> >  	const int *adcpnp;
> > +	const int cali_val;
> >  	struct thermal_bank_cfg bank_data[];
> >  };
> >  
> > @@ -295,6 +308,7 @@ struct mtk_thermal {
> >  	.num_banks = MT8173_NUM_ZONES,
> >  	.num_sensors = MT8173_NUM_SENSORS,
> >  	.vts_index = mt8173_vts_index,
> > +	.cali_val = MT8173_CALIBRATION,
> >  	.bank_data = {
> >  		{
> >  			.num_sensors = 2,
> > @@ -330,6 +344,7 @@ struct mtk_thermal {
> >  	.num_banks = 1,
> >  	.num_sensors = MT2701_NUM_SENSORS,
> >  	.vts_index = mt2701_vts_index,
> > +	.cali_val = MT2701_CALIBRATION,
> >  	.bank_data = {
> >  		{
> >  			.num_sensors = 3,
> > @@ -356,6 +371,7 @@ struct mtk_thermal {
> >  	.num_banks = 1,
> >  	.num_sensors = MT2712_NUM_SENSORS,
> >  	.vts_index = mt2712_vts_index,
> > +	.cali_val = MT2712_CALIBRATION,
> >  	.bank_data = {
> >  		{
> >  			.num_sensors = 4,
> > @@ -376,6 +392,7 @@ struct mtk_thermal {
> >  	.num_banks = MT7622_NUM_ZONES,
> >  	.num_sensors = MT7622_NUM_SENSORS,
> >  	.vts_index = mt7622_vts_index,
> > +	.cali_val = MT7622_CALIBRATION,
> >  	.bank_data = {
> >  		{
> >  			.num_sensors = 1,
> > @@ -402,7 +419,7 @@ static int raw_to_mcelsius(struct mtk_thermal *mt, int sensno, s32 raw)
> >  	raw &= 0xfff;
> >  
> >  	tmp = 203450520 << 3;
> > -	tmp /= 165 + mt->o_slope;
> > +	tmp /= mt->conf->cali_val + mt->o_slope;
> >  	tmp /= 10000 + mt->adc_ge;
> >  	tmp *= raw - mt->vts[sensno] - 3350;
> >  	tmp >>= 3;
> > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ