From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EED0432861E; Mon, 28 Sep 2026 04:44:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790570677; cv=none; b=Ybf5oyjYPBetFi65TL+nn4uCqooulQ8F62dRoTNz6+Bf1s7BBGmNns/HdKiOccBUXiL1QX0lpFq8RHazAuYI/UY1m819ldYcjapW4oU06YSom5TG01y3xtw6Vyzlro1rFXKwl96iM0ju72uidCKHiC+dmgdPceyxsDmZdB6UKkw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790570677; c=relaxed/simple; bh=gYYyP0IHWIg7sydv6pjKknPCiaOdKcshjd211VS5lMw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=lyzc9LNQDHVrLXtqkHMuyiZmRqPOsVML3DfoY73NUWpNjkaA2vVFdEVMWuIKRbcZ7ar2prO8pUXObRzPaaP6yg7MVyP7pIYzgETKeuG9/gHo6Lryw49MeQMhZBJ0c4V26EMifqaUP4EXnNF3zvAh3eCKvMDBcWu16Y8j/gRPn74= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [223.64.68.159]) by gateway (Coremail) with SMTP id _____8DxC9Kw8LlqWmEQAA--.48148S3; Mon, 28 Sep 2026 12:44:32 +0800 (CST) Received: from kernelserver (unknown [223.64.68.159]) by front1 (Coremail) with SMTP id qMiowJDxg8ys8LlqvfElAA--.52750S2; Mon, 28 Sep 2026 12:44:29 +0800 (CST) From: Binbin Zhou To: Binbin Zhou , Huacai Chen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Yinbo Zhu , "Rafael J . Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba Cc: Huacai Chen , Xuerui Wang , loongarch@lists.linux.dev, devicetree@vger.kernel.org, linux-pm@vger.kernel.org, Binbin Zhou Subject: [PATCH v6 0/7] thermal: loongson2: Add support for Loongson-2K0300 SoC Date: Mon, 28 Sep 2026 12:44:09 +0800 Message-ID: X-Mailer: git-send-email 2.52.0 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:qMiowJDxg8ys8LlqvfElAA--.52750S2 X-CM-SenderInfo: p2kr3uplqex0o6or00hjvr0hdfq/1tbiAgEECGq52vkBHAAAsi X-Coremail-Antispam: 1Uk129KBj93XoWxJF4xAw1xCrWUJrWxXrWkAFc_yoWrWrW8pa y3uwnFkr4DGr4UAwsxJw4rZF4Yvwn5ta9rZF4fK345uwn8Kryay3y8tan8ZryxCrs8XFy2 vr1kKr4kCF4DCFXCm3ZEXasCq-sJn29KB7ZKAUJUUUUr529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUBFb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVWxJVW8Jr1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6r4UJVWxJr1ln4kS14v26r1Y6r17M2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12 xvs2x26I8E6xACxx1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1Y 6r17McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64 vIr41lc7CjxVAaw2AFwI0_JF0_Jw1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_ Jr0_Gr1l4IxYO2xFxVAFwI0_Jrv_JF1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8Gjc xK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r4a6rW5MIIYrxkI7VAKI48JMIIF0xvE2Ix0 cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8V AvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E 14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07jOa93UUUUU= 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/cover.1789546118.git.zhoubinbin@loongson.cn/#t V5: - Rebase on linux-pm/thermal; - Drop patch-3 for it was applied. Link to V4: https://lore.kernel.org/all/cover.1785829933.git.zhoubinbin@loongson.cn/ 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/cover.1785480242.git.zhoubinbin@loongson.cn/ 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/cover.1784619512.git.zhoubinbin@loongson.cn/ 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/cover.1783670011.git.zhoubinbin@loongson.cn/ 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 -- 2.52.0