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: <Y4X23BWjsxzzXH/H@makrotopia.org>
Date:   Tue, 29 Nov 2022 12:11:08 +0000
From:   Daniel Golle <daniel@...rotopia.org>
To:     Henry Yen (顏修溫) <Henry.Yen@...iatek.com>
Cc:     "linux-mediatek@...ts.infradead.org" 
        <linux-mediatek@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "rui.zhang@...el.com" <rui.zhang@...el.com>,
        "linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
        "daniel.lezcano@...aro.org" <daniel.lezcano@...aro.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "amitk@...nel.org" <amitk@...nel.org>,
        "rafael@...nel.org" <rafael@...nel.org>,
        "matthias.bgg@...il.com" <matthias.bgg@...il.com>,
        Steven Liu (劉人豪) 
        <steven.liu@...iatek.com>,
        Xing Fang (方兴) <Xing.Fang@...iatek.com>
Subject: Re: [PATCH 1/2] thermal: mediatek: add support for MT7986 and MT7981

On Tue, Nov 29, 2022 at 11:53:58AM +0000, Henry Yen (顏修溫) wrote:
> On Mon, 2022-10-31 at 23:07 +0000, Daniel Golle wrote:
> > diff --git a/drivers/thermal/mtk_thermal.c
> > b/drivers/thermal/mtk_thermal.c
> > 
> > +static int raw_to_mcelsius_v3(struct mtk_thermal *mt, int sensno,
> > s32 raw)
> > +{
> > +	s32 tmp;
> > +
> > +	if (raw == 0)
> > +		return 0;
> > +
> > +	raw &= 0xfff;
> > +	tmp = 100000 * 15 / 16 * 10000;
> > +	tmp /= 4096 - 512 + mt->adc_ge;
> > +	tmp /= 1490;
> > +	tmp *= raw - mt->vts[sensno] - 2900 - mt->adc_oe + 512;
> 
> Hi Daniel,
> 
> Regarding the conversion formula, I would suggest following the
> original one, i.e., discarding "adc_oe" parameter as shown in [1].

Ok, I see. According to the commit description it looked to me more
like adc_oe has been dropped by accident, it doesn't sound like it
happened on purpose:
"Refactor MT7986 thermal temperature calculation formula to
prevent loss of floating-point accuracy."

Hence it made sense to be to keep the parameter and really only
use the updated formula to not loose precision. Maybe you can inquire
with the original author if dropping adc_oe was intentional, despite
being unmentioned in the commit message.


> This equation is derived based on hardware-specific theory, so any
> arbitrary change could possibly lead to incorrect temperature output.
> Thanks.

On my BPi-R3 board I found the value 512 burned into the efuse, so in
practise the resulting calculated temperature is exactly the same on
this board.

If other MT7986 or MT7981 boards will have arbitrary values stored in
adc_oe field in the efuse because this value isn't even used during
the manufacturer's calibration process, then of course, there is no
choice other than dropping it here as well.

> 
> [1]
> 
> https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/baf36c7eef477aae1f8f2653b6c29e2caf48475b%5E%21/#F0
> 
> 
> Henry
> 
> > +
> > +	return mt->degc_cali * 500 - tmp;
> > +}
> > +
> >  /**
> >   * mtk_thermal_get_bank - get bank
> >   * @bank:	The bank

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ