Skip to content

thermal/drivers/loongson2: Fix trip programming and add Loongson-2K0300 support

Binbin Zhou linux-devicetree linux-pm loongarch stable 3 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v9 Latest7 patches 0 repliesNew
  2. v87 patches 2 repliesSuperseded
  3. v78 patches 5 repliesSuperseded

Changes in v9 from the cover letter

- Add Reviewed-by from Huacai, thanks;
- Fix issues reported by Sashiko AI:
Patch (3/7):
- extract gate_lo with FIELD_GET(GENMASK(7, 0), gate) before FIELD_PREP()

Patches in v9 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7thermal/drivers/loongson2: Fix negative trip conversion in set_tripsdrivers/thermal/loongson2_thermal.c+2 -10 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+93 -290 replies
4/7thermal/drivers/loongson2: Simplify thermal sensor registrationdrivers/thermal/loongson2_thermal.c+4 -140 replies
5/7thermal/drivers/loongson2: Move per-SoC ops and init into chip datadrivers/thermal/loongson2_thermal.c+74 -640 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/Kconfig drivers/thermal/loongson2_thermal.c+151 -00 replies

Reviews trailers per patch

All 7 patches have a Reviewed-by or Acked-by.

PatchHuacai ChenConor Dooley
1/7R-b
2/7R-b
3/7R-b
4/7R-b
5/7R-b
6/7R-b A-b
7/7R-b

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

Read the v9 thread

Cover letter [PATCH v9 0/7] thermal/drivers/loongson2: Fix trip programming and add Loongson-2K0300 support

Hi all:

This series fixes trip-point handling in the Loongson-2 thermal driver, refactors the driver around per-SoC chip data, and adds support for the Loongson-2K0300 thermal sensor.

The first three patches are fixes and are marked for stable:

- Patch 1 fixes signed division when converting negative milli-degree trip points to degrees Celsius.
- Patch 2 fixes the arguments to clamp() so trip points are limited to the supported sensor range.
- Patch 3 fixes Loongson-2K2000 trip-point programming by adding a per-SoC register callback and handling the split HI_GATE register.

Patches 4-5 are cleanups and preparation work:

- Patch 4 removes the unnecessary multi-sensor registration loop.
- Patch 5 moves the per-SoC ops and hardware initialization into chip data.

Patch 6 adds the Loongson-2K0300 DT binding, and patch 7 adds driver support for the Loongson-2K0300 thermal sensor.

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

Thanks.
Binbin

=========
V9:
- Add Reviewed-by from Huacai, thanks;
- Fix issues reported by Sashiko AI:
Patch (3/7):
- extract gate_lo with FIELD_GET(GENMASK(7, 0), gate) before FIELD_PREP()

    to avoid the __BF_FIELD_CHECK_MASK() BUILD_BUG_ON();

- disable INTEN while updating the 16-bit gate to prevent a torn {old_hi, new_lo} threshold from latching a spurious interrupt.
Patch (7/7):
- add depends on MFD_SYSCON;
- delay after writing LS2K0300_THSENS_CFG_REG to avoid misdetecting old fuse on a premature OUT_REG read.

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

V8:
Patch (1/7):
- Use MILLIDEGREE_PER_DEGREE macro instead of explicitly casting MILLI;

- Split patch-4 into two parts: the bitfields section will be merged into patch-3, and the remaining changes will be merged into patch-6 as preparation for introducing the new SoC.

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

V7:
Patch (1/8):
- New patch;
- Fix negative temperature conversion in set_trips;
Patch (3/8):
- Use writew()/writeb() in loongson2_2k2000_set_trips_regs;
Patch (4/8):
- Rewite the thermal sensor registration loop to clearer;
Patch (5/8):
- Fix loognson2_thermal_set_trips typo;
Patch (8/8):
- Read CHIP_ID1 only when EXTERN_ID is set;
- Simplify the Internal ID calculation;
- Add the necessary comments.

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

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: Fix negative trip conversion in set_trips thermal/drivers/loongson2: Fix clamp() usage for thermal trip points thermal/drivers/loongson2: Fix Loongson-2K2000 trip point programming thermal/drivers/loongson2: Simplify thermal sensor registration thermal/drivers/loongson2: Move per-SoC ops and init 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/Kconfig                       |   1 +
 drivers/thermal/loongson2_thermal.c           | 383 ++++++++++++++----
 3 files changed, 355 insertions(+), 102 deletions(-)

base-commit: 4358090906b01806ee483229e8d7163b806bd116

Signature · 1 line
2.52.0