From patchwork Sat Aug 10 08:03:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13759443 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10olkn2033.outbound.protection.outlook.com [40.92.42.33]) (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 A6AD934CE5; Sat, 10 Aug 2024 08:03:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.42.33 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723277038; cv=fail; b=SZ4MWGM9dsv83Pm3j/0+nVDKAPtUXg+s9c04xNj4oZikA25LNSVxnhYjpT813y3dtdw7eYvBaspdrLjQd7wcNsLXnI5J6e2GMxu0jc6P4/G7U9kjjlG/c4K7qFNHISKFwmNqBEDMjHsihNW2nTEj97CwkOhLFgeQA9E32xObLF4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723277038; c=relaxed/simple; bh=f5u7/HOWtC3oS9BWDOOz4KxoWLRlqmrS7rql1RDNLSE=; h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version; b=XJE+RTtJ6y5ZZDr/O1UDeDVQj2VyDXE0PmiJ9TnvXcJNhy1P0JSbE10C60j8FDHDA5XwrMaz56zx8pMbIhiH9CgDzpw+sivEGaKK38pdmwgCjGvP5ZFz+HBNVBjhyBFt13K8W1VJoaowOAXaLCOD26oOjqDxHEJJQ1tnAVhSx+A= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com; spf=pass smtp.mailfrom=outlook.com; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b=ExPgPpOw; arc=fail smtp.client-ip=40.92.42.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=outlook.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b="ExPgPpOw" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Qn6bYJo4DDY/gGFfQvSrRdsITQvs8skjGEbwvcQrSNnCJe3oJgTfLgTT4Wqxxx8cIWwI3Gi90QXJnnts38bUTpW9Uwm+h4MKDBXoUKAIRbcNJDuMb+43epSqypKTWJ3hFYIwudatVoFeVJFkfgYmDVU22DtMdICvriT3fNTBSpGuMNgHOw91NfwnDQrzQo+kQnkbxSfH/Tz/HuW33nni5YdkLt+2pQKQaXiSC5EIxLD1peczKZciUR7NeOFJTC1oSpB72Fk+Ldq/EJxa3RmD3Uzey535cFUsOeMEcT8L+axO+HorXTVjhPRXp65ultIdmgMSSDUjnwsweIMx2kDCxg== 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=Mi3Az0JRlQjKq+1wQWxafTGjvrVZazpXaXtVblE35I0=; b=UYnZD0Oj3wMRJHlCX5cQjeqdDuW3AvRtxM8NLC2POMookpti+4iQ5WW1UopD1Si+K89vE4nMIpAvcZR/INQG1ulc+Tr0TLW31515g0UkdxY5dJ4GhJNA+YWeFtSSbfAA6V4j8fieibnhZfYxzy9XmGmlwQrkG2MhYhyergZnLJ769+1MM0KKBjaNG2zrD2cAyyjuyvvjJLDqrm2iViuYi6F4L6o/lW4coUu2OCddvi5uttip7H1QVIFIIuBc2SBPYfk7Hko2qZZghnj5SDE8F5Ifl0dEi95WkFKCAE+XQuI7Hivel7llW40RoXOfjljuCRpqsyuXoYtUQ7ctuFSBaQ== 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=Mi3Az0JRlQjKq+1wQWxafTGjvrVZazpXaXtVblE35I0=; b=ExPgPpOwnbrurTK7djWgV13tvdz8XdX5Dryb17X6KKCy/UAUZyW4bD2tol3mYbhfk532EdRbA/NJc6moaYGVxMPjGryUgjfa1PJFUsPTaf+bk0nF+SjvFW/yJcGp6AhsW8zjwkzl8MynOmH3cZB9vSd4FTqo4JDnDxk2jHKdSDb5as3G5FJsUg7KXKebZcvse4kirdia4qeSzEQwYmPkAEwzhh48G2GRdEQp8p/kcdqepiJis2iTs2HPOgYkpwhOxHO9nmUYOOlWBqOZnmS9hN8cngF80CQ8QBuWeo7vMp5utXDc3oZ1FeflI7kwOzAwD5+pXPhCn3QNbgDVz4wZMA== Received: from IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) by PH7PR20MB5117.namprd20.prod.outlook.com (2603:10b6:510:1b0::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.24; Sat, 10 Aug 2024 08:03:50 +0000 Received: from IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::ab0b:c0d3:1f91:d149]) by IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::ab0b:c0d3:1f91:d149%4]) with mapi id 15.20.7849.015; Sat, 10 Aug 2024 08:03:50 +0000 From: Inochi Amaoto To: Jean Delvare , Guenter Roeck , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen Wang , Inochi Amaoto , Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Guo Ren , Chao Wei , Lad Prabhakar , Drew Fustini , Sunil V L , Hal Feng Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [PATCH v10 0/4] riscv: sophgo: Add SG2042 external hardware monitor support Date: Sat, 10 Aug 2024 16:03:13 +0800 Message-ID: X-Mailer: git-send-email 2.46.0 X-TMN: [fUL1MM2j2DHRk5Sq2Af3uE7/7Ch5OAk7b+ng64cyD6c=] X-ClientProxiedBy: TYCP286CA0154.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:383::19) To IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) X-Microsoft-Original-Message-ID: <20240810080314.382409-1-inochiama@outlook.com> Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR20MB4953:EE_|PH7PR20MB5117:EE_ X-MS-Office365-Filtering-Correlation-Id: 8a649d99-a707-4c97-74bd-08dcb912f831 X-Microsoft-Antispam: BCL:0;ARA:14566002|8060799006|19110799003|15080799003|5072599009|461199028|1602099012|440099028|4302099013|3412199025|1710799026; X-Microsoft-Antispam-Message-Info: niZzoufR1FtIbRAcByuqxhSu52kGc7NGr53bu1N9OlUm2GTL8xpvIIPHC+RcrRGo04v0985rRt/FupH6Z2No50zvoWB9bMGBo8FPwDfXUlCUqxnSrRA23MwkhCsBB3JzaKaADIQW7PrT2IQdyDmeYYp3HMz2ysOKhThBu4wm+xy4dP6qxtyprhNG5VDAzq7PJ5uORazBFke66leW1bWO7HVUiyvb3fvouDGJZJVFokO1iwmUR6RtT1W8HwLfcnO+7n7vrWnd8ZrkJZRKJyC72Kcn99mD/t+zTY3dg/OqrVrgrjbMPZYRAi/N1YE5zXxzLytplV8KFjisUf9EA5ParZaENYQQGPUXcZ+VM9KTV8r14k6wG79+wxI1SQ4bDxZl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4B8OYgcPAMXpYVuZ2UpUIvtlKGnFeUc649V5vgSFeejNhVBn/I9DDY/pBioRoAwTSEKsi3nifq3fH9qyq140kiaPZb+jZWas2SXhIuYTjsqsJyRKhEEforW0+vAPHjLUjoPEX98SQFx0mh4ZWza9MlOg21irIWo0SPV8av1SZ+4S42FHcSN3nUbgm9Rn3aCczKYUqIESwId9NHKf8lSp10iyVXiGXbnVdcYGDf5sbSac2cltgx/CptjMezhjr7GEh1Y4yqQUhriFG2DZDLFvGUf8Pxuz5Okzrmg2ydYuwLB/SJKzLXTilyL4vvxdxqLlo+WmcdrO2EgZIOeaSd7KznnBZX+lGVesYZnwMZbYRzuLuF+0rC6Cm3yyInKULPgLx2yjyKGEnMO8GtdyX/F8UaQ8LhuUMHVwGiFm5Ldb734ub+1PEU+FOmDXTGkZhgnLdstFZWXB5uY+ExdO339iFu+q0A+hsgoom7344HEAlNbWrzyZZousyL9snVVZi+s3vBge7b+uMMOwB7Bj/G/wg1V9ZnLbVmHyIp4wFEbB8EH23bz9Ql8FuMtdB01jlWPZNzu8jGkttr/URzcXUD4QD/bgSbcNDWDj7YdzTFipdEwbjeOn9FESRiUCq5DkHxdpLSQetCuzFtzTrhZBGzL9hsyIbwJeqvDXGVMqCk8+76rrGXLUqSTEcu4fIbtFJxAKI2PKgGc5a8N/2/w6MZymrkYS9wpb X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8a649d99-a707-4c97-74bd-08dcb912f831 X-MS-Exchange-CrossTenant-AuthSource: IA1PR20MB4953.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2024 08:03:50.6542 (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: PH7PR20MB5117 Add support for the onboard hardware monitor for SG2042. Can be tested with OpenSBI v1.5. The patch require the following i2c patch: https://lore.kernel.org/all/IA1PR20MB4953DB82FB7D75BF8409FFF4BBB72@IA1PR20MB4953.namprd20.prod.outlook.com/ Changed from v9: 1. remove missed wrong return value. 2. add documentation for the other interface of the driver. 3. rename repower_action to repower_policy. 4. use break to unify "return 0" in is_visible function. Changed from v8: 1. rename critical_action to repower_action, and add some comment 2. remove unnecessary wrap function 3. use guard macro to simplify mutex process. Changed from v7: 1. add mutex protected and fix the return value when writing "critical_action" Changed from v6: 1. restore the driver name to sg2042-mcu 2. remove unnecessary wrap function and check in the driver. 3. add dts and config entry. Changed from v5: 1. rename driver name to sgmcu as it will support more sophgo chip. 2. move some attr to debugfs. 3. add standard crit_hyst support 4. add documentation Changed from v4: 1. use fix patch for binding ref. 2. use unevaluatedProperties instead of additionalProperties for binding Changed from v3: 1. add thermal-sensor check. 2. change node type from syscon to hwmon Changed from v2: 1. fix bindings id path. Changed from v1: 1. Move patch from soc to hwmon. 2. Fix typo. Inochi Amaoto (4): dt-bindings: hwmon: Add Sophgo SG2042 external hardware monitor support drivers: hwmon: sophgo: Add SG2042 external hardware monitor support riscv: dts: sophgo: Add mcu device for Milk-V Pioneer riscv: defconfig: Enable MCU support for SG2042 .../hwmon/sophgo,sg2042-hwmon-mcu.yaml | 43 ++ Documentation/hwmon/index.rst | 1 + Documentation/hwmon/sg2042-mcu.rst | 77 ++++ .../boot/dts/sophgo/sg2042-milkv-pioneer.dts | 60 +++ arch/riscv/configs/defconfig | 1 + drivers/hwmon/Kconfig | 11 + drivers/hwmon/Makefile | 1 + drivers/hwmon/sg2042-mcu.c | 388 ++++++++++++++++++ 8 files changed, 582 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/sophgo,sg2042-hwmon-mcu.yaml create mode 100644 Documentation/hwmon/sg2042-mcu.rst create mode 100644 drivers/hwmon/sg2042-mcu.c base-commit: d2d190621b60d77496d36659e1621b20c897b25d prerequisite-patch-id: 5e7221ed1c63bb4d68e4a2a0141440e32d29e397 --- 2.46.0