From patchwork Sun Sep 13 14:55:23 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Kalashnikov X-Patchwork-Id: 3310 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 379AA1C1FC5 for ; Sun, 13 Sep 2026 17:01:10 +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-25861-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-25861-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 4622335C92 for ; Sun, 13 Sep 2026 14:56:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B139E3382E5; Sun, 13 Sep 2026 14:56:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mstvJRj+" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (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 7942A326924 for ; Sun, 13 Sep 2026 14:56:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789311371; cv=none; b=GxamcCR9V0Dfu8CNB6VD2FQNL6EP5EeTiEUPjOTztwwvRLE1JpQ3dP6+7JDaeu/xeL08c5VlSciugAMq538mvnyGANf+GOidY+a4wrvN5IYWo/dlF84hnlaVPu4vkJX2k6EXBxy79dwTCnIl6hJyTIMdd0kXNafODadTV8Vu7Ww= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789311371; c=relaxed/simple; bh=c0FwilGJH257Vmi4WBaFoyoKQXfgT/wqYU4kh/brsPk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PSoxuetYpnVO0WK5xoSxg0vZTg38ytUGLt62uzAA7xXDHKfEC3ZoVd5K7dGAOKOKzh4AydxLbQ3u++KVS2bAwVtC0syI0JXKxWCiwd/VVxRk0irk7il+go3PTUeOgFlrS5DnCDGlalEkC74dRc6JfFxJ/BHYgxqLZUrog7s34/4= 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=mstvJRj+; arc=none smtp.client-ip=209.85.210.171 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-f171.google.com with SMTP id d2e1a72fcca58-86a25369f16so1869671b3a.3 for ; Sun, 13 Sep 2026 07:56:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789311368; x=1789916168; 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=z/z4QNBtUdI4E15ZNXPZtkbjaHvGmUhKoMr+O5uGaIE=; b=mstvJRj+OPo6xZyFBxcxqEb+0rpbXYSWdTZkmtOtKLOkriEkYo41GKHFb/thLLNBho tNk7LovoxV75yjoG0LhsAHGOwUO/ezc1McUpnpJIBkQgoDJoWsqr8hlnChYGg28Jglcm vG/uLfqO2Q/JJNgb64D1sGoNfMu/DRg0Eu3A+pPGbiD8Xrt6RVxKG5DaYrn6Di2lckj5 E7KRhaaJLiEO9pRGdwKq4sTUcgKEDHB+geGrDtygH7tZZqPP4imE1ZtbeNv8e+oKUJ2q 8XHHJ978j3+fSRXbz1Ejd/DhFP/aSQosy4jqvBKpHnO/bMteE59nLyhPb6NzKEMZI/NT y/Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789311368; x=1789916168; 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=z/z4QNBtUdI4E15ZNXPZtkbjaHvGmUhKoMr+O5uGaIE=; b=dZijcQIK9VqEn9lo4KDEbgvImKrt3oQfW5A4eao//UBCsAqZF6TnYufpnHh22HOIQf k1dq8A6/Y/CzP+OOiYHXqH5PC7lCmeOQ8te/TQPa7Fb8b+L8eKL04lR5qvMwP1Oy+XnF AfDjrKljF+pM1cfwCN6T8+gUTpON+nRyIqr/U5niygsOt7wgfTSd9hiqfuERzQ5R6Z8l WVi3LwgwO1R7dUGdrw9wz/Tg3Q5W5HDd/cuPU2OWCDegLF7lnC7IvYFuSs2Hn3ctaswS TbVA33Av0Zc6TKX/MTPX50jnE3llAJ+CvQ/yEGVOWyTA7FAPVruvJHbQ3s2X17VWaihK pX5w== X-Forwarded-Encrypted: i=1; AKwUvBwIbKzYsVw+UHEum9QZCmvxvgB9WjR0BwWiiV5I9Btz2IuV2Ly3Q+d8mZfE/Cov88va/Ga1aYGQez3QUw==@lists.linux.dev X-Gm-Message-State: AFuF++ltwc4JSRNt8dYsNF16goY2noHExlx5Ls5QU3Guez8A2DqZlZMf uQ1AWbSSO4dmZFIplxje2O2BKb6sliz5zm0eaEynlcBRQjCp8esFJw5e X-Gm-Gg: AYBFou0CjQLLnNLk2nfMIISgrCYEYyzYQKVpaaRYbooHzSGExFAYZDAgbHbAYxAwuez QdpbSY+C7acnjiL1x8mUTjk4BUbh6ale9rJqAIG0z8DdFyM21jIpQI8lJ+LUsCzwlShjYV4C56m uecN4hLvrCZOUw5yUujU3lHu3AvmvSAwuvsNNkZnzncMyOLm/yliGk+LKFBSpO/aEV26tE61Yud D6bFxjcNWFdkmoK19zCVcfpAvKkJBVRdKsINhTZyp3opQmp+76aipG7XOSBC9CWouoKe8BSbFqr i0cv2qKjC3ImGNxUeq8xLOyAThDXS6EfJ/r2+Wg27zGL3Pf/QdHWSGH0StxIHF/p5Z5oiSNZnji oSrgYDqqOb8m9VLHFlYgWaUUsBtJ7T/cWBFBNneroHsFrNuMVxx3rf0xNk/NesiJbb/Oxzu24wu Iv6FtC3zNMGY6uJdotVqENtvTbVhO/sd02feGiQo9db+27AKWUPqJErGk2/gVVZzgp X-Received: by 2002:a05:6a21:46c5:b0:3d1:60d3:99f8 with SMTP id adf61e73a8af0-3daed46ad42mr25849990637.5.1789311368455; Sun, 13 Sep 2026 07:56:08 -0700 (PDT) Received: from archlinux ([207.90.239.231]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-33ba7a9bb56sm21467366eec.31.2026.09.13.07.55.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Sep 2026 07:56: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 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, Philipp Zabel , =?utf-8?q?Juan_Manuel_L=C3=B3pez_Carrillo?= , Andre Przywara Subject: [PATCH v6 1/5] dt-bindings: thermal: sun8i: Add A523 THS0/1 controllers Date: Sun, 13 Sep 2026 22:55:23 +0800 Message-ID: <20260913145527.18148-2-iuncuim@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260913145527.18148-1-iuncuim@gmail.com> References: <20260913145527.18148-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?= From: Mikhail Kalashnikov Add dt-bindings description of the thermal sensors in the A523 processor. 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 | 34 +++++++++++++++++-- 1 file changed, 31 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..792081af5 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,26 @@ allOf: - clock-names - resets + - if: + properties: + compatible: + contains: + enum: + - allwinner,sun55i-a523-ths0 + - allwinner,sun55i-a523-ths1 + then: + properties: + nvmem-cells: + minItems: 2 + nvmem-cell-names: + minItems: 2 + else: + properties: + nvmem-cells: + maxItems: 1 + nvmem-cell-names: + maxItems: 1 + required: - compatible - reg From patchwork Sun Sep 13 14:55:24 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Kalashnikov X-Patchwork-Id: 3311 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 A10B11C33B4 for ; Sun, 13 Sep 2026 17:01:34 +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-25862-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-25862-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 40B88363F8 for ; Sun, 13 Sep 2026 14:56:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E900B329C48; Sun, 13 Sep 2026 14:56:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WGJ6c/eY" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 0033C334C3D for ; Sun, 13 Sep 2026 14:56:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789311386; cv=none; b=ZV9zp7eLRBVMkGEhynh8TfRvBvKD4i02N0Ah5dgnb5M4sFs7suEIsMpWvSr/9UreuuIIzORONpspGLor8F0wocZRTm7kVEQ0PA5h5eIUNMNMPj/5uvTQIh5PnknP/zUN+e6yprXB7/ebXcVzBgM+zcdkODLIlEwlIZLwhlIrc+U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789311386; c=relaxed/simple; bh=0TPiKoG4GPPZx3Popa85L5Rb7uSjVhIAcmRo7lxz1XQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t3xu5u7ps+3b2cHEfiQj7R/5l4ewt4PXhGfU5mxifi6UFYz4TpLdsKP65wIGdIuSXEMI5s/ClaQhoNFBa+1H7MZm/WzQ+8r5ZZnYnr/CCd/e4U2Q2rT8xafB3bghubWD3ajHf9Rxctq+cd+bTWIrPDIbOTXdYE/7hQAsCFUpQmg= 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=WGJ6c/eY; arc=none smtp.client-ip=209.85.214.177 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-pl1-f177.google.com with SMTP id d9443c01a7336-2caced6038eso23562775ad.0 for ; Sun, 13 Sep 2026 07:56:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789311382; x=1789916182; 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=VAFG6OrHDCLtY8RoJ0lJqtavylNBVWsmbDH0jNrFE9U=; b=WGJ6c/eYseNlMkpj7MRCAhRn+bWyB+NZerUUbq5Wq3tUnZFe/pGfLkNGzZ9qqSRO9v kA75DZAKxUm/2USw05F9jFtdC7ICPlNLJ5LleuBYZRgGUgeGCxC5fdbeUowqqoW/WrJE 3pRr/qu7qj5CoFFKpry6NZy0sy+NrelfHD87P6bPF4ehL393SLerUmveDj2zstoxBBRH qXsf5BeCYb2eu4N906VEIYOfY3KMV7QUQ7q+BT7O0qowEmk9jfMSD9WIXdjUpgopdWl0 E/XUmZsOeu/jfA5w7h2eY3ST1DeDvz4VYPzeNJIcH4YO+BRqxc0yHJCwBhEZkmMhgzy1 EoOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789311382; x=1789916182; 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=VAFG6OrHDCLtY8RoJ0lJqtavylNBVWsmbDH0jNrFE9U=; b=FkNIYduyRpyZBXSzaHPYrgKjy5XZPDdiO3ERRpmq233MOv3QbG0ODLW3CsPZu4b30G hFSOsz87BKKRUXgnRIK/MiY+QgKyRNDBaoIIFeA36DX5rn9E3EzmNV22PrVKBH3cJ3XP z6eq5Xwy+Yk7dhRFabGhpSXjQt0e2P6dU4Urdl5NsCQit5YP/G0ppGQktg17znJCY9qT dmXmwPYE8XmKDpXSKWz+y8BVKOysd+oDKgFkXpEWyz+jUynlFfHeaQhgj1+q/0epEYuJ 5UbG4NGD4P4eHQG4TE5nrmyJOXs1cePYo3/v7dqsCnxtEAlM+EIKjV5HKV3+91rsmPxZ FE4g== X-Forwarded-Encrypted: i=1; AKwUvBzuNCylMqORaIAIhMxTWlkhDs6Qy6gxdWZlk5YwNXMYuzTZUjJMWaAy+TWZYcIwQ47WEqVPfwjibeHEeA==@lists.linux.dev X-Gm-Message-State: AFuF++lsqWBMm1rT1XCrKk4CQMupC1GImnPCcSRuqdAqWQEoOeC5XQWi lE7R2Gs9KLAmbRIFaRTYbtam+6O9vgfZmxfz00h4wk5dQZE4ZBDiNUAs X-Gm-Gg: AYBFou1WEQxR+wngl+XR/NXmiiXqwnIB06UBt5RQNO9Ux76gFIice0MMUfn2uzw+ZS/ 1ZWxjvwvl95dh1B0aboo/57FUxR6ypC06kK2FrGDhCc+OAaUPf1lqrtxlLRXUvnOZzdb9LpqP/B ps9fx7VUHUkukHlSf3igxOejnudBVTN1M63N8RWf2H7Ts2IR1fRlDyWLh/NWieo9jMkgZOF58a+ fVPlr5gR+1/yky5865je10A8IOCRyWyK/A0fTsAr2rxgARh3kHT8DDoMiemiOykFYgrfC3CTbg9 MOfMGRjW18cI7SFiR4LVTTZPVuDudZt+bc0NmvHYKDftz8iUhRYedV2CkR5ra8JO4lOldhiHVB4 SFJlrSPRVKk++RExYFsOgWI6icoE+c8hAwsivB5c8w/3oOtZHstqDRbLkepHyPVuD6iEdaVHyDq SGrbTPN13AYWQ7gQrMjnsfna2TmHCZUYAD1I9qSbsD2hzmCfZLvkKshJtaylyNacxu X-Received: by 2002:a17:902:f786:b0:2d8:d4d2:d138 with SMTP id d9443c01a7336-2dd5f1bc196mr31924865ad.20.1789311382058; Sun, 13 Sep 2026 07:56:22 -0700 (PDT) Received: from archlinux ([207.90.239.231]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-33ba7a9bb56sm21467366eec.31.2026.09.13.07.56.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Sep 2026 07:56:21 -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 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, Philipp Zabel , =?utf-8?q?Juan_Manuel_L=C3=B3pez_Carrillo?= , Andre Przywara Subject: [PATCH v6 2/5] thermal/drivers/sun8i: replace devm_reset_control_get to devm_reset_control_get_shared_deasserted Date: Sun, 13 Sep 2026 22:55:24 +0800 Message-ID: <20260913145527.18148-3-iuncuim@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260913145527.18148-1-iuncuim@gmail.com> References: <20260913145527.18148-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?= From: Mikhail Kalashnikov 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 284684137..1412bce63 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -341,11 +341,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; @@ -388,19 +383,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 Sun Sep 13 14:55:25 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Kalashnikov X-Patchwork-Id: 3308 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 C4B1D1C1FC5 for ; Sun, 13 Sep 2026 16:56:45 +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-25863-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-25863-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 2376C26976 for ; Sun, 13 Sep 2026 14:56:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B9E46331EAB; Sun, 13 Sep 2026 14:56:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NVy8qDv9" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (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 19F53331A53 for ; Sun, 13 Sep 2026 14:56:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789311399; cv=none; b=PSs+UEAi9yfl7y2kqZTOS9HLN07c6wNMjxJQGH53a+7bVrQgRzyalKSm0rv/Ub4hwOituSGVXAwWIglkQRtI+cpIcWLSxwihRnyNLQmBjDsbI3zwxUhvp8vACt4TWVh24F544qKFAIzqrzuj/JfeV3BWXicBZ4ltRZnqfVhJPe0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789311399; c=relaxed/simple; bh=eAYwAL+ffPnZAqP7POHGmOo+jkIZt7HAkY6H3prb/vA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=njcjq1MMNuwXmbNauUNSomeS4WWXB1x31mUSyLrENAOmnljJc4dBAysUbAeA/FxF7OyaIfozX/9f8qLWI4+Vh2wmHuRZl2UGJF3a9k6kopXC92IkdhI0OU2zygQGV5pHtbYgTSSprcqx2lfN0Hf1nWJOiWvkBDmyNB3Ob23q+HQ= 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=NVy8qDv9; arc=none smtp.client-ip=209.85.214.175 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-pl1-f175.google.com with SMTP id d9443c01a7336-2dd1dcdcf95so18420815ad.1 for ; Sun, 13 Sep 2026 07:56:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789311397; x=1789916197; 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=CdQEo7CCMpGixzfwvENOdVkMVrSMvvagZo4VCY8/koc=; b=NVy8qDv9aFNin5rm8xZ/TwEEzRzFyqQ9z0YjRrAM5nSynpoBeM7lFtur6osvAucyEJ 0km7ImHWJHqZlS22dGGjijAD1qeISd+Px5jm4TSVcOCdTLdzKq1YoXJsxRhkDbmd+H4e fZJuytsXEX4boOUInQgFAZYNTOJEGAkbgpT2EsDpzUP6TMQRsRfX3I68RRnN24Qy5VFZ GI4Q4m/4OlsZlpgt6vMlxmL4PLJf7lUnwx1fRdLlI3MXYu34Npy2Iq87/JJ6Qc0nsR8z XW6WjzHtjlChv7O0EhpAw+4A9XHSt9cddqyTAYNFofxojm8vMnwmEwC9jnEeoHA1iJ9L RWRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789311397; x=1789916197; 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=CdQEo7CCMpGixzfwvENOdVkMVrSMvvagZo4VCY8/koc=; b=EyZH2JpCUa0Q0hp0Tfyqk+TzBlZ1uuxVHt+73uD1VNAxBQj6klbo3fpwCaWXWjOO7a MoohQHQ7Jq9kkl/lpmAkHdLvkZ5vHkDKZNk6Vna84IFKJMI9EjEuJ4u2WSKslm1VweKp oMThZWKI1k4E9NAavMVSXIsWiNXun96lz+THU6cKmmP07PqMMMVWB55MOO2FViT2t08m mHd3yvvGy0bz2SYdBZpm7kULueqKcngIjHK5IXDLLKofZ1UPjJ+EaxQWwFYLjA9Y99HF DRoKx/omZaUpwJvefz9YRF7EfmZ462A/nMpAJLJ1JBlV50XMzy38b3QryuC9WRruznlS 1rFg== X-Forwarded-Encrypted: i=1; AKwUvBwICSDgYXNbGmPoGUgFk2Eb8+WXuFcqF0YAaFxXyDqAkPTM/noqj4T9MP7aahaflUd6gXyuW002LQjd1Q==@lists.linux.dev X-Gm-Message-State: AFuF++m/9q68OwU7hU2aXm1FLv6v4eAVJzckLUPs/yaJGWHcld/TswIZ xQIcU0Ft6E/gL7P6JbFWLHaFtlUpewK3Ysmw4C5Lij+zeJsJIHWyl4ts X-Gm-Gg: AYBFou0OidOT8bh7oS8m+dA4BjrgkjL6D89caJROneC93MRbrVnwikST06jf+7o7sz8 UqX4u4ESvS8z4tNVsmx3hMDncaGcNnpwTe9lxNM4K1tBjVkZYsOEyPNFl0FAdSM/p/vCXGgb/Fp tldaSxWCskhicYhZD0aO/Yw9W4clL87rXaanDHDs+liv6lTPsjHmjiQPeLjvey8zKy50c71JKbA 4MWYe5zDb3sR7s4d9VgHr0Tg7yz5dbKUeXhN1jUVxKOk/yobO/FI5+9aLFIunUowCh6fOGdQWH0 4SfzYQRO48OdiwkRBIc4ZHGM+Qk941vTgb1HxGGXXmw5Ath3Tdd6ojeHkTfJE5qdUuZrw43LyMf GjfCYfZyco8lv4BMmVAaqqmYEZkl579ptsZ/xpQRQ13eb8S+SSLoLBQRUrYdviHEZDx/S0dLFq8 acNZuxmf+A9oVoo0/kRDBJ+95WQfs/t5Z2L7ECzVsB1mOORUW7j0k4z9QtYgyyXV/N X-Received: by 2002:a17:902:c409:b0:2d9:2ff6:246e with SMTP id d9443c01a7336-2dd5f1d74d6mr32381155ad.23.1789311397076; Sun, 13 Sep 2026 07:56:37 -0700 (PDT) Received: from archlinux ([207.90.239.231]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-33ba7a9bb56sm21467366eec.31.2026.09.13.07.56.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Sep 2026 07:56:36 -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 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, Philipp Zabel , =?utf-8?q?Juan_Manuel_L=C3=B3pez_Carrillo?= , Andre Przywara Subject: [PATCH v6 3/5] thermal/drivers/sun8i: get calibration data from two nvmem cells Date: Sun, 13 Sep 2026 22:55:25 +0800 Message-ID: <20260913145527.18148-4-iuncuim@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260913145527.18148-1-iuncuim@gmail.com> References: <20260913145527.18148-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 [5.84 / 15.00]; RBL_SENDERSCORE(2.00)[104.64.211.4:from]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; DMARC_POLICY_SOFTFAIL(1.00)[gmail.com : SPF not aligned (relaxed), No valid DKIM,none]; R_MISSING_CHARSET(0.50)[]; MAILLIST(-0.15)[generic]; BAD_REP_POLICIES(0.10)[]; MIME_GOOD(-0.10)[text/plain]; HAS_LIST_UNSUB(-0.01)[]; PRECEDENCE_BULK(0.00)[]; TAGGED_RCPT(0.00)[dt]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_TWELVE(0.00)[20]; FREEMAIL_CC(0.00)[vger.kernel.org,lists.infradead.org,lists.linux.dev,pengutronix.de,gmail.com,arm.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[sin.lore.kernel.org:rdns,sin.lore.kernel.org:helo]; FORGED_SENDER_MAILLIST(0.00)[]; RCVD_COUNT_FIVE(0.00)[6]; FROM_NEQ_ENVFROM(0.00)[iuncuim@gmail.com,linux-sunxi@lists.linux.dev]; ASN(0.00)[asn:63949, ipnet:104.64.192.0/19, country:SG]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[207.90.239.231:received,100.90.174.1:received,209.85.214.175:received]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[104.64.211.4:from]; TAGGED_FROM(0.00)[bounces-25863-noreply=patchwork.local]; R_SPF_ALLOW(0.00)[+ip4:104.64.211.4]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; ARC_ALLOW(0.00)[subspace.kernel.org:s=arc-20240116:i=1]; FREEMAIL_TO(0.00)[gmail.com,kernel.org,intel.com,arm.com,sholland.org]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[] X-Rspamd-Queue-Id: C4B1D1C1FC5 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?= From: Mikhail Kalashnikov 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 | 81 +++++++++++++++++++++------------ 1 file changed, 53 insertions(+), 28 deletions(-) diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c index 1412bce63..360654880 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -300,43 +300,68 @@ 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); + if (!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 (!IS_ERR_OR_NULL(calcell)) nvmem_cell_put(calcell); return ret; } From patchwork Sun Sep 13 14:55:26 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mikhail Kalashnikov X-Patchwork-Id: 3312 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 E03C11C1FC5 for ; Sun, 13 Sep 2026 17:02:17 +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-25864-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-25864-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 EFB0537729 for ; Sun, 13 Sep 2026 14:56:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E2E7C316905; Sun, 13 Sep 2026 14:56:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SR7jGNDx" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (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 CEC4032F76D for ; Sun, 13 Sep 2026 14:56:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789311415; cv=none; b=tWI5qBz6ttyb393LzSRgsTNSBfM+5rc/cltWP7YNfyIC4Nev+o3jvmBTE2fLGOBzkiuCCmlyn63vR8nLuvQJQs8me3p068auDl1Xhd58ioudeJfCrJ0AuW+1q7nH/gjziNLHW480UvGueoyKsfMS6i47hUfLzmxSjPV8+spOm5I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789311415; c=relaxed/simple; bh=002rqKnwYlIeVlmK+OrjXg0dmApCO+jy4dOIn8rGOwc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Yh2HR3p4CIkzlRHS++cKwsMfFGAmO0f86QC0rvQk8sXTdK/CPt8idN9HiyTZORGkMdovOa47zMHF64eUsvsu6Hykip+qYasdXF6mmQ2QohH1VJU9S1hkMEDCZnQX2nhmPJUzAbBpAGM1rYowGV5Wl8bKiqWuKiLOywqH1MD9SOc= 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=SR7jGNDx; arc=none smtp.client-ip=209.85.214.171 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-pl1-f171.google.com with SMTP id d9443c01a7336-2d942c7cc2fso23188785ad.3 for ; Sun, 13 Sep 2026 07:56:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789311411; x=1789916211; darn=lists.linux.dev; h=content-transfer-encoding:content-type: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=MFmILcFARM3nbjJrUrOfoTXP5jUQVkRuUWrnpYTCEmM=; b=SR7jGNDxVmAhjmEakxBRuzQsH1MtLkbLzZE9sXhlPP23yFzP0sTzvNwCKDxiPgR3Iz sHQF3JoxjOstdOteHnU1j9JGuxoeDTpsYdSHu63rZhHY9N+CehasM+zX+g1EeK6PoBX4 VslRGwjxDWbtZVErqjBOxauJ3H2aWzwvOazj5xcEpdHV8TQZoiST7rnOU9DUg8UsNrSn CueimjTLd0waN114RB9+tT/lA30k4g6EajlGuoUPZGMQtTY9VQuquSgID4oWfaSem53b qDWtxGIuecBlMpp7b5cohXHeAe6KWuW8IPd2zUXmaqp4/PNsIPoFDwrP+0iNq5BI6KLC qnoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789311411; x=1789916211; h=content-transfer-encoding:content-type: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=MFmILcFARM3nbjJrUrOfoTXP5jUQVkRuUWrnpYTCEmM=; b=mYLkGDZGkKf8s8GQYv7rcS3nNwg3s+OFvATcBCee6XyYSraBd33twlyB9w7RP0M43m AzdXFtIJY7cxyIriV3qe4bIndfWvXxBSPEFdiAQ5r9BZfYj/3nBNV5O0mNy0uS5/WpQa /SMf59ffqAbjiJyuYjuBm3vF732Tm4h8EUUGrS6Np5eyYYhHb/cgRcOKFOnx+6szJc7E 86Qb1gGw72PBZmfk16QpLbjgpRDqxwrxDl68dn3tSIlb/+j7qmhTNUYnMR54B+34ZfG0 D5xDPjh6Cei2erOP2Jw8OvFzWxGzYQQ8IB+DGWHUlNMXWkMEIOCJa3Q2CCoemioOX59N YLXg== X-Forwarded-Encrypted: i=1; AKwUvByA4ZYXJ0NjsVjxfxW1eYs57oO7uMytKCbbCSNh3NtdYO+2wxVfnQkwQkQFXsuwhEzvC7gCkoPafCq8Pg==@lists.linux.dev X-Gm-Message-State: AFuF++mapaYaXi1fNq34thI3YRGoDov+pF8Day1JAg+x9WYPcvS7yNRg 9bTQTk1hd+fUr2tVSSI5m/dO6pGzjvHbkrYsCGUZmhQSC+bp4PxrcRRa X-Gm-Gg: AYBFou0I16OP18KBQVYLgf45VzR+nqoc2hLPVn1N7+dcUpdjs9bLQYZAE/jm5rZKLbO UCsxiz3JQz7rQ8x489UL3WOwXvwfNxnquVnpy+1Cj1tnvFWZNely1wp5jcOBFS47+5Wwhl6Y3vC crgAOKP8bN+uNRQj0np9rLxhcczA8ndS1oRMIIYpKYoQcGOVH7LP3qdsYPICG2NtIon6d5QzUKu dmTAl4XFkltsefj+Sm/REGX2X8El+Gsx34nLJzscmSWrg/z0a47r73k+5o26X/1h+hpsCySkYAo c9H91TjPHnwz1HEnC/ICRHlUJI+hhAXSdGFCIOq7X1OVKGW5GqZZEAfNBlEpn8OE6XNCcjpxrhv 1Fw6By1w7Y5Xms2+RjA/+n0cWO1goHdAN+skin3efGDGOPxLLQw1+cETMlAE6QW6/s8+CHxMcAY oXcHUuLDIPQg+9Hre0qt/4/hONFzt9gmiaElpKTms/LqofCvpVcCgF4UFCcN9ZkpEs X-Received: by 2002:a17:90b:51c8:b0:38e:5b59:c2ff with SMTP id 98e67ed59e1d1-39d9bbc802bmr22552630a91.3.1789311411298; Sun, 13 Sep 2026 07:56:51 -0700 (PDT) Received: from archlinux ([207.90.239.231]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-33ba7a9bb56sm21467366eec.31.2026.09.13.07.56.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Sep 2026 07:56:50 -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 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, Philipp Zabel , =?utf-8?q?Juan_Manuel_L=C3=B3pez_Carrillo?= , Andre Przywara Subject: [PATCH v6 4/5] thermal/drivers/sun8i: Add support for A523 THS0/1 controllers Date: Sun, 13 Sep 2026 22:55:26 +0800 Message-ID: <20260913145527.18148-5-iuncuim@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260913145527.18148-1-iuncuim@gmail.com> References: <20260913145527.18148-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?= From: Mikhail Kalashnikov 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 4 sensors: ths1_0 - "big" cores ths1_1 - "little" cores ths1_2 - gpu ths1_3 - npu The user manual for the T527 processor describes 4 sensors, whereas the one for the A523 describes only 3. As additional information, the BSP driver was used, in which the value SUN55IW3_CAL_COM(5000) is used as the calibration value in the formula; in the mainline driver it is treated as the ft_deviation value. Also, in the BSP driver the NPU sensor is used for both the GPU and the NPU — its actual purpose is unclear; both sensors are functional and show temperature changes depending on load. Signed-off-by: Mikhail Kalashnikov Reviewed-by: Chen-Yu Tsai --- drivers/thermal/sun8i_thermal.c | 147 ++++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+) diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c index 360654880..4a81486f8 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_BELOW 2736 +#define SUN55I_A523_OFFSET_ABOVE 2825 +#define SUN55I_A523_SCALE_BELOW 74 +#define SUN55I_A523_SCALE_ABOVE 65 + struct tsensor { struct ths_device *tmdev; struct thermal_zone_device *tzd; @@ -114,6 +120,21 @@ static int sun50i_h5_calc_temp(struct ths_device *tmdev, return -1590 * reg / 10 + 276000; } +/* + * The constant names were chosen in accordance with the BSP driver; + * they indicate whether the value corresponds to a high or low + * temperature (relative to a value of ~55 °C), rather than the reg value + * that was read. + */ +static int sun55i_a523_calc_temp(struct ths_device *tmdev, + int id, int reg) +{ + if (reg >= SUN55I_A523_DELIMITER) + return SUN55I_A523_SCALE_BELOW * (SUN55I_A523_OFFSET_BELOW - reg); + else + return SUN55I_A523_SCALE_ABOVE * (SUN55I_A523_OFFSET_ABOVE - reg); +} + static int sun8i_ths_get_temp(struct thermal_zone_device *tz, int *temp) { struct tsensor *s = thermal_zone_device_priv(tz); @@ -298,6 +319,105 @@ static int sun50i_h6_ths_calibrate(struct ths_device *tmdev, return 0; } +/* + * The A523 calibration data is stored in the eFuse, split across two + * nvmem cells. THS1 has four sensors, including ths1_3 which is used + * for the NPU, each with its own calibration value. The fields are + * packed as shown in the layouts below. + * + * 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[1]) + 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; + case 3: + sensor_reg = ((caldata[4] >> 12) | + (caldata[5] << 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). + * + * The BSP's SUN55IW3_CAL_COM(5000) is applied as ft_deviation + * in sun8i_ths_get_temp(), after calc_temp(), and therefore + * intentionally not repeated here. + */ + cdata = CALIBRATE_DEFAULT - + ((sensor_temp - ft_temp) / SUN55I_A523_SCALE_BELOW); + + 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; @@ -719,6 +839,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 = 4, + .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 }, @@ -729,6 +874,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 Sun Sep 13 14:55:27 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Kalashnikov X-Patchwork-Id: 3309 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mxe881.netcup.net (Postfix) with ESMTPS id 40CF01C1FC5 for ; Sun, 13 Sep 2026 16:57:12 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=gmail.com; spf=pass (sender IP is 172.232.135.74) smtp.mailfrom=linux-sunxi+bounces-25865-noreply=patchwork.local@lists.linux.dev smtp.helo=sto.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.232.135.74 as permitted sender) client-ip=172.232.135.74; envelope-from=linux-sunxi+bounces-25865-noreply=patchwork.local@lists.linux.dev; helo=sto.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sto.lore.kernel.org (Postfix) with ESMTP id 2B1596064C3 for ; Sun, 13 Sep 2026 14:57:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BDCA2316905; Sun, 13 Sep 2026 14:57:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Q1GOditu" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-pz2-f43.google.com (mail-pz2-f43.google.com [74.125.228.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 BB272331EAB for ; Sun, 13 Sep 2026 14:57:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789311429; cv=none; b=oE5T72XQar+qzYF1OjRn0o2FbQJVwVhy1G2vSOz76CFxSXTsXR8DAw3j+3ylKfMZ4d2eMSqzHXzqOOeo93wkX/A5GgOvf6HcorUqBvPIOrsBu0SE8Mb0WV4eMPxeQAa3vVJRGqhXgDkCiISyRr9vtIunaKzUMFel5WNiXReY3Y0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789311429; c=relaxed/simple; bh=U8TcarFOSxPgPS3gl1vJEnVGMW4O7dlmLEDGi+5O5hE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ihjq+fUantCY4phcT1iQh/IGh7KbysvdrOeItyJVuHKCIr8xfwi4mT1CdmI5ZTCJJuR1OOH/QLrdS1mtershMqfsPGKXcGRZLspAYam7Y2ZqnHBR9oExmH12uDGgFp7BhMF8MATGF2I4mJNIBbikHigG18KhJP8fXS9uzpkJNWQ= 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=Q1GOditu; arc=none smtp.client-ip=74.125.228.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-pz2-f43.google.com with SMTP id 41be03b00d2f7-cc4c08393dfso797618a12.3 for ; Sun, 13 Sep 2026 07:57:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789311426; x=1789916226; 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=Ojm3inVGHkUK0yBRj0L32h8BiK2OtTXiQ8B+T74NBtE=; b=Q1GOditutsjOhg6AhP16vwBQnzFcJxsrJcbMjTmBSCysMMP3QNzqhu5kMpUxHxakZI COWq+CYwtp6f1aplvszvSJRri8gwcWAexRXWJQf8qcXTTszAEfdOiQDudsNJ4dsn/yOY UlueJCi+VdwQ+33aqU6uhB8+QbM7WrOjbi89s2YsFEg/z5pwnkfQkoq8IViBW9V2gHna KcbaCwne+TqaBtD3u1BAscKvYjzbPv3bzdIPaMe9MivkAhugxXlD4AGKSTvXFF59P+mO 0Ia7q8D6YRng2/ktKNduyhJyRSp1y9S5rGU6HVEUNG+M8EPSCOmikVr5VXzA0xXe2JPh M+mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789311426; x=1789916226; 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=Ojm3inVGHkUK0yBRj0L32h8BiK2OtTXiQ8B+T74NBtE=; b=OEWpIpSPPo8zltn0MLY2p7mFr2Wj6uApKJLXmep8dZRMSvFnc+VV39ngY/d/CSxUN3 wtGrDHva9a664RW6RIx3PQAKaccSFOaFIqvQwCtweSwmrjGAGLlqCzPtxjSxHloWhmUM 5YEgy47zzv1qZe7I47Mo3d4sj8iNUmfUGAuf4peVsZFO05kM7rDNTp+QjwDvPoTu0VPl J0MyH8hVuQEd+ZbyiDXzPIyRut4Vih2TXwkSfoABH/6+Xi4j/kuryumtDS/kG1NMET7Z SAYZLepqGtbOqAwbKkk+o6sjjGKRDmNHFeWm940eXNbHd50P5BL8MZvWu+BVnUwTnUvH /apA== X-Forwarded-Encrypted: i=1; AKwUvBzMkWD6ULOjye7H7AQ8PxpPTfVSKkQ6iVmBkO56ECv0Sac5nBLKVqDvrYqUxVTgui7X/y+RDfBaOapzcQ==@lists.linux.dev X-Gm-Message-State: AFuF++lVHCZl3r1VQ9eMYjpKKmnlPKixlqLtY1oIfKfZ8mO6EWtZeHfl bFDrwIiYbBN8VmlZvNYx7um1qGKXvg/RA6PJFtfg+6M7aXxrWI4iO70z X-Gm-Gg: AYBFou2m8Qfdr106laG5uATyU2oljh51CTTPbt7eWJpCPxcPFZStGV74YjO1iLeC4vK OhGdRNlpegaBda2W5vIUAHD/WkiRy9rsXDtUO3d5gnBEwcHmncfFUxMpgGXLf+ur7EIITwXHakz zAJkHGkXEIu82+uESZxaE2Sbuc22z3MHRiJLTZFvwEQxIE+hjTl7KpsQsbN5uE7EuIE84gCT306 z8NUsPPD0wppCalW4BLIrJrT/6XG3JHo1AfXcHm4lThJOzqQx8Ey4pMY9M6zLrmwB1N8Htx9XXP ICk8LhBC6U+QFXSt4GWkmTUCvna++Tm1WEBA3txe8tbTK87EspeLv0J2a2YhxE2mJeErmnXc6wf EsoXZi8u8uo8AK1bdepnrKL1Uhnkib3akhGOC4bMspPVQZ19OIzMJQGSpJsbHerf9vweXLmiKyN AHvgDN+Azj+p1TIO7D19Yt2XJj4hEbpNnAm14mcIRFs+y3h1aT557Xt8JgddhFXAfO X-Received: by 2002:a05:6300:83:b0:3da:755f:a031 with SMTP id adf61e73a8af0-3db0e1440cdmr14771539637.12.1789311426035; Sun, 13 Sep 2026 07:57:06 -0700 (PDT) Received: from archlinux ([207.90.239.231]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-33ba7a9bb56sm21467366eec.31.2026.09.13.07.56.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Sep 2026 07:57:05 -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 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, Philipp Zabel , =?utf-8?q?Juan_Manuel_L=C3=B3pez_Carrillo?= , Andre Przywara Subject: [PATCH v6 5/5] arm64: dts: allwinner: sun55i: add thermal sensors Date: Sun, 13 Sep 2026 22:55:27 +0800 Message-ID: <20260913145527.18148-6-iuncuim@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260913145527.18148-1-iuncuim@gmail.com> References: <20260913145527.18148-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?= From: Mikhail Kalashnikov 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 4 sensors: ths1_0 - "big" cores ths1_1 - "little" cores ths1_2 - gpu ths1_3 - npu 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 | 172 ++++++++++++++++++ 1 file changed, 172 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi index 85ef492ff..ced544154 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>; }; }; @@ -380,6 +389,30 @@ 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>; @@ -611,6 +644,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 { @@ -1145,4 +1186,135 @@ npu: npu@7122000 { power-domains = <&ppu PD_NPU>; }; }; + + thermal-zones { + cpu0-thermal { + polling-delay-passive = <100>; + polling-delay = <1000>; + thermal-sensors = <&ths1 1>; + sustainable-power = <1200>; + + trips { + cpu-trip-0 { + temperature = <70000>; + type = "passive"; + hysteresis = <0>; + }; + + cpu0_target: cpu-trip-1 { + temperature = <90000>; + type = "passive"; + hysteresis = <0>; + }; + + 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 { + polling-delay-passive = <100>; + polling-delay = <1000>; + thermal-sensors = <&ths1 0>; + sustainable-power = <1600>; + + trips { + cpu-trip-0 { + temperature = <70000>; + type = "passive"; + hysteresis = <0>; + }; + + cpu4_target: cpu-trip-1 { + temperature = <90000>; + type = "passive"; + hysteresis = <0>; + }; + + 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>; + + trips { + gpu-trip-0 { + temperature = <60000>; + type = "passive"; + hysteresis = <0>; + }; + + gpu-trip-1 { + temperature = <90000>; + type = "passive"; + hysteresis = <0>; + }; + + gpu-trip-2 { + temperature = <110000>; + type = "critical"; + hysteresis = <0>; + }; + }; + }; + + npu-thermal { + polling-delay-passive = <100>; + polling-delay = <1000>; + thermal-sensors = <&ths1 3>; + + trips { + npu-trip-0 { + temperature = <110000>; + type = "critical"; + hysteresis = <0>; + }; + }; + }; + + ddr-thermal { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&ths0>; + + trips { + ddr-trip-0 { + temperature = <110000>; + type = "critical"; + hysteresis = <0>; + }; + }; + }; + }; };