devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frank Wunderlich <frank-w@public-files.de>
To: AngeloGioacchino Del Regno 
	<angelogioacchino.delregno@collabora.com>,
	Frank Wunderlich <linux@fw-web.de>,
	linux-mediatek@lists.infradead.org
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Daniel Golle <daniel@makrotopia.org>
Subject: Re: [RFC v1 3/3] thermal/drivers/mediatek/lvts_thermal: add mt7988 support
Date: Wed, 13 Sep 2023 12:52:29 +0200	[thread overview]
Message-ID: <465DDC1C-D687-47A7-966C-73FB42CFC5DD@public-files.de> (raw)
In-Reply-To: <8949cbfa-acae-d6ac-e5fb-f238a29630bc@collabora.com>

Am 13. September 2023 10:16:51 MESZ schrieb AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>:
Hi angelo,

thanks for first look

>Il 11/09/23 20:33, Frank Wunderlich ha scritto:
>> From: Frank Wunderlich <frank-w@public-files.de>
>> 
>> Add Support for mediatek fologic 880/MT7988.
>> 
>> Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
>> ---
>>   drivers/thermal/mediatek/lvts_thermal.c | 73 +++++++++++++++++++++++++
>>   1 file changed, 73 insertions(+)
>> 
>> diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
>> index c1004b4da3b6..48b257a3c80e 100644
>> --- a/drivers/thermal/mediatek/lvts_thermal.c
>> +++ b/drivers/thermal/mediatek/lvts_thermal.c
>> @@ -82,6 +82,8 @@
>>   #define LVTS_GOLDEN_TEMP_DEFAULT	50
>>   #define LVTS_COEFF_A_MT8195			-250460
>>   #define LVTS_COEFF_B_MT8195			250460
>> +#define LVTS_COEFF_A_MT7988			-204650
>> +#define LVTS_COEFF_B_MT7988			204650
>>     #define LVTS_MSR_IMMEDIATE_MODE		0
>>   #define LVTS_MSR_FILTERED_MODE		1
>> @@ -1272,6 +1274,67 @@ static int lvts_remove(struct platform_device *pdev)
>>   	return 0;
>>   }
>>   +/*
>> + * LVTS MT7988
>> + */
>> +#define LVTS_HW_SHUTDOWN_MT7988	117000
>
>Are you sure that this chip's Tj is >117°C ?!
>
>Looks a bit high... if it is exactly 117°C, I would suggest cutting earlier,
>either at 110 (safe side) or 115: after all, this is a life-saver feature and
>the chip is actually never meant to *constantly* work at 110°C (as it would
>degrade fast and say goodbye earlier than "planned").

I took values from SDK

https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/refs/heads/master/target/linux/mediatek/files-5.4/drivers/thermal/mediatek/soc_temp_lvts.c#1483

>> +//enum mt7988_lvts_domain { MT7988_AP_DOMAIN, MT7988_NUM_DOMAIN };
>> +
>> +enum mt7988_lvts_sensor_enum {
>> +	MT7988_TS3_0,
>> +	MT7988_TS3_1,
>> +	MT7988_TS3_2,
>> +	MT7988_TS3_3,
>> +	MT7988_TS4_0,
>> +	MT7988_TS4_1,
>> +	MT7988_TS4_2,
>> +	MT7988_TS4_3,
>> +	MT7988_NUM_TS
>> +};

>This enumeration should be definitions in bindings (mediatek,lvts-thermal.h).
>
>Besides, the LVTS is about internal temperatures, so those TS3_x and 4_x can
>be renamed like what was done for MT8192 and MT8195: this is because you will
>never see TS3_2 being CPU2 on a board and CPU4 on another, being those - again -
>internal to the SoC, hence unchangeable.

Right these sensors are internally only and i took naming from sdk to avoid confusion. And i have not more information about these internal sensors (special meaning),but their values are packed together to get the resulting (average) temperature.

>Another reason is that you'll anyway have to refer to those sensors in the
>devicetree to configure thermal trips and such, so... :-)

In device tree it will look like this:

https://github.com/frank-w/BPI-Router-Linux/blob/6.5-lvts/arch/arm64/boot/dts/mediatek/mt7988a.dtsi#L771

Daniel has also defined thermal trips there,but these are untested atm. I only verified temperature itself i get from sysfs as far as i can (start at ~40°C and reaching ~70 while running).

>Regards,
>Angelo

regards Frank

  reply	other threads:[~2023-09-13 10:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-11 18:33 [RFC v1 0/3] add LVTS support for mt7988 Frank Wunderlich
2023-09-11 18:33 ` [RFC v1 1/3] dt-bindings: thermal: mediatek: add mt7988 compatible Frank Wunderlich
2023-09-12 15:58   ` Rob Herring
2023-09-13  7:49   ` AngeloGioacchino Del Regno
2023-09-13 10:57     ` Frank Wunderlich
2023-09-13 11:23       ` AngeloGioacchino Del Regno
2023-09-11 18:33 ` [RFC v1 2/3] thermal/drivers/mediatek/lvts_thermal: make coeff configurable Frank Wunderlich
2023-09-13  8:03   ` AngeloGioacchino Del Regno
2023-09-13 17:40     ` Aw: " Frank Wunderlich
2023-09-11 18:33 ` [RFC v1 3/3] thermal/drivers/mediatek/lvts_thermal: add mt7988 support Frank Wunderlich
2023-09-13  8:16   ` AngeloGioacchino Del Regno
2023-09-13 10:52     ` Frank Wunderlich [this message]
2023-09-13 11:43       ` AngeloGioacchino Del Regno
2023-09-13 17:16         ` Aw: " Frank Wunderlich

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=465DDC1C-D687-47A7-966C-73FB42CFC5DD@public-files.de \
    --to=frank-w@public-files.de \
    --cc=amitk@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=conor+dt@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=daniel@makrotopia.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.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=linux@fw-web.de \
    --cc=matthias.bgg@gmail.com \
    --cc=rafael@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=rui.zhang@intel.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).