From patchwork Mon Oct 14 07:38:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haylen Chu X-Patchwork-Id: 835355 Received: from bayard.4d2.org (bayard.4d2.org [5.78.89.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D46221384BF; Mon, 14 Oct 2024 07:58:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=5.78.89.93 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728892698; cv=none; b=JcnnF1UL/62RyhvyqHWaltg04vC5s8ULPu8Dv0qvEwPgldokwBKCGajZWb++BbJELIVNK7l+qnKAGD/NnpKLBXM23M2UFanOonmzNuBCapeC4+BzETZCclGKMlSpKPWiXjtBmFZX065pLiLoROr4uPS960Ig/ae52GVuvmjwnoo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728892698; c=relaxed/simple; bh=lPoc6pym9DSYQLknNxVyoHOgF8wwG7bJWhc07t4BUfA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dI0zWUCc91HEMMcFg63kIi1eITAhAMQP2zStEla0cWBmw9e+K8A0iaI7xmT1EBCdu4xFywC23FDdTvog9DUmAN+1RQo1EL/OWao9PZXmvOOdBY1X2tDKf7dLJa2Kggqv5vCaTv/WRAbB3AcVLN/ObO8S3/3umLCawOTKGosrmHs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=4d2.org; spf=pass smtp.mailfrom=4d2.org; dkim=pass (2048-bit key) header.d=4d2.org header.i=@4d2.org header.b=XNBqLfi7; dkim=pass (2048-bit key) header.d=4d2.org header.i=@4d2.org header.b=hGGDTu8O; arc=none smtp.client-ip=5.78.89.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=4d2.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=4d2.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=4d2.org header.i=@4d2.org header.b="XNBqLfi7"; dkim=pass (2048-bit key) header.d=4d2.org header.i=@4d2.org header.b="hGGDTu8O" Received: from bayard.4d2.org (bayard.4d2.org [127.0.0.1]) by bayard.4d2.org (Postfix) with ESMTP id 73092122FE26; Mon, 14 Oct 2024 00:38:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=4d2.org; s=mail; t=1728891525; bh=lPoc6pym9DSYQLknNxVyoHOgF8wwG7bJWhc07t4BUfA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XNBqLfi7Mg3aScFk8JnEbvZBA21HfmeOGJM6Y7VVpBkau4Nhui0v5Ua2g7KT2t02y MVNcJRLyiXuieb6NzLCgivi23CbCY1Dg+e+FWou+Wr05NGsVh03ghJpV62+srEXtcy YzCkE20l18zZ7KZe+G0zvLYOMtzt3PsiR52HBDG6fArE1wJrGdsQ3+mko9tdnDgChj lwMg/uL2YBdvRDfjwE/oadRfc/CQ/fqXsRR46QiEAY1jq0/afUKW0X1UAGI+qwU6/V iZnqWI8//h8XfyFtFohVS8kLBXC7M/0ahs1LvUov4iKHXGb5IkjDIDKtrf7kR1y8O8 fVOBrP4+C6EdA== X-Virus-Scanned: amavisd-new at 4d2.org Authentication-Results: bayard.4d2.org (amavisd-new); dkim=pass (2048-bit key) header.d=4d2.org Received: from bayard.4d2.org ([127.0.0.1]) by bayard.4d2.org (bayard.4d2.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7A1VF3tOUE2e; Mon, 14 Oct 2024 00:38:43 -0700 (PDT) Received: from localhost.localdomain (unknown [110.52.220.241]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) (Authenticated sender: heylenay@4d2.org) by bayard.4d2.org (Postfix) with ESMTPSA id 43A51122FE21; Mon, 14 Oct 2024 00:38:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=4d2.org; s=mail; t=1728891523; bh=lPoc6pym9DSYQLknNxVyoHOgF8wwG7bJWhc07t4BUfA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hGGDTu8OZMFmxGIKeJkuFmaktpuekIOPExp+WOYDAz88vgV8YsjRJ8UFgUI0Y1zsD 9GAZS58elqBBYecsSMI8iL/Aih6VvReW3q9jnb6DO2AyNLwhcNUlGXVxNg0d/XjlPg mYoofXAGXxksWZu9f0sFMvF5xW8JtAg9SseNAbvL7/PREq53RPXrwTD153yKaT3+u+ Sv7tv2DRRQR+WwZYVE2tLgNXh1i2/zdTxi4tfPZtf5v9ry8fjGjsuUDxhp9zuPwpoV uvPrWQv+xkfsvsRHXMa4xAWZa06yDwca9rxngnapls3Cp1lLihAa9A/bxr6NIS/ZN3 G1OBCpguG8UDg== From: Haylen Chu To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen Wang , Inochi Amaoto , Paul Walmsley , Palmer Dabbelt , Albert Ou , Jisheng Zhang Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Haylen Chu Subject: [PATCH v5 1/3] dt-bindings: thermal: sophgo,cv1800-thermal: Add Sophgo CV1800 thermal Date: Mon, 14 Oct 2024 07:38:11 +0000 Message-ID: <20241014073813.23984-2-heylenay@4d2.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241014073813.23984-1-heylenay@4d2.org> References: <20241014073813.23984-1-heylenay@4d2.org> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add devicetree binding documentation for thermal sensors integrated in Sophgo CV1800 SoCs. Signed-off-by: Haylen Chu --- .../thermal/sophgo,cv1800-thermal.yaml | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/sophgo,cv1800-thermal.yaml diff --git a/Documentation/devicetree/bindings/thermal/sophgo,cv1800-thermal.yaml b/Documentation/devicetree/bindings/thermal/sophgo,cv1800-thermal.yaml new file mode 100644 index 000000000000..14abeb7a272a --- /dev/null +++ b/Documentation/devicetree/bindings/thermal/sophgo,cv1800-thermal.yaml @@ -0,0 +1,57 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/thermal/sophgo,cv1800-thermal.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Sophgo CV1800 on-SoC Thermal Sensor + +maintainers: + - Haylen Chu + +description: Sophgo CV1800 on-SoC thermal sensor + +$ref: thermal-sensor.yaml# + +properties: + compatible: + enum: + - sophgo,cv1800-thermal + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + interrupts: + maxItems: 1 + + sample-rate-hz: + minimum: 1 + maximum: 1908 + default: 1 + + '#thermal-sensor-cells': + const: 0 + +required: + - compatible + - reg + - clocks + - interrupts + +additionalProperties: false + +examples: + - | + #include + #include + thermal-sensor@30e0000 { + compatible = "sophgo,cv1800-thermal"; + reg = <0x30e0000 0x100>; + clocks = <&clk CLK_TEMPSEN>; + interrupts = <16 IRQ_TYPE_LEVEL_HIGH>; + #thermal-sensor-cells = <0>; + }; +... From patchwork Mon Oct 14 07:38:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haylen Chu X-Patchwork-Id: 835356 Received: from bayard.4d2.org (bayard.4d2.org [5.78.89.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2697614AD24; Mon, 14 Oct 2024 07:38:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=5.78.89.93 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728891535; cv=none; b=k2xaDxd5znPzU42mHnM7coR4QkcD0D/8O7EQ38xhciVuqmVICZFU3Udmixo4vso67Coka8sloWpq4SnykJpUJtG1iieTs4ZwcCrCBCW9JS4muQLKyjVsqpJ8+27ISACppa6B+WzGZyV3TiVIblwGnrcka0jzr0yJyUjaCFI9Lws= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728891535; c=relaxed/simple; bh=DwDhlRnfpNqUwydKjC1DfKRcf6/WtjZO99jAwo/5zu0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k4glcYkD25WhJ3aQB3pYDULzFH0rNPZxcb1BYuVGVGCAvKMrguX8fIsTbqD5KQ3Nd+U4BcrYR9HFL65Ax7kizjBWSmk9d6TRXue03tazqX59eS42LRakhhJxOSiyzXt8grjKKnQ5LuxCiOmccqHEM/0Q9LUDbQ2xq4e95vP5Fa0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=4d2.org; spf=pass smtp.mailfrom=4d2.org; dkim=pass (2048-bit key) header.d=4d2.org header.i=@4d2.org header.b=y1916qdS; dkim=pass (2048-bit key) header.d=4d2.org header.i=@4d2.org header.b=y1916qdS; arc=none smtp.client-ip=5.78.89.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=4d2.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=4d2.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=4d2.org header.i=@4d2.org header.b="y1916qdS"; dkim=pass (2048-bit key) header.d=4d2.org header.i=@4d2.org header.b="y1916qdS" Received: from bayard.4d2.org (bayard.4d2.org [127.0.0.1]) by bayard.4d2.org (Postfix) with ESMTP id D1357122FE1E; Mon, 14 Oct 2024 00:38:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=4d2.org; s=mail; t=1728891533; bh=DwDhlRnfpNqUwydKjC1DfKRcf6/WtjZO99jAwo/5zu0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y1916qdSUQSOFUWoMsWsKiK+hPQ9abzy46MMb+1BK7HiIzjV+YkPmX0kMXsCMN4oZ nt55DEO0RHjD4Y5yzgnYGjj/1rgOBu1x2dgvVouuuPVYAJeVaNB9/16fxzCYq9DuKX tXumTql/PSWyIllPnLqHSDm3U+JdJ55N4mENBoYNFfswHEPmsw57vIDA+kz0vuwhG7 Mu+vVjVk+YIj+nddSMQHtKwNy4rKrgIeyp18Yd5AFea4mGmgTKRDxRrur/mbT73sDV KwftQJFPGnFE71ByhL6yc4+DnOaAVpTHUi00X6YPpUUEhcMOtp31BxULUMs76mnkDH ROQ3gXcYYLYQw== X-Virus-Scanned: amavisd-new at 4d2.org Authentication-Results: bayard.4d2.org (amavisd-new); dkim=pass (2048-bit key) header.d=4d2.org Received: from bayard.4d2.org ([127.0.0.1]) by bayard.4d2.org (bayard.4d2.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bJZxxpwYIaA4; Mon, 14 Oct 2024 00:38:53 -0700 (PDT) Received: from localhost.localdomain (unknown [110.52.220.241]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) (Authenticated sender: heylenay@4d2.org) by bayard.4d2.org (Postfix) with ESMTPSA id 1679B122FE21; Mon, 14 Oct 2024 00:38:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=4d2.org; s=mail; t=1728891533; bh=DwDhlRnfpNqUwydKjC1DfKRcf6/WtjZO99jAwo/5zu0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y1916qdSUQSOFUWoMsWsKiK+hPQ9abzy46MMb+1BK7HiIzjV+YkPmX0kMXsCMN4oZ nt55DEO0RHjD4Y5yzgnYGjj/1rgOBu1x2dgvVouuuPVYAJeVaNB9/16fxzCYq9DuKX tXumTql/PSWyIllPnLqHSDm3U+JdJ55N4mENBoYNFfswHEPmsw57vIDA+kz0vuwhG7 Mu+vVjVk+YIj+nddSMQHtKwNy4rKrgIeyp18Yd5AFea4mGmgTKRDxRrur/mbT73sDV KwftQJFPGnFE71ByhL6yc4+DnOaAVpTHUi00X6YPpUUEhcMOtp31BxULUMs76mnkDH ROQ3gXcYYLYQw== From: Haylen Chu To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen Wang , Inochi Amaoto , Paul Walmsley , Palmer Dabbelt , Albert Ou , Jisheng Zhang Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Haylen Chu Subject: [PATCH v5 3/3] riscv: dts: sophgo: cv18xx: Add sensor device and thermal zone Date: Mon, 14 Oct 2024 07:38:13 +0000 Message-ID: <20241014073813.23984-4-heylenay@4d2.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241014073813.23984-1-heylenay@4d2.org> References: <20241014073813.23984-1-heylenay@4d2.org> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add common sensor device for Sophgo CV18xx SoCs and thermal zone for CV1800b SoC. Signed-off-by: Haylen Chu --- arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 28 +++++++++++++++++++++++++ arch/riscv/boot/dts/sophgo/cv18xx.dtsi | 8 +++++++ 2 files changed, 36 insertions(+) diff --git a/arch/riscv/boot/dts/sophgo/cv1800b.dtsi b/arch/riscv/boot/dts/sophgo/cv1800b.dtsi index ec9530972ae2..af53c9ec3197 100644 --- a/arch/riscv/boot/dts/sophgo/cv1800b.dtsi +++ b/arch/riscv/boot/dts/sophgo/cv1800b.dtsi @@ -12,6 +12,34 @@ memory@80000000 { device_type = "memory"; reg = <0x80000000 0x4000000>; }; + + thermal-zones { + soc-thermal { + polling-delay-passive = <1000>; + polling-delay = <1000>; + thermal-sensors = <&soc_temp>; + + trips { + soc_passive: soc-passive { + temperature = <75000>; + hysteresis = <5000>; + type = "passive"; + }; + + soc_hot: soc-hot { + temperature = <85000>; + hysteresis = <5000>; + type = "hot"; + }; + + soc_critical: soc-critical { + temperature = <100000>; + hysteresis = <0>; + type = "critical"; + }; + }; + }; + }; }; &plic { diff --git a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi index b724fb6d9689..0465561f7043 100644 --- a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi +++ b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi @@ -133,6 +133,14 @@ portd: gpio-controller@0 { }; }; + soc_temp: thermal-sensor@30e0000 { + compatible = "sophgo,cv1800-thermal"; + reg = <0x30e0000 0x100>; + clocks = <&clk CLK_TEMPSEN>; + interrupts = <16 IRQ_TYPE_LEVEL_HIGH>; + #thermal-sensor-cells = <0>; + }; + i2c0: i2c@4000000 { compatible = "snps,designware-i2c"; reg = <0x04000000 0x10000>;