Skip to content

thermal: loongson2: Add support for Loongson-2K0300 SoC

Binbin Zhou linux-devicetree linux-pm loongarch stable 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest7 patches 7 repliesIn review
  2. v54 patches 2 repliesSuperseded
  3. v45 patches 4 repliesApplied
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v35 patches2 repliesSuperseded
v24 patches2 repliesSuperseded
v12 patches9 repliesSuperseded

Changes in v6 from the cover letter · 19 lines

- Rebase on linux-pm/thermal;
Patch (2/7):
- New patch;
- Fix incorrect clamp() argument order for thermal trip points;
Patch (3/7):
- New patch;
- Fix Loongson-2K2000 trip point programming by adding a per-SoC set_trips_regs callback and handling the split HI_GATE registers;
Patch (4/7):
- New patch;
- cleanup: use GENMASK/FIELD_* helpers, add named constants, and factor common trip point setup;
Patch (5/7):
- New patch;
- refactor: move thermal_zone_device_ops into chip_data and replace the Loongson-2K2000 flag special case with an optional init_extend_resource callback;
Patch (7/7):
- Updated the 10-bit output to 11-bit in commit message;
- Temporarily remove the implementation of set_trips;
- Remove unnecessary header files;
- Rewrite get_temp, separating read_calib and detect_old_fuse into new functions to be called during the probe;
- Use macros to define the relevant numbers.

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7thermal/drivers/loongson2: Correct thermal sensor registration loopdrivers/thermal/loongson2_thermal.c+5 -37 replies
2/7thermal/drivers/loongson2: Fix clamp() usage for thermal trip pointsdrivers/thermal/loongson2_thermal.c+2 -20 replies
3/7thermal/drivers/loongson2: Fix Loongson-2K2000 trip point programmingdrivers/thermal/loongson2_thermal.c+55 -220 replies
4/7thermal/drivers/loongson2: Use bitfields and per-SoC thermal opsdrivers/thermal/loongson2_thermal.c+72 -510 replies
5/7thermal/drivers/loongson2: Move per-SoC ops into chip datadrivers/thermal/loongson2_thermal.c+27 -230 replies
6/7dt-bindings: thermal: loongson,ls2k-thermal: Add compatible for Loongson-2K0300Documentation/devicetree/bindings/thermal/loongson,ls2k-thermal.yaml+55 -180 replies
7/7thermal/drivers/loongson2: Add Loongson-2K0300 supportdrivers/thermal/loongson2_thermal.c+136 -00 replies

Reviews trailers per patch

1 of 7 patches has a Reviewed-by or Acked-by.

PatchConor Dooley
1/7
2/7
3/7
4/7
5/7
6/7A-b
7/7

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCH v6 0/7] thermal: loongson2: Add support for Loongson-2K0300 SoC

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 series also includes fixes and cleanups for the existing Loongson-2 thermal driver, which are necessary to support the new SoC cleanly.

The patchset have been validated on the Loongson-2K series development boards.

Thanks.
Binbin

=========
V6:
- Rebase on linux-pm/thermal;
Patch (2/7):
- New patch;
- Fix incorrect clamp() argument order for thermal trip points;
Patch (3/7):
- New patch;
- Fix Loongson-2K2000 trip point programming by adding a per-SoC set_trips_regs callback and handling the split HI_GATE registers;
Patch (4/7):
- New patch;
- cleanup: use GENMASK/FIELD_* helpers, add named constants, and factor common trip point setup;
Patch (5/7):
- New patch;
- refactor: move thermal_zone_device_ops into chip_data and replace the Loongson-2K2000 flag special case with an optional init_extend_resource callback;
Patch (7/7):
- Updated the 10-bit output to 11-bit in commit message;
- Temporarily remove the implementation of set_trips;
- Remove unnecessary header files;
- Rewrite get_temp, separating read_calib and detect_old_fuse into new functions to be called during the probe;
- Use macros to define the relevant numbers.

Link to V5:
https://lore.kernel.org/all/[email protected]/#t

V5:
- Rebase on linux-pm/thermal;
- Drop patch-3 for it was applied.

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

V4:
- Rebase on linux-mfd/for-mfd-next;
Patch (3/5):
- Remove the operation that adds compatible to the select node.

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

V3:
Patch (2/5):
- New patch for moving thermal_ops to chip_data;
Patch (3/5):
- Correct spelling errors;
Patch (4/5):
- Add Acked-by from Conor, thanks;
Patch (5/5):
- Keep loongson2_thermal_data->chip_data as const, and use data->flags as the private data.
- Renmae LOONGSON2_THSENS_OUT_10B_MASK -> LOONGSON2_THSENS_OUT_11B_MASK;

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

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 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 (7):
thermal/drivers/loongson2: Correct thermal sensor registration loop thermal/drivers/loongson2: Fix clamp() usage for thermal trip points thermal/drivers/loongson2: Fix Loongson-2K2000 trip point programming thermal/drivers/loongson2: Use bitfields and per-SoC thermal ops thermal/drivers/loongson2: Move per-SoC ops into chip data
dt-bindings: thermal: loongson,ls2k-thermal: Add compatible for

    Loongson-2K0300

thermal/drivers/loongson2: Add Loongson-2K0300 support

 .../thermal/loongson,ls2k-thermal.yaml        |  73 +++-
 drivers/thermal/loongson2_thermal.c           | 336 ++++++++++++++----
 2 files changed, 321 insertions(+), 88 deletions(-)

base-commit: ec0d89150a9381d591344a9f6f5428655c227a7f

Signature · 1 line
2.52.0