From patchwork Sat Jul 4 17:14:07 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Kalashnikov X-Patchwork-Id: 2555 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mxe881.netcup.net (Postfix) with ESMTPS id 617791C00CB for ; Sat, 4 Jul 2026 19:15:47 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=gmail.com; spf=pass (sender IP is 172.234.253.10) smtp.mailfrom=linux-sunxi+bounces-24157-noreply=patchwork.local@lists.linux.dev smtp.helo=sea.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.234.253.10 as permitted sender) client-ip=172.234.253.10; envelope-from=linux-sunxi+bounces-24157-noreply=patchwork.local@lists.linux.dev; helo=sea.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sea.lore.kernel.org (Postfix) with ESMTP id 3B36A301AA4C for ; Sat, 4 Jul 2026 17:15:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 98AEA373BE9; Sat, 4 Jul 2026 17:14:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BVdn02k4" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50D6435F60E for ; Sat, 4 Jul 2026 17:14:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783185299; cv=none; b=qjk66G+UK4zhs1JOE4d0Aii7mLN5LUQA77/Z1V5q3hgj7Zw0Z0ab7d6ajLYuqeodW/m87EIY+jfcVETcMCDQsS+2OvA6/a2bQ7Y/fm2ZW9+uxV7dkwQuAW/7b7zQWDO1e6rVkHypFu9m71v+fzES7QKgMxa2N2V1YH4HONnd+pM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783185299; c=relaxed/simple; bh=NNneVdy0HhxnlGFqTwE8omGAtOyN6+sEw6Qa8xG+YSU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HPLKpzPakWUkb8v0ZXzZKi51KC4BG8A3k57zH6cbqA/o+CkUYTxqqW1Sk4ATaOCGersPfAg+x+MtIlW6gXXMZEKaVqR64V+cPB/CriUyxTXcjKVlocFKZBRxSZhBXgv63s/crGuv6/jZSWjOc5wGELdI1FG/jxt1xVirSeLcGOU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BVdn02k4; arc=none smtp.client-ip=209.85.210.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-847aebc56b6so1195209b3a.3 for ; Sat, 04 Jul 2026 10:14:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783185298; x=1783790098; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=k6kKI5J8Ttv5I5yUn+NLV5sWRapXSwcPAxycZh/dkxc=; b=BVdn02k4/zbNb87cTMRvO8WV46BnlGveklgHEpOWEpD/P2FP3THV0EJPnVGERP5lcx B9eICFuZq87NtnKE8q5oD60SBIdKbIzTb9Ty9GRiDIOFRpK98savCi1fv0gV7JU0PFs5 pz62uYsYvtXxP0pCBdQIBaxRFYUpk7qlUHrZRgqcl/58h1ZkYN/HodA+02JlHOGDQpS4 2YW/rSMe2ajNNBhH9CyWYsVeQM2QnNrmpIBWvQI0MEhjJAxXcvGVR9hKnlF0A5TBlDsv OwBT45YDygbHkZIpfnFlHk9oodIEBbPo1f09x4zJmB7ezi0An41i0wkHJlGKa+SV8L+E hxug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783185298; x=1783790098; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=k6kKI5J8Ttv5I5yUn+NLV5sWRapXSwcPAxycZh/dkxc=; b=GKU0qgp2IgF3hmZONbBZCU1uU16IgjQvwnJ53eN2FYpgxbD9MjYhp2jJ+p2OU9AX8T zKs6F4Fr3IK3oEaiRvYQYtPkAVePZXXcF5otgbcf7qExcW64X2FqNKFY2zUf0Laulq94 8ubeic2MN/VdIfrXdcr7tiq/tZkswFqtRbsaLKC4E+hOrW83nXe25u6RD6G4aEzHVsXE A7bX2mSp6eOHRukbrALRoE9uLurBQrrQpCZk3J7KwE0GsmHjUu/XMfA3O2peSsDtWfkp w07CPSlubeWX2/zywQXzNC/2aQc1nRxzmo9BqHqAHOAvsMOiffj9u47fOPJ654pZ0C9K hDbQ== X-Forwarded-Encrypted: i=1; AFNElJ/jJVwskk25vuKBpUHFXnHdekAPeQKdCUTezXlgHs5X8ZHsOQzaqR+O5CBZGb979qWvIaRhIOkrkA2AQQ==@lists.linux.dev X-Gm-Message-State: AOJu0YxCUQ2fGSwmfsNh2rZnzzDONoBi3UeMZRLTk/d8y2CNGquLVnqj iN8q50Qd13qUN36Md+IXRw19HYQdTsp7x3aD3WlGfkFqStDW/BJ2DkHJ X-Gm-Gg: AfdE7clgWCQ2q9xXQGviFc5ukjIFeIeXSCf/lvBsC/oE2lx0sg0nQS6ACopS+O9ovLo /KnHegMRSWJ5YCOivkxHVkShZVzW1VfNrzafz3Qm+CxN9DsBqZU1wnmvCFExCvr3M6YQlEZtEbw E0s5kw48PHGjtCQCLH+MgUj36i54ODr36JvlXXdrtpH9Z6yx1fIpklLwv/v/6MuWnCbeXGkLcoi MUo7MIQhb5MzTCiQqaUTkxAoJyC2S+FUcr3+XxATgnCsIj6nWJgBS8olZ7T77bo2fucpHhkaCBq yNFwJpEWO5EGFkCNzPmqbAhLDnbDoO77rjX40RlCphEq5+d3jw67MtmVpXqAG57oI6UXfRbu+by X9cdWYKybOAjbp4eRi83dBFIVirmaXZc3OGV/5HxxqYmJpLY/EDA2idlstspTze60jySAhpgeCe n8RbOj X-Received: by 2002:a05:6a00:4f92:b0:842:2ddb:e305 with SMTP id d2e1a72fcca58-847f6f69949mr3837076b3a.43.1783185297621; Sat, 04 Jul 2026 10:14:57 -0700 (PDT) Received: from archlinux ([212.192.12.80]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d498adsm1379101b3a.32.2026.07.04.10.14.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2026 10:14:56 -0700 (PDT) From: Mikhail Kalashnikov To: Vasily Khoruzhick , Yangtao Li , "Rafael J . Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Philipp Zabel Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v5 1/5] dt-bindings: thermal: sun8i: Add A523 THS0/1 controllers Date: Sun, 5 Jul 2026 01:14:07 +0800 Message-ID: <20260704171411.1413349-2-iuncuim@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260704171411.1413349-1-iuncuim@gmail.com> References: <20260704171411.1413349-1-iuncuim@gmail.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= Add dt-bindings description of the thermal sensors in the A523 processor. The controllers require activation of the additional frequency of the associated gpadc controller, so a mod clock property required. The calibration data for both thermal controllers (THS0, THS1) is split across two nvmem cells at different offsets, requiring the two cells to be read and merged. To maintain backward compatibility, the name of the old cell remains "calibration" and the new cell is named "calibration-second-part". Signed-off-by: Mikhail Kalashnikov Reviewed-by: Chen-Yu Tsai --- .../thermal/allwinner,sun8i-a83t-ths.yaml | 54 +++++++++++++++++-- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml b/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml index 3e61689f6..6f5b2f3b9 100644 --- a/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml +++ b/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml @@ -24,6 +24,8 @@ properties: - allwinner,sun50i-h5-ths - allwinner,sun50i-h6-ths - allwinner,sun50i-h616-ths + - allwinner,sun55i-a523-ths0 + - allwinner,sun55i-a523-ths1 clocks: minItems: 1 @@ -47,11 +49,16 @@ properties: maxItems: 1 nvmem-cells: - maxItems: 1 - description: Calibration data for thermal sensors + minItems: 1 + items: + - description: Calibration data for thermal sensors + - description: Additional cell in case of separate calibration data nvmem-cell-names: - const: calibration + minItems: 1 + items: + - const: calibration + - const: calibration-second-part allwinner,sram: maxItems: 1 @@ -107,6 +114,7 @@ allOf: enum: - allwinner,sun8i-h3-ths - allwinner,sun20i-d1-ths + - allwinner,sun55i-a523-ths0 then: properties: @@ -132,6 +140,29 @@ allOf: - clock-names - resets + - if: + properties: + compatible: + contains: + enum: + - allwinner,sun55i-a523-ths0 + - allwinner,sun55i-a523-ths1 + then: + properties: + clocks: + minItems: 2 + nvmem-cells: + minItems: 2 + nvmem-cell-names: + minItems: 2 + else: + properties: + nvmem-cells: + maxItems: 1 + nvmem-cell-names: + items: + - const: calibration + required: - compatible - reg @@ -176,4 +207,21 @@ examples: #thermal-sensor-cells = <1>; }; + - | + #include + #include + #include + + thermal-sensor@2009400 { + compatible = "allwinner,sun55i-a523-ths1"; + reg = <0x02009400 0x400>; + interrupts = ; + clocks = <&ccu CLK_BUS_THS>, <&ccu CLK_GPADC1>; + clock-names = "bus", "mod"; + resets = <&ccu RST_BUS_THS>; + nvmem-cells = <&ths_calibration0>, <&ths_calibration1>; + nvmem-cell-names = "calibration", + "calibration-second-part"; + #thermal-sensor-cells = <1>; + }; ... From patchwork Sat Jul 4 17:14:08 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Kalashnikov X-Patchwork-Id: 2553 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mxe881.netcup.net (Postfix) with ESMTPS id AA4461C3FF9 for ; Sat, 4 Jul 2026 19:15:19 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=gmail.com; spf=pass (sender IP is 172.105.105.114) smtp.mailfrom=linux-sunxi+bounces-24158-noreply=patchwork.local@lists.linux.dev smtp.helo=tor.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.105.105.114 as permitted sender) client-ip=172.105.105.114; envelope-from=linux-sunxi+bounces-24158-noreply=patchwork.local@lists.linux.dev; helo=tor.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by tor.lore.kernel.org (Postfix) with ESMTP id 340713012CDA for ; Sat, 4 Jul 2026 17:15:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4C1FA35202B; Sat, 4 Jul 2026 17:15:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qVP2Uzwz" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F243B374A1A for ; Sat, 4 Jul 2026 17:15:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783185317; cv=none; b=KkJW2M0VFrSItU6MHUCR7bz1o1DhADI0ueOK3MIIhdim0kcNllq+ZwUtjvItga3GJHK9riHHqhH64OAKah0JiJK5dcePpJTqGAZzxjwZjuK/mF2gd0ArcaLUy9P4k2XKsWUAkLW7LDyNBgTh5Ay/iciaJoNfYz463sVdDwz1750= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783185317; c=relaxed/simple; bh=hiDqfxEwo2m08vVR+XmTBBNvFPcoR44JVTQtfXJLBKI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LHxqCF6FXQFyK/L+rol0ivuG1eBwPYR/n8bU9QZMc26EUeeQKuV8JoJZ9TtlcCNT53SDZsVD3ZxMZJcpHvS189MPQ0eq37aPgrxmtMAy6y48HAkHXbGvaDs4pcpxQxxjn5g5GphYgFhXp+XCcPqJ0Rc1SYz/YeokSa8m+OCy9hA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=qVP2Uzwz; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-847e6f03df8so1972292b3a.0 for ; Sat, 04 Jul 2026 10:15:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783185315; x=1783790115; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=baNPOtnreWkoR3AhhTVFf+uOWjoLtova69oE/tcCCJk=; b=qVP2Uzwzl9aNoJiGHL3yy4ksDn++4Zf0wSrop1v0kDy+Gn0K3vffgX1SC7GSlcmLlc fwVOQSrObUZ3Kn3D5O+AIrDsu6aIrAe7cW379Db7gKM5p5S1PpI6CaoyobWkV8DuNGzb br7YY38HoNsXXd5+KTbG1Mb2EN1bl1MPP2v+NvfgztJ8ns3/B0bNj1fynaAvVG+d2kXF SMCdai65G5vL7Ath5L8l5yyfZWgs2KDM1uPOCX4qiBw3WaYfWXfsNwzTOHhJoSbFnp9I FV2dMbruexd4KIHmiwN5emBdw+7pyS/euV6pjdaTnPUBmYSthl1HVc6hv/X+/UUmvd9e 27mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783185315; x=1783790115; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=baNPOtnreWkoR3AhhTVFf+uOWjoLtova69oE/tcCCJk=; b=YkZkkbPu23yx/yEqzDWGvJ3cjJKnICElx/ipLy8mk5ndYBEU2dLNrxwKi9axhVOzVp 3AJGlUoM8BOwJxjvax3ORyVWXaNZJNeDKLKjhyfxQRRfUZr6FEv9ZstpNg6QrO2XSztj fHhuU4YjNsLNsnwyGeDPHWZ1z8k6rBC1cRObsIDj/HMkkzujm10XEufdbUP8xI368XqP ig0KwrxGthVRbt/uYW0bQbEk0M3Y0aFWinpiVO2SSCgD9OmpcUDr9isFHcYQ4TQB+CHV pwGkGTuQq4PPrLXNF9VV0uNGAfhOs03OG4nkBq0iscOw+JP38D8jRfxbOrhkTyup9K/U zyGA== X-Forwarded-Encrypted: i=1; AHgh+RoPbUDtAJdkoOK10b5KCCCYq8ykInrWpvZluRzGHcQ2i1JPRw/ZAFZueggd1qelioEpZXC5cRq7tOIFiA==@lists.linux.dev X-Gm-Message-State: AOJu0Yxi1r6gULVgRTzrxsWKydFLg+VPEl7QfdJ+ynEKYN8ngi3mJOLn lT2rq4IywJzayNYYOmDJFl+iFoQUNlISTR7Q3o+G7SEY16SuwZS8Gdgv X-Gm-Gg: AfdE7clFrGyKTniXG/Rz8IR2z2XSoiILft2JYr4XUwT2xK9ORmkwblw3PLQ/Xy07gRq jzxBZqMDXweuwkXNMUNhJZ4ohcXpCnrx9pj0nD+0BHj6WuwPHZUdUTLJXO6quNpr19UYHJqM3HU UtS/kKsMKztlKe8bKl4ks+UIk0GVrIxDQHvNxuSHbxZv5q1DA4EINnHhtcg7Vi0BF12l0zqZR5b nB3zJintCo8XSBXgd4sE0E8rUggNvXnASmFroTp3MDbqt76JYuFjIFM9tM+MbydI0RRZcdwm+00 zLHhOZhEmWmsiHlUYVvibPEhC3l1kbVXMOtFizpIujfkq9O1+RxE8OFmfsVv7Gc6rRN8FP2re5K j5hlW6anaocuWTlbHwF77pcvCI7DLMLMz3VaJecuD/XOaoPU4/55KbVsofKcmhbUzXA4Z1BccmR +yu2Hs X-Received: by 2002:a05:6a00:1c86:b0:82f:9407:d167 with SMTP id d2e1a72fcca58-847f6ee42c4mr3927100b3a.38.1783185315280; Sat, 04 Jul 2026 10:15:15 -0700 (PDT) Received: from archlinux ([212.192.12.80]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d498adsm1379101b3a.32.2026.07.04.10.14.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2026 10:15:14 -0700 (PDT) From: Mikhail Kalashnikov To: Vasily Khoruzhick , Yangtao Li , "Rafael J . Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Philipp Zabel Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v5 2/5] thermal/drivers/sun8i: replace devm_reset_control_get to devm_reset_control_get_shared_deasserted Date: Sun, 5 Jul 2026 01:14:08 +0800 Message-ID: <20260704171411.1413349-3-iuncuim@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260704171411.1413349-1-iuncuim@gmail.com> References: <20260704171411.1413349-1-iuncuim@gmail.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Rspamd-Server: rspamd-worker-8404 X-Spamd-Result: default: False [0.34 / 15.00]; BAYES_HAM(-5.50)[100.00%]; RBL_SENDERSCORE(2.00)[172.105.105.114:from]; SUSPICIOUS_RECIPS(1.50)[]; DMARC_POLICY_SOFTFAIL(1.00)[gmail.com : SPF not aligned (relaxed), No valid DKIM,none]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; MAILLIST(-0.15)[generic]; MIME_GOOD(-0.10)[text/plain]; BAD_REP_POLICIES(0.10)[]; HAS_LIST_UNSUB(-0.01)[]; PRECEDENCE_BULK(0.00)[]; TAGGED_RCPT(0.00)[dt]; RCPT_COUNT_TWELVE(0.00)[18]; FUZZY_BLOCKED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[tor.lore.kernel.org:rdns,tor.lore.kernel.org:helo]; FORGED_SENDER_MAILLIST(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_FIVE(0.00)[6]; TAGGED_FROM(0.00)[bounces-24158-noreply=patchwork.local]; R_SPF_ALLOW(0.00)[+ip4:172.105.105.114]; FREEMAIL_TO(0.00)[gmail.com,kernel.org,intel.com,arm.com,sholland.org,pengutronix.de]; FREEMAIL_FROM(0.00)[gmail.com]; TO_DN_SOME(0.00)[]; FROM_NEQ_ENVFROM(0.00)[iuncuim@gmail.com,linux-sunxi@lists.linux.dev]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:63949, ipnet:172.105.96.0/20, country:SG]; ARC_ALLOW(0.00)[subspace.kernel.org:s=arc-20240116:i=1]; RCVD_VIA_SMTP_AUTH(0.00)[] X-Rspamd-Queue-Id: AA4461C3FF9 X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= The A523 processor has two temperature controllers, but they share a common reset line. Make it shared with the shared variant of devm_reset_control_get(), and also simplify the driver by switching to devm_reset_control_get_shared_deasserted(). Signed-off-by: Mikhail Kalashnikov Reviewed-by: Chen-Yu Tsai Reviewed-by: Philipp Zabel --- drivers/thermal/sun8i_thermal.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c index 226747906..df0c26970 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -342,11 +342,6 @@ static int sun8i_ths_calibrate(struct ths_device *tmdev) return ret; } -static void sun8i_ths_reset_control_assert(void *data) -{ - reset_control_assert(data); -} - static struct regmap *sun8i_ths_get_sram_regmap(struct device_node *node) { struct platform_device *sram_pdev; @@ -389,19 +384,10 @@ static int sun8i_ths_resource_init(struct ths_device *tmdev) return PTR_ERR(tmdev->regmap); if (tmdev->chip->has_bus_clk_reset) { - tmdev->reset = devm_reset_control_get(dev, NULL); + tmdev->reset = devm_reset_control_get_shared_deasserted(dev, NULL); if (IS_ERR(tmdev->reset)) return PTR_ERR(tmdev->reset); - ret = reset_control_deassert(tmdev->reset); - if (ret) - return ret; - - ret = devm_add_action_or_reset(dev, sun8i_ths_reset_control_assert, - tmdev->reset); - if (ret) - return ret; - tmdev->bus_clk = devm_clk_get_enabled(&pdev->dev, "bus"); if (IS_ERR(tmdev->bus_clk)) return PTR_ERR(tmdev->bus_clk); From patchwork Sat Jul 4 17:14:09 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Kalashnikov X-Patchwork-Id: 2554 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mxe881.netcup.net (Postfix) with ESMTPS id F34EC1C00CB for ; Sat, 4 Jul 2026 19:15:43 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=gmail.com; spf=pass (sender IP is 104.64.211.4) smtp.mailfrom=linux-sunxi+bounces-24159-noreply=patchwork.local@lists.linux.dev smtp.helo=sin.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 104.64.211.4 as permitted sender) client-ip=104.64.211.4; envelope-from=linux-sunxi+bounces-24159-noreply=patchwork.local@lists.linux.dev; helo=sin.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sin.lore.kernel.org (Postfix) with ESMTP id 344A5300250C for ; Sat, 4 Jul 2026 17:15:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2F0B9374A19; Sat, 4 Jul 2026 17:15:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="d846CZ6/" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4B9935202B for ; Sat, 4 Jul 2026 17:15:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783185338; cv=none; b=VmXsGnEWkS+JeHJp9jSEd9L05pwl/Dgmk+k4XaZaJBntA20mQ2tGIDccJlJ8ZFIVW4OWDsg46bn8cObx/uR//gkS9KDVXK+0d5d5rJ0NWc3bjzrBD2L4sTWrSV8OIg0el+bD8Urcrpe7BepVYfNXnzZFRvAAKiljjq1eghbFXMI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783185338; c=relaxed/simple; bh=NL0+DczK+bX7h5aeTAoVt3cN5b8jI07kISjmFCzG0dY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YMHMOeRQA4UlkhvvMWDqTgGC4ULIvJmaZ1Ake26o9kR385jKuOxaq2CMZjnJ89sHlGgrSCyCDH8aVE62QusB+a36ylSHUv/OvUexW2Gkkp+j8KUppom0mk/r0fDK5ysRxYOcq2EeODPA4jnFNycpElDDHZ8y8sq5zPCzyZ0lX4g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=d846CZ6/; arc=none smtp.client-ip=209.85.210.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-84532e3dbf7so1558591b3a.1 for ; Sat, 04 Jul 2026 10:15:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783185336; x=1783790136; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JsQaU9uZZtvn5+lIZrSejmQfTd4zI1y5dE5Iy0qO9rc=; b=d846CZ6/6WwNuHov48EG+8Evp8+AHIJn4lcYl16a2+2X8wztCDV3U24lV6jtF+TOaF kRFl8WWn4wc9+DFqxOMnhUuYYpF2hueLW5S48eQEjMx9emB2qyJqoZkAggzgRMkwd3zF 3xV9YORR89CuOICCjNu2AJNRzYPjAIXxzpFCXdMDxy9No5nCkajk3bVirPAmOHiRuYzj Gg/1GWVq7a7vRPnBTg/qF+OKI9FbPdbs9oj7s8f9ydarLaDEUMfE1Bm1J1iBJjskj2vO PwCKzWprmhnLh1k867DeJZuTuV0xEwfFYRrLOs9S9bMwh41QNVp8MkFwmK8XXZ49zg+G Yd/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783185336; x=1783790136; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=JsQaU9uZZtvn5+lIZrSejmQfTd4zI1y5dE5Iy0qO9rc=; b=IaitMkFOeqj/rNbunK0yLUYzAWb1vssD+vObVjFLxsikitt/x+KIJ0kQpRj0qEhing aQ8IYsHOdzd8DWHyOPfl5497lcWoRunVW6iCgrl8l9S9OFBpvea/osypJ9PrSMiCb/ZU Fl+gOOkeFBUzVLEQcDF8Al/wsHWyIFw17dx+oyDwsJNWDIuEmNzAxR32OX/58hhnh7BN 3pKh1+dT+ZR3Z5DOdnYNTE4WVYIZMNpwpYRmYDOKD1FGqJPqSBlodztSZcNccDUEGlRq rKZu27TAvO5sG47Q+uli+fDRSm8vDZ3hdYezWtpCQ+k7sTsX5PJEX0u0+P7/2IYOjzGi 4h+g== X-Forwarded-Encrypted: i=1; AFNElJ/oNhfpWvfheO7rZ9S3xUxX8s/+ozQRYKMqTxlOWoz59I9i7JmCtDDaODHXwGFEh/dcuZRQloe9AF3NuQ==@lists.linux.dev X-Gm-Message-State: AOJu0YyoAHqaUr8j4mTE/kSz21meL39cAudEoUSazpI5DlqAcoofuXV5 9VysGUxCFJHq0r+GZBInAYngwDWLYj6rGI1qkb6Wt4pfTX1c61KxF6Eh X-Gm-Gg: AfdE7cmI8HYZXmXyRel6r/rATmM5SsXNSjISxpt6+keHVsbuLPJfC1NUf/VqVvX50/o RMrmUnMB50ocXHpxouWfIyYAIVqnNuhIFbQa2fzx6oLjAsK2AYnYSlW9REqkq+zzEpXjOmV+6eP toy92/9nhaUavFgYn7uF2SEtA9lpSDD+jQGXFpxGPEFlDLFBW4bYlOH/K3umOChEb0VZfHsxqb0 nx00/T5AGyJeTG9sPMBiPBhVsBcI4s6+p42Or2RBVmPasew1SaSRZaMBZxQeDNCVoFICymOSzpE JZCQArXVsLuWQ9CkWuNQiQk4LscBX9rcVPzHAD99HIrnlQGOdO3fICOYF+PB3a79rHQRdKQeK8N nw27cXLwj9izEIWjLeNWNImU6hzltA7QaCZxAudI3+VNf7C+kGrQtodm70AGXkae3UnULByHIS8 Gu14sr X-Received: by 2002:a05:6a00:3305:b0:847:902a:57c1 with SMTP id d2e1a72fcca58-847f6f84d6fmr4092931b3a.57.1783185336159; Sat, 04 Jul 2026 10:15:36 -0700 (PDT) Received: from archlinux ([212.192.12.80]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d498adsm1379101b3a.32.2026.07.04.10.15.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2026 10:15:35 -0700 (PDT) From: Mikhail Kalashnikov To: Vasily Khoruzhick , Yangtao Li , "Rafael J . Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Philipp Zabel Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v5 3/5] thermal/drivers/sun8i: get calibration data from two nvmem cells Date: Sun, 5 Jul 2026 01:14:09 +0800 Message-ID: <20260704171411.1413349-4-iuncuim@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260704171411.1413349-1-iuncuim@gmail.com> References: <20260704171411.1413349-1-iuncuim@gmail.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Rspamd-Server: rspamd-worker-8404 X-Spamd-Result: default: False [0.34 / 15.00]; BAYES_HAM(-5.50)[100.00%]; RBL_SENDERSCORE(2.00)[104.64.211.4:from]; SUSPICIOUS_RECIPS(1.50)[]; DMARC_POLICY_SOFTFAIL(1.00)[gmail.com : SPF not aligned (relaxed), No valid DKIM,none]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; MAILLIST(-0.15)[generic]; MIME_GOOD(-0.10)[text/plain]; BAD_REP_POLICIES(0.10)[]; HAS_LIST_UNSUB(-0.01)[]; PRECEDENCE_BULK(0.00)[]; TAGGED_RCPT(0.00)[dt]; RCPT_COUNT_TWELVE(0.00)[18]; FUZZY_BLOCKED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[sin.lore.kernel.org:rdns,sin.lore.kernel.org:helo]; FORGED_SENDER_MAILLIST(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_FIVE(0.00)[6]; ARC_ALLOW(0.00)[subspace.kernel.org:s=arc-20240116:i=1]; R_SPF_ALLOW(0.00)[+ip4:104.64.211.4]; FREEMAIL_TO(0.00)[gmail.com,kernel.org,intel.com,arm.com,sholland.org,pengutronix.de]; FREEMAIL_FROM(0.00)[gmail.com]; TO_DN_SOME(0.00)[]; FROM_NEQ_ENVFROM(0.00)[iuncuim@gmail.com,linux-sunxi@lists.linux.dev]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; TAGGED_FROM(0.00)[bounces-24159-noreply=patchwork.local]; ASN(0.00)[asn:63949, ipnet:104.64.192.0/19, country:SG]; RCVD_VIA_SMTP_AUTH(0.00)[] X-Rspamd-Queue-Id: F34EC1C00CB X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= The A523 processor has calibration data in two nvmem cells. To be able to add support, the ability to add data from two cells into one array must be added. Signed-off-by: Mikhail Kalashnikov Reviewed-by: Chen-Yu Tsai --- drivers/thermal/sun8i_thermal.c | 80 +++++++++++++++++++++------------ 1 file changed, 51 insertions(+), 29 deletions(-) diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c index df0c26970..3bdd62aa8 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -301,43 +301,65 @@ static int sun50i_h6_ths_calibrate(struct ths_device *tmdev, static int sun8i_ths_calibrate(struct ths_device *tmdev) { - struct nvmem_cell *calcell; + struct nvmem_cell *calcell = NULL; struct device *dev = tmdev->dev; - u16 *caldata; - size_t callen; + struct device_node *np = dev_of_node(dev); + struct property *prop; + const char *cellname; + u8 *caldata = NULL; + size_t callen = 0; int ret = 0; - calcell = nvmem_cell_get(dev, "calibration"); - if (IS_ERR(calcell)) { - if (PTR_ERR(calcell) == -EPROBE_DEFER) - return -EPROBE_DEFER; - /* - * Even if the external calibration data stored in sid is - * not accessible, the THS hardware can still work, although - * the data won't be so accurate. - * - * The default value of calibration register is 0x800 for - * every sensor, and the calibration value is usually 0x7xx - * or 0x8xx, so they won't be away from the default value - * for a lot. - * - * So here we do not return error if the calibration data is - * not available, except the probe needs deferring. - */ - goto out; - } + of_property_for_each_string(np, "nvmem-cell-names", prop, cellname) { + size_t len; + u8 *caldatapart; + + calcell = of_nvmem_cell_get(np, cellname); + if (IS_ERR(calcell)) { + if (PTR_ERR(calcell) == -EPROBE_DEFER) + return -EPROBE_DEFER; + /* + * Even if the external calibration data stored in sid is + * not accessible, the THS hardware can still work, although + * the data won't be so accurate. + * + * The default value of calibration register is 0x800 for + * every sensor, and the calibration value is usually 0x7xx + * or 0x8xx, so they won't be away from the default value + * for a lot. + * + * So here we do not return error if the calibration data is + * not available, except the probe needs deferring. + */ + goto out; + } + + caldatapart = nvmem_cell_read(calcell, &len); + nvmem_cell_put(calcell); + calcell = NULL; + if (IS_ERR(caldatapart)) { + ret = PTR_ERR(caldatapart); + goto out; + } + + caldata = devm_krealloc(dev, caldata, callen + len, GFP_KERNEL); + if (!caldata) { + kfree(caldatapart); + ret = -ENOMEM; + goto out; + } - caldata = nvmem_cell_read(calcell, &callen); - if (IS_ERR(caldata)) { - ret = PTR_ERR(caldata); - goto out; + memcpy(caldata + callen, caldatapart, len); + callen += len; + kfree(caldatapart); } - tmdev->chip->calibrate(tmdev, caldata, callen); + tmdev->chip->calibrate(tmdev, (u16 *)caldata, callen); - kfree(caldata); + devm_kfree(dev, caldata); + caldata = NULL; out: - if (!IS_ERR(calcell)) + if (!IS_ERR_OR_NULL(calcell)) nvmem_cell_put(calcell); return ret; } From patchwork Sat Jul 4 17:14:10 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Kalashnikov X-Patchwork-Id: 2556 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mxe881.netcup.net (Postfix) with ESMTPS id 420DE1C00CB for ; Sat, 4 Jul 2026 19:16:04 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=gmail.com; spf=pass (sender IP is 172.105.105.114) smtp.mailfrom=linux-sunxi+bounces-24160-noreply=patchwork.local@lists.linux.dev smtp.helo=tor.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.105.105.114 as permitted sender) client-ip=172.105.105.114; envelope-from=linux-sunxi+bounces-24160-noreply=patchwork.local@lists.linux.dev; helo=tor.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by tor.lore.kernel.org (Postfix) with ESMTP id 2F6AB3016003 for ; Sat, 4 Jul 2026 17:16:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D1C9D28C009; Sat, 4 Jul 2026 17:15:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KR3Smi4N" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37598374E4C for ; Sat, 4 Jul 2026 17:15:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783185358; cv=none; b=eJQDePN2dtcKmVIfKkQ7+DMaDC0P461uS3YDzzp25QGTpnpGQlO3IMbbSFn7ByKV6W3bQyLmPyeeL2g8cYT/TWYfp8boYqk8+RiFc1C1bVXX6ViKbCeRjYc5N1MVIkkEYnwrC+K3Fv0Qgd1j6yxmP91sfHH8M8kh2cTIbp3h/MQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783185358; c=relaxed/simple; bh=seTZIEtXtqVVYV7kSKXvd99fs7QNW1ZFwg2DmcgKEAI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DiL72lJRICBqdSceLSlgfXRMNOlDawaEzXQIDSkQLplaAxepTMS2XEJYocklUS4v8D0A3uPpV+PIK/q5YB+T+W1hvB7soSGQrkW/jl/SdTrfnQxRA+s4DqMqF+YiRasjJPwhzDgCIX8RsgPNy2qK4iLrsUwTreK33aHSGWRl18U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KR3Smi4N; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-845c92bc464so1080543b3a.2 for ; Sat, 04 Jul 2026 10:15:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783185356; x=1783790156; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=+gR5VfBTV21+OrP9WqQJ4BqzawxRB45whAsA2GtJSFg=; b=KR3Smi4NP6i82wBHQcxJzySC4CkBU2vfVEQUAI7/H7VNHcJXUacA0HppFKa0h0rINm MEdRUzk5oFWmzXVs1g5Hf9t+fXYdWsKhwyuiq2zPjMAsr+RMUmtOSz7KGP5Sbam0wdd+ V8XpgRZsckRjJDRKvtPpqdv4/4+vv5i68gdzij7vXw8yNua2ZPoz2lz/9QdgQlhNJN9U 1ZXh1lIS5/Bc4tTY4guL0xSXBZtXKa167iLoWyZsq0nDxcatwrYKpU+y2EpvH+omuIpY 3u4TUxiJwL38HYaMksYIn3Q00y27o5L9ztEOVtbqWzxK2Tq2fCOiRLUdmZ0CRq8mZdLJ oq1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783185356; x=1783790156; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=+gR5VfBTV21+OrP9WqQJ4BqzawxRB45whAsA2GtJSFg=; b=NTCiygjwb/+3x3RA0fXV1GNv+xZ0f4NmLmXKFL1HHdtQKrNGQjllBBGoyXFh/1RWp0 wyFdO5iF2EEZo8oC1t2fvxwyO7n2SKFDfEThMx06WYmV7AwemZ+sai8fBNZ69aPE8RCZ IYcR1QhuXaDgr5CRj5PB8SN1pFYReACgaNxfDajx5fKp1p6A6ilEe9JZUh1MaWS0LU1d w5Yheec0KCWJywwwSOL2zOMIQ1esP5ioDqdMRily43yZaftsx9eYvN/VXGBDqZDJVbDR QNcDVSvzoytdBYttUcC/6l3aWP1k05d4EHcXkmqnoyvB879wA6LjyRaZwKDZqeUx6UD+ IJ+A== X-Forwarded-Encrypted: i=1; AFNElJ+dB1jI2v6JG+ZAybToQANxsu33whHdvM3gvH5CYzjYpbtlygnYLEDsR4f9tztCRTdiVGG2POLDaYMs4w==@lists.linux.dev X-Gm-Message-State: AOJu0YwFr2pQXElu9yhi8wp9tz1rBwN7oqAYme2z2ZE+93qcP7l6Q5XF Am5Rntk95L+gpTUt9kCHt8geBYRSahcq/1SbOwIHUJBoZ5yuktGXSjJI X-Gm-Gg: AfdE7clN/lOMZxpTFyh5E+9wiKmJoonUrsc6A7/SrUsQ+HitEd328aSiF6rSPSN6t6Q 2Qg46lkcZXiSl1WSKiZ/RpvBH41FCduSiCS5cV5solNrQ5pVi7bB2qhL0dsUR4u4bq0exLdkrXX pv7cMnlIvm8iTxad6a/3n+XT5Sx4wiiEe8kr1tTi5G9sq3yvGhjcOjzMM/WOQvmIf8/LsCZg9Ev VaVq5/ia6w5e0ilDHH73x0J90ZY6Ijs19Lh/k3FnBkpd468bTDO2eWR38VULsdr8L5YkzjDcpHc w0lHuSrlbM42QW5Y7C8pZkdWl7DLG87akcu7DfpA5QwZwP/ImtHRxDrYubEI+J3SzNyqD3CB0uB 7+f7J9YNEuzUxsVeSMUXW+TaElgpq6oBk5bowRNwJsxtGOtIGRL6fCUsgHSeJDOktyMqpViPbUQ wBcjtuebcRsG1GtxQ= X-Received: by 2002:a05:6a00:2394:b0:845:ec31:26cd with SMTP id d2e1a72fcca58-847f6f4fe9bmr3324398b3a.46.1783185356439; Sat, 04 Jul 2026 10:15:56 -0700 (PDT) Received: from archlinux ([212.192.12.80]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d498adsm1379101b3a.32.2026.07.04.10.15.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2026 10:15:54 -0700 (PDT) From: Mikhail Kalashnikov To: Vasily Khoruzhick , Yangtao Li , "Rafael J . Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Philipp Zabel Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v5 4/5] thermal/drivers/sun8i: Add support for A523 THS0/1 controllers Date: Sun, 5 Jul 2026 01:14:10 +0800 Message-ID: <20260704171411.1413349-5-iuncuim@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260704171411.1413349-1-iuncuim@gmail.com> References: <20260704171411.1413349-1-iuncuim@gmail.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Rspamd-Server: rspamd-worker-8404 X-Spamd-Result: default: False [0.34 / 15.00]; BAYES_HAM(-5.50)[100.00%]; RBL_SENDERSCORE(2.00)[172.105.105.114:from]; SUSPICIOUS_RECIPS(1.50)[]; DMARC_POLICY_SOFTFAIL(1.00)[gmail.com : SPF not aligned (relaxed), No valid DKIM,none]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; MAILLIST(-0.15)[generic]; MIME_GOOD(-0.10)[text/plain]; BAD_REP_POLICIES(0.10)[]; HAS_LIST_UNSUB(-0.01)[]; PRECEDENCE_BULK(0.00)[]; TAGGED_RCPT(0.00)[dt]; RCPT_COUNT_TWELVE(0.00)[18]; FUZZY_BLOCKED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[tor.lore.kernel.org:rdns,tor.lore.kernel.org:helo]; FORGED_SENDER_MAILLIST(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_FIVE(0.00)[6]; TAGGED_FROM(0.00)[bounces-24160-noreply=patchwork.local]; R_SPF_ALLOW(0.00)[+ip4:172.105.105.114]; FREEMAIL_TO(0.00)[gmail.com,kernel.org,intel.com,arm.com,sholland.org,pengutronix.de]; FREEMAIL_FROM(0.00)[gmail.com]; TO_DN_SOME(0.00)[]; FROM_NEQ_ENVFROM(0.00)[iuncuim@gmail.com,linux-sunxi@lists.linux.dev]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:63949, ipnet:172.105.96.0/20, country:SG]; ARC_ALLOW(0.00)[subspace.kernel.org:s=arc-20240116:i=1]; RCVD_VIA_SMTP_AUTH(0.00)[] X-Rspamd-Queue-Id: 420DE1C00CB X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= The A523 processor has two temperature controllers, THS0 and THS1. THS0 has only one temperature sensor, which is located in the DRAM controller. THS1 does have 3 sensors: ths1_0 - "big" cores ths1_1 - "little" cores ths1_2 - gpu The datasheet mentions a fourth sensor in the NPU, but lacks any registers for operation other than calibration registers. The vendor code reads the value from ths1_2, but uses separate calibration data, so we get two different values from real one. Signed-off-by: Mikhail Kalashnikov Reviewed-by: Chen-Yu Tsai --- drivers/thermal/sun8i_thermal.c | 133 ++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c index 3bdd62aa8..f48ed9eae 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -59,6 +59,12 @@ #define SUN50I_H6_THS_PC_TEMP_PERIOD(x) ((GENMASK(19, 0) & (x)) << 12) #define SUN50I_H6_THS_DATA_IRQ_STS(x) BIT(x) +#define SUN55I_A523_DELIMITER 0x7c8 +#define SUN55I_A523_OFFSET_ABOVE 2736 +#define SUN55I_A523_OFFSET_BELOW 2825 +#define SUN55I_A523_SCALE_ABOVE 74 +#define SUN55I_A523_SCALE_BELOW 65 + struct tsensor { struct ths_device *tmdev; struct thermal_zone_device *tzd; @@ -114,6 +120,15 @@ static int sun50i_h5_calc_temp(struct ths_device *tmdev, return -1590 * reg / 10 + 276000; } +static int sun55i_a523_calc_temp(struct ths_device *tmdev, + int id, int reg) +{ + if (reg >= SUN55I_A523_DELIMITER) + return SUN55I_A523_SCALE_ABOVE * (SUN55I_A523_OFFSET_ABOVE - reg); + else + return SUN55I_A523_SCALE_BELOW * (SUN55I_A523_OFFSET_BELOW - reg); +} + static int sun8i_ths_get_temp(struct thermal_zone_device *tz, int *temp) { struct tsensor *s = thermal_zone_device_priv(tz); @@ -299,6 +314,97 @@ static int sun50i_h6_ths_calibrate(struct ths_device *tmdev, return 0; } +/* + * The A523 nvmem calibration values. The ths1_3 is not used as it + * doesn't have its own sensor and doesn't have any internal switch. + * Instead, the value from the ths1_2 sensor is used, which gives the + * illusion of an independent sensor for NPU and GPU when using + * different calibration values. + * + * efuse layout 0x38-0x3F (caldata[0..3]): + * caldata[0] caldata[1] caldata[2] caldata[3] + * 0 16 24 32 36 48 60 64 + * +---------------+---------------+---------------+---------------+ + * | | | temp | ths1_0 | ths1_1 | + + * +---------------+---------------+---------------+---------------+ + * + * efuse layout 0x44-0x4B (caldata[4..7]): + * caldata[4] caldata[5] caldata[6] caldata[7] + * 0 12 16 24 32 36 48 64 + * +---------------+---------------+---------------+---------------+ + * | ths1_2 | ths1_3 | ths0 | | + + * +---------------+---------------+---------------+---------------+ + */ +static int sun55i_a523_ths_calibrate(struct ths_device *tmdev, + u16 *caldata, int callen) +{ + struct device *dev = tmdev->dev; + int i, ft_temp; + + if (!caldata[0]) + return -EINVAL; + + ft_temp = (((caldata[2] << 8) | (caldata[1] >> 8)) & FT_TEMP_MASK) * 100; + + for (i = 0; i < tmdev->chip->sensor_num; i++) { + int sensor_reg, sensor_temp, cdata, offset; + /* + * Chips ths0 and ths1 have common parameters for value + * calibration. To separate them we can use the number of + * temperature sensors on each chip. + * For ths0 this value is 1. + */ + if (tmdev->chip->sensor_num == 1) { + sensor_reg = ((caldata[5] >> 8) | (caldata[6] << 8)) & TEMP_CALIB_MASK; + } else { + switch (i) { + case 0: + sensor_reg = (caldata[2] >> 4) & TEMP_CALIB_MASK; + break; + case 1: + sensor_reg = caldata[3] & TEMP_CALIB_MASK; + break; + case 2: + sensor_reg = caldata[4] & TEMP_CALIB_MASK; + break; + default: + sensor_reg = 0; + break; + } + } + + sensor_temp = tmdev->chip->calc_temp(tmdev, i, sensor_reg); + + /* + * Calibration data is CALIBRATE_DEFAULT - (calculated + * temperature from sensor reading at factory temperature + * minus actual factory temperature) * X (scale from + * temperature to register values) + */ + cdata = CALIBRATE_DEFAULT - + ((sensor_temp - ft_temp) / SUN55I_A523_SCALE_ABOVE); + + if (cdata & ~TEMP_CALIB_MASK) { + /* + * Calibration value more than 12-bit, but calibration + * register is 12-bit. In this case, ths hardware can + * still work without calibration, although the data + * won't be so accurate. + */ + dev_warn(dev, "sensor%d is not calibrated.\n", i); + continue; + } + + offset = (i % 2) * 16; + regmap_update_bits(tmdev->regmap, + SUN50I_H6_THS_TEMP_CALIB + (i / 2 * 4), + TEMP_CALIB_MASK << offset, + cdata << offset); + } + + return 0; +} + static int sun8i_ths_calibrate(struct ths_device *tmdev) { struct nvmem_cell *calcell = NULL; @@ -717,6 +823,31 @@ static const struct ths_thermal_chip sun50i_h616_ths = { .calc_temp = sun8i_ths_calc_temp, }; +/* The A523 has a shared reset line for both chips */ +static const struct ths_thermal_chip sun55i_a523_ths0 = { + .sensor_num = 1, + .has_bus_clk_reset = true, + .has_mod_clk = true, + .ft_deviation = 5000, + .temp_data_base = SUN50I_H6_THS_TEMP_DATA, + .calibrate = sun55i_a523_ths_calibrate, + .init = sun50i_h6_thermal_init, + .irq_ack = sun50i_h6_irq_ack, + .calc_temp = sun55i_a523_calc_temp, +}; + +static const struct ths_thermal_chip sun55i_a523_ths1 = { + .sensor_num = 3, + .has_bus_clk_reset = true, + .has_mod_clk = true, + .ft_deviation = 5000, + .temp_data_base = SUN50I_H6_THS_TEMP_DATA, + .calibrate = sun55i_a523_ths_calibrate, + .init = sun50i_h6_thermal_init, + .irq_ack = sun50i_h6_irq_ack, + .calc_temp = sun55i_a523_calc_temp, +}; + static const struct of_device_id of_ths_match[] = { { .compatible = "allwinner,sun8i-a83t-ths", .data = &sun8i_a83t_ths }, { .compatible = "allwinner,sun8i-h3-ths", .data = &sun8i_h3_ths }, @@ -727,6 +858,8 @@ static const struct of_device_id of_ths_match[] = { { .compatible = "allwinner,sun50i-h6-ths", .data = &sun50i_h6_ths }, { .compatible = "allwinner,sun20i-d1-ths", .data = &sun20i_d1_ths }, { .compatible = "allwinner,sun50i-h616-ths", .data = &sun50i_h616_ths }, + { .compatible = "allwinner,sun55i-a523-ths0", .data = &sun55i_a523_ths0 }, + { .compatible = "allwinner,sun55i-a523-ths1", .data = &sun55i_a523_ths1 }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, of_ths_match); From patchwork Sat Jul 4 17:14:11 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Kalashnikov X-Patchwork-Id: 2557 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mxe881.netcup.net (Postfix) with ESMTPS id D17481C00CB for ; Sat, 4 Jul 2026 19:17:26 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=gmail.com; spf=pass (sender IP is 172.234.253.10) smtp.mailfrom=linux-sunxi+bounces-24161-noreply=patchwork.local@lists.linux.dev smtp.helo=sea.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.234.253.10 as permitted sender) client-ip=172.234.253.10; envelope-from=linux-sunxi+bounces-24161-noreply=patchwork.local@lists.linux.dev; helo=sea.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sea.lore.kernel.org (Postfix) with ESMTP id BEFF5300B12A for ; Sat, 4 Jul 2026 17:16:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3CEFF375AB5; Sat, 4 Jul 2026 17:16:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Q+gdP/sg" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F28183750AD for ; Sat, 4 Jul 2026 17:16:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783185377; cv=none; b=lTN0/AH04c8FWcaX3w37l1AXVUeM/QGaxNGUUUAOS/eIjvO6ZHOdD2TL+2GmP6eBmfXs5krKP2MWZ/dIygo6qY1VGYRyUkjMrOL79yKaZhSyWFSUgVkb78sJuVvCpj18RqHxAphNqU69jMfiS0pKCHrp5A64f0X4ZRfU4y+SPTY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783185377; c=relaxed/simple; bh=UwcwC3xtFbMfaEu/qElwOXnRVv0bbJHNhKNq97pt4IE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kVsG2xCz7jucw4UhcHsJGGqIkUE6C5l17WOa8QpM06qRZ7fHhks/PZdzL2ZtfwNEaczHrNRqth3M1lw81UNCoctdmpi0TBnAxMtml8t6xlYDnpB5Zzly2mlW1aosebXVE9NFLnbCbzRNw6LfM9Bahsds/SH14UwSJyUyPaMDJ6E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Q+gdP/sg; arc=none smtp.client-ip=209.85.215.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-c88973b6965so1848334a12.1 for ; Sat, 04 Jul 2026 10:16:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783185374; x=1783790174; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=d95C5AOhdaLbCgZk6LC0vYbHPRqhfdHed++OCDXOWh4=; b=Q+gdP/sggO66Bb+kO6AEK3r1kWIHOzmcaxEBsR4JmyvSiLa2nmgU7REOeEngkarXlX i0mUSgvTuJJArMZFjCplB1OmO9IHHSJfgUoz+bxAgJP+EtC11trDf/oOTLPmhpSy7wyE rptJ6RpwEsDu/QcF6E1VnYkPxOjGmQMCUtEy1lxegREAIL4pDl0qfvUMG40cIxNyZ4Dp ZEwb5+kpBB4YSWrJ5s23MfYsr0QKL2wkKhfFbxFQL+ro2NOy9NXgbd0kjuTXoGR7Edlj V7OPF628IcQ2Y0HbhsM4qit2gXrcWQr4bpk1jvilpTcjEyOB+VX4wihuOTr60GZ44C7w h8Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783185374; x=1783790174; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=d95C5AOhdaLbCgZk6LC0vYbHPRqhfdHed++OCDXOWh4=; b=sS/mbz3yE1PV9UxBiYle9dKDy4oL29nMkPwHEnaugxabPQsJFaqxY1/4QorgtWsaSe gxNhcPUwqFSrnAQPFZV9Gg/8Dd8Ea5gYCIk2PaUDdHQFY8OLJtIe8crueBm/1szXttXP +OWKRUNfT1OVmVJ8U1BhVVtaIZRzAApu/0NGs1UOm3VxTtbyz6OxQonyNEUNHHxa8U1I uNiLohJHp9VlItQEtErjL9JRNsdn3uHOM3xDRvWYYGjQuhGf0x+XTrvo0G+duRu6EFSt rWKdzoZGYW4Ay5QwLhb9rVtyxKkXg8MmMeqPkpMV2i9FpS6fEiOBq4QV3qg8gzq2Hss7 wV5Q== X-Forwarded-Encrypted: i=1; AFNElJ+y832X9jpBP6SZ41Gq6W7///Kbckkk31bv4rg7PnNlZR6u72daTc1AFH2/Ho92tSqtQFUT5FDfDzCJMg==@lists.linux.dev X-Gm-Message-State: AOJu0YwAd/kf0JfWwb8bSTdcWOyA2ixeSrqU6AfDb9AkvYhjSKFziRwj wD/J5VEnJXNFU/Wzyq1aQn7LeUgsosg3wRvOkrSDoVBqIGB7RomKgxkeZuzpmw== X-Gm-Gg: AfdE7cm5IV8jerkT8GCwnAPSDv0VloBXniwheRG5j3N/AiSkOraIi+eMD6rklLpeVo3 sGb/G26dQuUrCVJVuLY3owcnO/lqf/5bNtBzoFyanCjgx4bPSoBlTg8vFmUia2EQ4sJRiDCDCID zO1IzyGKiRIJ2yqt4VjHBXpD1yuh3EYLJIFZEZ2w99qxKho7LdYAopG/5WE/Pz0VPAbwq7TFnCB 13PC+/QQl7C64SdGRCQRNhzA+5f1S/Rcdbt3WWPqo2K9lnwKecn/dd0cyRyXWAkBxBcITE2ewZH DejNVDfSHtkWzPlXBXsU6Fvx0VItcx/rFdCj8+Ko0AUHnRcgW6MYU1x8S7aEu+5miQL2l580vFs h4OZis2fhL72xAbc1W8j5YuXn98ShZl78OQfNuGc7HsP4B1ilvy00qdnaUNoJYNeJBEWG/HWHsk wlGtHj X-Received: by 2002:a05:6a21:3394:b0:3bf:aa29:1612 with SMTP id adf61e73a8af0-3c03fa43612mr3885982637.28.1783185373846; Sat, 04 Jul 2026 10:16:13 -0700 (PDT) Received: from archlinux ([212.192.12.80]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d498adsm1379101b3a.32.2026.07.04.10.15.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2026 10:16:13 -0700 (PDT) From: Mikhail Kalashnikov To: Vasily Khoruzhick , Yangtao Li , "Rafael J . Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Philipp Zabel Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v5 5/5] arm64: dts: allwinner: sun55i: add thermal sensors Date: Sun, 5 Jul 2026 01:14:11 +0800 Message-ID: <20260704171411.1413349-6-iuncuim@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260704171411.1413349-1-iuncuim@gmail.com> References: <20260704171411.1413349-1-iuncuim@gmail.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= The A523 processor has two temperature controllers, THS0 and THS1. THS0 has only one temperature sensor, which is located in the DRAM controller. THS1 does have 3 sensors: ths1_0 - "big" cores ths1_1 - "little" cores ths1_2 - gpu Add the thermal sensor configuration and the thermal zones. Trips temperature, polling-delay and sustainable-power parameters are derived from the manufacturer's BSP. Signed-off-by: Mikhail Kalashnikov --- .../arm64/boot/dts/allwinner/sun55i-a523.dtsi | 160 ++++++++++++++++++ 1 file changed, 160 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi index ca6a16807..2ed00e7a7 100644 --- a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi @@ -11,6 +11,7 @@ #include #include #include +#include / { interrupt-parent = <&gic>; @@ -26,6 +27,7 @@ cpu0: cpu@0 { device_type = "cpu"; reg = <0x000>; enable-method = "psci"; + #cooling-cells = <2>; }; cpu1: cpu@100 { @@ -33,6 +35,7 @@ cpu1: cpu@100 { device_type = "cpu"; reg = <0x100>; enable-method = "psci"; + #cooling-cells = <2>; }; cpu2: cpu@200 { @@ -40,6 +43,7 @@ cpu2: cpu@200 { device_type = "cpu"; reg = <0x200>; enable-method = "psci"; + #cooling-cells = <2>; }; cpu3: cpu@300 { @@ -47,6 +51,7 @@ cpu3: cpu@300 { device_type = "cpu"; reg = <0x300>; enable-method = "psci"; + #cooling-cells = <2>; }; cpu4: cpu@400 { @@ -54,6 +59,7 @@ cpu4: cpu@400 { device_type = "cpu"; reg = <0x400>; enable-method = "psci"; + #cooling-cells = <2>; }; cpu5: cpu@500 { @@ -61,6 +67,7 @@ cpu5: cpu@500 { device_type = "cpu"; reg = <0x500>; enable-method = "psci"; + #cooling-cells = <2>; }; cpu6: cpu@600 { @@ -68,6 +75,7 @@ cpu6: cpu@600 { device_type = "cpu"; reg = <0x600>; enable-method = "psci"; + #cooling-cells = <2>; }; cpu7: cpu@700 { @@ -75,6 +83,7 @@ cpu7: cpu@700 { device_type = "cpu"; reg = <0x700>; enable-method = "psci"; + #cooling-cells = <2>; }; }; @@ -355,6 +364,32 @@ gpadc: adc@2009000 { status = "disabled"; }; + ths1: thermal-sensor@2009400 { + compatible = "allwinner,sun55i-a523-ths1"; + reg = <0x02009400 0x400>; + interrupts = ; + clocks = <&ccu CLK_BUS_THS>, <&ccu CLK_GPADC1>; + clock-names = "bus", "mod"; + resets = <&ccu RST_BUS_THS>; + nvmem-cells = <&ths_calibration0>, <&ths_calibration1>; + nvmem-cell-names = "calibration", + "calibration-second-part"; + #thermal-sensor-cells = <1>; + }; + + ths0: thermal-sensor@200a000 { + compatible = "allwinner,sun55i-a523-ths0"; + reg = <0x0200a000 0x400>; + interrupts = ; + clocks = <&ccu CLK_BUS_THS>, <&ccu CLK_GPADC0>; + clock-names = "bus", "mod"; + resets = <&ccu RST_BUS_THS>; + nvmem-cells = <&ths_calibration0>, <&ths_calibration1>; + nvmem-cell-names = "calibration", + "calibration-second-part"; + #thermal-sensor-cells = <0>; + }; + wdt: watchdog@2050000 { compatible = "allwinner,sun55i-a523-wdt"; reg = <0x2050000 0x20>; @@ -586,6 +621,14 @@ sid: efuse@3006000 { reg = <0x03006000 0x1000>; #address-cells = <1>; #size-cells = <1>; + + ths_calibration0: ths-calibration0@38 { + reg = <0x38 0x8>; + }; + + ths_calibration1: ths-calibration1@44 { + reg = <0x44 0x8>; + }; }; gic: interrupt-controller@3400000 { @@ -1102,4 +1145,121 @@ npu: npu@7122000 { power-domains = <&ppu PD_NPU>; }; }; + + thermal-zones { + cpu0_thermal: cpu0-thermal { + polling-delay-passive = <100>; + polling-delay = <1000>; + thermal-sensors = <&ths1 1>; + sustainable-power = <1200>; + + trips { + cpu0_threshold: cpu-trip-0 { + temperature = <70000>; + type = "passive"; + hysteresis = <0>; + }; + + cpu0_target: cpu-trip-1 { + temperature = <90000>; + type = "passive"; + hysteresis = <0>; + }; + + cpu0_critical: cpu-trip-2 { + temperature = <110000>; + type = "critical"; + hysteresis = <0>; + }; + }; + + cooling-maps { + map0 { + trip = <&cpu0_target>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + + cpu4_thermal: cpu4-thermal { + polling-delay-passive = <100>; + polling-delay = <1000>; + thermal-sensors = <&ths1 0>; + sustainable-power = <1600>; + + trips { + cpu4_threshold: cpu-trip-0 { + temperature = <70000>; + type = "passive"; + hysteresis = <0>; + }; + + cpu4_target: cpu-trip-1 { + temperature = <90000>; + type = "passive"; + hysteresis = <0>; + }; + + cpu4_critical: cpu-trip-2 { + temperature = <110000>; + type = "critical"; + hysteresis = <0>; + }; + }; + + cooling-maps { + map0 { + trip = <&cpu4_target>; + cooling-device = <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + + gpu-thermal { + polling-delay-passive = <100>; + polling-delay = <1000>; + thermal-sensors = <&ths1 2>; + sustainable-power = <2400>; + + gpu-trips { + gpu_temp_threshold: gpu-trip-0 { + temperature = <60000>; + type = "passive"; + hysteresis = <0>; + }; + + gpu_temp_target: gpu-trip-1 { + temperature = <90000>; + type = "passive"; + hysteresis = <0>; + }; + + gpu_temp_critical: gpu-trip-2 { + temperature = <110000>; + type = "critical"; + hysteresis = <0>; + }; + }; + }; + + ddr-thermal { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&ths0>; + + trips { + ddr_temp_critical: ddr-trip-0 { + temperature = <110000>; + type = "critical"; + hysteresis = <0>; + }; + }; + }; + }; };