From patchwork Mon May 4 05:02:41 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Kalashnikov X-Patchwork-Id: 2104 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 973AE1C0270 for ; Mon, 4 May 2026 07:03:44 +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-23051-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-23051-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 8FEF1300AB03 for ; Mon, 4 May 2026 05:03:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F1E29257824; Mon, 4 May 2026 05:03:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="okFMgtLn" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) (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 869662472A2 for ; Mon, 4 May 2026 05:03:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777871007; cv=none; b=IR4obTo5w3PzBfdR5Q3cyZOukBiq3C5/UBaZchy+91Ox7R5odJlYS/BzcG7C9f3D/bp2eUXk9l5VK7poWAAepmZ3Qpvzl1ebyS4/fyXVXCxvqHufMewIZbvgWWF7E22GNUBRe+/lhtBi8soN0ayrTj1wabhF298OW2fzmGNUSHQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777871007; c=relaxed/simple; bh=e+V2hd+ejnpH4qk2aVtlzrEBe/9p2o5z8qY/F+AU6ZE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eqdwNm8VfM4zQWuteglOqR9lpEuUZgFn3Cll2t4brBQZ1ivsYy8W1lXM17Zpxui3x2mh65E0g3qyep434jr9DgtzCl5kAphMJBGTalb28EWYGHCJ+vYhjoL+htHSmk07CDIlDUqVBUEi5yw6pBV9LHC1uuCc2ZZkBsrqFs9JAuk= 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=okFMgtLn; arc=none smtp.client-ip=209.85.216.41 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-pj1-f41.google.com with SMTP id 98e67ed59e1d1-364ef7a759bso1443188a91.1 for ; Sun, 03 May 2026 22:03:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777871006; x=1778475806; 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=U+hY6I1QbsBJjzyv0BxYALLJHQ4yccrLD8dnNfVypx8=; b=okFMgtLnsYFlpqzivP/0WAB7g/U3cDVq0pxpu5b4z7jNbYTeglP9OegdHiEoq6zYiZ 7MQyEiH0tENfv++dpVephTqfRdYHHrglZHoqIWNV1kfy3uyB5+mSsG6NFOf3q4wxWOlx AJSufisSfdZ63Avfm4jzqLUr9SK/XL647e3a+vKMH3UlSWBdyZ6GfCzDlMNNFWyYLIWs ix82uHCOeAdhEuTyn4TwGdI0eMl9cxHzrO4eq+WijEkUh8eSK/hwUO0QH3kWKT+pYigg D1pxNuq4AFiOHpAG+TDkxCVXfRm6vA0zj02GfhHq+V3NNvLWibpkptY3d6cC7GugQMLg 350g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777871006; x=1778475806; 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=U+hY6I1QbsBJjzyv0BxYALLJHQ4yccrLD8dnNfVypx8=; b=No+gidFo512ngoAGIV4EAnJPoZqV1rEk3a0TGg3V3mlLOq86AbL5vsv1xOIpogCmML hW6hfs6c44NNVjDD3VdFR2m+gUG9gN2+wnztq7h8Z57KQyzMXakK2t3kxf1KozOQ3Th3 bR2+8qrzmjYiI/ylW7RtYV15W000gwwK4nOMIZ3YlIspiXE5Q2Cxy2L+pyAaBBlsAAU5 Tf3F30iaAYBHMejVR2cpmH1XXaafCr/6YnOASkvBgyUrLsoImiiHsWsrjXQsY982YPkb gKLtowhyz5p3uRwm5k7RkKPP2cjmU0H3o9V+WfnKyYI4sv5iawdCIkwnRiqjTlN5T2i9 zfDA== X-Forwarded-Encrypted: i=1; AFNElJ9llq+PnUhznKD9VINnHI7uAd2ul8/+2taLTuVUsBJDF+h6e1rPBY9ijPMB7XhM5Xeua9/K7IndcpA7Lw==@lists.linux.dev X-Gm-Message-State: AOJu0Yyh4AY5KmI6k1LlxxEoTFmSrOjgV2b1BRU5wL6JND/Jv/XO3TV1 XTG++y3RB6HJ6MEWllltLhZQ8/ZF07YoSx8CjRTPRiFbSOuKPccoGV2f X-Gm-Gg: AeBDieuBMJPndYtempcoL0UFQ2XZfZuMLULOwnPiRIcdZyxXar3YStv5/9U58U9k09h cUhQe7TrvJYlKun1l7tMC4KACciory+0m5huhOVGA+AmqoDm4b8K1Bsm5+jHkeUpraLSXUfNQCN XXnMOfDtupvCMt+j4MSQujUX8R+uZ6jaL5lLbhpqyftxYR7MpFS5TdpWhiHREFzEw0OjvNHSYtr hObnW0+VGESF60NRiMWFWDUKJk1v6pxakOYaSgjEVVZd/6o0TWHuIZ4X+wbFFIA4Nv++/07TyKx OTJjsFCk/gzdJM553U+5yNasXw37ZATGByXsZ8JyXqGEW/nm3bPES1ICY5ZtfwTw6e0UOvVERTC luTlbz9tcgL4J1V8kRtUrg09GTIbB+3pLOkEJU+dfW4IQjw4iw/xmVTxTs0zVQuOkgXXyE4T/dd lNsA== X-Received: by 2002:a17:90b:4f82:b0:35d:93c7:e386 with SMTP id 98e67ed59e1d1-364c44b65e7mr14781931a91.4.1777871005911; Sun, 03 May 2026 22:03:25 -0700 (PDT) Received: from archlinux ([2605:e440:15::152]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-365437b50b0sm2662908a91.0.2026.05.03.22.03.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 May 2026 22:03:25 -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 v4 1/5] dt-bindings: thermal: sun8i: Add A523 THS0/1 controllers Date: Mon, 4 May 2026 13:02:41 +0800 Message-ID: <20260504050245.646078-2-iuncuim@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260504050245.646078-1-iuncuim@gmail.com> References: <20260504050245.646078-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 is split into two cells that are in different areas of nvmem. Both controllers require access to both memory cell, so a new property nvmem-cells has been added. To maintain backward compatibility, the name of the old cell remains the same and the new nvmem-cell-names is called 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..6020413c3 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 Mon May 4 05:02:42 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Kalashnikov X-Patchwork-Id: 2106 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 E22DA1C0555 for ; Mon, 4 May 2026 07:04:09 +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-23052-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-23052-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 D02613007368 for ; Mon, 4 May 2026 05:03:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E7096266B46; Mon, 4 May 2026 05:03:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JRKQhBIO" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (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 7AB2123C8C7 for ; Mon, 4 May 2026 05:03:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777871021; cv=none; b=DD1cWc9FJun0HPkijmi3bysuydQwl19WJf8Ppv9aco9XlpNujxEt0d39OjI4yKHFhnDHOVUq2PpR3pqgl7pAvChFv64RaQjchGA88Dmg9oyw9CUmHs2bon7UktSlJKD2TGBgNLeYzXmePqrDZRfvnM69GjlYL/aTeQOVqYqx75o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777871021; c=relaxed/simple; bh=2TFX3CXq6/rmxkKsrdpy4I6/+x+PNEWuxGgifaViL0U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cfb/+V5TNp4MlXJizs5Pa5JCb7wblIFQFRmx07lEn2HuktLPgi0OZ0nydbyrNdwSfeqtWitJnosjSu9Oe3azmVL4rYJzqrK+hZrDNP8dFQQpjpTP7jfwOCWAT1jJ/kMxkKBEsLvejb1iCJYKfKH/7Nz8DVzCS39Xo46qZkhdhPs= 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=JRKQhBIO; arc=none smtp.client-ip=209.85.216.43 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-pj1-f43.google.com with SMTP id 98e67ed59e1d1-364ff382b0bso2335725a91.2 for ; Sun, 03 May 2026 22:03:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777871020; x=1778475820; 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=tCX5Iqac13O3XfLY0RNkBX2Gq9jD0l1ObowJKbWU4OM=; b=JRKQhBIOW6ZubrdsTGO5tn04tAtbnBqAeOC20VBDvb62lpMp1OFk/esO47JXDgg6Av s/MfId6GXN8auwxVA2AAnurlRE258dXVgfOKOH4NGRPkr1biscM3mwIfYan2Cl4ZAL96 f4BZbG6JAe6lB7bF2/OxyyjQ8muN9rSsq8uGcZvEGrexA/W9GlUZ6RuOIzxr1GufdwlB GeR34ccn8IcXFjNiOrjhRg4v2SntDWCuGtP+RZHAXiGNAdtLdyMOoEOB0CkdLJYvL5Uk kxN70HRsLvkL7g8h0QewEfvYZnWvltfILrASjoXbGRE45z6NzWcrSii22jIuLAvA9pB3 IdlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777871020; x=1778475820; 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=tCX5Iqac13O3XfLY0RNkBX2Gq9jD0l1ObowJKbWU4OM=; b=YCXQ6U0jLqh/6yLLqBS6cUMZGlnWlR/pLN2ton77bQ1IgsddjmKgTwLik35jFSNsqK DEiP2gZ96JcE8u2s9eu8zXsaAJKt+XkVT9GAnqDSj85DC3PsJ3tAFwy6pfXRVR9Gz1k1 PZAASCybxtm3acWzdJYk/qSO9Ylx4t52h0Jzwg0D1uKqDDxxx81hCPC4TKBqlh0Xjmd9 p47E2n4w2YMYmkoohUQYVp+jpaP5qRZ4B5DSu32G3DA9fhSp48n/23yHm8eAhzVB9/xo mJ67HeeNniz2r0d3x9idShcjqtNbjcDllWmSWEBpZT9I5jTiTe86sTUTHRBz3OK60vYX /dvA== X-Forwarded-Encrypted: i=1; AFNElJ+yhvMjS4gahTZpQN3ikLTkU7RTIvry3yjvKBCDL7k7vrySJ7KIs85zepbevqn3VGa5FW7cdQVIajK9CA==@lists.linux.dev X-Gm-Message-State: AOJu0YwBcVI0gCHV+hYmt9TooCc3ot72Kfd2sMxHWPdUczBeD5S1YtEo 7lDMRa5+lgL/qGTWGtoGy3Bif8PXIj4nqIi9QN3WBf2r9aEcrjM6Kavz X-Gm-Gg: AeBDieunCyRJYSgA6DPxbURzNhtShIAFDRcGd2k9TnISBhnwxud4UCSTiMMFsuH9nKY oMPlwabPJ90TwiaUz1UOGY5Uijg4VLBe1u8/e0/CWktxXJ/K1HCtkoyMe8/ONm8USxl76Dma+Bd /0VDOb8Zh/iDj5kXh0mfYtnK6rSNE4GGQkjcZo5OpiXHPYvmTrvLLWNHxqhnM5ZELfkOkk7tzr9 fyxKaLF/z2vz9PazbPkwXY91a+FTjZtgb7to0Le0qhWJW8r4S1E8Cbj2C3w7lBNOerYat1bhCAP tTndKEvyWzeloHZuoFmhqUlADT98SDBGylo2zyIOs1DskPT0nl6u69PLfAVvWghTmHoZUS7B4cs +wHSOZW6+7bHC7iuNmC2lDQsgq88BHxZYBlQK5jQ21crRhAbetr2xj1Aw0tdedjCx+QSmZqahrp usGFyp3qEepZ5s X-Received: by 2002:a17:90b:3b4f:b0:35e:3e86:e2d1 with SMTP id 98e67ed59e1d1-3650cdbaa39mr8265243a91.7.1777871019885; Sun, 03 May 2026 22:03:39 -0700 (PDT) Received: from archlinux ([2605:e440:15::152]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-365437b50b0sm2662908a91.0.2026.05.03.22.03.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 May 2026 22:03:39 -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 v4 2/5] thermal/drivers/sun8i: replace devm_reset_control_get to devm_reset_control_get_shared_deasserted Date: Mon, 4 May 2026 13:02:42 +0800 Message-ID: <20260504050245.646078-3-iuncuim@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260504050245.646078-1-iuncuim@gmail.com> References: <20260504050245.646078-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, 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: Chen-Yu Tsai --- 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 Mon May 4 05:02:43 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Kalashnikov X-Patchwork-Id: 2105 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 3E7AA1C0270 for ; Mon, 4 May 2026 07:04:04 +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-23053-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-23053-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 BAC143001598 for ; Mon, 4 May 2026 05:03:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9DE1425A33F; Mon, 4 May 2026 05:03:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eViOQ9eo" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (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 577CE23C8C7 for ; Mon, 4 May 2026 05:03:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777871036; cv=none; b=Zr4layR80YozgiGtlKyl67LA6Lixa7amipY8/LegPmyNyCds9kqS0SLIXfsrkoB0yBbuzIFLBbXGcelMRf9Nh/WyHOmBZTbAq8Qyebd5khjDe/KhXbNahSlkNwBeqcaHVp617bSrNPogNK+a4VgC657qITSSGbCYCcFl/wCrTIo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777871036; c=relaxed/simple; bh=ESOpoZ6325VLRLNq/W+ehNeMfVtaJC9EPjvW5kmH1DI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G0mBrsE+z+bvkwz1X92w5PliDTWTUDX23uzdU+uLEhzpa7hwZNfLMsKYIqVoGuXGuYii3+IoGrGwybIoP2NwhUz9NwV842472pdkRE/AKApsUCo74stOmQku8k/TlsY6Kbznb7Rkt6FyG5i9Bwd/Gw5Ad86qFkX20U9nODOSwmE= 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=eViOQ9eo; arc=none smtp.client-ip=209.85.216.46 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-pj1-f46.google.com with SMTP id 98e67ed59e1d1-35691a231a7so2444249a91.3 for ; Sun, 03 May 2026 22:03:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777871034; x=1778475834; 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=BR+GQkq+OHGSaM1M1XSEfGoOR2adYsGXzd7KgnjDEDM=; b=eViOQ9eoL6s5NJye3zsCdI8Da+9crwbCrGk9ria3T0Q8k7BRvU73ST9HaAfKPhHQne RY0F/4n8S0Qg1WkPu8tL9qIKoQftxVYPSDHZca3HQU8Ri0WteSERMWotM4tRgOZZsviw L9Wok5ltyn90kB+zQ1kieRlM0c5FjSTjOLPPYNdsybY33hRU8Xvuynhkio/n+srrnptw JNPex39fsEj17+9co8VcKxiTnlRO2j08a9uzrAKTuJpQR9qTaP9dzfybqKfrK8Y82vHA 0uH/Xk06OqQNMO7iL9dhZlTmvxUshR86112ktnVRwdKtIqGmoDeDh/eC2n0It17Lki3w jU9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777871034; x=1778475834; 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=BR+GQkq+OHGSaM1M1XSEfGoOR2adYsGXzd7KgnjDEDM=; b=VZ0LPcvFufd60ZHJKKS1psdgIICryvbO9G/noNlQ+rjDwK3wy3W4PsRTAwR9pvIs3O /MHi5TmoyPNSmPPt6iRHiF5A3AvCYvrwgrae2SarO0ZyBBgsXqMqKCQtAUd4W5SdG6Xl Wg9M+XJvjP1yheyy8Uc7EHBOERxjCl38Q7/L3v0rIDmlxlcEQNJ7cNpdmXArFgLb5bFa 5qB9LM4ACZLhBdinmIFFNYeg/km6DR6yNVmv9DsK+lo68FDkKVE7xLQ+h54YC148RxSb CCgfVuJdbCfRIj1ZoJpmxfxebpzpDYs4u63yfj5kuBJoTdqQZTqQDZFeHOegyhGpxNpN 8yuQ== X-Forwarded-Encrypted: i=1; AFNElJ8WAl9msA4WxpxFuSBxdM1Y0/gPmmVKjienGdDphLUvXH1upqNk7o7LRuIjARjNRKlc9BruB+ly3bt9BA==@lists.linux.dev X-Gm-Message-State: AOJu0YxruTMChpUKOEV5RTW7Z9QR56IW7uaOb/BNsomIollU+WQ1ED4m qYXjKJpH9nfKMgZl0qZRz5vAUQg6xpXn/LCOhDZGOBxXM9//cqnUuyvD X-Gm-Gg: AeBDievlg+hLIwmfhTHwa7S9sH539zFpX27KYR+5VKmzRyrLjYWM1Q8YtsrktTdnKgg gcSVe7u+2sJ5y9bsOUg0OkA/XjKDh7LDS1fb4iqnUi9RQsV8+Bd2G30KHTiwV9KPX1x/GrsGO40 avh248JOFn72vO3wqSvZ1IyTjIeu9AxfFU//sBOVXUFNUD1E3kEjJTj6N9CpqClm74k7QP3ghQ0 PmzUo5WuiyE7Tm0Le6reAkgQwGXOKOiWMPQeE0QaE1JKbCkurf0MpGdVWyTa0t/8IHRRq7Mr/aG 3lzOp7aFclZOq+dqwSSJYOySoNqgQK/ZTs/ou4a84IZzMiz/KWjmHB8p7T6oCS2Y9Wpt/9MrKb9 BNJVQHT+cPF1pqO3HPfwByrk8xaVkV3Kv5WucuggqJRalmf0tyl0dX6puLjEEA6OFua6WeA3017 Si7Q== X-Received: by 2002:a17:90b:17d0:b0:35a:24f3:2c8e with SMTP id 98e67ed59e1d1-3650cd95ddemr8487132a91.9.1777871034512; Sun, 03 May 2026 22:03:54 -0700 (PDT) Received: from archlinux ([2605:e440:15::152]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-365437b50b0sm2662908a91.0.2026.05.03.22.03.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 May 2026 22:03: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 v4 3/5] thermal/drivers/sun8i: get calibration data from two nvmem cells Date: Mon, 4 May 2026 13:02:43 +0800 Message-ID: <20260504050245.646078-4-iuncuim@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260504050245.646078-1-iuncuim@gmail.com> References: <20260504050245.646078-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-23053-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: 3E7AA1C0270 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 cell. 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 --- drivers/thermal/sun8i_thermal.c | 77 ++++++++++++++++++++++----------- 1 file changed, 52 insertions(+), 25 deletions(-) diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c index df0c26970..c4aaff8f7 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -301,43 +301,70 @@ 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; + } + + memcpy(caldata + callen, caldatapart, len); + callen += len; + kfree(caldatapart); } - caldata = nvmem_cell_read(calcell, &callen); if (IS_ERR(caldata)) { ret = PTR_ERR(caldata); goto out; } - 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 (calcell && !IS_ERR(calcell)) nvmem_cell_put(calcell); return ret; } From patchwork Mon May 4 05:02:44 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Kalashnikov X-Patchwork-Id: 2107 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 078A31C0536 for ; Mon, 4 May 2026 07:04:20 +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-23054-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-23054-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 B8F803008E30 for ; Mon, 4 May 2026 05:04:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 11789263C9F; Mon, 4 May 2026 05:04:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="a+TKlZ6j" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) (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 AAFE0256C61 for ; Mon, 4 May 2026 05:04:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777871050; cv=none; b=Xn5rPfGCedPCKS5v9UuIDE69do2RFu3weaN4tDn4IDxR09Wnlm+WUB+b6URThC0RTPBg597My5VtYQjtthYa2COfKK9HH2K5IBQaecM2z3jW7/53ag1FirC6r3lN1AJScsbcQrSCC2M4rAJskQwORdkEXjVdDdORdiFCz1ktipc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777871050; c=relaxed/simple; bh=QyoUgJ2jJeKlm1ndIJvXIiS5587bYg8xTKAl4U8ecQw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FrM0V4slUoN42JPg5QRTbkAV6UTkGx16vTAtUrP6B0dcXo9ia3sABGycW1RNRN+3igxioTMDbuiqHZ5G/U2KX0isyM1EvOT0iVup/PI6nOaUFBieV3wL1w7au8BPq26L98Icvednxy72vSyy1ZghHazzmW6QxD7NEg1RnL0sgVU= 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=a+TKlZ6j; arc=none smtp.client-ip=209.85.216.48 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-pj1-f48.google.com with SMTP id 98e67ed59e1d1-365425c98c6so357194a91.0 for ; Sun, 03 May 2026 22:04:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777871049; x=1778475849; 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=B3+Iww+WFVs530WIpfYPC8wfiAgNCYmHbA4msVXQjbo=; b=a+TKlZ6jaa1zfwmEElqMey3h1CCNsmTRrc/B1uaHvmai7DBrpelL9s9znsydic24rI 5ZG/UQ5S6xWoRurXerHvYyv3ZnRsVugRGOYpGwkEmDQ+bpO4W1d+b4+EjwOYtk93HsYl je2PFnKHGWitBW1VBMRIhOM3j4NHwEx6/d4NJeJjeI26s0vWi9r+ugKYc1RZch2W4fwy I0LafN+UnNVs1/JEZOZRfCF+i9YI46TjSPjd66LVM7+gM3dNFOVSNCvtBCWMT+eHcp5D uPX5e1cxZj/Qy2ZNI8nOnjqDVlJ8dNB/maca9L+4sEdsB5aB79trHiBH0v2lpgPptBcP YCWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777871049; x=1778475849; 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=B3+Iww+WFVs530WIpfYPC8wfiAgNCYmHbA4msVXQjbo=; b=IQwFQeHNdJRrY7FA3LdCJs6QonsRIM/AUtIJBy40hNxftcUo44EN6iQw/AeMo/lU8E auAzUNNNo3/n39fZYVhQ4fLrsV7X8sTuUcdpagGcXtykX4QtxH+mpsCLd6He0NNe/2bm z33loxbE37dMzVC4p2JDiqJUhZfOA5OAR3VbZ6mp4F5HFa5WEYV/XduTGe+RP8I38SUM lPST8Q2EZw0uAPfk0e2uHSghE4+d+IDmPHaqX2d1dsyrMFVi6NOBlCUv06wTP2Cf7CVA HT8Vl/Um3kvz5dfkQnjcl8pZBBb43eVYplFSs/w+sGAuEl11rONitx9uIPGejSmvgyl8 r1FQ== X-Forwarded-Encrypted: i=1; AFNElJ8iEcLy8PFTM10VNbSLVeYYhOatDARMdi4g+U0a0wIxcGaCxcGMNKC0PyGGDJAS9UJGM7f4fyr4ihIwww==@lists.linux.dev X-Gm-Message-State: AOJu0YxZ7l9z5QnEoEmWh2r63vE39h1geSvZoOrwSVUJ++w434aTukts osCczQeiaYND9AlR+DUbCzwUhsT3TND4dGS6Y2BkSbIdBxTTYd4FuWcH X-Gm-Gg: AeBDietmbFeqYT4uvCKL9fI+j9l7iOC4aseAW9CaAOS4oZR/2pYKXh1StjTsEvC2SCC PyUElZ/YxJ1qfDbem8HGUPI3bmQCPhOyjzJVDE70t4CLcSQS362cyXmzkEwe06rtIJzI239b3az gprxrjikkO8l6cdSi8gP9mb2nWF65JwoINVIgw2d/OmEnvTErEi8NszlBdpxpEqD5EvELcYBkBH lBJdYfbiP5Dg/Q/urmHVbRMFIiFHkDcIso1tPLITufwa6DA/VqQ1/IBeeCS02DPWh+4NcyTH6R7 e7ZUjHTRjjMHfwte9Jlocf2Tn4xE5R70TiUVrEFvnuDpEeDyAeLOOo3mHKfsQVMGLImKc7Se7Md ZluA9IyaV8pv3MhpyabWPn7E0xeER4TMIf4cK6IkHUHoJ7d9geJOL9kpqfHy4MMSMpPAYL7J7eA +3Kw== X-Received: by 2002:a17:90b:2b45:b0:35d:8fdb:4f36 with SMTP id 98e67ed59e1d1-3650ce0098dmr8169319a91.18.1777871048840; Sun, 03 May 2026 22:04:08 -0700 (PDT) Received: from archlinux ([2605:e440:15::152]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-365437b50b0sm2662908a91.0.2026.05.03.22.03.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 May 2026 22:04:08 -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 v4 4/5] thermal/drivers/sun8i: Add support for A523 THS0/1 controllers Date: Mon, 4 May 2026 13:02:44 +0800 Message-ID: <20260504050245.646078-5-iuncuim@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260504050245.646078-1-iuncuim@gmail.com> References: <20260504050245.646078-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. 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 c4aaff8f7..3b73aafab 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; @@ -722,6 +828,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 }, @@ -732,6 +863,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 Mon May 4 05:02:45 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Kalashnikov X-Patchwork-Id: 2108 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 184561C0270 for ; Mon, 4 May 2026 07:04:31 +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-23055-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-23055-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 D77A330048D8 for ; Mon, 4 May 2026 05:04:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3876F265606; Mon, 4 May 2026 05:04:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PfjY1eJp" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) (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 ADC65258EE9 for ; Mon, 4 May 2026 05:04:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777871065; cv=none; b=ZVZ4WeLwtoMabiC1/I4ZHKd12z5yiKf6R+57rWfhkcCN85cuEChWgW/0sheIzH+Fg/7HW3EsD9A3YWZKi5U76DaYnTVMuvgBbWDKqYH6YTRoCe/1qqkEGA7SkUJ2z9HbvdQHwj0H5lh0c6i7qXnf72L52XlVfVE6EV4b3GnIFU8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777871065; c=relaxed/simple; bh=+AfMOyYfNSai/vzHaaojDNYbQlGipPu5vQcMVMO/QuY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CVr/yuLHwMZKf/Ok4JME1paC8Ryw+8+z00v9i66bmVZv1gbu8YA+WisQhODlYDMmG4htNKK6uR1LoCi64jYeXAFkuIhWgAZ/tE7eLDaT22toHJxlP/xjwQ9cyi5OhYk/1bd0YgXuhb4uBcDlKKGPDEO71FAQtAx8j1mYWR1mG94= 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=PfjY1eJp; arc=none smtp.client-ip=209.85.216.48 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-pj1-f48.google.com with SMTP id 98e67ed59e1d1-364ef7a759bso1443466a91.1 for ; Sun, 03 May 2026 22:04:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777871063; x=1778475863; 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=2Zx5JZiDM7P1W4ijYGbXe8KVsddltmoo33akfRDuMeY=; b=PfjY1eJplHrB0bHLfPt2nNbRvwXLFOI+ODMQDyw4KYZtCKaGDm0pgRCvZ6nV8Szb0o JQM7BmZIOjT3VaBdOjPYqo2YNwl05/ICS4xax+8HVpg80gQFpKAfLJA25kEjUez10rkx PkqXW2nWppbQ/Vr4Y7U+v5Vn5d41Jq/efqeR8fukJtGHf5ygigoHJv0B3Z6G6mmA90AA syjIveY6OBAl4RtUuptkgklpW+VDXuiq1iCBUce4PRsUiwLnVKLZx7Ktf0QJOxvmnk8D lndj7tBpVieVLwGTBBWqeHzWnnP+3mEaepmLBJPx0WdzRt1/AaCnN1GuVtpKOY7HNjld GH1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777871063; x=1778475863; 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=2Zx5JZiDM7P1W4ijYGbXe8KVsddltmoo33akfRDuMeY=; b=rilaZowakENaQ6ZOXn+zf+gBo6d7F5so78NddMdeZSrVWbIDa5nMVn7WY5z9E6uFkx fpCaneMJIDzNjeQTuHUC8kyg6AGUtdi0h9tGJqmJpqpXGnL3BLL+Wsotge5T9aAXVfNo P28zBQdl+kYk/HWQcEDeFsTAqFgCgi5AfCftCRlvKF8+hZ76CizpvbY1KfJ2lqtyfznk Lo2HIHbCtjqMt8OMtXggMIz8EHpAjUU3c52/rT0/K+H6wdrfmasElsSbnlYmf2UD8YVt yw142aJM4g+irS3v4sODrM1PJLU7c3bf9oXxbUYZabsVnmIwwN7J9N96o2MOUIpZLfXf pGhw== X-Forwarded-Encrypted: i=1; AFNElJ/EiVo3gAVdDcKtLXu0GSjJfeckw0het041UffU5b8Yo1lPyP6wcYvso2MopzzJsNDFmx6FQ8iSdgRIEA==@lists.linux.dev X-Gm-Message-State: AOJu0Yy5KBdk4O4sAAFnvhJV/mnfwqyvzD3MWeSZyLyJPsRV3T43UI5Q q4J2XuqHNkL/654FDeGRRGSfEA+7KhQAnW1imNFsn7tRaaZWg1HcheHl X-Gm-Gg: AeBDiesPQF2pXQlLIF2u78DCCk2IPa6nVO2eVUiJSn6Ft5JY9EaMBIQ5j8g4iS8FCs9 KK8dXp9gWNl87h9sB7IaiGWEuDTGB2nuatylG4WNgrCerPcsb5OM524mZloJdDoI8+wEPl9gBhA qZQTuycrGbdBoRcenjWLeWTLkfJ5RMYi97zJU2vHVt3gmHOtE16A2r7L9R3QdL+nbI3UH15di+c 53pn0r9NY40jbX5mP1O8u7RcrFsWRVdI8mNVonlefbLVW1oR7Vy4n6imPc8wH4RdT8ykes/t0lG HFXv7xx02eKx5erLJLe6bt5YZVemSE196Kmy3ciShmhf4NMmFUGNtVOViojo8PGomFGOwOaVPYu vp9/TEvkEppuyyh7M5lUXhtQGJqAS1Cvhz/cy77WCTjc/KT9CNwAhybbAykL0HEYTLJYEVxInyz gHVg== X-Received: by 2002:a17:90b:2586:b0:35f:c258:a9a2 with SMTP id 98e67ed59e1d1-364c49fc890mr13397626a91.17.1777871062958; Sun, 03 May 2026 22:04:22 -0700 (PDT) Received: from archlinux ([2605:e440:15::152]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-365437b50b0sm2662908a91.0.2026.05.03.22.04.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 May 2026 22:04:22 -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 v4 5/5] Allwinner: A523: add support for A523 THS0/1 controllers Date: Mon, 4 May 2026 13:02:45 +0800 Message-ID: <20260504050245.646078-6-iuncuim@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260504050245.646078-1-iuncuim@gmail.com> References: <20260504050245.646078-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]; ARC_ALLOW(0.00)[subspace.kernel.org:s=arc-20240116:i=1]; 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:+]; TAGGED_FROM(0.00)[bounces-23055-noreply=patchwork.local]; ASN(0.00)[asn:63949, ipnet:172.105.96.0/20, country:SG]; RCVD_VIA_SMTP_AUTH(0.00)[] X-Rspamd-Queue-Id: 184561C0270 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. 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 | 154 ++++++++++++++++++ 1 file changed, 154 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi index 5afa8d92a..288a4710b 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>; }; }; @@ -565,12 +574,46 @@ dma: dma-controller@3002000 { #dma-cells = <1>; }; + 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>; + }; + sid: efuse@3006000 { compatible = "allwinner,sun55i-a523-sid", "allwinner,sun50i-a64-sid"; 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 { @@ -1087,4 +1130,115 @@ 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>; + }; + }; + }; + }; };