From nobody Sat Feb 7 10:07:48 2026 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 E44F825BEE5 for ; Sat, 25 Oct 2025 04:32:12 +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=1761366736; cv=none; b=Jav2YzWG+jVvmRvDeig4qQqVwrmOVPURRCpbJyTREQK2M4VED75hrclEzTbNgPUrzONKra/KoqzEXGyI747svoIfvn8zELpt5fYzfRycj0UQjWIWUuQUvifotsTNp5CF+spNLw0HfVdHrTOk8BrtdalKsw4pshyn5R1+SYLjQlw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761366736; c=relaxed/simple; bh=LxsKOmVaDzOSy8bwwU0rWY43UlPO4MkzptnRxF9FP4I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=p+/o34MH3V3wlOjEtHfBOfPs/5nEN+BdpgyvrznXXADGjHAQv8giiWV3y1b6fbJuj+sEADWVnx3YxpzbBFswYdJQUH0KPaS5jhNzvMktQEb7CtcGwRDVBTmHJvYAR9wZ4B9hTVG5C6mjbKnwJmyJRkjhTypeeOrxdclU9BabYOY= 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=B9Qcok5R; 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="B9Qcok5R" Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-3737d0920e6so44916811fa.1 for ; Fri, 24 Oct 2025 21:32:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761366731; x=1761971531; darn=vger.kernel.org; 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=CuZHP6YFsCwwA4TkyjhYi+XmEZKmSYURob9jZc/v+s0=; b=B9Qcok5RoenL6fqPlY6e10yRncd50H3kwiY26o1qE/pRn6c3Ux3k+uEO7MSFd7/CaA NBcnmRvhUXZxjl5UbiEiKC18ag4KrYRvH4/A1HnNIkuufh2ElkBerbg7+A5tNjSHRklG PDWjquaC9tXHMJmIGiZWIOIa9pgAz2ZfFXdi8wqCl+ymzUdzMtfiGOxGGWUE/ez21CNN QOyIyFY13Kk/ehCS2DBw6txxg3R4VuC3RKf/RbpLigqk7mn76XVnLL+kK5ExLmc6ftMH 8aGzA3NqEUCAVaWaZnxWNRdaVi6kxo0wk2LMD1gMzc/CbQQAGBQweBzckNKNjJJ+q6ad Vsew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761366731; x=1761971531; 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=CuZHP6YFsCwwA4TkyjhYi+XmEZKmSYURob9jZc/v+s0=; b=YGMPpHKeVz+OlxqOK2NmszaNhXKsxIE/Vs0lJKPxxJY46Su/7YwOcn6TSDEnJY53MF b/29JWIhUS31ThAkrgtp4WnSlBhC9xe12tj9VJhpBLgoJdpQAAsV43WgSkzJN/aG4gtx DNGrZUA0L32J2DlPANnOalmpF5pUb0j3WC/AUaIF3mkcvlvb2mRZ3XrLlbnHTASX50XH HjmArW44dFKiE0KMn7ndUjN7CjermRnR0FYt4g5MAgOW88r0fCO9BE6/xYy/kodDYAlp p/TGozan88QGezH1bPrzjRV03FCa9C467O34fiDXXc8OZ/p39zTEmoOKH9b6yrFb9/ri 2QzQ== X-Forwarded-Encrypted: i=1; AJvYcCVvQ4Jsgf//KKTsbD52S9z1SHzjF3yJFS/cao7hporT3H0aFDjDSY06ezVtnzPkABbwLQmD1Shv+v9PRvM=@vger.kernel.org X-Gm-Message-State: AOJu0Yw/ZEgBIU0VcxkBmB6XVA4mylYDNAudXU6dxY9vFAJ3LlElfLM1 2oy1lDDrpnhFWD+SD+q10EH/qz1uQaXvSe9dKxsWsR+pifcFXy6cWtSc X-Gm-Gg: ASbGncspN0wte8SeZliVtT9x46d5ALbRyEQ7AkpgaiaIFLf8sUE3dsAPre6BR5CRZNe x/4FwKouII558+3Jp8+T5zCZMcjnr2sK3/YUouc6eqty4LzofapNl6RiwcJsmUb6zPkdQQqip1l 7gqEYkLzTi9EEweY1vqHIl8wo+zOB3Pvc/ON83x4MaI4a7bvTsTvwZooSk+IbZ7ii+hbu7AqV0+ My8AHGSF7p/OwZXd4yVFU2ScR78OeWFzzVA4UAn9MOFn0t4vexLeDLDndavOFmiTEM33y5raxD/ oVLL+RNazRclcJCkzzpQCx5REH2UlZceeozlFONR1jGkuFBa9EC12kWdDen8CLuRoMh5GZopeRz JChN4YpnXDZ8t8OpDruAR6amMsP43qYLP6u3LyawnDBoix2EnDc1BQghA3zakeW2H5u6uNqjO/E gH X-Google-Smtp-Source: AGHT+IHidqK20asSnkSoaYA0Ua+IEXaUMgtNo1d+OXf+4JbTCbl0aR8F8Cd5djjk9glXI6+3c84fFA== X-Received: by 2002:a2e:a916:0:b0:376:4430:b545 with SMTP id 38308e7fff4ca-378e4648542mr13761041fa.49.1761366730866; Fri, 24 Oct 2025 21:32:10 -0700 (PDT) Received: from junAIR ([176.106.241.81]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-378ee0ca7a0sm3409241fa.33.2025.10.24.21.31.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Oct 2025 21:32:10 -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 1/6] dt-bindings: thermal: sun8i: Add A523 THS0/1 controllers Date: Sat, 25 Oct 2025 12:31:24 +0800 Message-ID: <20251025043129.160454-2-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Mikhail Kalashnikov Add a binding for D1/T113s thermal sensor controller. Add dt-bindings description of the thermal sensors in the A523 processor. The controllers require activation of the additional frequency of the associated gpadc controller, so a new clock property has been added. The calibration data is split into two cells that are in different areas of nvmem. Both controllers require access to both memory cell, so a new property nvmem-cells has been added. To maintain backward compatibility, the name of the old cell remains the same and the new nvmem-cell-names is called calibration-second-part Signed-off-by: Mikhail Kalashnikov --- .../thermal/allwinner,sun8i-a83t-ths.yaml | 56 ++++++++++++++++++- 1 file changed, 53 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..b2f750ef2 100644 --- a/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.ya= ml +++ b/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.ya= ml @@ -24,18 +24,23 @@ properties: - allwinner,sun50i-h5-ths - allwinner,sun50i-h6-ths - allwinner,sun50i-h616-ths + - allwinner,sun55i-a523-ths0 + - allwinner,sun55i-a523-ths1 =20 clocks: minItems: 1 items: - description: Bus Clock - description: Module Clock + - description: GPADC Clock =20 clock-names: minItems: 1 + maxItems: 2 items: - const: bus - const: mod + - const: gpadc =20 reg: maxItems: 1 @@ -47,11 +52,16 @@ properties: maxItems: 1 =20 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 =20 nvmem-cell-names: - const: calibration + minItems: 1 + items: + - const: calibration + - const: calibration-second-part =20 allwinner,sram: maxItems: 1 @@ -107,6 +117,7 @@ allOf: enum: - allwinner,sun8i-h3-ths - allwinner,sun20i-d1-ths + - allwinner,sun55i-a523-ths0 =20 then: properties: @@ -132,6 +143,32 @@ allOf: - clock-names - resets =20 + - if: + properties: + compatible: + contains: + enum: + - allwinner,sun55i-a523-ths0 + - allwinner,sun55i-a523-ths1 + then: + properties: + clocks: + minItems: 2 + clock-names: + enum: [ bus, gpadc ] + nvmem-cells: + minItems: 2 + nvmem-cell-names: + minItems: 2 + else: + properties: + nvmem-cells: + maxItems: 1 + nvmem-cell-names: + maxItems: 1 + items: + - const: calibration + required: - compatible - reg @@ -176,4 +213,17 @@ examples: #thermal-sensor-cells =3D <1>; }; =20 + - | + thermal-sensor@2009400 { + compatible =3D "allwinner,sun55i-a523-ths1"; + reg =3D <0x02009400 0x400>; + interrupts =3D ; + clocks =3D <&ccu CLK_BUS_THS>, <&ccu CLK_GPADC1>; + clock-names =3D "bus", "gpadc"; + resets =3D <&ccu RST_BUS_THS>; + nvmem-cells =3D <&ths_calibration0>, <&ths_calibration1>; + nvmem-cell-names =3D "calibration", + "calibration-second-part"; + #thermal-sensor-cells =3D <1>; + }; ... --=20 2.51.0 From nobody Sat Feb 7 10:07:48 2026 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 4A905262FCB for ; Sat, 25 Oct 2025 04:32:27 +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=1761366749; cv=none; b=QlQZaA/2/Qy/XDahA+GUqKrUZxNCu5HHD+lLwcY8a9BoXMlkFIUomvLeQIk7uL3q+hhwiFsEa/tdrVAxezYSh/Z8uR5HO+g0eR6NqQALXaxYmrbyi0DkoCbuph68O5StoNSvyy0kit0BIGEtT3Snggg0riRRXaaQcQoB60Yos5U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761366749; c=relaxed/simple; bh=OXisvb9gi/TE1J28fYKNKmNR9Heo/ymBioo9V+DNdQY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jexVZPBD+lqmE6F+UlMcNy0oxxP7U3fryctgXvCL5eNM7Ki1+49e0OenlYP0Ph9jk9+Hx56LkpbcfJ0IYbdGqAsJS4EEyYhmXaKlQl0I5pe6fMCG0yplrfecrxPGylFwQ1vJoy5ww1T6LDuR7JjS4X0+FUfVI/IE5iQ6/x9K/8c= 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=R+YihWyp; 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="R+YihWyp" Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-378d50e1cccso30696881fa.0 for ; Fri, 24 Oct 2025 21:32:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761366745; x=1761971545; darn=vger.kernel.org; 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=bw4z9PVBnrl74pcQ+V85ZiVa2r5TmKnZAhW/Uv6GfHQ=; b=R+YihWypytT+BYopJ6H1ko8x1lvV7sFSCuzdQisFVc8mp0p3RNjyiL5xEege9jTbbl eHY3wcO7Z5ugKxaCIeZmPBt2j7QRzMJJgmL+H0W5u5JuWNj8/9RVzrkM8yw9Zh0HwMC/ tsAbogbD88rNrUFYB25YI5xVkB6AdcOGQuQwaYb8mUlWebEtmyhN9fhIKDxUc0wON/nB 98Uk9TQZtJIdeTA4m9vSNhn3QAKd3ihv431BYg107Wcqv2XJ5M980JCR/UlqEnDOQrTT 4eaAI/eZkqsxSfd6+CIDe+HJnWBlVlV9fI5q15fM+wHIMXnR11bkS79UhID6agLnAkyN uQOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761366745; x=1761971545; 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=bw4z9PVBnrl74pcQ+V85ZiVa2r5TmKnZAhW/Uv6GfHQ=; b=bg2xO3B/WZdMYJ7kwBzgtH8q1JBrKC7JPp4sd2ySsBSy6uwHElXALROhzftFdmOlfn focEolJhRd/wfnVmkTuLTTJ8NDbZcC7KDhn16YJrj/Yzc3yQGkeZnuY+yJ6WcBS7jKG6 XwYIrjzbPowPGpzMMSOhu2JdpWnKhVn2DL6fnMaa3ntAWXQCv6P32Tz7NXz/wu+hH3Fp Pqq6WCh/TWqNIf0vTudLZgBMBPeV8xnsp352ScaZYAC20eYAD3DAijcmcvgUPyPvMXzP ICvWS9OxCiegArkTrxbWFH1NgquhIz0I9xobJmCbII9imx7ZdRxleeyjXSGzX3AjuyGh Jpmg== X-Forwarded-Encrypted: i=1; AJvYcCUqIRlT9++iSc4hb8WBgqQdjnirIus3th8jkVqprAgzbKno+yGV9Pqhttww4bJ+h7sv7E8hXuyEFeuPVTk=@vger.kernel.org X-Gm-Message-State: AOJu0YzefS1Tfn87eESVfXbjSHhHJMkelb/YPcSgHXboO0a0Fcgt8qF+ /ZS3aad641havq+vKXpoGtfTF9XNtupZWm7LUIZIKjEg47FA1nMksXzi X-Gm-Gg: ASbGncvMmN/h9K4idLZPAE4091gO9X7jUZlVrNDcT9euu5cXa+Gx5TDgflkk1C8eSuO VwsamV+fYXOV8kzsHJeEv+9rnNqm41WLiUbUiypVehWPZy1BxoYB2mD/HBPHT657dYcxItsmUwP mCH6VScVdxwEVuln0j2GDlow4FnByU8m0st0VfkmXgZe1LtudIkvh3fpZtVvJw0zs8NZXJkSQdh H+pf9YokgA4DjGXGjgSbtgDogM7hVDQgscZEvHwCnPhnAOYY05J48/udeGriOrb6aRdOWaQpX2t h8LMLLCL7zQ2rokWV0XeB8UNquVmYxa1b3XBxqKakigQAoBcdQjqv/KwPL8+LFv5yMkbaqiqE8o vZQk8wQmwIw6OQ9MMY5adJ0Bx0VENXRhX0jJ5JHMSWqYlUhriGJ2HOBMOY75lMMcLVNemV7mN7B Ro X-Google-Smtp-Source: AGHT+IFIlO0Xnz3NfsASBS+sA6Ogolz52/zgOOHUf1BRiQNX9JIhdrYW1iCIFtP2vXKndrvpB2lUXQ== X-Received: by 2002:a05:651c:221f:b0:375:db6e:fac9 with SMTP id 38308e7fff4ca-37797a0dab3mr93162251fa.31.1761366745177; Fri, 24 Oct 2025 21:32:25 -0700 (PDT) Received: from junAIR ([176.106.241.81]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-378ee0ca7a0sm3409241fa.33.2025.10.24.21.32.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Oct 2025 21:32:24 -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 2/6] thermal/drivers/sun8i: add gpadc clock Date: Sat, 25 Oct 2025 12:31:25 +0800 Message-ID: <20251025043129.160454-3-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Chen-Yu Tsai --- drivers/thermal/sun8i_thermal.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_therma= l.c index 226747906..c02c398b0 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -66,6 +66,7 @@ struct tsensor { }; =20 struct ths_thermal_chip { + bool has_gpadc_clk; bool has_mod_clk; bool has_bus_clk_reset; bool needs_sram; @@ -89,6 +90,7 @@ struct ths_device { struct regmap_field *sram_regmap_field; struct reset_control *reset; struct clk *bus_clk; + struct clk *gpadc_clk; struct clk *mod_clk; struct tsensor sensor[MAX_SENSOR_NUM]; }; @@ -417,6 +419,12 @@ static int sun8i_ths_resource_init(struct ths_device *= tmdev) if (ret) return ret; =20 + if (tmdev->chip->has_gpadc_clk) { + tmdev->gpadc_clk =3D devm_clk_get_enabled(&pdev->dev, "gpadc"); + if (IS_ERR(tmdev->gpadc_clk)) + return PTR_ERR(tmdev->gpadc_clk); + } + if (tmdev->chip->needs_sram) { struct regmap *regmap; =20 --=20 2.51.0 From nobody Sat Feb 7 10:07:48 2026 Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.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 EF76A267B9B for ; Sat, 25 Oct 2025 04:32:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761366764; cv=none; b=tuD1PDHJHWdTi1QfMsb1VQeT5Jn15GYMapgBrsYuMmu6/Vlk9y/YKDSTSNV94vZ99xwJ8PBAQReYRa9H6aPepTgcROMInPp6B9kd4baSBv2hcMULV3rZVgGQxGJw1WvmyJkpE84zyDM4qmAF3brwAThjVb1h7Z9p/sqiBtKZrZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761366764; c=relaxed/simple; bh=JFlSRxXwWBQ3XACpCIXATa+zwXHpyzhtFajoU+nnbIg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dUabEoWY86NRzQ1lORKaDjHcJBehz6VbSvQD/Tn1HU26gvipX2D8EOamOIOTw5fU3NmB2EyqPO9EbCHbLDnzqpNVzSiVeAViWDJ01S2zTShTH4Zd2PcIrWgRcsOPO79JBE9sUgs31zo4FATEJs4NhZDGP0YLAYGPDa8hv3lEWMw= 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=d0qv2fnc; arc=none smtp.client-ip=209.85.208.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="d0qv2fnc" Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-3761e5287c9so32387381fa.2 for ; Fri, 24 Oct 2025 21:32:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761366761; x=1761971561; darn=vger.kernel.org; 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=i3+BmyLOtp7xUTMRQtQMY1TWwM+wvGI7ScMcGnjI6fc=; b=d0qv2fncNLrQWksm/Kj+aDzfPcFi280b/vHBqmfbPUYAPe9VIHu5mFSd1EnS6qX50A bs09pYFYEWVUvj5VtpQzthJUcX4JvPzxQhdc/TBgTZJAXlCajzzZTae6v38fn6JlYcfE o2IbEM19U86R1Jp+cECN/C5YpkIfxc/adSehpNUhVTTqezDgsFv5oUTsF2Q8OJIL2CGy eEgFHfN/exVu2ahSsDgSBuLIx82sFDXouAsZEYbSkQ0K8oVK9LI72CYEJr8EOlkhnYx/ e356HZkn09YG0vnHTDnAudvLEZgpTfGS2LG5zTy45NTfu6Wy/vjKwk04ZswuJmjhQd/Q cTiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761366761; x=1761971561; 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=i3+BmyLOtp7xUTMRQtQMY1TWwM+wvGI7ScMcGnjI6fc=; b=s4c+pmyY+My9sfaZ9sxGJhjT1I3LrSNnaPmZCR9KB7G3LmZGWPhuT2fF+djoqwCECh eL1E03Ix8MNMs2qrajmJBBqyNebGOQu1GTgDt6vrr4wf1MCQ+IzBcUfRomTIfQsu5Dm+ GqzzR68faksArex7am6XXBsEYqdeQWagkF9QMUGHvv81Vc3vIUgRL3xcNyQunv9XcXqh StSkdopmBmhzKZyw+WS/pS/oZn0efutM1670XDn38oBrdOBw2e/XEhYAa4wc/J/WEHbX Njc/7g345QrvaM6U8fbHZrpIth7GrWmXhtPw7WfpWmrPijzZytKLiH9FtqK0ouCZ2M9h 9OVQ== X-Forwarded-Encrypted: i=1; AJvYcCUp9+7Si9VOg8dJr/FpeA+pVHVYNVM5OAqff0riNeEHyuYHaAl5JrccF/TNY89R1zaNpa0GGr1jkxHq41g=@vger.kernel.org X-Gm-Message-State: AOJu0YyV0sS4jhRlRe6/eN//js4z4C7q5BHAhCq9OzClzK40HTx7ZdUS v2frMOLqhl+WQyk84i5k0Sn2OG9rGLke+hel8VtSNtXHfIHroRR9+sLW X-Gm-Gg: ASbGncucaiY8pA+H3n/O7iSXFx1nhCo3FXJMEYN0WcJQ3sl/08/hZazQtsafsOYxP3V bdlEBS9U+JHmS5SCpgXE0PEgksPB6qsfXF8IFSCTHIGXUDwvQJba/EULSI7mYhrKhQTHF8tw/BT MB+OyvX0ElDkHdrYm6LL/HpUGm6ckQPcGhDNP4BEzvvE+fQx7xsme4U822CS43vujpQsHvRqkol Rkr7aCicwKW9N7furNuvZa+HUdUNJGkwnrrErhQl5I1ezFXZxQW0RGpqDj+lTP+I8cAkACKgNUQ tr6f0pZIyMh6/2Ip42Ous26aIU9D1lmBy0rYjbGj5Qg/IX2679CviSP38m/vL7N06FpUxXad4if dy+WAjBY0tpYL0eKRnh5rm5zPA0+hUixtA8h24fCGGIXqiKFRSdzDw7+KdPRLE4Qqiw== X-Google-Smtp-Source: AGHT+IEKvrwo7BMcvdLr8sMnPaVHb2OI/tgnv1kSKzQDgd1sc7jso2BrG2SWkbje2QobtPqCs0yKQw== X-Received: by 2002:a2e:bd17:0:b0:36c:2367:b3c1 with SMTP id 38308e7fff4ca-37797a58f18mr88205231fa.35.1761366760931; Fri, 24 Oct 2025 21:32:40 -0700 (PDT) Received: from junAIR ([176.106.241.81]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-378ee0ca7a0sm3409241fa.33.2025.10.24.21.32.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Oct 2025 21:32:40 -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 3/6] thermal/drivers/sun8i: replace devm_reset_control_get to devm_reset_control_get_shared_deasserted Date: Sat, 25 Oct 2025 12:31:26 +0800 Message-ID: <20251025043129.160454-4-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- 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_therma= l.c index c02c398b0..aa496e1ba 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -344,11 +344,6 @@ static int sun8i_ths_calibrate(struct ths_device *tmde= v) return ret; } =20 -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; @@ -391,19 +386,10 @@ static int sun8i_ths_resource_init(struct ths_device = *tmdev) return PTR_ERR(tmdev->regmap); =20 if (tmdev->chip->has_bus_clk_reset) { - tmdev->reset =3D devm_reset_control_get(dev, NULL); + tmdev->reset =3D devm_reset_control_get_shared_deasserted(dev, NULL); if (IS_ERR(tmdev->reset)) return PTR_ERR(tmdev->reset); =20 - ret =3D reset_control_deassert(tmdev->reset); - if (ret) - return ret; - - ret =3D devm_add_action_or_reset(dev, sun8i_ths_reset_control_assert, - tmdev->reset); - if (ret) - return ret; - tmdev->bus_clk =3D devm_clk_get_enabled(&pdev->dev, "bus"); if (IS_ERR(tmdev->bus_clk)) return PTR_ERR(tmdev->bus_clk); --=20 2.51.0 From nobody Sat Feb 7 10:07:48 2026 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 94644272E45 for ; Sat, 25 Oct 2025 04:32:56 +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=1761366778; cv=none; b=PVZn8EsJ8vv0LsWt49vPiMftCiHe0+bbktipl5Ozbliq3O7d13vuF4czkGMBfuyyVwGsxDkhNw0/sWRskYufqfG5PjDKddX7kvtf7X5OTDbCPV1BW4OQDsaWHFkkW3vF3pPVDoMZsSL4k+XA5z0aMh+UPWNhwwoiHOJmzeVqDd0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761366778; c=relaxed/simple; bh=J/zzc1ja43MRTCgO8LF4bp6opHtC/iF4Lw9TqE0/ybQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HY9SsCwD/yqoRPBLeS6RPcFT3+NyAy/ghJt/j5abwTgqTMrLZ5KW4VdqjD6yxXZqCg+2bpNVIBMQvqRm3oNUcyj/lL5gJ/VVJwRGRsMj+1PMUQaAg21hrsKtdhNaUNnxEJYm8DDwCM0B/3VYtH6jc3hEJeOjfcbWOoM1O1aSSJY= 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=g6SvKMbM; 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="g6SvKMbM" Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-3737d0920e6so44922911fa.1 for ; Fri, 24 Oct 2025 21:32:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761366775; x=1761971575; darn=vger.kernel.org; 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=aU3qD3/P4X3aGl+GxoTABgHAWYmZmNCs4mQEkZTLmtc=; b=g6SvKMbMx5mK95nUcQ8Jn+I/cpwcGYIi26wVqPU/lWP4xMdse69QnKDcbuOdGaD3w3 PCX9I/W2jOcGx10GSufAvchvpuxcYRW/sAd6WlFe1s9fMZ5ysWtJ18Ntg+f9tba+q2lz UaNL9Vfbm+xVLgGh5FVvHaVq9fSBAtDp/SIw8w4K1fupzRiUb4UrKvtp3DJNeN9mXYbm GPCkTz4CtA1JunK1dW1hRisRsS5aiSQoPsJ2NM/k2YA45pRC0H1whuToVmW/h8d4/H74 myoTCuaaaFlDnXZqctENXy+l6rO6UaqHrfxahBmcUirPcuiur3lhUlothbIOYD4dOwqy Nkiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761366775; x=1761971575; 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=aU3qD3/P4X3aGl+GxoTABgHAWYmZmNCs4mQEkZTLmtc=; b=LH8dFjjHMwfij8Abmus+QNC6VRQ/gL9I97du/+ofvM/c3vflSoRC8btAM8b/8Ygo8u xJqwp3y6k509BUAzZDboG7mMeBEpt/6jhGBMc3m5ul7Zp24XHsJqY7H7zaSzEnfYykn0 Yxi4oOVmAFpp2m4Eq4XOqbNmdVyHxDr8Axqyw1sRQXZednY7k0bdfug80R2SDNQjae/G Il9dG5xLa19GltBowAvlZDNoaJ/UNEy+g3kgnN6ObdlnKcyeKDl8ucOrff5kgbjW0xqu rZLLlm64EfXQ2BnicjKi1mk1lI11/1z1XtjCziq/pbbOOLKr7EVQTw0Mv7PU4G0FAzCk 23Mg== X-Forwarded-Encrypted: i=1; AJvYcCUR8G33VEKdgljyk0VUw8keXEuL/Xrwm3mt8lV9b040taMPjgzw4I1D851/NCfemrGGmiP6uhohKR3mCcA=@vger.kernel.org X-Gm-Message-State: AOJu0YxNG9pKVLdHgAmoONiW+Wh+wLiOWbkit1KnkUr8HeAzXWOGur3Z Vd9RnodKdzshDX4aMltGHfZuwuhxBQUDFBYxmERQgTmDZPwVogoWhVJo X-Gm-Gg: ASbGnctJBcLtXURomK7zgr0EwC3C6IDgsGoSkYCgh6Dj/TlfAVsFTBOOZqnrFBKMG5d MDeVkSe20wc8ACOhbeRQFNa+upaTNyyL8oW0iLE+LxaQBpCr38V3CWa+XeV6W0BWTzyApYu5krx leabY1gSUienHX4KLEIGK8Ahej2L4o4FkggRAbpeevgp3lCyvK7o/XZ+6ChdmfZmYCUAB+i6VMy 02Ft7YYZD0yMl5jkZcL7UJUuDzo+YkpUioOghswVCQVOm4vx+Apntik5ZH3Zsmz9sicUGB8aV8I 5jWg9hbqHasUcaKDQpomjbEQmcOI5ELpg+HRSc3U/ahK24WkmWEntJYed4z26hyBI//feaEHI6X ZGEbfrDSzo/5A7X0Q5DphzulBhYCDRk50M7mAJRXyi7ckRMyQCWFfEdv07jmwL5c2dr1JJ3fphY dL X-Google-Smtp-Source: AGHT+IH/eF1EDfMQXoqCn1NhnMmPtXp6P1wcPRtuabMRfy3u2y12SFECgEV2LqHRoicJ+PYpOzbYLg== X-Received: by 2002:a2e:a916:0:b0:376:4430:b545 with SMTP id 38308e7fff4ca-378e4648542mr13765001fa.49.1761366774636; Fri, 24 Oct 2025 21:32:54 -0700 (PDT) Received: from junAIR ([176.106.241.81]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-378ee0ca7a0sm3409241fa.33.2025.10.24.21.32.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Oct 2025 21:32:54 -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 4/6] thermal/drivers/sun8i: get calibration data from two nvmem cells Date: Sat, 25 Oct 2025 12:31:27 +0800 Message-ID: <20251025043129.160454-5-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Mikhail Kalashnikov The A523 processor has calibration data in two nvmem cell. To be able to add support, the ability to add data from two cells into one array must be added. Signed-off-by: Mikhail Kalashnikov --- drivers/thermal/sun8i_thermal.c | 77 ++++++++++++++++++++++----------- 1 file changed, 52 insertions(+), 25 deletions(-) diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_therma= l.c index aa496e1ba..d6d8e13e5 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -303,43 +303,70 @@ static int sun50i_h6_ths_calibrate(struct ths_device = *tmdev, =20 static int sun8i_ths_calibrate(struct ths_device *tmdev) { - struct nvmem_cell *calcell; + struct nvmem_cell *calcell =3D NULL; struct device *dev =3D tmdev->dev; - u16 *caldata; - size_t callen; + struct device_node *np =3D dev_of_node(dev); + struct property *prop; + const char *cellname; + u8 *caldata =3D NULL; + size_t callen =3D 0; int ret =3D 0; =20 - calcell =3D nvmem_cell_get(dev, "calibration"); - if (IS_ERR(calcell)) { - if (PTR_ERR(calcell) =3D=3D -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 =3D of_nvmem_cell_get(np, cellname); + if (IS_ERR(calcell)) { + if (PTR_ERR(calcell) =3D=3D -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 =3D nvmem_cell_read(calcell, &len); + nvmem_cell_put(calcell); + calcell =3D NULL; + if (IS_ERR(caldatapart)) { + ret =3D PTR_ERR(caldatapart); + goto out; + } + + caldata =3D devm_krealloc(dev, caldata, callen + len, GFP_KERNEL); + if (!caldata) { + kfree(caldatapart); + ret =3D -ENOMEM; + goto out; + } + + memcpy(caldata + callen, caldatapart, len); + callen +=3D len; + kfree(caldatapart); } =20 - caldata =3D nvmem_cell_read(calcell, &callen); if (IS_ERR(caldata)) { ret =3D PTR_ERR(caldata); goto out; } =20 - tmdev->chip->calibrate(tmdev, caldata, callen); + tmdev->chip->calibrate(tmdev, (u16 *)caldata, callen); =20 - kfree(caldata); + devm_kfree(dev, caldata); + caldata =3D NULL; out: - if (!IS_ERR(calcell)) + if (calcell && !IS_ERR(calcell)) nvmem_cell_put(calcell); return ret; } --=20 2.51.0 From nobody Sat Feb 7 10:07:48 2026 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 D9F07274646 for ; Sat, 25 Oct 2025 04:33:11 +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=1761366793; cv=none; b=hw0h408ENFTd4iRm86NlcmZUKPlpTl3itD+8cyfJVGIFgHSLzGotysoQGfb8Ixb2nz4Eu5eRYj0nMAmd7BvXgjVuZqbD90bX6wYCeT5qecCuzRDykTaovnkwAIgWTwG6OXgQo0DHwoFsPnVdDGEpOfJaoTtbKbfPXDOqlT/7Szs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761366793; c=relaxed/simple; bh=vKwIkRtVEbLiJY2BlW4E9oyIfD48LqL7a3hDQ3iAOsA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PP6GjYAIPSCQz1jjL/KO9exdSHNwlIX0NohpMlR/15KUliJVPSkRtzVQ1/ca49dk6PuR6DM4B3vFoWPYFWBAlHUEat5vbXfdGqY0C5k1S/xLbZC6AbKrbIG3py3R5Fg6AkLwh9vY2yHjzv1GjryJzvLYpUxNvAUBp3FTkvg3C80= 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=I/aiqgIZ; 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="I/aiqgIZ" Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-362acd22c78so24656521fa.2 for ; Fri, 24 Oct 2025 21:33:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761366790; x=1761971590; darn=vger.kernel.org; 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=BpucFmLklCdqMhA9C9XyPHvfCwLqk6dMk7FGikdB0lU=; b=I/aiqgIZzf1+H/rfKheCJ5WcvKaTX0yc90/N4AmXtWycpheIw5SkaZcqhujrOPNV6w 2LsduEBQTtzysaBX+uU8zEY16HqiRk0OwD0Tm0KTyfbkljqFpiEPp0oILMG7jDsCP7z/ oV5yiruFkepNsm6ctESclmaqgFqe2ML1F3fnjcfgwsUD55h3QTEkacXyzvUsxHmryTJu SCmMD7ioVbOYjpVCvH7PcXmyFLv9JrvoUPjp5ahdPW+9MAB0zAWz6OdQQftw631Z9zYZ 9iSh3BN7l+GMgIt8U4Qln/em7WnHncpW9fTGM0Xhthr5dK+6V537ZQ32t+dfncTMlHZV 9TEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761366790; x=1761971590; 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=BpucFmLklCdqMhA9C9XyPHvfCwLqk6dMk7FGikdB0lU=; b=KrhsqVmQXmNKmt0B73cxGQOPa0834YTs5eZrerUOky0744YkIbo9NgjB76yeSlR1f9 znfKDQ7Nir31C85CksTZ3N5ofxDr4lwV9c9CWl/ko7bvvAX867ac3zrXHRUVRbcKRhl/ dw1hP1u+4LBsIOyIhcVM6KFjhDyBgIKwNqBx7Y69hcsOMa7KN8mOVzf5t45Z7S0ecvk0 1sy2GAeVagqADHQdWUaQZF9t/ngLezz9hwW1I+n8v/ah1Vxkdo5PEhahxEwpJ4Wg7/Mv /yM2gbHZeU1ErI3atr32eCOlnNADVSqh5I5Rjl0rQnSwGHWxhEjAMWaWVnKmmiLtJ1f1 1OuA== X-Forwarded-Encrypted: i=1; AJvYcCUq+BlHJenAWzVWR7vwhDcjpKrx81oxy7ahPgnRNrj+RWE8hcI4/h78q+VnwduTWjH//mWO3yGeUhSHA5o=@vger.kernel.org X-Gm-Message-State: AOJu0YzdV0mFV2nltGycs/1U8bilcZurrE8bb1DAYPIRWCxSqq0YOj7C PTSLT62CNC2IEWI3bnxlNZJ0p2MIcvyHM8k8Yml1GRliC4y2vgbCbYc8 X-Gm-Gg: ASbGnctJh6fn107QfDZecdDPIYIJ6fDefKcU9Rp0o+TrADv0jNiEVZsGvuij+3szwIF Q9IlP9hGBO4Ms0BC4L/S11BFTqPA/MZmUuB+ezZHYdmMdI35+QPWrVyzMF3VU57DE4TFRPtuc8R kwWJjotO3ukZiW1Yx9ghRFcynAZein3e6JM/RWs2yB6xtN0Wd+rqlPRVGZkDGnzpNobFO37wDZT e9H1C/hsMySexJNQrbbTdaYp7NXuGoXl1CNHh/6JsdrI5xr9O8tq8n8TSWLkefUfDyHWcyinbyV 0EDA4Y0c8SLdc4k4lkIMVvhcf5B3P2iGu+9aI+j8MGsETkhlL5s9wiVUB9quRQKPTnfl0yKcCX0 Rx6le89Pj1jaRvIHSub5dTlmYyuM7ncTDI/k+nWJQU7YKyYgkgtCOAAp7b1CKiDCIHaU1nFjIaA Tn X-Google-Smtp-Source: AGHT+IGI1bkGkIs+m+mcDg1QheXEpjkKTfwp/CVg0HfjhPonvg/HY7Zg24J0VSwSVIiajjlFuNgFMg== X-Received: by 2002:a05:651c:150c:b0:378:e58f:5f10 with SMTP id 38308e7fff4ca-378e58f613dmr12893371fa.35.1761366789881; Fri, 24 Oct 2025 21:33:09 -0700 (PDT) Received: from junAIR ([176.106.241.81]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-378ee0ca7a0sm3409241fa.33.2025.10.24.21.32.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Oct 2025 21:33:09 -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 5/6] thermal/drivers/sun8i: Add support for A523 THS0/1 controllers Date: Sat, 25 Oct 2025 12:31:28 +0800 Message-ID: <20251025043129.160454-6-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 | 133 ++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_therma= l.c index d6d8e13e5..7d35ea3c4 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) =20 +#define SUN55I_A523_DELIMITER 0x7c8 +#define SUN55I_A523_OFFSET_ABOVE 2736 +#define SUN55I_A523_OFFSET_BELOW 2825 +#define SUN55I_A523_SCALE_ABOVE 74 +#define SUN55I_A523_SCALE_BELOW 65 + struct tsensor { struct ths_device *tmdev; struct thermal_zone_device *tzd; @@ -116,6 +122,15 @@ static int sun50i_h5_calc_temp(struct ths_device *tmde= v, return -1590 * reg / 10 + 276000; } =20 +static int sun55i_a523_calc_temp(struct ths_device *tmdev, + int id, int reg) +{ + if (reg >=3D SUN55I_A523_DELIMITER) + return SUN55I_A523_SCALE_ABOVE * (SUN55I_A523_OFFSET_ABOVE - reg); + else + return SUN55I_A523_SCALE_BELOW * (SUN55I_A523_OFFSET_BELOW - reg); +} + static int sun8i_ths_get_temp(struct thermal_zone_device *tz, int *temp) { struct tsensor *s =3D thermal_zone_device_priv(tz); @@ -301,6 +316,97 @@ static int sun50i_h6_ths_calibrate(struct ths_device *= tmdev, return 0; } =20 +/* + * The A523 nvmem calibration values. The ths1_3 is not used as it + * doesn't have its own sensor and doesn't have any internal switch. + * Instead, the value from the ths1_2 sensor is used, which gives the + * illusion of an independent sensor for NPU and GPU when using + * different calibration values. + * + * efuse layout 0x38-0x3F (caldata[0..3]): + * caldata[0] caldata[1] caldata[2] caldata[3] + * 0 16 24 32 36 48 60 64 + * +---------------+---------------+---------------+---------------+ + * | | | temp | ths1_0 | ths1_1 | + + * +---------------+---------------+---------------+---------------+ + * + * efuse layout 0x44-0x4B (caldata[4..7]): + * caldata[4] caldata[5] caldata[6] caldata[7] + * 0 12 16 24 32 36 48 64 + * +---------------+---------------+---------------+---------------+ + * | ths1_2 | ths1_3 | ths0 | | + + * +---------------+---------------+---------------+---------------+ + */ +static int sun55i_a523_ths_calibrate(struct ths_device *tmdev, + u16 *caldata, int callen) +{ + struct device *dev =3D tmdev->dev; + int i, ft_temp; + + if (!caldata[0]) + return -EINVAL; + + ft_temp =3D (((caldata[2] << 8) | (caldata[1] >> 8)) & FT_TEMP_MASK) * 10= 0; + + for (i =3D 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 =3D=3D 1) { + sensor_reg =3D ((caldata[5] >> 8) | (caldata[6] << 8)) & TEMP_CALIB_MAS= K; + } else { + switch (i) { + case 0: + sensor_reg =3D (caldata[2] >> 4) & TEMP_CALIB_MASK; + break; + case 1: + sensor_reg =3D caldata[3] & TEMP_CALIB_MASK; + break; + case 2: + sensor_reg =3D caldata[4] & TEMP_CALIB_MASK; + break; + default: + sensor_reg =3D 0; + break; + } + } + + sensor_temp =3D 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 =3D CALIBRATE_DEFAULT - + ((sensor_temp - ft_temp) / SUN55I_A523_SCALE_ABOVE); + + if (cdata & ~TEMP_CALIB_MASK) { + /* + * Calibration value more than 12-bit, but calibration + * register is 12-bit. In this case, ths hardware can + * still work without calibration, although the data + * won't be so accurate. + */ + dev_warn(dev, "sensor%d is not calibrated.\n", i); + continue; + } + + offset =3D (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 =3D NULL; @@ -730,6 +836,31 @@ static const struct ths_thermal_chip sun50i_h616_ths = =3D { .calc_temp =3D sun8i_ths_calc_temp, }; =20 +/* The A523 has a shared reset line for both chips */ +static const struct ths_thermal_chip sun55i_a523_ths0 =3D { + .sensor_num =3D 1, + .has_bus_clk_reset =3D true, + .has_gpadc_clk =3D true, + .ft_deviation =3D 5000, + .temp_data_base =3D SUN50I_H6_THS_TEMP_DATA, + .calibrate =3D sun55i_a523_ths_calibrate, + .init =3D sun50i_h6_thermal_init, + .irq_ack =3D sun50i_h6_irq_ack, + .calc_temp =3D sun55i_a523_calc_temp, +}; + +static const struct ths_thermal_chip sun55i_a523_ths1 =3D { + .sensor_num =3D 3, + .has_bus_clk_reset =3D true, + .has_gpadc_clk =3D true, + .ft_deviation =3D 5000, + .temp_data_base =3D SUN50I_H6_THS_TEMP_DATA, + .calibrate =3D sun55i_a523_ths_calibrate, + .init =3D sun50i_h6_thermal_init, + .irq_ack =3D sun50i_h6_irq_ack, + .calc_temp =3D sun55i_a523_calc_temp, +}; + static const struct of_device_id of_ths_match[] =3D { { .compatible =3D "allwinner,sun8i-a83t-ths", .data =3D &sun8i_a83t_ths }, { .compatible =3D "allwinner,sun8i-h3-ths", .data =3D &sun8i_h3_ths }, @@ -740,6 +871,8 @@ static const struct of_device_id of_ths_match[] =3D { { .compatible =3D "allwinner,sun50i-h6-ths", .data =3D &sun50i_h6_ths }, { .compatible =3D "allwinner,sun20i-d1-ths", .data =3D &sun20i_d1_ths }, { .compatible =3D "allwinner,sun50i-h616-ths", .data =3D &sun50i_h616_ths= }, + { .compatible =3D "allwinner,sun55i-a523-ths0", .data =3D &sun55i_a523_th= s0 }, + { .compatible =3D "allwinner,sun55i-a523-ths1", .data =3D &sun55i_a523_th= s1 }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, of_ths_match); --=20 2.51.0 From nobody Sat Feb 7 10:07:48 2026 Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4CC61494C2 for ; Sat, 25 Oct 2025 04:33:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761366808; cv=none; b=hvQawGLFlN7tiIl8CE/eM8ddiqoqorFQmu4ef1vGHlIvO2RcoDflzhsFjuUOkOGQgjZar5L1++EmBs/drRyIj3363fJ8Yt44VWSd/zFcD131C7JpMrkcucQtjcKcnpEK+Jdq+v0eI9sJgb1nKdSBUt0mX33ktbytLkpMkX3YWSU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761366808; c=relaxed/simple; bh=HLkZrRq3NGY0xnF3Ajij+/FlY5p+nZpDzyvy6gl4718=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lHpjL4n5Ral9Mq6qb5kn/Qz1jWdYpVDl7/Lb+KfH3XEtoJIR78C79lkk/9UJFL+R97Mx9hnh5WEnYaik4xzQb5ssYKzTdJEZzjjrA5urdFUhZYlCjO6BDZVvxmN7Uxb1x/otqQmmcx76i54xLFVv8cYUN8WCx41if/P2/DWfbL4= 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=hoCirQMk; arc=none smtp.client-ip=209.85.208.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hoCirQMk" Received: by mail-lj1-f179.google.com with SMTP id 38308e7fff4ca-378d54f657fso33856931fa.2 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=vger.kernel.org; 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=hoCirQMkw5YFtqaX4tBDfoaWOlUNrfXVLQsp7qAjEZe+0xfT8aFeCVATC4bDN458Tx V6/SWYhMGJVCSX55kF/q1p18fWptMjw/E9NPSQI8tfsTn5Am06mPah4tK6o/Kt1tPF6H q1xXOYhQaEhJaUW1KXCtTtMt+URehJD5fs6vS68hQRvKrX50ZQCB4w44p50SfNFR0j0y 3+hxuviMgpBxFnmugOE/2+0qq3drcxynlhGGp6sDPvjX4D+H3lfWxHm1B3tylvn5Ed3m mt/71MhC/fnh2q8Wgpnucxz7fgHvBoqBoi0EU5JB9ScNbKQjNdmRgAHMMyHOaclAO0Yo rL9A== 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=NhWZPPT2yenOUIr7130lmr1pk6S13tO9ATbdFQwFOBUV1rPSa5X4o3XS936TpxtipH bRt+4Dn0k/7kLeORqbJZ47usKoS83vL9ai1/0xrP5GHpm0ylPte02jK18sg1lmX5ftkt yMlvzWUxeDliEuWaldN4maYWEWZ/CdFzk+0+c448Ldabqa8kxFibaJ0I8jq0xnfDgNhT ZzLHSB6jBqSOn18mO+fcCD543sM0+l4aSPi677o5RyzPvrsQYEisKG0ezNkuFX/QrnYG WRHLyplat/aBddFHRmlfpQeJ/Uu9dvXcmcnjb1U9G6KwaB+nV03Fxkyry3xx6CpnrDGl /7yA== X-Forwarded-Encrypted: i=1; AJvYcCWcOHo37wdS3equyDVYUDkQGa87EHrAKP63lK7vDwByfDO5sYKQJHgr+k5hD041SbV/frRNcr01+DQN6do=@vger.kernel.org X-Gm-Message-State: AOJu0YxsML5JERj6ezy0vOHdcsW3zQrtaJXjq5Z0PbmMGqpDH1q33d0V W6l2vGaCpv5XFhzFgQwWBzuMshdvvwoRPNJyxvuAZPpnhF9HoZWCVaKI X-Gm-Gg: ASbGncvYChJEf2HBRVGUIHoxGz5fgI867Zybj654f9DyMSrW7KGVshmv7rIDL2UL+ka swb+52Qb/deXR/9mg0tfcO8ZMQ74i922GI8MSi9G/jsgP4XdAdd6oAIDBI+8DaVW41YnI+corv8 KzNBN8Hydx3fPinh6AoQWO13LIleJ3pqGxP8l5fdhN35LcqiWQTrpHcwK8mQFQ+bX+rRS6ITwd5 JWn5tHgrnvHQ7mftlR1+DvOplMnPdKeOOvJ/k5iF5EDqZq5vMtW5VmXYlBfwRSj1wKWMjNzHJLu WTFARShhk8CqZtFWfe9jpcJvbF9HV1YgqcnY1Tw3HPG2nLhvbjccnn/2WRPTifF2UZCrHUQZ3gn E3q/kHu0sHKEXI/BlaJf8FgGtArpvBrvTnUYa0Tw/TNMQBr5RGBJc5vodKZaC5rz3BfQ+UngmWj Ks 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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/bo= ot/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 =20 / { interrupt-parent =3D <&gic>; @@ -26,6 +27,7 @@ cpu0: cpu@0 { device_type =3D "cpu"; reg =3D <0x000>; enable-method =3D "psci"; + #cooling-cells =3D <2>; }; =20 cpu1: cpu@100 { @@ -33,6 +35,7 @@ cpu1: cpu@100 { device_type =3D "cpu"; reg =3D <0x100>; enable-method =3D "psci"; + #cooling-cells =3D <2>; }; =20 cpu2: cpu@200 { @@ -40,6 +43,7 @@ cpu2: cpu@200 { device_type =3D "cpu"; reg =3D <0x200>; enable-method =3D "psci"; + #cooling-cells =3D <2>; }; =20 cpu3: cpu@300 { @@ -47,6 +51,7 @@ cpu3: cpu@300 { device_type =3D "cpu"; reg =3D <0x300>; enable-method =3D "psci"; + #cooling-cells =3D <2>; }; =20 cpu4: cpu@400 { @@ -54,6 +59,7 @@ cpu4: cpu@400 { device_type =3D "cpu"; reg =3D <0x400>; enable-method =3D "psci"; + #cooling-cells =3D <2>; }; =20 cpu5: cpu@500 { @@ -61,6 +67,7 @@ cpu5: cpu@500 { device_type =3D "cpu"; reg =3D <0x500>; enable-method =3D "psci"; + #cooling-cells =3D <2>; }; =20 cpu6: cpu@600 { @@ -68,6 +75,7 @@ cpu6: cpu@600 { device_type =3D "cpu"; reg =3D <0x600>; enable-method =3D "psci"; + #cooling-cells =3D <2>; }; =20 cpu7: cpu@700 { @@ -75,6 +83,7 @@ cpu7: cpu@700 { device_type =3D "cpu"; reg =3D <0x700>; enable-method =3D "psci"; + #cooling-cells =3D <2>; }; }; =20 @@ -398,12 +407,46 @@ syscon: syscon@3000000 { ranges; }; =20 + ths1: thermal-sensor@2009400 { + compatible =3D "allwinner,sun55i-a523-ths1"; + reg =3D <0x02009400 0x400>; + interrupts =3D ; + clocks =3D <&ccu CLK_BUS_THS>, <&ccu CLK_GPADC1>; + clock-names =3D "bus", "gpadc"; + resets =3D <&ccu RST_BUS_THS>; + nvmem-cells =3D <&ths_calibration0>, <&ths_calibration1>; + nvmem-cell-names =3D "calibration", + "calibration-second-part"; + #thermal-sensor-cells =3D <1>; + }; + + ths0: thermal-sensor@200a000 { + compatible =3D "allwinner,sun55i-a523-ths0"; + reg =3D <0x0200a000 0x400>; + interrupts =3D ; + clocks =3D <&ccu CLK_BUS_THS>, <&ccu CLK_GPADC0>; + clock-names =3D "bus", "gpadc"; + resets =3D <&ccu RST_BUS_THS>; + nvmem-cells =3D <&ths_calibration0>, <&ths_calibration1>; + nvmem-cell-names =3D "calibration", + "calibration-second-part"; + #thermal-sensor-cells =3D <0>; + }; + sid: efuse@3006000 { compatible =3D "allwinner,sun55i-a523-sid", "allwinner,sun50i-a64-sid"; reg =3D <0x03006000 0x1000>; #address-cells =3D <1>; #size-cells =3D <1>; + + ths_calibration0: ths-calibration0@38 { + reg =3D <0x38 0x8>; + }; + + ths_calibration1: ths-calibration1@44 { + reg =3D <0x44 0x8>; + }; }; =20 gic: interrupt-controller@3400000 { @@ -732,4 +775,115 @@ npu: npu@7122000 { power-domains =3D <&ppu PD_NPU>; }; }; + + thermal-zones { + cpu0_thermal: cpu0-thermal { + polling-delay-passive =3D <100>; + polling-delay =3D <1000>; + thermal-sensors =3D <&ths1 1>; + sustainable-power =3D <1200>; + + trips { + cpu0_threshold: cpu-trip-0 { + temperature =3D <70000>; + type =3D "passive"; + hysteresis =3D <0>; + }; + cpu0_target: cpu-trip-1 { + temperature =3D <90000>; + type =3D "passive"; + hysteresis =3D <0>; + }; + cpu0_critical: cpu-trip-2 { + temperature =3D <110000>; + type =3D "critical"; + hysteresis =3D <0>; + }; + }; + + cooling-maps { + map0 { + trip =3D <&cpu0_target>; + cooling-device =3D <&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 =3D <100>; + polling-delay =3D <1000>; + thermal-sensors =3D <&ths1 0>; + sustainable-power =3D <1600>; + + trips { + cpu4_threshold: cpu-trip-0 { + temperature =3D <70000>; + type =3D "passive"; + hysteresis =3D <0>; + }; + cpu4_target: cpu-trip-1 { + temperature =3D <90000>; + type =3D "passive"; + hysteresis =3D <0>; + }; + cpu4_critical: cpu-trip-2 { + temperature =3D <110000>; + type =3D "critical"; + hysteresis =3D <0>; + }; + }; + + cooling-maps { + map0 { + trip =3D <&cpu4_target>; + cooling-device =3D <&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 =3D <100>; + polling-delay =3D <1000>; + thermal-sensors =3D <&ths1 2>; + sustainable-power =3D <2400>; + + gpu-trips { + gpu_temp_threshold: gpu-trip-0 { + temperature =3D <60000>; + type =3D "passive"; + hysteresis =3D <0>; + }; + gpu_temp_target: gpu-trip-1 { + temperature =3D <90000>; + type =3D "passive"; + hysteresis =3D <0>; + }; + gpu_temp_critical: gpu-trip-2 { + temperature =3D <110000>; + type =3D "critical"; + hysteresis =3D <0>; + }; + }; + }; + + ddr-thermal { + polling-delay-passive =3D <0>; + polling-delay =3D <0>; + thermal-sensors =3D <&ths0>; + + trips { + ddr_temp_critical: ddr-trip-0 { + temperature =3D <110000>; + type =3D "critical"; + hysteresis =3D <0>; + }; + }; + }; + }; }; --=20 2.51.0