public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Henry Yen (顏修溫)" <Henry.Yen@mediatek.com>
To: "linux-mediatek@lists.infradead.org" 
	<linux-mediatek@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"rui.zhang@intel.com" <rui.zhang@intel.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"daniel.lezcano@linaro.org" <daniel.lezcano@linaro.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"amitk@kernel.org" <amitk@kernel.org>,
	"rafael@kernel.org" <rafael@kernel.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"daniel@makrotopia.org" <daniel@makrotopia.org>
Cc: "Steven Liu (劉人豪)" <steven.liu@mediatek.com>,
	"Henry Yen (顏修溫)" <Henry.Yen@mediatek.com>,
	"Xing Fang (方兴)" <Xing.Fang@mediatek.com>
Subject: Re: [PATCH 1/2] thermal: mediatek: add support for MT7986 and MT7981
Date: Tue, 29 Nov 2022 11:53:58 +0000	[thread overview]
Message-ID: <997af7f23e4cf174b6fed34abfed9c972c50ff77.camel@mediatek.com> (raw)
In-Reply-To: <20221031230748.xRL1SJX5PchbqyD2hxlXVi5XiA2L39VKuLCwNxdN6uc@z>

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].
This equation is derived based on hardware-specific theory, so any
arbitrary change could possibly lead to incorrect temperature output.
Thanks.

[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

       reply	other threads:[~2022-11-29 11:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20221031230748.xRL1SJX5PchbqyD2hxlXVi5XiA2L39VKuLCwNxdN6uc@z>
2022-11-29 11:53 ` Henry Yen (顏修溫) [this message]
2022-11-29 12:11   ` [PATCH 1/2] thermal: mediatek: add support for MT7986 and MT7981 Daniel Golle
2022-11-30  7:43     ` Henry Yen (顏修溫)
2022-10-31 23:07 Daniel Golle

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=997af7f23e4cf174b6fed34abfed9c972c50ff77.camel@mediatek.com \
    --to=henry.yen@mediatek.com \
    --cc=Xing.Fang@mediatek.com \
    --cc=amitk@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=daniel@makrotopia.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=steven.liu@mediatek.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