From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EECCA26D4DD for ; Sat, 25 Oct 2025 04:33:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761366807; cv=none; b=W87BPCXSE+Yeu7JY9O2rNwXy9dp5BR/MBfQ1GVAax+VgZ23rNqLfbDTIwhqU90EdYj8PP7wyin4OWKDOgJoyian8PqHrRGSTYGHDu2UMWmg+XU5qMbvqgDfgkkYzG2cAGWT+z1vR+HiUwMCpXY51BRSuCzwbC7eGJQmx0wrk0Eg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761366807; c=relaxed/simple; bh=HLkZrRq3NGY0xnF3Ajij+/FlY5p+nZpDzyvy6gl4718=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=skqD26hkRaiRM4/7Sa1ll0b6WKpZA2vof8fZ+QCKcVkdRW+g8ZaM2mPcGEPUF5jN5r9V37at1nPd6xCcpp2OU53IOgMNIN/TZxBIyOLJUkGHwmatAqmkcgwRZdmVl3uzL/R1buJc51WIUojFZtvTVe1Pz9yvzHbq8CoMZwEsw4E= 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=c09F8Bc5; arc=none smtp.client-ip=209.85.208.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="c09F8Bc5" Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-378d65d8184so37589561fa.0 for ; Fri, 24 Oct 2025 21:33:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761366804; x=1761971604; 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=nGpVSnY2YGnC6StYjZi+g05NBMCnFA0794RPi3L6J+s=; b=c09F8Bc57O8yXAts7RYjF72o54jCvCbZ9pMzZD5VJ9eW4Js6I4jruOXwVydSaX6Gv4 fV4G5uXF+VpuoPz4SP/JOdKiKMOl0Gso6Z0NIGaxQ5ou/FnjIPjqTa1e9kRr8Rgrxep8 6/tNUNDDp6v9vHYrrlMEvXE+qVhTdt3LzkCGpMZgcGRTo++1I2dFsKFteyLTm/SkMGdF Fb9Dono92L9hpLtzqSVe3ceisRaPsM2eYF6z3fHD0pC1vcAc726mpnG+LhDm8tyZYfXj 84173szYpzpLmGzYgINiB+1Gr1TUE6yUlz9J6zHUYLEAa7flYSa/zAfDWmhMIzxULgVn V7Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761366804; x=1761971604; 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=nGpVSnY2YGnC6StYjZi+g05NBMCnFA0794RPi3L6J+s=; b=WUPjiqgQx7IinnBlozFHFN9i0cXS8iq7+sNxj8O7/YWxCcC3iyM2WRGvu2TZAzwMxz U2vgMP+L8u178uxU5peC1OZZOPy36Odsc49gb70VLnvjx0BuMzn/HESqfCq1Tzexor7p gop0K44YCFjz2ORy8I6x7Hl1+Rtkn8rwXDNvF3Ivr9PIGOY3yGtpL5XRraHfXvrZvu3T FpP/mkgSahHgcUZFiDrZ4JvHdckLPf/93RyoKtCZSyO34KF3NvHYmpAY58XqDHzX4Srb p/WlkElDu6WaPn/IzHmIEgag2cFMiFPrVstjJGbfuboI1d7A4nhzH2q0e4OhykdSYtzd 418g== X-Forwarded-Encrypted: i=1; AJvYcCWhPK5mZS4e/XKeK1RjOoy4Huh2ygF67Ao3yvn+Lznftn1HVoAC2KVhPg3ntvIb8TYELqnmAWISqc1Gaw==@lists.linux.dev X-Gm-Message-State: AOJu0YyP4eqnYu0fuV/MC4aviJKlFscz5SMRuFuIDBSh+X3/oP0DNHKi kdUtKDvaxcNVhwfQK9O7KQt2IP68heiYEAB36SW4wSy3+7FHlD0ILQr/ X-Gm-Gg: ASbGncsIaL1aETZG8xpZcL3+m+VFScpfybZfvXyRasHMQnrKuhJI1Wy97GJSOS/GcPu xG4byZsse7xihbuNOqC8IDe462n+uVlQ4oUjpAr71B8tVziDj74V7vrBkgQMzm+RE4FD402xOrR 7YYV6eV5xhJmqaHGUd+LRH1yHTNu1Brx9Had25s1ijKyf8MLBSYG5MYbaINktiQJ50Z93DexrkM Kh6bY35tySETQG6m182ODq1B2RhWrmvDj3eAB4GWWmVm2eHsxUMIgepRWKLGA4kHFce3dWRfjwV a/DQTbedKM5OQc9udm/33EefCPks2JWInU6BgG/1OCeby1DYOZi1YR6/Ux/6L4KY9jF7+XEbeR0 EKKXguzsidyJBi5wUqVLdTiiJhe+HqPEwPmVVslI4NqWxyamgWf/YItJ01lVlv6M7Q6BfRsLV4V ua X-Google-Smtp-Source: AGHT+IGj8aCrZj29Rg9HWwRsU0X1CDkriVFw8huU9nZ548l08naKsaur1apTfOMiV+X0MeyojMrrVA== X-Received: by 2002:a2e:b8cc:0:b0:36a:925e:cf3c with SMTP id 38308e7fff4ca-37797a39146mr98679831fa.31.1761366803946; Fri, 24 Oct 2025 21:33:23 -0700 (PDT) Received: from junAIR ([176.106.241.81]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-378ee0ca7a0sm3409241fa.33.2025.10.24.21.33.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Oct 2025 21:33:23 -0700 (PDT) From: iuncuim To: Vasily Khoruzhick , Yangtao Li , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Philipp Zabel Cc: Andre Przywara , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v3 6/6] Allwinner: A523: add support for A523 THS0/1 controllers Date: Sat, 25 Oct 2025 12:31:29 +0800 Message-ID: <20251025043129.160454-7-iuncuim@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251025043129.160454-1-iuncuim@gmail.com> References: <20251025043129.160454-1-iuncuim@gmail.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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. Trips temperature, polling-delay and sustainable-power parameters are derived from the manufacturer's BSP. Signed-off-by: Mikhail Kalashnikov --- .../arm64/boot/dts/allwinner/sun55i-a523.dtsi | 154 ++++++++++++++++++ 1 file changed, 154 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi index 7b36c47a3..0cbe73601 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>; }; }; @@ -398,12 +407,46 @@ syscon: syscon@3000000 { ranges; }; + 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_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", "gpadc"; + resets = <&ccu RST_BUS_THS>; + nvmem-cells = <&ths_calibration0>, <&ths_calibration1>; + nvmem-cell-names = "calibration", + "calibration-second-part"; + #thermal-sensor-cells = <0>; + }; + sid: efuse@3006000 { compatible = "allwinner,sun55i-a523-sid", "allwinner,sun50i-a64-sid"; reg = <0x03006000 0x1000>; #address-cells = <1>; #size-cells = <1>; + + ths_calibration0: ths-calibration0@38 { + reg = <0x38 0x8>; + }; + + ths_calibration1: ths-calibration1@44 { + reg = <0x44 0x8>; + }; }; gic: interrupt-controller@3400000 { @@ -732,4 +775,115 @@ npu: npu@7122000 { power-domains = <&ppu PD_NPU>; }; }; + + thermal-zones { + cpu0_thermal: cpu0-thermal { + polling-delay-passive = <100>; + polling-delay = <1000>; + thermal-sensors = <&ths1 1>; + sustainable-power = <1200>; + + trips { + cpu0_threshold: cpu-trip-0 { + temperature = <70000>; + type = "passive"; + hysteresis = <0>; + }; + cpu0_target: cpu-trip-1 { + temperature = <90000>; + type = "passive"; + hysteresis = <0>; + }; + cpu0_critical: cpu-trip-2 { + temperature = <110000>; + type = "critical"; + hysteresis = <0>; + }; + }; + + cooling-maps { + map0 { + trip = <&cpu0_target>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + + cpu4_thermal: cpu4-thermal { + polling-delay-passive = <100>; + polling-delay = <1000>; + thermal-sensors = <&ths1 0>; + sustainable-power = <1600>; + + trips { + cpu4_threshold: cpu-trip-0 { + temperature = <70000>; + type = "passive"; + hysteresis = <0>; + }; + cpu4_target: cpu-trip-1 { + temperature = <90000>; + type = "passive"; + hysteresis = <0>; + }; + cpu4_critical: cpu-trip-2 { + temperature = <110000>; + type = "critical"; + hysteresis = <0>; + }; + }; + + cooling-maps { + map0 { + trip = <&cpu4_target>; + cooling-device = <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + + gpu-thermal { + polling-delay-passive = <100>; + polling-delay = <1000>; + thermal-sensors = <&ths1 2>; + sustainable-power = <2400>; + + gpu-trips { + gpu_temp_threshold: gpu-trip-0 { + temperature = <60000>; + type = "passive"; + hysteresis = <0>; + }; + gpu_temp_target: gpu-trip-1 { + temperature = <90000>; + type = "passive"; + hysteresis = <0>; + }; + gpu_temp_critical: gpu-trip-2 { + temperature = <110000>; + type = "critical"; + hysteresis = <0>; + }; + }; + }; + + ddr-thermal { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&ths0>; + + trips { + ddr_temp_critical: ddr-trip-0 { + temperature = <110000>; + type = "critical"; + hysteresis = <0>; + }; + }; + }; + }; }; -- 2.51.0