From patchwork Tue Jul 16 09:42:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haylen Chu X-Patchwork-Id: 13734227 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7C7C3C3DA59 for ; Tue, 16 Jul 2024 09:43:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=S0UYr9FVo6gZik4YC7msC2MtowLGDy3b3RRYeitceJM=; b=0ZzyRIQM5kYrFu 1xaEG+4G7pqulZPsYKVggSoGFbjjYDoGJDFQ85Vw5WUY9B8UEdoZqVxbPzds5QyN1XsHE3pA5Fe+2 6PtfQGDUcteT8TB48Vo8oPLP6kxfo6+sOinrhMM1rQRQKr4xTayi4ANNEVBuRRW0VU+Kd0v37P6QC OrjcEDeDhhDm6L4Aom7nfBSG4YvCrUV0TGuEWCQNo/olgnvLQ2G4QjfCMlXbZRiGYFY1+iz3zrdVa Lc//OlnEJwYOvaiWmyU9Q+0l/qX31k4mhxnDdl/AinNHrXxt09NBALqvd1uNAqiuz+R16xVD2wCrD FyC1tfbVvw7/Fc2XZN/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTeiE-00000009v0o-43xJ; Tue, 16 Jul 2024 09:43:10 +0000 Received: from mail-sgaapc01olkn2082f.outbound.protection.outlook.com ([2a01:111:f400:feab::82f] helo=APC01-SG2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTei9-00000009uui-0PMp for linux-riscv@lists.infradead.org; Tue, 16 Jul 2024 09:43:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SmfHeKVT9rd0cmopCHj6eXGs8zC6E4D3PWZUZ21kJqEwERszFDDeeLI9flAunEOkkVU2ed1+KzxjXyUJ4Z5hWurXnuNoykiLM1stvxBYXy8lRC7YhEMHOWkvqC08v5njkQMmT8iiwx+swvOGxSWf83ozPue4YxlMewLYM+Uu6V5h8//Z5LJvJxd0IXYCmA1KqPdkqTki9xnHaUJmwJ0E0XYsok4s4M19VC1krJGGH5T1iH7rv7exDJjJjX2NBgskUxwTnX9XIfvq5vCtSj8V97zRZL2RNPRhRPUP/xK/AUTTJ+Vb5j10uXDMPHik62Fs6V9BYUc+nQf1ksoL0z8MfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hbxh3994dy47RBIvBkHXTKHUnWsOTKtRuj1dxcRmpoo=; b=sgGVnwRPsukO1LXQWVZVIJsY20Gw5V0LxF+VWM6rASzA8lIlIpjBww0Mktab4UlEGtdqAZ/PR2omiTLZWvSy6FkhykjZlLrMO/SoV5VInD5XRJHqtj8c8/TuRtViZMJEOIlDnaK/I2Q5U8cQRO152dtal+S3LnbFX7TS/TVmeF2CbnzLTNOZuiA2qvxaY22fp12Gm8jtY4TF9DbODAe0aRZQBG/cY8JaP448+sWnBSwtj1Ro5tIcnP2w0cF40VxHcQPxzV5bnRX+wWVc+Lk+ceHikKA8WZNjtujIrH8zaj1FQnRmyaRE6pFezbWXizyB1rq7EaPgoBx1quBQvF+d1Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hbxh3994dy47RBIvBkHXTKHUnWsOTKtRuj1dxcRmpoo=; b=CKSzvqjZTYToaibFPfKrL3rrW5DbsTmmlHBI0chDPLmYqj8w2Gpvgxm7gq+NZAg1vGtUcPySKlUijTPfP5s2LJrwQ09UdQQLwyjiTXJKlerAcvYyBwpy/hy7UBLf+6bJ8wbtvYnlt0jjGDEIbZhbt6McVuWvsOKgl7hyQOl5w4WMmEq4f0A+IKeSFCCo3JAFsaeZuKl6rCUfoGKOoxpC/JF6x1RupYqsL2Z/F4aQ6KuNK57/MN9DaCk8TtdnBmknSy/EhGy41y7mS5NVEIaRoeG1EefppNfhaVG1phin5KAlKCVetHChG6Zir5JjoE53BuhRB/MLsv3ZOc/wU9UP3w== Received: from SEYPR01MB4221.apcprd01.prod.exchangelabs.com (2603:1096:101:56::12) by TYZPR01MB4895.apcprd01.prod.exchangelabs.com (2603:1096:400:281::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.28; Tue, 16 Jul 2024 09:42:53 +0000 Received: from SEYPR01MB4221.apcprd01.prod.exchangelabs.com ([fe80::b674:8f70:6e29:3756]) by SEYPR01MB4221.apcprd01.prod.exchangelabs.com ([fe80::b674:8f70:6e29:3756%5]) with mapi id 15.20.7762.027; Tue, 16 Jul 2024 09:42:53 +0000 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 v4 1/3] dt-bindings: thermal: sophgo,cv1800-thermal: Add Sophgo CV1800 thermal Date: Tue, 16 Jul 2024 09:42:33 +0000 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: X-TMN: [1Qn/yyu0Ed40mCrve2gGJ9XcE7GsJTCu] X-ClientProxiedBy: SI2PR04CA0010.apcprd04.prod.outlook.com (2603:1096:4:197::11) To SEYPR01MB4221.apcprd01.prod.exchangelabs.com (2603:1096:101:56::12) X-Microsoft-Original-Message-ID: <20240716094235.51679-1-heylenay@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEYPR01MB4221:EE_|TYZPR01MB4895:EE_ X-MS-Office365-Filtering-Correlation-Id: 1c2c4cc3-c0ca-43f0-5e72-08dca57baa1c X-Microsoft-Antispam: BCL:0;ARA:14566002|8060799006|19110799003|461199028|3412199025|1602099012|4302099013|440099028|1710799026; X-Microsoft-Antispam-Message-Info: V7lr/FDHl8Ec1JTwZZS0PGzY1urQpM3EcR3NmY1uiH9un4Tb9wUalv1xT2EkjUe2L3jBjQAaBl6/Brk8ZQmuyGdmSo6cPf/8vy5LfGsGJahcf0qdSM/ctdvi8IF6WbehMpoQ2X8VFnYGvqKrhNN7GcENijDLQSrpyhfo++5XCiMTpFuX2vvRnZKgy4boorNgiqXfQrHBGOWOMi3jkCXDsxeLZclwvnDr/xV00v50wS8oykMAtFX5gfJdBfKGH5SE1DZ08R5FAPB6K3E5FMw2mEMhcwqxN2g62zZRjS0Wo+cc0bGnYNi1tGF/XDeocbYejua0wnH8r30EQPOqSJukMR70iGDa8fWGi4q4qGgvY83zLsH6TjjpmN76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bWpTYB6mFG6WcDVkjtH6nZkKPVcZDR7gGbyqMdp+QQ/mnjfq2phZzHPlgK0QY1IQR8QHgs7nbm8stMZxYnCbRgdHLR8WpIlTGOw/ds9HuBUeSuhkZtNfRjKcP8LYleLGL7r0hX9jN55AcYETdJ/mLycOrz3wtRr/HCJfMQcpOYdnbrf8EoZu2TZxQHtilnA9MJMPMTmKvIk+YNSr2d6p8ftku7IZvO1XGmmsCVUsKWg9FMZSrFm+P+EKGSEgT3fL8IPiuxYHrnqrURa+sZUgtMN75kiReF9v0ACZWdIRBtaTvm8vLyMrzEyco72O6xrvqZ4XnzKvVWwW5fQruRYKVr80255hRA9HQShb7EnRVS/JM2mKSgRaeiTgiVGfdRVatpAM70pY/Q8yIXf2OQQsSrR0ZBxXOQnO+fDyLYs5NVuPbIP+9krRZTGkIVbeh9ruZxj8rzeu6cgMo+oW5WyYQKgCCaLrVmt+w2xqlQwuHtlP7SP/9XSvMrwCxxg+dJ8Qjaq2ETPoszVZRwEjD3WinFYDYu6THl3V4RDwgLhGzIcUWTBXiOberBm9+lnoK0o8vgnD/VOG9gN3BcNKMWmC+I5YRgTs60P7B95/IfF14eZQGjkOunkDJydB6uBQI7FHibaqXZ9y9Xv8i0cfeh4B5JLujrCa0vN9UIdNc= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1c2c4cc3-c0ca-43f0-5e72-08dca57baa1c X-MS-Exchange-CrossTenant-AuthSource: SEYPR01MB4221.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2024 09:42:53.5973 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR01MB4895 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240716_024305_190719_64D00C49 X-CRM114-Status: GOOD ( 10.00 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add devicetree binding documentation for thermal sensors integrated in Sophgo CV180X SoCs. Signed-off-by: Haylen Chu --- .../thermal/sophgo,cv1800-thermal.yaml | 55 +++++++++++++++++++ 1 file changed, 55 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..58bd4432cd10 --- /dev/null +++ b/Documentation/devicetree/bindings/thermal/sophgo,cv1800-thermal.yaml @@ -0,0 +1,55 @@ +# 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 + +properties: + compatible: + enum: + - sophgo,cv1800-thermal + + reg: + maxItems: 1 + + clocks: + description: The thermal sensor clock + + 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 Tue Jul 16 09:42:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haylen Chu X-Patchwork-Id: 13734228 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9FAD8C3DA60 for ; Tue, 16 Jul 2024 09:43:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sOJ9grWD64EdSyzlgFIr5OfoIzehHWz458/4iUA+I20=; b=Ch3Go48GZeC62d FLjGtf+PkoLpB8uMu0TTJHIM8xKHQj+UOD5RqloHhWEgjyYXt3lbbJahHynMpnQX1p627Ek6Kc1nN NG5lYl6IFLFA3RAX40p6ehCR6VSWUmDBiLwdCrbrHb2pJ4cy39YkapJDjcwGzmKKnvzB6rz2KZkg6 9nrdQclnGvi9zahXFQR33EZtWWrQBu6VTHT07EDBK9MX8Xz7xlIDSQKm+oO+hQwtSJzoskqdOqrxd 0yUsXz/q0pOZqOneXAnz2avI/34SPUzJOJlOI4MFzy6k4frOtYSvtmyKFCVKBMs8h8b3gTQGSEe4f JsPhirxmzDiJXVLR+BHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTeiH-00000009v39-2Wex; Tue, 16 Jul 2024 09:43:13 +0000 Received: from mail-sgaapc01olkn2082f.outbound.protection.outlook.com ([2a01:111:f400:feab::82f] helo=APC01-SG2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTeiB-00000009uui-3dEK for linux-riscv@lists.infradead.org; Tue, 16 Jul 2024 09:43:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YMT+vXmcF4X6phnl4Yb8oAZWaQ7M/SLgTg/AyQA4r7+/lrKnf4NzAb0oJe9OysR53cBehNxLuYT+QfB3twQQ8B67RCEyotcF8akIp+A68lPl4rRdmdN9IBiy0ID6kIFcZG8EkCOMHoPM1DoJ/SnMA7ShiaPrvoOO6IcfPGG69E42k8qASrWYuwVW0cZ56d9CAYt+WcLPaQcUnC8iTEPKpEyPFIRPDcA+10Q9fOSCyLcGu5JBquG985e8pETqkZkhak6l3DeylFzzTgPfqOeW6ontD4yB7OHgAuKLG5kSxYtw08J5xL3FUz7pcE6TxK9xXEyz3VRSTgo4W4Oov1rDSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pcjU6u+xZdT4at50y1D8oO1b1LKeJTwhS0qre43U55w=; b=pvjW6y6PWLdKPN05ZxAu6N8K1z7QzG3UZr/EWieMzUrizkfEP6q6M97LLsA+pudScwJ+KbJiuZd4rRxDj5FEVPbwlOenigIWfIwmnevM3SSXqfH94xTD2xO94n4xnQn2rBFDzQJ/FuNak8mT/gTr/FnDb2djx/VK1UMYELCVRG5tecLcTnfjMcon8NVF6e6K30HbHMMVrID9RLbGcpLHx5Nu3pCAuzNniaNhoYQJqyBndCHQXh3EwYeNE8+krcxEop18rzdMfOCXNgM55CbI1pBHjmXLZlCX2cWonOs0Yq3ahr3ZytOpp1WiVc9oxQ7fwje8kaqzbvaAyDrrDHU5Lg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pcjU6u+xZdT4at50y1D8oO1b1LKeJTwhS0qre43U55w=; b=FSsyH6F41oi8itSNE2BwuGPOKk5bMkX868eMt/1WVRnJS2ejAnLF1cAr+Ab6OAX8sgnlNLb+nkFuvtKXvy7Vz0fNJWoJOhV+UkatDSlc2tRGFADF9IQ41A4a1PswkCcGEDGFGAXzrhAJJsRpInnr/alvX6ZU+Wc8EcUer3r8e5oaxOICbDQaOFAP+IBctHI+F1QR4pgo4pCFxrzD5p+GZVx9tS3d1lLosSQONS3ou/5TETyi4c3pKGg4JFdlQQlI0DbtefJy1mk85YJcvz+RAl1lQ8DnxX9vflc/lxg6NJtqm+sW7g2bUdibwQDw/hXmhHeg6pXoFJDxYX5QOPqfBw== Received: from SEYPR01MB4221.apcprd01.prod.exchangelabs.com (2603:1096:101:56::12) by TYZPR01MB4895.apcprd01.prod.exchangelabs.com (2603:1096:400:281::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.28; Tue, 16 Jul 2024 09:42:59 +0000 Received: from SEYPR01MB4221.apcprd01.prod.exchangelabs.com ([fe80::b674:8f70:6e29:3756]) by SEYPR01MB4221.apcprd01.prod.exchangelabs.com ([fe80::b674:8f70:6e29:3756%5]) with mapi id 15.20.7762.027; Tue, 16 Jul 2024 09:42:59 +0000 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 v4 2/3] riscv: dts: sophgo: cv18xx: Add sensor device and thermal zone Date: Tue, 16 Jul 2024 09:42:34 +0000 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: X-TMN: [Eo9T4eB2h0SntHEZUaT+rg5aja+x/XjK] X-ClientProxiedBy: SI2PR04CA0010.apcprd04.prod.outlook.com (2603:1096:4:197::11) To SEYPR01MB4221.apcprd01.prod.exchangelabs.com (2603:1096:101:56::12) X-Microsoft-Original-Message-ID: <20240716094235.51679-2-heylenay@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEYPR01MB4221:EE_|TYZPR01MB4895:EE_ X-MS-Office365-Filtering-Correlation-Id: 3f41dfd2-29c1-4cc7-6aa7-08dca57bad9e X-Microsoft-Antispam: BCL:0;ARA:14566002|8060799006|19110799003|461199028|3412199025|440099028|1710799026; X-Microsoft-Antispam-Message-Info: pGASelZbKVobZLqUtgYm4Y5s9y+k6YIlQaP7toyXnYbPDrJyU3RiZtgTVdFeSUGcx9FLdCElqOovyfVAu0JSMjBlxqO42DEXA2GMq6UfgDjp22NqRrXJ3ec8ET/N9365kZE1r091TNzQ5w+Gdq+zQmaZv+8K9i4cXNw1DduUNmOiL0JnXDoL2eBc/nyOGvNj45c8HjPP8TeORxwaxQrvXsGamDxI86SKCSlx95Z8HFng0A97agLWEFVNz3Tf2d9n98A2Yd3YizIF3d9QPvtB+nqRLI5Bu0rWPyxFFS5W/2/AW0y0oECYMmAyXQkedaC3rkiez1DsATlXDi3RcHWnP78+JYGOW1gfqecJremXyrNwX3J5tYM4bFCF9gyfC755a8kJThWAM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qr5X1j42S3RHT56gbBLrmCZpyMbl5N8ba0Hip3Q5AqnxNRCwOspXbzOsHuEDfUQO1Kl5ZCWiG9/A8zggr6DJ+BtYWzKO97g3S5Czj1lB5vamQj+JC9FGoq/BKgwPdbIT4N51Zwl8xXRx8bsG+WFCwrZM1ge0GBYaNqTisjfAICjV4LJKW1EVyoDDm6kpX1PLmIZLtK5zUV8d9JW04qjUMPdEDw/MA+YwIx7F0k2at9C7SYb5T7VudOkHvut0W9jj9pS9nLq4Ze7+yV3d35w8i8MdtOkMQfw1W8tixcaU9amSRfpAErO2RqWKfYu+6LueFkFANPdm0gldolxNKerrr7ry0cHIWNKPnE7thhrhCeRqWOcihrAqUmai+A1I1J172fUhe4MdrtqiNKqX4Nc0YyRMTNXQSFhXd0dgyL6eV2D8tS0ejmh6KHjY4xt2mGA4rLOCnAuEVjXtE7/HpdaTGc/7E86fY91/NwrzEGRMYlpniBMC2EP1kIJL7LmW9pjfaCRxIBOAoh/W7sv/hYS0J6ORLpZ7LlBCOgL7PLVzi/u8= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f41dfd2-29c1-4cc7-6aa7-08dca57bad9e X-MS-Exchange-CrossTenant-AuthSource: SEYPR01MB4221.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2024 09:42:59.4496 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR01MB4895 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240716_024307_963678_5B7A9FE1 X-CRM114-Status: UNSURE ( 7.98 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add common sensor device Sophgo CV18xx SoCs and thermal zone for CV1800b SoCs. Signed-off-by: Haylen Chu --- arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 30 +++++++++++++++++++++++++ arch/riscv/boot/dts/sophgo/cv18xx.dtsi | 8 +++++++ 2 files changed, 38 insertions(+) diff --git a/arch/riscv/boot/dts/sophgo/cv1800b.dtsi b/arch/riscv/boot/dts/sophgo/cv1800b.dtsi index ec9530972ae2..0b5c7bc94b05 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 { @@ -25,3 +53,5 @@ &clint { &clk { compatible = "sophgo,cv1800-clk"; }; + + diff --git a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi index 891932ae470f..76b02cc279aa 100644 --- a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi +++ b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi @@ -310,5 +310,13 @@ clint: timer@74000000 { reg = <0x74000000 0x10000>; interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>; }; + + 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>; + }; }; }; From patchwork Tue Jul 16 09:42:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haylen Chu X-Patchwork-Id: 13734229 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D82CEC3DA59 for ; Tue, 16 Jul 2024 09:43:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=l+j3INqkLnB1nJEElubFkf0DpAdo1eoh4Q0Kp4LXRZo=; b=371Rdsyki/Vg4u mCRzYeHJiZzO5X4n3DqV4u2lGDILOS3YsBbyJC76u/2aPIzyUE7wICpHLLRBst9yw2OaDwquJt+Zu 68OkZPPqv+Q0/OIRwTv5zjfFpDj0G7UuEaUoKYU8AEb9FNbr22xR7bfqB7caA+nfYtytJScyCeext jJlmGnaZ3qfoO+QTXVGbJbSXEPoMndzeUf/QcakPxQ3ZJ/b9zNnLNYj1hLdMRO0+3tBEkWahQOb20 IoUAuRvTb+5atRq+frJ16aZKTXciPpN3wkveuUOKJGgQ4bJq0rflgjNGpQJeuf1kYkzv1qP4IwzjB vycUovvzAqNhV6npSkZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTeiK-00000009v4c-0eZI; Tue, 16 Jul 2024 09:43:16 +0000 Received: from mail-sgaapc01olkn2082f.outbound.protection.outlook.com ([2a01:111:f400:feab::82f] helo=APC01-SG2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTeiE-00000009uui-3q0T for linux-riscv@lists.infradead.org; Tue, 16 Jul 2024 09:43:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GOswFl/IjCnmjH2pOa5hCl/p2TgKTJYp6PdXAKxAS4YOk8bEMfYZ2NavYM0wlpK9MZWdhbExMOroUxroqHbJce2vy5N9pc+AHihITy/YSZ6HpJznJ76AgOO01dTn69szqXUGy5wAYFYXBOZt5Qf3Y9kH5Bdd0bEEbbHYAP9zqcgP6xrGI/HZEXwXPd62niFwbh/UwXtA/ROBi8WlfjgI/61Z89aDt1dsDBnf9HiLcGX2T1TdysiwHNw0NSC6uqp5M4j9Lfn8vGLSkqxTj2+OGuOPfHXMuCMgkqjYoSUM+KjklZ3yCbTqim2LtWH8Z+NwL2GxTKepb9BoX8CezKOiWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9Ef6FeKpd+W0xLDHpsy/nlPMTEKbeiNL67hnB653Z6k=; b=cnhCqSbqi5BOlR/5kpgaaBh5kUxzU1cCJiE7tQaWgauPuvFVAuOp00dKlMXF8IjJ3C6UTeL7pJ2V1hAte3xq0X1tb1L5J/pGaQfOiCLKD5xV2fs2MjJzZK8LJkNIotdrrbzMiokZdPv80h5E5mgVg4XYx6pCd3OBwYKEGk8RKus+Z4EeJcM+aSDk1nvoTgSg90ENnFy+qKg25dFK2vNo0lqXlrX6KOwg2vnJUWdLyCH6azyhj+XolhgD9REC5TZBP3pvpT+IsSe3d9A+E+j1Dqzitc6ACY+KeLOxKyim5CZq3D6Vf2Y4vGQomCiRGW25NoYfMpddLa0xikEV5PnBgQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9Ef6FeKpd+W0xLDHpsy/nlPMTEKbeiNL67hnB653Z6k=; b=dM9XjJ+KPnO5K55j6YnK/ZXj0qf8jBTskoNw/er66S7oSvrPRwEViIwG9SjxO/dyMSwMmovVm5ZsSWblIswZEY7Dlv91eigBCjru5lcNIGUTy8cxXhDPBlVXZ3u+zgWqA7dgEQmWkgVM+zqMYU8paA4fw9GOefMq/huRQa/kNNaZkIukjqhZckWoDaCXKI/VDbnXc9MU2sL//qyAT803xLE/g2u+rvlHEDCnMP+kzrpnAx8YBDekr8HnYRjl60sAl/ewCGJO+Uu7NlkTq28vzywggGjkHdcx6uVq7K3sxTqpeA15w7PpXFWgYKoZK5+hfqGfnteUa9bHm5VIPFo2sg== Received: from SEYPR01MB4221.apcprd01.prod.exchangelabs.com (2603:1096:101:56::12) by TYZPR01MB4895.apcprd01.prod.exchangelabs.com (2603:1096:400:281::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.28; Tue, 16 Jul 2024 09:43:03 +0000 Received: from SEYPR01MB4221.apcprd01.prod.exchangelabs.com ([fe80::b674:8f70:6e29:3756]) by SEYPR01MB4221.apcprd01.prod.exchangelabs.com ([fe80::b674:8f70:6e29:3756%5]) with mapi id 15.20.7762.027; Tue, 16 Jul 2024 09:43:03 +0000 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 v4 3/3] thermal: cv180x: Add cv180x thermal driver support Date: Tue, 16 Jul 2024 09:42:35 +0000 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: X-TMN: [dpfur8txUxkJLfBUTN3M8cdWVTStQeJQ] X-ClientProxiedBy: SI2PR04CA0010.apcprd04.prod.outlook.com (2603:1096:4:197::11) To SEYPR01MB4221.apcprd01.prod.exchangelabs.com (2603:1096:101:56::12) X-Microsoft-Original-Message-ID: <20240716094235.51679-3-heylenay@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEYPR01MB4221:EE_|TYZPR01MB4895:EE_ X-MS-Office365-Filtering-Correlation-Id: 42def73b-3d69-4496-33a7-08dca57bb025 X-Microsoft-Antispam: BCL:0;ARA:14566002|8060799006|19110799003|461199028|3412199025|440099028|1710799026; X-Microsoft-Antispam-Message-Info: 9itgIIYiy59aJbOVoXRnrXPv0V4mDlHbvptjNQcae4kbIKpth+Z3iwffbDGxxfaG0lnSmD9jmdNdDSvhIzTQuZcrD61+gfqahh7V1BFoIfp4ckc+CTRQ+Au/JA3CaywgwA9sfIpfqhzlKZizzb9BAd3DP0lyeKp435XcSP5aQa6E6HZxdUy2ZO9rmDO0TOXmykbH8Z0Zu5FZlAxaSKzv1TYBy78qkBwIOadeecqK/L+K1mAf/ALxC+k+5yAGjZC2lAgFZUb8qFVSVMVt1p6dZGM+gJpr82Zt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hce2hk5bvJROoapds50HHZxri+Q9Lt0C193d3yB26cAVwnhFg8J6xtVFpYcWi1JycRkRdZt6aD0nofdfjlfgK+HLO6154x4SMib47lOmmVO5bDMK/31jpsuiPlxM07gNdnzFcs/JSc7+Fz30qAZPzoqj8k8HeP3K4oxUj5GKv7K8PX1QgbqeSSnpFBBaVLv3WHr7HYeR+laqrH5hEwPJlnnxgSxZJ/d+xanYPIXJfDSiqSED+dcNNT45MAfl2BnQhUSiGFKv5mv7N1DK4rFGbeqo3Z2hkRk8tvkkgAZSRDoWtyeJJ19dElDypDXX8XCKLqFnMdbWlO5EnP1egtBimHTViYCQP0NL0yXi6rCYMcFZm6xlcvNCcK6fuH4JuHxLuXjWxR88RZVvBxtBm+ZYjkTvSmrnehkyZjvCzS6rdJItg4TEj1iRkw96rsxZs7DB+wifjjkO/VP7yZIs2JckpWig15Ss7QLAV3WKJomxf3WpQ/hLAlig9otm2rF3t06cQVuQO+VUPXvUNUNG3eI64Qo2CQd9nmsA83BaZpboogAWADBJXXRcreAQH9I1EcZHFQp7A89lNSkrwkUyFvRlE8DosXtWOkNbp6IfTFJMLTGRnsd/MjA9AgKyWqIbSFxsyjmNwbJ0dh1whZd/YE= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 42def73b-3d69-4496-33a7-08dca57bb025 X-MS-Exchange-CrossTenant-AuthSource: SEYPR01MB4221.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2024 09:43:03.6885 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR01MB4895 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240716_024311_149818_186F6777 X-CRM114-Status: GOOD ( 19.46 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add support for cv180x SoCs integrated thermal sensors. Signed-off-by: Haylen Chu --- drivers/thermal/Kconfig | 6 + drivers/thermal/Makefile | 1 + drivers/thermal/cv180x_thermal.c | 241 +++++++++++++++++++++++++++++++ 3 files changed, 248 insertions(+) create mode 100644 drivers/thermal/cv180x_thermal.c diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index 204ed89a3ec9..f53c973a361d 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -514,4 +514,10 @@ config LOONGSON2_THERMAL is higher than the high temperature threshold or lower than the low temperature threshold, the interrupt will occur. +config CV180X_THERMAL + tristate "Temperature sensor driver for Sophgo CV180X" + help + If you say yes here you get support for thermal sensor integrated in + Sophgo CV180X SoCs. + endif diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile index 5cdf7d68687f..5b59bde8a579 100644 --- a/drivers/thermal/Makefile +++ b/drivers/thermal/Makefile @@ -65,3 +65,4 @@ obj-$(CONFIG_AMLOGIC_THERMAL) += amlogic_thermal.o obj-$(CONFIG_SPRD_THERMAL) += sprd_thermal.o obj-$(CONFIG_KHADAS_MCU_FAN_THERMAL) += khadas_mcu_fan.o obj-$(CONFIG_LOONGSON2_THERMAL) += loongson2_thermal.o +obj-$(CONFIG_CV180X_THERMAL) += cv180x_thermal.o diff --git a/drivers/thermal/cv180x_thermal.c b/drivers/thermal/cv180x_thermal.c new file mode 100644 index 000000000000..8b726c0ad848 --- /dev/null +++ b/drivers/thermal/cv180x_thermal.c @@ -0,0 +1,241 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2021 Sophgo Inc. + * Copyright (C) 2024 Haylen Chu + */ + +#include +#include +#include +#include +#include +#include +#include + +#define TEMPSEN_VERSION 0x0 +#define TEMPSEN_CTRL 0x4 +#define TEMPSEN_CTRL_EN BIT(0) +#define TEMPSEN_CTRL_SEL_MASK GENMASK(7, 4) +#define TEMPSEN_CTRL_SEL_OFFSET 4 +#define TEMPSEN_STATUS 0x8 +#define TEMPSEN_SET 0xc +#define TEMPSEN_SET_CHOPSEL_MASK GENMASK(5, 4) +#define TEMPSEN_SET_CHOPSEL_OFFSET 4 +#define TEMPSEN_SET_CHOPSEL_128T 0 +#define TEMPSEN_SET_CHOPSEL_256T 1 +#define TEMPSEN_SET_CHOPSEL_512T 2 +#define TEMPSEN_SET_CHOPSEL_1024T 3 +#define TEMPSEN_SET_ACCSEL_MASK GENMASK(7, 6) +#define TEMPSEN_SET_ACCSEL_OFFSET 6 +#define TEMPSEN_SET_ACCSEL_512T 0 +#define TEMPSEN_SET_ACCSEL_1024T 1 +#define TEMPSEN_SET_ACCSEL_2048T 2 +#define TEMPSEN_SET_ACCSEL_4096T 3 +#define TEMPSEN_SET_CYC_CLKDIV_MASK GENMASK(15, 8) +#define TEMPSEN_SET_CYC_CLKDIV_OFFSET 8 +#define TEMPSEN_INTR_EN 0x10 +#define TEMPSEN_INTR_CLR 0x14 +#define TEMPSEN_INTR_STA 0x18 +#define TEMPSEN_INTR_RAW 0x1c +#define TEMPSEN_RESULT(n) (0x20 + (n) * 4) +#define TEMPSEN_RESULT_RESULT_MASK GENMASK(12, 0) +#define TEMPSEN_RESULT_MAX_RESULT_MASK GENMASK(28, 16) +#define TEMPSEN_RESULT_CLR_MAX_RESULT BIT(31) +#define TEMPSEN_AUTO_PERIOD 0x64 +#define TEMPSEN_AUTO_PERIOD_AUTO_CYCLE_MASK GENMASK(23, 0) +#define TEMPSEN_AUTO_PERIOD_AUTO_CYCLE_OFFSET 0 + +struct cv180x_thermal_zone { + struct device *dev; + void __iomem *base; + struct clk *clk_tempsen; + u32 sample_cycle; +}; + +static void cv180x_thermal_init(struct cv180x_thermal_zone *ctz) +{ + void __iomem *base = ctz->base; + u32 regval; + + writel(readl(base + TEMPSEN_INTR_RAW), base + TEMPSEN_INTR_CLR); + writel(TEMPSEN_RESULT_CLR_MAX_RESULT, base + TEMPSEN_RESULT(0)); + + regval = readl(base + TEMPSEN_SET); + regval &= ~TEMPSEN_SET_CHOPSEL_MASK; + regval &= ~TEMPSEN_SET_ACCSEL_MASK; + regval &= ~TEMPSEN_SET_CYC_CLKDIV_MASK; + regval |= TEMPSEN_SET_CHOPSEL_1024T << TEMPSEN_SET_CHOPSEL_OFFSET; + regval |= TEMPSEN_SET_ACCSEL_2048T << TEMPSEN_SET_ACCSEL_OFFSET; + regval |= 0x31 << TEMPSEN_SET_CYC_CLKDIV_OFFSET; + writel(regval, base + TEMPSEN_SET); + + regval = readl(base + TEMPSEN_AUTO_PERIOD); + regval &= ~TEMPSEN_AUTO_PERIOD_AUTO_CYCLE_MASK; + regval |= ctz->sample_cycle << TEMPSEN_AUTO_PERIOD_AUTO_CYCLE_OFFSET; + writel(regval, base + TEMPSEN_AUTO_PERIOD); + + regval = readl(base + TEMPSEN_CTRL); + regval &= ~TEMPSEN_CTRL_SEL_MASK; + regval |= 1 << TEMPSEN_CTRL_SEL_OFFSET; + regval |= TEMPSEN_CTRL_EN; + writel(regval, base + TEMPSEN_CTRL); +} + +static void cv180x_thermal_deinit(struct cv180x_thermal_zone *ct) +{ + void __iomem *base = ct->base; + u32 regval; + + regval = readl(base + TEMPSEN_CTRL); + regval &= ~(TEMPSEN_CTRL_SEL_MASK | TEMPSEN_CTRL_EN); + writel(regval, base + TEMPSEN_CTRL); + + writel(readl(base + TEMPSEN_INTR_RAW), base + TEMPSEN_INTR_CLR); +} + +/* + * Raw register value to temperature (mC) formula: + * + * read_val * 1000 * 716 + * Temperature = ----------------------- - 273000 + * divider + * + * where divider should be ticks number of accumulation period, + * e.g. 2048 for TEMPSEN_CTRL_ACCSEL_2048T + */ +static int cv180x_calc_temp(struct cv180x_thermal_zone *ctz, u32 result) +{ + return (result * 1000) * 716 / 2048 - 273000; +} + +static int cv180x_get_temp(struct thermal_zone_device *tdev, int *temperature) +{ + struct cv180x_thermal_zone *ctz = thermal_zone_device_priv(tdev); + void __iomem *base = ctz->base; + u32 result; + + result = readl(base + TEMPSEN_RESULT(0)) & TEMPSEN_RESULT_RESULT_MASK; + *temperature = cv180x_calc_temp(ctz, result); + + return 0; +} + +static const struct thermal_zone_device_ops cv180x_thermal_ops = { + .get_temp = cv180x_get_temp, +}; + +static const struct of_device_id cv180x_thermal_of_match[] = { + { .compatible = "sophgo,cv1800-thermal" }, + {}, +}; +MODULE_DEVICE_TABLE(of, cv180x_thermal_of_match); + +static int +cv180x_parse_dt(struct cv180x_thermal_zone *ctz) +{ + struct device_node *np = ctz->dev->of_node; + u32 tmp; + + if (of_property_read_u32(np, "sample-rate-hz", &tmp)) { + ctz->sample_cycle = 1000000; + } else { + /* sample cycle should be at least 524us */ + if (tmp > 1000000 / 524) { + dev_err(ctz->dev, "invalid sample rate %d\n", tmp); + return -EINVAL; + } + + ctz->sample_cycle = 1000000 / tmp; + } + + return 0; +} + +static int cv180x_thermal_probe(struct platform_device *pdev) +{ + struct cv180x_thermal_zone *ctz; + struct thermal_zone_device *tz; + struct resource *res; + int ret; + + ctz = devm_kzalloc(&pdev->dev, sizeof(*ctz), GFP_KERNEL); + if (!ctz) + return -ENOMEM; + + ctz->dev = &pdev->dev; + + ret = cv180x_parse_dt(ctz); + if (ret) + return dev_err_probe(&pdev->dev, ret, "failed to parse dt\n"); + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + ctz->base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(ctz->base)) + return dev_err_probe(&pdev->dev, PTR_ERR(ctz->base), + "failed to map tempsen registers\n"); + + ctz->clk_tempsen = devm_clk_get_enabled(&pdev->dev, NULL); + if (IS_ERR(ctz->clk_tempsen)) + return dev_err_probe(&pdev->dev, PTR_ERR(ctz->clk_tempsen), + "failed to get clk_tempsen\n"); + + cv180x_thermal_init(ctz); + + tz = devm_thermal_of_zone_register(&pdev->dev, 0, ctz, + &cv180x_thermal_ops); + if (IS_ERR(tz)) + return dev_err_probe(&pdev->dev, PTR_ERR(tz), + "failed to register thermal zone\n"); + + platform_set_drvdata(pdev, ctz); + + return 0; +} + +static int cv180x_thermal_remove(struct platform_device *pdev) +{ + struct cv180x_thermal_zone *ctz = platform_get_drvdata(pdev); + + cv180x_thermal_deinit(ctz); + + return 0; +} + +static int __maybe_unused cv180x_thermal_suspend(struct device *dev) +{ + struct cv180x_thermal_zone *ctz = dev_get_drvdata(dev); + + cv180x_thermal_deinit(ctz); + clk_disable_unprepare(ctz->clk_tempsen); + + return 0; +} + +static int __maybe_unused cv180x_thermal_resume(struct device *dev) +{ + struct cv180x_thermal_zone *ctz = dev_get_drvdata(dev); + + clk_prepare_enable(ctz->clk_tempsen); + cv180x_thermal_init(ctz); + + return 0; +} + +static SIMPLE_DEV_PM_OPS(cv180x_thermal_pm_ops, + cv180x_thermal_suspend, cv180x_thermal_resume); + +static struct platform_driver cv180x_thermal_driver = { + .probe = cv180x_thermal_probe, + .remove = cv180x_thermal_remove, + .driver = { + .name = "cv180x-thermal", + .pm = &cv180x_thermal_pm_ops, + .of_match_table = cv180x_thermal_of_match, + }, +}; + +module_platform_driver(cv180x_thermal_driver); + +MODULE_DESCRIPTION("Sophgo CV180x thermal driver"); +MODULE_AUTHOR("Haylen Chu "); +MODULE_LICENSE("GPL");