From patchwork Fri Apr 11 00:38:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: iuncuim X-Patchwork-Id: 1799 Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (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 C910BD515 for ; Fri, 11 Apr 2025 00:39:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744331970; cv=none; b=QkXcD5lrxcjxp6zq4BVAKRw/1vvfhyjYxnjIiG6298EhbrNVuTN97bMnALVMxrRkEHGtsXADSVAqDexhVeMbk0wyFO5sFZsF0o9yPgCJc9YNfQ43psvAl4pkCJgRpV7o+Af5F5/ZKvfZeweJHHa+9xxvSUYFjYglPlObUvHPQYk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744331970; c=relaxed/simple; bh=4drhvRp1v2mp/1rw3RlittyMG3A82PQwVLHy+wmOHKo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kIyt+ImgHwG7DNNG3w8PDtmNX1TusRyspjaGJptb+BD2Npb0lmIHtaki3IkLAteUk1rCDrq/Ghs7nNKbw3J20E2X6TNj/ezr7k9NycYcCuK8v3VPa+NVeHb+2gKuzrpcbRyI+je/Oc/V08ggL33VXI8ncaUDEx3YlrCMzMxkO+E= 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=EmZp95pE; arc=none smtp.client-ip=209.85.208.174 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EmZp95pE" Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-30c0517142bso11279461fa.1 for ; Thu, 10 Apr 2025 17:39:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744331967; x=1744936767; 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=mgLz+wxMK3cB0CjJ97zDR/iMoodve9Fd9p0FjX989r0=; b=EmZp95pEA/jJqQw/RWFfUnCAn1aHLiG+LOIpLxtPec3mlabNW2Ehtuz+qdzjahVoh8 8uAcNPMfxl0rSyQf6orSfo+fR2syi+MHSABSQSmEsNxCf/+FryTPay4EfG6FJz/C1P2I o5iGkS9SOeYEZsRgzfXiwSXT1cW5BKAo8vhBvpzPvYqXJIdczLixlV6ORpMRnYT1ICOy X+pWvLNyrcy6+/nkRcA5RDoiXIDxLrFORbq/e0GxtpX2Rn/HjIR6WwRRiFXHvAIHIHki ZUwZEvRkU2UbsnfRLjI+WUbubB+A6Bo5VFVsyclxZqj0ZAGx3yJxu4NvOu9y7uBfAkjI +88A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744331967; x=1744936767; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mgLz+wxMK3cB0CjJ97zDR/iMoodve9Fd9p0FjX989r0=; b=Llpg+tFUKCoVFR5m3hQo/bmKp8j05kc1VH+4/Ct+0ArrclwXKVI45r333avX1eBAJH ddw4XUlt/QE+5tFOsVlZEruiN9E6+XD3f9z9tpIEmqPfg79i0GnwEkm8fTuVUcoXiMsQ 1ROM14omilY8svZYnyFcm0ZGPkzxRdgnoWj/yQlv4qDcLgaoZctk7PZj1bAxoQdlVLUE Kl1hc0xrk/0hqOSBVbX8KGbhG4ovHWh9zu9Z5bfXNFOH7jasHMx8kCgr+Kf2fCjILh5+ zyXSMo1rKedtbwN60zB6+j4XqSGX5V5Pnxz7Dy96zDvy8R5jAOXkmu/OnhnfKdc/PK11 83KA== X-Forwarded-Encrypted: i=1; AJvYcCVEvqL65F6rSNL6aBkRlOWpbZ75VUx31R5ijkFmV1zIPUmdzny+8uOSb2qVUzAC79oS1+SLpdJl5uxANg==@lists.linux.dev X-Gm-Message-State: AOJu0YwBRf1iWiHtz0FiXIP4U4ULLwOx1hNGlo+da3/c/2l+99oSQfsh eal3692w5t9y1C4dvvpsJKNA9BL6T85QzOTOJUza3UnWBPeMZYWx X-Gm-Gg: ASbGncv3PicNBseF63l1zltKs9tMkeB//mc8aKBW/ag5LOLHa/FwVNCqa1EafpkdWXW PH0g1vKUybTGLd+Lw5zuP6ORG74SYmg6NaT9RowJc3LQBZoQt2IrZp2zakQzypkbQonie/8FIqZ ydKuodgGWkkyXsv7hHADKyJxHSzM7b6ULtz19c6jIiosgmi5vnMi4rk6n2XKw8bFyHRGqCFlAkV MW6enljciYcn/2neALI5PaOQ3vriNHPD5V5L9A4A00MXJmiCYUWVhFQmp0QKMTvvBwB01tuR3mL 456YpNorwyiIEzWBz7DfB0QqYqDqGoF/H/PGTQPv0yOnAOUDgHTcQ6RkfSiJ X-Google-Smtp-Source: AGHT+IFsLLiiBQI5ZLGY7lfwqEqas7w6lvcmymmKeoSRpIy/66PmWCqCbglM7RpgOnvLMZAozSYyIg== X-Received: by 2002:a05:651c:905:b0:30b:ecfc:78bf with SMTP id 38308e7fff4ca-310499d40fdmr2095651fa.5.1744331966765; Thu, 10 Apr 2025 17:39:26 -0700 (PDT) Received: from localhost.localdomain ([176.106.241.81]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-30f464ea5c6sm6344251fa.62.2025.04.10.17.39.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Apr 2025 17:39:26 -0700 (PDT) From: iuncuim To: Vasily Khoruzhick , Yangtao Li , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Andre Przywara Cc: "Rafael J . Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , 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, Piotr Oniszczuk Subject: [PATCH 1/6] thermal/drivers/sun8i: add gpadc clock Date: Fri, 11 Apr 2025 08:38:21 +0800 Message-ID: <20250411003827.782544-2-iuncuim@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250411003827.782544-1-iuncuim@gmail.com> References: <20250411003827.782544-1-iuncuim@gmail.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O From: Mikhail Kalashnikov Some processors (e.g. Allwinner A523) require GPADC clocking activation for temperature sensors to work. So let's add support for enabling it. Signed-off-by: Mikhail Kalashnikov --- drivers/thermal/sun8i_thermal.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c index 226747906..1f3908a60 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -66,8 +66,9 @@ struct tsensor { }; struct ths_thermal_chip { - bool has_mod_clk; - bool has_bus_clk_reset; + bool has_gpadc_clk; + bool has_mod_clk; + bool has_bus_clk_reset; bool needs_sram; int sensor_num; int offset; @@ -89,7 +90,8 @@ struct ths_device { struct regmap_field *sram_regmap_field; struct reset_control *reset; struct clk *bus_clk; - struct clk *mod_clk; + struct clk *mod_clk; + struct clk *gpadc_clk; struct tsensor sensor[MAX_SENSOR_NUM]; }; @@ -417,6 +419,16 @@ static int sun8i_ths_resource_init(struct ths_device *tmdev) if (ret) return ret; + if (tmdev->chip->has_gpadc_clk) { + tmdev->gpadc_clk = devm_clk_get_enabled(&pdev->dev, "gpadc"); + if (IS_ERR(tmdev->gpadc_clk)) + return PTR_ERR(tmdev->gpadc_clk); + } + + ret = clk_prepare_enable(tmdev->gpadc_clk); + if (ret) + return ret; + if (tmdev->chip->needs_sram) { struct regmap *regmap; From patchwork Fri Apr 11 00:38:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: iuncuim X-Patchwork-Id: 1798 Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (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 8D0C61096F for ; Fri, 11 Apr 2025 00:39:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744331988; cv=none; b=siiEVfUZZ5s3pfjnINhLc7q6mSgGeGGFM4rrT3kmOR93sGF17D2j/S6/UtX4GUPC1oJdwi83MAV+74zoiyuKSivWgpd/A/YzniBSsKm86wmbJWcCInwlbfF3yJd+zNlM7CU1Y3ftlrSIo9rxczkxSykDAvmxSlOvxyw20rEvsTQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744331988; c=relaxed/simple; bh=hUmYTmAvcs2uf7zk3vjXCVXow3V8zdSVau9bQr5WKPc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gjnA+S70WT4/AN5WOJtHEA5j+A4JzAn0tkGwdzzfdf719uMvOVGgtdOArMYiS36zmQz/7hoByVRlgVxB0vIogHIMSzhHLugam8o0ZEpXpduRRe1SyQfVh0Hmod5LmsDf3bo2gGpDk2MFhUdJFuNN84w3nbmA/PT2Y5ErWKQ6Ls8= 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=fu8bxRIh; arc=none smtp.client-ip=209.85.208.170 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fu8bxRIh" Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-30bf5d7d107so11731241fa.2 for ; Thu, 10 Apr 2025 17:39:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744331985; x=1744936785; 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=T38zkrO9x36m4etdaLiyiX7JPZf+RzDpwj3Zgm9TBys=; b=fu8bxRIh6aoGAtjg9AfXJwAue/UtBZDz7LT3lCFxW40dPSDgdegwbmxa4jk9kXw0sK zGaQ1l7z55EAPuBpIin50ghoePJqPprnytGdGUvdfHfP8lW8uVbCgylFDmwtRxd5oC0h 2W1nHvNIdbpVvDOsxfUAmWGEXGPcwHcC54StsiYpP6g6mXcTOmeTZAlgzCv2dA3ucsyY j8PtooO2nlJyHDvNq2IgRO2vQ+VSdVvLJDpOnIhtmg3xcxHceVdrlCRrKvfELR9ZhLjY jxSYjtiPAb6L+VxOruZb+0xHEbhL0aiIzsvL/qq4eaqmPhPjg1tt3KcKteT7dlwtjXFn BuVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744331985; x=1744936785; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T38zkrO9x36m4etdaLiyiX7JPZf+RzDpwj3Zgm9TBys=; b=ZFejM+kYaz06zrv57KF8fvBq1O15qcsKgi4sX8sri0xst/XHxqpL3yieCvIdbordVv 9JYhN3r7uQplUWx4JVjoKASE9joqF1ZMQGE6OD6KuRKfz6E9pswGVY0AJ2JvRkrcjxqM vce5vicZywlNzDaLm9KY/yGM3JqVVSQ+9TOHjXN0z2S6s7sEOb0y4nLbEm6UEiBE30Jt xnuTt8++UxBzwJaNozYTUSu0kxbQXDdiVKu+j7zzeJNwT3gyW0yfzaFpT5oon20tQKPD JFVg53e+Gs1jB6iOE5mNjLEefPheOtwHx8osHh3hZZLdAOD0XSITbYQEX+5QEQ31+/TC CppA== X-Forwarded-Encrypted: i=1; AJvYcCUAKB755BlBMGLmr4llgFKadP9ECyJ17+lM1F0RHfgo3cr4r5N9NDcytIm/YH24Q2H9P1JRKPxvyXofoQ==@lists.linux.dev X-Gm-Message-State: AOJu0YzAS5mS7oP7M0mdVyN+g3UerBVwKQ5h0ullmP/VtAteCAQnDBwZ ZC3cFdd2t/znToVA+Aj4Sa/cp2YPG8F4f+b4WE+iEr1rfDG4hAzh X-Gm-Gg: ASbGncvyLeZETxoEYQ9tA0ULTcfOnMGCS6hu52UI3lpyOQzqWUAE2oxH2jMYivyDj9W m0IlK/8nDkaNepOzbrg3D+jEV+1xl9HU+QCmXB4USQ0nBqIFUh+47MkLyGH/EITr13BPvKcivXX cfWvlbBv0pX1+R0hMInhDH8ne23Tls0Qrs7hdyPG9LBA++lHqpTBxW6HEiycbP7YIQ9Y6D1aGKh of3yeORyrJYMITfE/FsMbbH6NKyg0VNEqI8M+1mcD4mW3vwRNzY7OlqVWFNYoqVQdsbRG5F9Uq6 wNiRlR9Ooyby9DA/2L69zjMGqDnBTWQ7XYwOy/4NdlvLauj4Aw== X-Google-Smtp-Source: AGHT+IFbxnSm5FcYra/NhgQKMu+OkU4ccH3bURF6g7KgB4DcFLTWIFmK1C48nXnn+TaTiHuSf8qBLw== X-Received: by 2002:a2e:ad86:0:b0:30c:1358:6400 with SMTP id 38308e7fff4ca-310499b4447mr1902191fa.5.1744331984565; Thu, 10 Apr 2025 17:39:44 -0700 (PDT) Received: from localhost.localdomain ([176.106.241.81]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-30f464ea5c6sm6344251fa.62.2025.04.10.17.39.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Apr 2025 17:39:44 -0700 (PDT) From: iuncuim To: Vasily Khoruzhick , Yangtao Li , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Andre Przywara Cc: "Rafael J . Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , 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, Piotr Oniszczuk Subject: [PATCH 2/6] thermal/drivers/sun8i: replace devm_reset_control_get to shared Date: Fri, 11 Apr 2025 08:38:22 +0800 Message-ID: <20250411003827.782544-3-iuncuim@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250411003827.782544-1-iuncuim@gmail.com> References: <20250411003827.782544-1-iuncuim@gmail.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O From: Mikhail Kalashnikov The A523 processor has two temperature controllers, but they share a common reset line. We need to use devm_reset_control_get_shared() instead of devm_reset_control_get() Signed-off-by: Mikhail Kalashnikov --- drivers/thermal/sun8i_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c index 1f3908a60..dc4055c9c 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -391,7 +391,7 @@ 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(dev, NULL); if (IS_ERR(tmdev->reset)) return PTR_ERR(tmdev->reset); From patchwork Fri Apr 11 00:38:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: iuncuim X-Patchwork-Id: 1797 Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (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 E15EF13FEE for ; Fri, 11 Apr 2025 00:40:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744332007; cv=none; b=RcpDUhholMxPcekaT89Dv9b1OtrVSDjtoUGXw9h7VsCS+u0TsrKzkHLETZ+bgkUdfuGdegT9mHN+ATENbCsiMx4lMAGq34sTOML/uDd/F+ij1a/leNLjaZ/LSfR7o/ZJDn0tjuxd5B5KqtgjTf+Hym0SO2RXMaJ7dtbiNbWsyN0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744332007; c=relaxed/simple; bh=z60GVKKnq+EBoMPOIQiGwthlZL/5bB21DgiBmuXlxlY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Yx9ijuqJZVy1SwlsYfGGIorP6k+VavW84JjYzwaWfL+5bXN6IVrzdzjho43EyZpi/6n0l+1tDs4qXiqOi4UchUxIeZp5e5a+FWx8UxZFxSEkq3LSKI1q/WlA1FmdZCp4UXZ/xOz648cQOnmiJSN4V3djkoS5S0Lmap6B4bpEyco= 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=e2/Nh19T; arc=none smtp.client-ip=209.85.208.169 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="e2/Nh19T" Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-3061513d353so15198721fa.2 for ; Thu, 10 Apr 2025 17:40:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744332004; x=1744936804; 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=d+rSfwK2IdMno7cgyqb3eYYWrYZbiRnVldmhW9L6vWA=; b=e2/Nh19TDtH0CFmO4MIaOBAxT/arwwGcD0NkNo8hDG7dBXRMZLZ0+dlt8FPk2PmG7A i4NAuQvRj0jtWzZLgpJjIShnC+wopPfeVrWdYzj2S/1KthZ/gUfxh2J7BdiqSjsCTdwP 7DqUUF+RNdzEvuwEFPJVj+LqvrzI9qVPLdQs640BitI90y40dP0j01ptKOFVOIMlm3qi a5BgJWxehQKQL9WdTt8rBbolmenP68zMGkm3zXuffBhGTiuSnZMo99JDUPSZIBdHSiZ7 pCV/Vd0Wlspg02BtKktcC5R9fPmZ1+aJl93b/y/gH4AHf8HHQ3fG14HjRVh6iyjmFqsy ZwiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744332004; x=1744936804; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=d+rSfwK2IdMno7cgyqb3eYYWrYZbiRnVldmhW9L6vWA=; b=Zoe96U74tSFrVBh4cuw00Z+f+xPGgPT4GZ13Gp5Ua/HABjlSy3KW2wJ4mEZ5NgKmYp kWXrbLCeeT2zUuKTZBUXKKfAN8Vh4nOf4DXuTarfmKzZnwFbol9rADk07qCt9RiIiVL3 cOrRkVHNiNyLMl2ZyvLWT8i5kAGcxnxN30oAsjCBj3fW2gASu/juoO9V3zvDbdPNYtu7 Zc1EfQYYM9lFx3LBj1tXWt/uN0akGhgH69zCq8NDWeEEFUnXzBXTwL1W8K5iKbfB9EDt iLftbhESG8+wQAI+CH7zm2wi5JvZxqdVcrkD4heNRDbBJRK9WoEOIb9VAtFvQ73kFxT+ /L7Q== X-Forwarded-Encrypted: i=1; AJvYcCUmt7KlSNL6Wc11IYfzlWvyf58RtVX+fNb8fNTE6Iv7jJhMP1NYSeFlR+Bj9gVlC42iGtWSTm40bq+03Q==@lists.linux.dev X-Gm-Message-State: AOJu0YzYF6EBQsaMWSKouMn5ql27U0OQXboqwlhL0Q9MpijXMtcESlkf POXKsQNS76uDI7b0TUFJ/CnvlPiLg5uNjthaNoA7TBGfypHxo982 X-Gm-Gg: ASbGncuxqimh/c3JFRQjHvpGz4o79se8lqguZ/KY6W84ORRZExhVnqQndi8+G4/xQ8T mNk0nc72oStAOI1GffjwQNmv4WD95Hq8b4/J46SV2WyRmnrnCddmjp1sPBKI5j5mFsffTLi88/X dLuSClqJnQq47nPBWRM7+BhM23szpNq91pU/mQTuJsDW/PM1jMJRdq1EBww34m9bOX71oqtzX5k AtzTj0ZXHVimkJSbVGw3cuAnjXQas+ZSg7Lke0DxmmDOqty4fN5i+aBKS5DBSI/IYdGHNszcFTC ugVmLxZ+BuwPshc+ZZVm5Pu9FREN6odWtZWByuCDg6GwZDtKDw== X-Google-Smtp-Source: AGHT+IEHx3pLyyA7RUjJFQMZKlcC6nirFWEfuuk3UQ55sdEchAVrUtO52D2wnKHHqYnoHtifKxO3Bg== X-Received: by 2002:a2e:ab18:0:b0:30c:7a7:e87c with SMTP id 38308e7fff4ca-31049a9a9f5mr2279391fa.35.1744332003965; Thu, 10 Apr 2025 17:40:03 -0700 (PDT) Received: from localhost.localdomain ([176.106.241.81]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-30f464ea5c6sm6344251fa.62.2025.04.10.17.39.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Apr 2025 17:40:03 -0700 (PDT) From: iuncuim To: Vasily Khoruzhick , Yangtao Li , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Andre Przywara Cc: "Rafael J . Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , 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, Piotr Oniszczuk Subject: [PATCH 3/6] thermal/drivers/sun8i: Add support for A523 THS0/1 controllers Date: Fri, 11 Apr 2025 08:38:23 +0800 Message-ID: <20250411003827.782544-4-iuncuim@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250411003827.782544-1-iuncuim@gmail.com> References: <20250411003827.782544-1-iuncuim@gmail.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O 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. 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 --- drivers/thermal/sun8i_thermal.c | 134 ++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c index dc4055c9c..919b05a96 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -116,6 +116,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 >= 0x7c8) + return tmdev->chip->scale * (tmdev->chip->offset - reg); + else + return 65 * (2825 - reg); +} + static int sun8i_ths_get_temp(struct thermal_zone_device *tz, int *temp) { struct tsensor *s = thermal_zone_device_priv(tz); @@ -208,6 +217,100 @@ static irqreturn_t sun8i_irq_thread(int irq, void *data) return IRQ_HANDLED; } + +/* + * 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 0x40-0x43 (caldata[4..5]) - not in use + * + * efuse layout 0x44-0x4B (caldata[6..9]): + * caldata[6] caldata[7] caldata[8] caldata[9] + * 0 12 16 24 32 36 48 64 + * +---------------+---------------+---------------+---------------+ + * | ths1_2 | ths1_3 | ths0_0 | | + + * +---------------+---------------+---------------+---------------+ + */ +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[7] >> 8) | (caldata[8] << 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[6] & 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) / tmdev->chip->scale); + + 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_h3_ths_calibrate(struct ths_device *tmdev, u16 *caldata, int callen) { @@ -721,6 +824,35 @@ 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_gpadc_clk = true, + .ft_deviation = 5000, + .offset = 2736, + .scale = 74, + .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_gpadc_clk = true, + .ft_deviation = 5000, + .offset = 2736, + .scale = 74, + .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 }, @@ -731,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 Fri Apr 11 00:38:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: iuncuim X-Patchwork-Id: 1796 Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) (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 3882813C3F6 for ; Fri, 11 Apr 2025 00:40:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744332026; cv=none; b=dPboDBB3DDJTS2CdM+53cuoxgnLZObvb3PosRTBH8WG+t3U9WMTGkuKMPA8LvqWfLCKY+Ezmb32D1ux7MosfNBhFvToD3bIslHDc1pvtQIXvZqho5DL37jxjvs5/AsbUm7rwcPNY+9Fne2iafixLCzgb3OhtgsOa1LIol2wozqw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744332026; c=relaxed/simple; bh=OVnmHC1nA8BJoaP2LILMHzkcbR2WcOje5+IPNQb/UsM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ps/ItS+QFMksSGALrWbaGMybFEqso/Wh0QAqCdc7gNAzhAW9J0Gg+PbyqCzax+pjJsPnRzpeoro4xJ4aFSXz0LUY/Jf56YzaI+su1rlV54IAqitRK3qqOb8onQJXmzBucCqgU1bMC9+RcBg4waFk6Ft/a6Ly2HE4L6owCD6G+0c= 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=ALfn0Lx+; arc=none smtp.client-ip=209.85.208.178 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ALfn0Lx+" Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-30db3f3c907so13611791fa.1 for ; Thu, 10 Apr 2025 17:40:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744332023; x=1744936823; 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=HkLjkAkBybKViu/IzAoHDfQk1VY1JyR4qcLvgOYgY4E=; b=ALfn0Lx+YeQNZfT5qNrSt0SfpaXi0hTFGu2TwmFUdpmpOgeqWxh78yz7ogUJotIDh1 GPoaCfnn2B80O4D5UEJGnmros0DmNXxH6B5r/JQeNTVd1xL06LrO5mjphbbXkIdKoAaI HwIAq2JnjlyOBYJXFZlQA7PP5sqUOqLzrFMkhNZMFLEll/GTJ6gLzSLWrVBtaNEyySq3 6e1RAkfS0yz5udp7xh2rp/IN6CT/zyL0RwoULLoewL3mqcJ2B4LEBAO+OOHx4NXQ7nZx TZ4n+5dLuUqpw1oG4WOnZrykL13YHDYBOShDnD0p0EpVYhRt1Vh/lMPe/J9mZi8CkGQQ mPaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744332023; x=1744936823; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HkLjkAkBybKViu/IzAoHDfQk1VY1JyR4qcLvgOYgY4E=; b=U8YR+Fkb+QoaHtThc1+4MA8XGgoygkmlQhdMGIBCCqe6moaJSny/rt0hf5v3z6E87+ 9fv/f/vGEhOraLvJS4g/lc0ZnN9FwZkH8XufxAhoB0h9I7qOCmKRJrmFRh8/bbEcPe0g vofaE6kz/6z0IHkhr4RkiS+UM/FDbKHJg+VEMokbItZp0ku1X2SxgFtTl+cGIAc7+D3h D8Js4z7Z1F1Ogp9slqs0wAxkfcbiup3mPZSuWhJ2fH65LDh4eDsWb+r/BCuERt6c8FVL MHPi/Q2mj7eMIB5kVWDbkKoWFjvJMjfKjHltxET7faiYgvYy6DCtCLsBS0+tMKRFGDcb vGlw== X-Forwarded-Encrypted: i=1; AJvYcCUaw3KeRTyeIwDZIx7lWxeIJxYe6BvLvxpwcEYAqYrXmXseIZR1+5iV/td+C+ymHT36MVbigRsor3Wfxw==@lists.linux.dev X-Gm-Message-State: AOJu0YxCatMNQWfVgk1NnIEwySs60FcLHCnqWpDwz5tv/vJKV2ZKRz7H arMrz3W1M0jUfeyjOWYUDClpZevlQ7XvVuJA50+m+fYU74p0MUrQ X-Gm-Gg: ASbGncvjsGoFd0UCaveW3MoV8Tl3wjo6/5srSlVU+83Vipsi7efnBBoa75ZFc0TevbZ fsPWRaXqIYg0No/dJ7FhjN6T8Vme/E5XIgvYnr+TvsmyLd/uz3wJWa0Mu4EiVhC8C+VsUd0Pcmf p2ri/Kphuvr1CI/jviZwUJjfE2IySkJ7agTTljo3yGQrI0lW7b+sFMo1MaVqqVGqa2pSZfVdhDh bTagIo28IG9kVps1mHUxGLFyiRu3ZoM52+GTCX0ZUiNyYFGbJp0EnwqZqz46kAlTFMiy7MrsEfr HPfhHIOyylayhuJW+kSj6+XwdIqbZOc0+lat2JofqEd3FHaNQg== X-Google-Smtp-Source: AGHT+IH0C04pdT7V39Cl5bBkK9z9UT0OrMbiEPLzhJb+HovoC/tpoPabyXxob1snSgH5ltQh5BDI9Q== X-Received: by 2002:a05:651c:2203:b0:30c:3f82:6844 with SMTP id 38308e7fff4ca-31049aadec7mr1968671fa.34.1744332023158; Thu, 10 Apr 2025 17:40:23 -0700 (PDT) Received: from localhost.localdomain ([176.106.241.81]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-30f464ea5c6sm6344251fa.62.2025.04.10.17.40.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Apr 2025 17:40:22 -0700 (PDT) From: iuncuim To: Vasily Khoruzhick , Yangtao Li , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Andre Przywara Cc: "Rafael J . Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , 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, Piotr Oniszczuk Subject: [PATCH 4/6] arm64: dts: allwinner: A523: Add SID controller node Date: Fri, 11 Apr 2025 08:38:24 +0800 Message-ID: <20250411003827.782544-5-iuncuim@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250411003827.782544-1-iuncuim@gmail.com> References: <20250411003827.782544-1-iuncuim@gmail.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O From: Mikhail Kalashnikov The SID controller should be compatible with A64 and others SoC with 0x200 offset. Signed-off-by: Mikhail Kalashnikov --- arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi index ee485899b..d626612bb 100644 --- a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi @@ -171,6 +171,13 @@ ccu: clock-controller@2001000 { #reset-cells = <1>; }; + sid: efuse@3006000 { + compatible = "allwinner,sun50i-a523-sid", "allwinner,sun50i-a64-sid"; + reg = <0x03006000 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + }; + mmc0: mmc@4020000 { compatible = "allwinner,sun55i-a523-mmc", "allwinner,sun20i-d1-mmc"; From patchwork Fri Apr 11 00:38:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: iuncuim X-Patchwork-Id: 1795 Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E908417C77 for ; Fri, 11 Apr 2025 00:40:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744332046; cv=none; b=oD0JSMKs28csEifOFjR1W4JNQQ5Xe1Sxi+Mb20WC0dicO15v0Hj1dUEe9iYoGQ9PU/l3/E5rVoKDi8LCGh3JwHfoEEzKAgcPkDiR5EhI/c1WDctg61MROyRUswOnX57A/3qh/n28ORoXI04ws4s8p57CXg26Ny4LQS3Dg1vXzC8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744332046; c=relaxed/simple; bh=Sr9C3AkfTXW+bU8fjxHLzXQi2OaODJymdItrPseCW/s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PRA3tPM4A5LuWWGECx/S/5MOflozrEICFVIbEkNVfs2hBJGn4Dhic4YLfqFrCT7Gbw5Bgs/1GQJjQjA1OJaRCikarHypKNL0twZoeCMKR189G3nLpNCwq7BNkSGxkIVmNT8XVovjCuAxB0AtUsV14UGdMFbJeIkDMO/AeYpNuas= 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=AmIHOsq0; arc=none smtp.client-ip=209.85.208.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AmIHOsq0" Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-3061513d353so15204531fa.2 for ; Thu, 10 Apr 2025 17:40:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744332043; x=1744936843; 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=pqMMUOwQC1FQBaxF5Z+cbkCBiisCIHbCIXU0D1pZnrM=; b=AmIHOsq0vCmxR9aMP2983a+RAfL40qYD/GIaFtq9LJDQLZVnTLXMULwuTymrHLBm/W HBhoc2+i5Ri2sywrPLc8Xi2tCuhU3SMhTA4jMTcZtWa+CR7zsrlhhPbS8+CX/K4Bopl8 toqPMmtR5pa3dLZnnwKsC7m97hJ3cnqw6J3mm40RztgYa06Gdwonp4fFSe+eObB/odrL zF3K2j5beD+w2UqCNZOi7qZm1/JbIKYuLj9dAjU5wdFMzJdwXeDWgT0WBnBBB93pQ0jh EKtQNyUdhKfSL2enRC1e9r581jDWp9QinukekvV1yTLLB0uFcfeDjzUHRUNpCBdk21rC gA3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744332043; x=1744936843; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pqMMUOwQC1FQBaxF5Z+cbkCBiisCIHbCIXU0D1pZnrM=; b=NnuwPEmONYGtaHIZiILkwphqJsy3C33riZkjdrODVqVB8DhQYHhFOi88PhOu46tWWj HP2bt9XPcTF2SvMt1iEm5E64qIdnTi9ML2ighACOuuDh4IRuRxmnQ/9YWqo/bj00+i+r MNZuxxYzCThJmBCH2Q4TRIx5m+y5iMtfi13gf+DbSFgu+J1+3YgEO1Uc+wGs/SJutsdg FXLsZM3yarKagOwk8XAl4jYbxGUfKsnbIuTfqL+oFk0yOInFXaivNy4Xue9ioQmDixAn Q2CaDsxXu9oy6/AA1aIy0V/FczYozgqGDFEEnyjjdXqkeaaKmpIKg7aAkMbPmP4cQXnI WWNw== X-Forwarded-Encrypted: i=1; AJvYcCUOYSVZRqkaeLYr3TNOFdhv4dzNV20VgsHEAR72u33fguVytOAUsUO+rLShWbr+5N8Ga4hExo12To6xog==@lists.linux.dev X-Gm-Message-State: AOJu0YwrC88lI3tC8LOcwVkVmVFm4YdCU5SyOLrGwKpIIxyQ/JYoE+QH HeCfKuGyKeLVOtGrIuZRVCavp+PPuvp+2iVdgiJP2A/t8BYi0dTG X-Gm-Gg: ASbGncsWb33bakd2UbtxZOUrgiujmHEgF3grTwOiw/mfUD9DMLFWTapYD3dOeSlR0yJ pTKCgOjVjVDEWRk7X1NARFfGOxfkZCvUln61sjuniDK2sbBQ9sTk55Y1zVXiHGxedM1MPS/XuBf fiaYDdsjeSSipUn2xhMXmCKkpYj+9d/td5Zm4lIT2Kcm3oLV3miQ8w8wCZn2vGXvnuuH0+xCLv3 35qTnr9+owDM61DGDqq59YmXx558x9SmfPYRv7o0WyWVDx3gao/2oWpeiFale7LKWqyYU+hHqHB mBiq4MZOKHXDNvGbolg2pcfC6k0ZXAvCpU3bEHSeHBf4j5Wa3Q== X-Google-Smtp-Source: AGHT+IF33816+KiMMv+fNeFdW0EInDxjtilG9kyALznQ6Y0n6dpa1CvrQmH8HkK1cx1k6+UUsrWg3g== X-Received: by 2002:a2e:a9a3:0:b0:302:2598:de91 with SMTP id 38308e7fff4ca-310499fb36bmr1693111fa.16.1744332042866; Thu, 10 Apr 2025 17:40:42 -0700 (PDT) Received: from localhost.localdomain ([176.106.241.81]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-30f464ea5c6sm6344251fa.62.2025.04.10.17.40.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Apr 2025 17:40:42 -0700 (PDT) From: iuncuim To: Vasily Khoruzhick , Yangtao Li , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Andre Przywara Cc: "Rafael J . Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , 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, Piotr Oniszczuk Subject: [PATCH 5/6] arm64: dts: allwinner: A523: Add thermal sensors and zones Date: Fri, 11 Apr 2025 08:38:25 +0800 Message-ID: <20250411003827.782544-6-iuncuim@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250411003827.782544-1-iuncuim@gmail.com> References: <20250411003827.782544-1-iuncuim@gmail.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O 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. 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 Signed-off-by: Mikhail Kalashnikov --- .../arm64/boot/dts/allwinner/sun55i-a523.dtsi | 138 ++++++++++++++++++ 1 file changed, 138 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi index d626612bb..4f36032b2 100644 --- a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi @@ -7,6 +7,7 @@ #include #include #include +#include / { interrupt-parent = <&gic>; @@ -22,6 +23,7 @@ cpu0: cpu@0 { device_type = "cpu"; reg = <0x000>; enable-method = "psci"; + #cooling-cells = <2>; }; cpu1: cpu@100 { @@ -29,6 +31,7 @@ cpu1: cpu@100 { device_type = "cpu"; reg = <0x100>; enable-method = "psci"; + #cooling-cells = <2>; }; cpu2: cpu@200 { @@ -36,6 +39,7 @@ cpu2: cpu@200 { device_type = "cpu"; reg = <0x200>; enable-method = "psci"; + #cooling-cells = <2>; }; cpu3: cpu@300 { @@ -43,6 +47,7 @@ cpu3: cpu@300 { device_type = "cpu"; reg = <0x300>; enable-method = "psci"; + #cooling-cells = <2>; }; cpu4: cpu@400 { @@ -50,6 +55,7 @@ cpu4: cpu@400 { device_type = "cpu"; reg = <0x400>; enable-method = "psci"; + #cooling-cells = <2>; }; cpu5: cpu@500 { @@ -57,6 +63,7 @@ cpu5: cpu@500 { device_type = "cpu"; reg = <0x500>; enable-method = "psci"; + #cooling-cells = <2>; }; cpu6: cpu@600 { @@ -64,6 +71,7 @@ cpu6: cpu@600 { device_type = "cpu"; reg = <0x600>; enable-method = "psci"; + #cooling-cells = <2>; }; cpu7: cpu@700 { @@ -71,6 +79,7 @@ cpu7: cpu@700 { device_type = "cpu"; reg = <0x700>; enable-method = "psci"; + #cooling-cells = <2>; }; }; @@ -171,11 +180,39 @@ ccu: clock-controller@2001000 { #reset-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", "gpadc"; + resets = <&ccu RST_BUS_THS>; + nvmem-cells = <&ths_calibration>; + nvmem-cell-names = "calibration"; + #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", "gpadc"; + resets = <&ccu RST_BUS_THS>; + nvmem-cells = <&ths_calibration>; + nvmem-cell-names = "calibration"; + #thermal-sensor-cells = <0>; + }; + sid: efuse@3006000 { compatible = "allwinner,sun50i-a523-sid", "allwinner,sun50i-a64-sid"; reg = <0x03006000 0x1000>; #address-cells = <1>; #size-cells = <1>; + + ths_calibration: thermal-sensor-calibration@38 { + reg = <0x38 0x14>; + }; }; mmc0: mmc@4020000 { @@ -602,4 +639,105 @@ rtc: rtc@7090000 { #clock-cells = <1>; }; }; + + thermal-zones { + cpu0_thermal: cpu0-thermal { + polling-delay-passive = <500>; + 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 = <500>; + 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 = <500>; + polling-delay = <1000>; + thermal-sensors = <&ths1 2>; + sustainable-power = <2400>; + + trips { + gpu_temp_critical: gpu-trip-0 { + 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>; + }; + }; + }; + }; }; From patchwork Fri Apr 11 00:38:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: iuncuim X-Patchwork-Id: 1794 Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (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 1B7B71B7F4 for ; Fri, 11 Apr 2025 00:41:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744332065; cv=none; b=p6CFUH2HAgqZgJl4OP9U9PstZti85vVRfvlQ1Kc76cQm1zd5CIgoT/LI1U/q+GuDbFdUnOj14KByyHdbrL3MvXWXiILkDoppuJttubEGlOFNuWvqp05vApE++HAl4IFH4i64NbFX8/rcbwDa9be7Mlj+Oxs7ppP5Q/Y1Mrp1668= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744332065; c=relaxed/simple; bh=3gj9u/hlulCyyg8E7Exqz6RlgLh9YXNSVMUR363LDeA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eMrCwy5S5Wtg6/rP93XlXNa/Fmn8m/D/CNGUUYkL5R2OnOO6jNI/s8jl5vukt3sdkriRs5u/PjuWKjOkJ1z7ki6k1MXJrfP5YKYqa2RD3BnmM508KXvdIUgoi66zpSvBwd/ypSwQuMni9na3w0+JDLQr+0mH8MdAUr6R0hMzn1g= 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=cGQxg1/E; arc=none smtp.client-ip=209.85.208.176 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cGQxg1/E" Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-30de488cf81so13533301fa.1 for ; Thu, 10 Apr 2025 17:41:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744332062; x=1744936862; 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=RVVDUXMgIvl3qGuqG7Y9JWon05wMZyYxnJ2zr2Ehlos=; b=cGQxg1/EyXzZeywcdVV6uSzPJTIuzus4ak7I/9uOal6v4WkgeANTfkES9E8Sf8HbYD JCaI0B6eQBeiPWuTtABytbrU9maQhO/tG4orhVnPUF6vhj1w/wQ708JDdYQkayVVM8+4 TLAWCeJYWOBa71CIvvS+EPqcZxDb/Qsk0X9G+UUblJEAk8FnqEcII0QA7cmC3aWPJFRa /ha1rWibLfFhbp0kn52DjfA71OtCJacXzsyaYxwXERM/QrXvh15Eu0u9V84cTd2tUobn RasbM7nv6xsDVHhoE77rLJBUbJjVIl/6kdBnMswF8I1meQFV4dFNbTthTyGQtBdog8mV LXog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744332062; x=1744936862; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RVVDUXMgIvl3qGuqG7Y9JWon05wMZyYxnJ2zr2Ehlos=; b=qlla/OeX5Hh0Wj7hrAk/QTSmR9niskS+frkmc+9f4ERItBdqdVJ2iXKL2h8BIf4OSP l7N9jR84mJO770U2EMoyzmu4/nHorGksIssqw5BTC9B6/Jg4wiWhkPMHaxgjd0X9L/Wd O7BROkTEh0r2ALS3TIL4Y27yhHzfMaWPZ1Jd0roIoV7M/JF7EjnGUmN0gtRev7dKccq0 AtYpUxPElr3Efc9EYe8xWm84QBKlmVB+3o+U5MQs6uBM+WC22YeErz1nVmnZ4neYXOUM 0whSujCAvu1IreDQPjtP9eIUfY/rRMMQToU+c3cyvP6AKevhFfJroOVrG13lXL7+3K1Y d9dg== X-Forwarded-Encrypted: i=1; AJvYcCVy+/hJXeu7jnWpOz0svrNoAQcxcX8zyK9Kb9M0OKHIa72ywh0AWU6Rf8sepZqL/zi3lkzztDwrqvqxBg==@lists.linux.dev X-Gm-Message-State: AOJu0YwoBcfQl5M77f/QEH1tToC9rd4juDwMowfU1LGasr0iL8YrbuUD 363op6L7bm9Sg+gsLlko/HOzP71Ie54F4MO7MaLdHcj1gpTZo4l+ X-Gm-Gg: ASbGncvPwCbfhmF58TUHEOqqSDx61niwkMLCFp4nE2k+ZZ+Yj2vH46YS+wxpvuQgZ+X IM3SlvmiwA+1AMBlaWlBDSPFQhhmtS07uJR5u8EwVrtcMnr29Vl2fuzVTvHxi8a8nTrslja9ohP b0YWApay9SnzC2d283gjGcTW/PqWjeaXQqELEa7kZmHgH3kKEzqPHEACCtupEj7jLsahxaobfin FgzKigfvv8eQjt/imTQ/iU1zFdTcrEMAhNiLBZj3DfTPoQqUFpUnEAZgmoJ+DZl/uHnU5OFo8Pq SeMDY5Ithv0D0qOrOCZPS9pv9xZXR/vlaWc/MxVcXuTuR5UYlw== X-Google-Smtp-Source: AGHT+IGiJdnH2bwA47CyELRWVzejAMbjmYQFTtee9XHHNai4Q7kPWpY1iiYd/YOYoOt9vN/NRllLgg== X-Received: by 2002:a2e:b8cc:0:b0:30b:b987:b6a7 with SMTP id 38308e7fff4ca-31049518235mr2053581fa.0.1744332062006; Thu, 10 Apr 2025 17:41:02 -0700 (PDT) Received: from localhost.localdomain ([176.106.241.81]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-30f464ea5c6sm6344251fa.62.2025.04.10.17.40.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Apr 2025 17:41:01 -0700 (PDT) From: iuncuim To: Vasily Khoruzhick , Yangtao Li , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Andre Przywara Cc: "Rafael J . Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , 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, Piotr Oniszczuk Subject: [PATCH 6/6] dt-bindings: thermal: sun8i: Add A523 THS0/1 controllers Date: Fri, 11 Apr 2025 08:38:26 +0800 Message-ID: <20250411003827.782544-7-iuncuim@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250411003827.782544-1-iuncuim@gmail.com> References: <20250411003827.782544-1-iuncuim@gmail.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O From: Mikhail Kalashnikov Add dt-bindings description of the thermal sensors in the A523 processor. Signed-off-by: Mikhail Kalashnikov --- .../bindings/thermal/allwinner,sun8i-a83t-ths.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml b/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml index 3e61689f6..70ac395ef 100644 --- a/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml +++ b/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml @@ -24,17 +24,21 @@ properties: - allwinner,sun50i-h5-ths - allwinner,sun50i-h6-ths - allwinner,sun50i-h616-ths + - allwinner,sun55i-a523-ths0 + - allwinner,sun55i-a523-ths1 clocks: minItems: 1 items: - description: Bus Clock + - description: GPADC Clock - description: Module Clock clock-names: minItems: 1 items: - const: bus + - const: gpadc - const: mod reg: @@ -107,6 +111,7 @@ allOf: enum: - allwinner,sun8i-h3-ths - allwinner,sun20i-d1-ths + - allwinner,sun55i-a523-ths0 then: properties: