Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mikhail Kalashnikov" <iuncuim@gmail.com>
Cc: devicetree@vger.kernel.org, linux-sunxi@lists.linux.dev,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v7 5/5] arm64: dts: allwinner: sun55i: add thermal sensors
Date: Fri, 04 Dec 2026 11:02:31 +0000	[thread overview]
Message-ID: <sashiko-outbox-249650@kernel.org> (raw)
In-Reply-To: <662a31b046d756f60cd58253bc06cc519b35a6af.1796378254.git.iuncuim@gmail.com>

Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [Medium] thermal: sun8i: wrong caldata[1] zero check in
  sun55i_a523_ths_calibrate()
- [Low] arm64: dts: allwinner: non-generic indexed SID calibration node
  names
- [Low] arm64: dts: allwinner: deprecated direct NVMEM cell syntax under
  sid
- [Low] arm64: dts: allwinner: redundant polling delays on
  interrupt-driven ths1 zones
--

commit f5933b3e1e2b516aea8e35cf8facb2a52106a490
Author: Mikhail Kalashnikov <iuncuim@gmail.com>

arm64: dts: allwinner: sun55i: add thermal sensors

This commit adds the THS0 and THS1 thermal sensor nodes, their SID
calibration cells, CPU cooling cells, and the corresponding thermal zones
for the Allwinner A523 SoC.

> diff --git a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
> index 85ef492ffeae7..ced54415419ef 100644
> --- a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi

[ ... ]

> @@ -611,6 +644,14 @@ sid: efuse@3006000 {
>  			reg = <0x03006000 0x1000>;
>  			#address-cells = <1>;
>  			#size-cells = <1>;
> +
> +			ths_calibration0: ths-calibration0@38 {
> +				reg = <0x38 0x8>;
> +			};

[Severity: Medium]
Can wiring ths_calibration0 into sun55i_a523_ths_calibrate() (added in
commit "thermal/drivers/sun8i: Add support for A523 THS0/1 controllers")
skip valid calibration or calibrate with a zero ft_temp?

drivers/thermal/sun8i_thermal.c:sun55i_a523_ths_calibrate() {
    ...
	if (!caldata[1])
		return -EINVAL;

	ft_temp = (((caldata[2] << 8) | (caldata[1] >> 8)) & FT_TEMP_MASK) * 100;
    ...
}

The 12-bit factory temperature spans the upper byte of caldata[1] and the
lower nibble of caldata[2], while byte 0x3a in caldata[1] is outside it.

With a 25.6 C factory temperature (0x100) and a zero byte at 0x3a,
caldata[1] is 0 and calibration fails with -EINVAL, leaving all THS0 and
THS1 sensors uncalibrated.  Checking ft_temp after extraction avoids this.

> +
> +			ths_calibration1: ths-calibration1@44 {
> +				reg = <0x44 0x8>;
> +			};
>  		};

[Severity: Low]
Should these nodes use generic names without instance numbers, such as
thermal-sensor-calibration@38 and thermal-sensor-calibration@44?  The unit
addresses already distinguish the two sibling nodes, and other Allwinner
dtsi files follow that convention.

[Severity: Low]
Should these new cells be placed under an nvmem-layout node with
compatible = "fixed-layout"?  Direct NVMEM cell subnodes are marked
deprecated in nvmem-deprecated-cells.yaml, and sid in sun55i-a523.dtsi has
no existing legacy cells to maintain compatibility with.

[ ... ]

> @@ -1145,4 +1186,135 @@ npu: npu@7122000 {
>  			power-domains = <&ppu PD_NPU>;
>  		};
>  	};
> +
> +	thermal-zones {
> +		cpu0-thermal {
> +			polling-delay-passive = <100>;
> +			polling-delay = <1000>;
> +			thermal-sensors = <&ths1 1>;
> +			sustainable-power = <1200>;

[ ... ]

> +		npu-thermal {
> +			polling-delay-passive = <100>;
> +			polling-delay = <1000>;
> +			thermal-sensors = <&ths1 3>;

[Severity: Low]
Do the ths1 thermal zones need non-zero polling-delay and a 100 ms
polling-delay-passive?

sun50i_h6_thermal_init() configures a 250 ms sample period with data
interrupts enabled, so sun8i_irq_thread() already updates all four zones
every 250 ms.  With polling-delay = <1000>, monitor_thermal_zone() cancels
and re-arms each poll timer on every interrupt without it ever expiring.

Once gpu-thermal reaches 60 C or a CPU zone reaches 70 C, the 100 ms
polling-delay-passive wakes the thermal workqueue twice between hardware
samples to re-read unchanged registers.  npu-thermal also has no passive
trips or cooling-maps, so both delays can be 0 as in ddr-thermal.

Setting polling-delay = <0> on the interrupt-driven zones and using at
least 250 ms for any needed polling-delay-passive avoids this extra work.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1796378254.git.iuncuim@gmail.com?part=5

      reply	other threads:[~2026-12-04 11:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 10:43 [PATCH v7 0/5] Allwinner: A523: add support for A523 THS0/1 controllers Mikhail Kalashnikov
2026-12-04 10:43 ` [PATCH v7 1/5] dt-bindings: thermal: sun8i: Add " Mikhail Kalashnikov
2026-12-04 10:43 ` [PATCH v7 2/5] thermal/drivers/sun8i: replace devm_reset_control_get to devm_reset_control_get_shared_deasserted Mikhail Kalashnikov
2026-12-04 10:43 ` [PATCH v7 3/5] thermal/drivers/sun8i: get calibration data from two nvmem cells Mikhail Kalashnikov
2026-12-04 10:58   ` sashiko-bot
2026-12-04 10:43 ` [PATCH v7 4/5] thermal/drivers/sun8i: Add support for A523 THS0/1 controllers Mikhail Kalashnikov
2026-12-04 11:02   ` sashiko-bot
2026-12-04 10:43 ` [PATCH v7 5/5] arm64: dts: allwinner: sun55i: add thermal sensors Mikhail Kalashnikov
2026-12-04 11:02   ` sashiko-bot [this message]

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=sashiko-outbox-249650@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=iuncuim@gmail.com \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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