[PATCH v2 0/4] thermal: loongson2: Add support for Loongson-2K0300 SoC

Binbin Zhou <[email protected]> Tue, 21 Jul 2026 20:24:19 +0800
Newsgroups dev.linux.lists.loongarch,dev.linux.lists.mfd,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-pm
Message-ID <[email protected]>
Hi all:

This patch series adds thermal zone support for the Loongson-2K0300 SoC.

The Loongson-2K0300's thermal sensor is generally compatible with the
existing Loongson-2K series, but it features several key differences:
1. It has an independent CPU ID register for reading chip version
information.
2. The raw temperature output field has been extended from 8 bits to 11
bits.
3. The temperature calculation formula has been updated to incorporate a
correction factor based on the version information.

To ensure robustness on older hardware revisions, a fallback mechanism
is included: if the calculated temperature falls outside the valid range
(-55 TO 125),  the driver falls back to a simpler calculation and prints
a warning.

The patches have been validated on the Loongson-2K0300 development board.

Thanks.
Binbin

=========
V2:
Patch (1/4):
 - New patch form Sashiko;
Patch (2/4):
 - New patch for adding chipid syscon compatible;
Patch (3/4):
 - Use `loongson,chipid` phandle replace chipid reg property;
Patch (3/4):
 - Refact `calib_offset` calculate routing;
 - Add LS2K0300_OLD_FUSE_FLAG flag.

Link to V1:
https://lore.kernel.org/all/[email protected]/

Binbin Zhou (4):
  thermal/drivers/loongson2: Correct thermal sensor registration loop
  dt-bindings: mfd: syscon: Allow syscon compatible for Loongson-2K0300
    chip id
  dt-bindings: thermal: loongson,ls2k-thermal: Add compatible for
    Loongson-2K0300
  thermal/drivers/loongson2: Add support for Loongson-2K0300

 .../devicetree/bindings/mfd/syscon.yaml       |   2 +
 .../thermal/loongson,ls2k-thermal.yaml        |  73 ++++++++---
 drivers/thermal/loongson2_thermal.c           | 120 +++++++++++++++---
 3 files changed, 162 insertions(+), 33 deletions(-)

-- 
2.52.0