Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: Chen-Yu Tsai <wenst@chromium.org>
Cc: "Nícolas F. R. A. Prado" <nfraprado@collabora.com>,
	matthias.bgg@gmail.com, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, kernel@collabora.com
Subject: Re: [PATCH 1/5] arm64: dts: mediatek: cherry: Add platform thermal configuration
Date: Mon, 24 Apr 2023 09:40:36 +0200	[thread overview]
Message-ID: <a052b2ba-e211-c997-7508-0d012663dedb@collabora.com> (raw)
In-Reply-To: <CAGXv+5G9Qh2ftB0NG4Km3wHQCgyxHK+Ae17QWJrv8V9VJaBH4A@mail.gmail.com>

Il 24/04/23 09:38, Chen-Yu Tsai ha scritto:
> On Mon, Apr 24, 2023 at 2:31 PM AngeloGioacchino Del Regno
> <angelogioacchino.delregno@collabora.com> wrote:
>>
>> Il 21/04/23 22:53, Nícolas F. R. A. Prado ha scritto:
>>> On Fri, Apr 21, 2023 at 03:37:52PM +0800, Chen-Yu Tsai wrote:
>>>> On Thu, Apr 20, 2023 at 5:45 PM AngeloGioacchino Del Regno
>>>> <angelogioacchino.delregno@collabora.com> wrote:
>>>>>
>>>>> This platform has three auxiliary NTC thermistors, connected to the
>>>>> SoC's ADC pins. Enable the auxadc in order to be able to read the
>>>>> ADC values, add a generic-adc-thermal LUT for each and finally assign
>>>>> them to the SoC's thermal zones.
>>>>>
>>>>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>>>>> ---
>>>>>    .../boot/dts/mediatek/mt8195-cherry.dtsi      | 105 ++++++++++++++++++
>>>>>    1 file changed, 105 insertions(+)
>>>>>
>>>>> diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
>>>>> index 8ac80a136c37..0820e9ba3829 100644
>>>>> --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
>>>>> +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
>>>>> @@ -114,6 +114,77 @@ ppvar_sys: regulator-ppvar-sys {
>>>>>                   regulator-boot-on;
>>>>>           };
>>>>>
>>>>> +       /* Murata NCP03WF104F05RL */
>>>>> +       tboard_thermistor1: thermal-sensor-t1 {
>>>>> +               compatible = "generic-adc-thermal";
>>>>> +               #thermal-sensor-cells = <0>;
>>>>> +               io-channels = <&auxadc 0>;
>>>>> +               io-channel-names = "sensor-channel";
>>>>> +               temperature-lookup-table = <    (-10000) 1553
>>>>> +                                               (-5000) 1485
>>>>> +                                               0 1406
>>>>> +                                               5000 1317
>>>>> +                                               10000 1219
>>>>> +                                               15000 1115
>>>>> +                                               20000 1007
>>>>> +                                               25000 900
>>>>> +                                               30000 796
>>>>> +                                               35000 697
>>>>> +                                               40000 605
>>>>> +                                               45000 523
>>>>> +                                               50000 449
>>>>> +                                               55000 384
>>>>> +                                               60000 327
>>>>> +                                               65000 279
>>>>> +                                               70000 237
>>>>> +                                               75000 202
>>>>> +                                               80000 172
>>>>> +                                               85000 147
>>>>> +                                               90000 125
>>>>> +                                               95000 107
>>>>> +                                               100000 92
>>>>> +                                               105000 79
>>>>> +                                               110000 68
>>>>> +                                               115000 59
>>>>> +                                               120000 51
>>>>> +                                               125000 44>;
>>>>> +       };
>>>>> +
>>>>> +       tboard_thermistor2: thermal-sensor-t2 {
>>>>> +               compatible = "generic-adc-thermal";
>>>>> +               #thermal-sensor-cells = <0>;
>>>>> +               io-channels = <&auxadc 1>;
>>>>> +               io-channel-names = "sensor-channel";
>>>>> +               temperature-lookup-table = <    (-10000) 1553
>>>>> +                                               (-5000) 1485
>>>>> +                                               0 1406
>>>>> +                                               5000 1317
>>>>> +                                               10000 1219
>>>>> +                                               15000 1115
>>>>> +                                               20000 1007
>>>>> +                                               25000 900
>>>>> +                                               30000 796
>>>>> +                                               35000 697
>>>>> +                                               40000 605
>>>>> +                                               45000 523
>>>>> +                                               50000 449
>>>>> +                                               55000 384
>>>>> +                                               60000 327
>>>>> +                                               65000 279
>>>>> +                                               70000 237
>>>>> +                                               75000 202
>>>>> +                                               80000 172
>>>>> +                                               85000 147
>>>>> +                                               90000 125
>>>>> +                                               95000 107
>>>>> +                                               100000 92
>>>>> +                                               105000 79
>>>>> +                                               110000 68
>>>>> +                                               115000 59
>>>>> +                                               120000 51
>>>>> +                                               125000 44>;
>>>>> +       };
>>>>> +
>>>>>           usb_vbus: regulator-5v0-usb-vbus {
>>>>>                   compatible = "regulator-fixed";
>>>>>                   regulator-name = "usb-vbus";
>>>>> @@ -260,6 +331,10 @@ &gpu {
>>>>>           mali-supply = <&mt6315_7_vbuck1>;
>>>>>    };
>>>>>
>>>>> +&auxadc {
>>>>> +       status = "okay";
>>>>> +};
>>>>> +
>>>>>    &i2c0 {
>>>>>           status = "okay";
>>>>>
>>>>> @@ -1098,6 +1173,36 @@ mt6315_7_vbuck1: vbuck1 {
>>>>>           };
>>>>>    };
>>>>>
>>>>> +&thermal_zones {
>>>>> +       soc_area_ntc {
>>>
>>> Not sure if that's what's causing the issue, but the thermal zone name should
>>> end with -thermal as per the binding. Also note that it needs to be under 20
>>> characters otherwise it will fail to be registered with -22 like below.
>>> (Also, node names shouldn't contain underscore)
>>>
>>> Thanks,
>>> Nícolas
>>>
>>>>> +               polling-delay = <1000>;
>>>>> +               polling-delay-passive = <250>;
>>>>> +               thermal-sensors = <&tboard_thermistor1>;
>>>>> +
>>>>> +               trips {
>>>>> +                       trip-crit {
>>>>> +                               temperature = <95000>;
>>>>> +                               hysteresis = <2000>;
>>>>> +                               type = "critical";
>>>>> +                       };
>>>>> +               };
>>>>> +       };
>>>>> +
>>>>> +       pmic_area_ntc {
>>>>> +               polling-delay = <1000>;
>>>>> +               polling-delay-passive = <0>;
>>>>> +               thermal-sensors = <&tboard_thermistor2>;
>>>>> +
>>>>> +               trips {
>>>>> +                       trip-crit {
>>>>> +                               temperature = <95000>;
>>>>> +                               hysteresis = <2000>;
>>>>> +                               type = "critical";
>>>>> +                       };
>>>>> +               };
>>>>> +       };
>>>>
>>>> I'm still getting:
>>>>
>>>> thermal_sys: Failed to find 'trips' node
>>>> thermal_sys: Failed to find trip points for thermal-sensor-t1 id=0
>>>> generic-adc-thermal thermal-sensor-t1: Thermal zone sensor register failed: -22
>>>> generic-adc-thermal: probe of thermal-sensor-t1 failed with error -22
>>>> thermal_sys: Failed to find 'trips' node
>>>> thermal_sys: Failed to find trip points for thermal-sensor-t2 id=0
>>>> generic-adc-thermal thermal-sensor-t2: Thermal zone sensor register failed: -22
>>>> generic-adc-thermal: probe of thermal-sensor-t2 failed with error -22
>>>> thermal_sys: Failed to find 'trips' node
>>>> thermal_sys: Failed to find trip points for thermal-sensor-t3 id=0
>>>> generic-adc-thermal thermal-sensor-t3: Thermal zone sensor register failed: -22
>>>> generic-adc-thermal: probe of thermal-sensor-t3 failed with error -22
>>>>
>>
>> I think you have something wrong locally - there's no thermal-sensor-t3 in this
>> devicetree...
> 
> I seem to have run a stale kernel image. Rebuilt the kernel and everything
> seems to work OK now.
> 
> BTW, I think the design went for a lower trip point. At least the hardware
> thermal protection IC on the Acer device trips at 85 degrees C, instead of
> 95 degrees C. Maybe that's accounting for the fact that these are external
> thermal sensors and have some latency and temperature difference. The PMIC
> specifies 85 degrees C maximum ambient air temperature. The SoC doesn't
> specify.
> 

Let's play safe then, I'll change that to 85 for the next version.

> Either way this is
> 
> Tested-by: Chen-Yu Tsai <wenst@chromium.org>
> Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>

Thanks!



  reply	other threads:[~2023-04-24  7:40 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20  9:44 [PATCH 0/5] MT8195 Acer Tomato - devicetrees Part 3 AngeloGioacchino Del Regno
2023-04-20  9:44 ` [PATCH 1/5] arm64: dts: mediatek: cherry: Add platform thermal configuration AngeloGioacchino Del Regno
2023-04-21  7:37   ` Chen-Yu Tsai
2023-04-21 20:53     ` Nícolas F. R. A. Prado
2023-04-24  6:31       ` AngeloGioacchino Del Regno
2023-04-24  7:38         ` Chen-Yu Tsai
2023-04-24  7:40           ` AngeloGioacchino Del Regno [this message]
2023-04-20  9:44 ` [PATCH 2/5] arm64: dts: mediatek: cherry: Assign dp-intf aliases AngeloGioacchino Del Regno
2023-04-21  6:46   ` Chen-Yu Tsai
2023-04-24  7:03     ` AngeloGioacchino Del Regno
2023-04-24  7:17       ` Chen-Yu Tsai
2023-04-24  7:19         ` AngeloGioacchino Del Regno
2023-04-20  9:44 ` [PATCH 3/5] arm64: dts: mediatek: cherry: Configure eDP and internal display AngeloGioacchino Del Regno
2023-04-21  6:57   ` Chen-Yu Tsai
2023-04-20  9:44 ` [PATCH 4/5] arm64: dts: mediatek: cherry: Enable PCI-Express ports for WiFi AngeloGioacchino Del Regno
2023-04-21  7:07   ` Chen-Yu Tsai
2023-04-20  9:44 ` [PATCH 5/5] arm64: dts: mediatek: cherry-tomato-r1: Enable NVMe PCI-Express port AngeloGioacchino Del Regno
2023-04-21  7:59   ` Chen-Yu Tsai
2023-04-24  8:13     ` AngeloGioacchino Del Regno
2023-04-24  9:40       ` Chen-Yu Tsai
2023-04-24  9:59         ` AngeloGioacchino Del Regno

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=a052b2ba-e211-c997-7508-0d012663dedb@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=devicetree@vger.kernel.org \
    --cc=kernel@collabora.com \
    --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=matthias.bgg@gmail.com \
    --cc=nfraprado@collabora.com \
    --cc=robh+dt@kernel.org \
    --cc=wenst@chromium.org \
    /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