From patchwork Tue Jul 13 06:00:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quan Nguyen X-Patchwork-Id: 12372823 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95FD1C11F66 for ; Tue, 13 Jul 2021 06:01:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 75D8D61279 for ; Tue, 13 Jul 2021 06:01:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233741AbhGMGD4 (ORCPT ); Tue, 13 Jul 2021 02:03:56 -0400 Received: from mail-dm6nam08on2096.outbound.protection.outlook.com ([40.107.102.96]:14848 "EHLO NAM04-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233638AbhGMGDz (ORCPT ); Tue, 13 Jul 2021 02:03:55 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V/R7IpzZ/FYJLRLHuoHzvDVwbT0ZPX1BF5PftosbUJwgP/1GLmSiEptVNFlWti4WyTzZNj7379zHBcfzW/Qev8CNUlj4EZOVXSS1MQXhE+C1QNABXmsLwcg7h5ZVTfssbTnQbTTzzaX7Tce7nlxs1iUSNDM+sgXYgR+8RaED1AgkGNN3urwYRWvUXi3fpfyB6jHMck2ZCqZwG6dcJwPs2f56slYokpQVuX+1ityiIZ9wm6l0nOEv2AcNGfup5ZlA5Z3FrZWzftAYruMnOsCGXgPTwSZMqUnzA53lQZmhz1bMZNH3CLU101Vj3uf39MBPHv6wnl2QFjociJxSnyXwPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6ljAYR3h0DzFYWX8MK6n9YUaFUW+TdMMGl4hAHN+FUo=; b=YJT27kSr4Qc6xEG5mf/9+xvSUbUTGLhUoOnnLVXncnrNwF/7wKn0WAT4S11I2G8ftti16xgKX9CEe3Zj6UBVrFChqKzt2uxzHhgG0+0sm0f/TzLsq0d+ECd2/+dr40qLiT1yAkR7DukD+0p9VbYZPPA/68kul7S8DyQsi1qkI4OGjBvGcSUbjvOVsWj2Xv0gKnIO5vontcQeMVH5p5ZxM1VLJl2qY0GGlrHedsc1wpwckcp+xjH2r3j9GTPhbC/UNz9DW5WZjN5cJdD+QqjdA8BvWMEDANB6HNWqYcVUXSM3Iw7uT4U+/60yA2P/HUpyAPL9BVwXOJKezBut5SzbSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6ljAYR3h0DzFYWX8MK6n9YUaFUW+TdMMGl4hAHN+FUo=; b=NSAwvbPnHenYMpz3E4LC/4GduVF1d3DR+Hys4hV5ffz3q29VGdQTXyBkZHUx3QAZoQXeCrjVGR3u3SvOFjDxEnHkO2F4rAPd36dXh5iVhUp5l0M0gwOukO1Xjsko0ToJG7IrDtnMnd11twWhb5EMStQePBH2957ca8SzB9QjMos= Authentication-Results: jms.id.au; dkim=none (message not signed) header.d=none;jms.id.au; dmarc=none action=none header.from=os.amperecomputing.com; Received: from MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) by MWHPR01MB2592.prod.exchangelabs.com (2603:10b6:300:3e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.20; Tue, 13 Jul 2021 06:01:01 +0000 Received: from MW2PR0102MB3482.prod.exchangelabs.com ([fe80::452a:24fb:12cb:9d7e]) by MW2PR0102MB3482.prod.exchangelabs.com ([fe80::452a:24fb:12cb:9d7e%5]) with mapi id 15.20.4308.027; Tue, 13 Jul 2021 06:01:01 +0000 From: Quan Nguyen To: Joel Stanley , Andrew Jeffery , Jean Delvare , Guenter Roeck , Rob Herring , Lee Jones , Jonathan Corbet , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org Cc: Open Source Submission , Phong Vo , "Thang Q . Nguyen" Subject: [PATCH v5 1/4] dt-bindings: mfd: Add bindings for Ampere Altra SMPro MFD driver Date: Tue, 13 Jul 2021 13:00:28 +0700 Message-Id: <20210713060031.31568-2-quan@os.amperecomputing.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210713060031.31568-1-quan@os.amperecomputing.com> References: <20210713060031.31568-1-quan@os.amperecomputing.com> X-ClientProxiedBy: HK2PR03CA0052.apcprd03.prod.outlook.com (2603:1096:202:17::22) To MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from hcm-sw-17.amperecomputing.com (118.69.219.201) by HK2PR03CA0052.apcprd03.prod.outlook.com (2603:1096:202:17::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.10 via Frontend Transport; Tue, 13 Jul 2021 06:00:57 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: afdaf19b-ad83-4871-b738-08d945c3970f X-MS-TrafficTypeDiagnostic: MWHPR01MB2592: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:883; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Y/rIHuBp/5dXAaGOOCKCbzvLgawc86Urw9Qq3PBiTtNr6fLaniPMamj2benqyz72fp4D6q4dBj1dxJ9iZX3y9XF0MFNyryDxoRaP3oFLXVVzK/M41gYB9J5JYz7vXjqUMaC9Kz/KYjwgnxOupxAlqpIOStxffKwchzBqbIvvH73qnktUm+lgvDY8GucVMWwJqmB9ODFYRH6A/QikfTQcQ8qsfnG2Ulg1YsOc5PIFaXu58EURfzo14euHQ+o1MjWyJjnBsp37BdcrTUBR/frO6a/Zm7rMGXnj907htTCfl99EoNBFbt+RUh/kTntJJxgTmx78G4alz47RK8mjzCM2ILnL0fRdUV5eFiHdPB3+djSoTEQaMSdgYizAthby66GcE/mb72uA591oxSF83ABrb48NK53Yo1TAVgHRxgWLfxkDbT9RXhVZ5FAXLjBtdlyydSPy0anvSH5RZxwmBgY0Q7+GQVIsmbDzXi1Jb1HR9wvxP3OsCbLFQmuP6er3kxrba8LIh8PB3oyjfdQZAJ6OKCFyU/FHW3V/nU9Sauegzlm8BfEhYjGFzzGWgSnu8190UON9IYKigiT1hWFRKv+Pfh4alVsSipQMH5ntdtzwllMdkEmagTNO8VyE7TrFOpBJx1YXy013I6cTkMoc/KZZj9oGoCU2s6dYgN9I0f87sMTZYguf9yDdZQKTBmJMkPbfU84Gm+pZScXdeOwGmysc8vHpZKJWEtMVPFo2Mr98WeemMkwzRP0vErD4+pcEDwosi5Hlke7/PtfNSEKEcpCAtlqn0il03Jnda5bbyhJe1/0hjX/ULSDdlMLFr9mTuiI7 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW2PR0102MB3482.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(39850400004)(376002)(136003)(396003)(366004)(966005)(2616005)(86362001)(110136005)(956004)(316002)(5660300002)(107886003)(66946007)(54906003)(66556008)(66476007)(4326008)(478600001)(38100700002)(38350700002)(6666004)(921005)(6512007)(52116002)(6506007)(83380400001)(26005)(2906002)(8676002)(7416002)(8936002)(186003)(1076003)(6486002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4clz9Dy0YsJefnY5Rd/qQ5cxj4f10hcjPLR7p9QuJWQ0pfvArztQZBu7r0dMExIwkB3UTdhEn5Os/B8FfVEc5yZuC65NQfIpfM/xCcdhOjGzcajzBvlpltxx9ICy10+gy8MRaHhBzcW7/ip7fQz5BxqxN8IAP0cxhXRpcL1y4NpDBtoorJvri7ToxCxGH+aDhn7WZCmz1sRw6OLsG32CLeUPV3kH7uCqdc4Dcu3q+vxubAyJzgs6abT59P4oiWv0qkPDGFsEQITl0fTy3hl0HUdElDMYNsiWtN6p2azAoPY6ID/iE2F1dXidERaYLQ1ouoIFKHA1cF7zKJ4t3HIiv6IelxqyGxN6Tdt5yxJjqyYxKePYluwSV0sTmXGnNuS0sgSrimZVaYHsKCCccqUb5Fug4qSBKCnZb38Gdf3neADoYiz74WNJh+pjUo6D3cmmeFAstg28670CQ/VsJGtFGGJpE3RHeb7IXBZt8N14lcw7E6gO7gzdHHumXRsTl/uGhjLdBLKO2IjiHlt9ubfNLivt2aNi998usgVYJeoiYvrpwsyK07ohUscx0X6QdocJ6KuzMFL4Vbu1Zue8w/wO+byd0juAO7YZ6dbLZvtQVDVek1sbkL6HQ/aSX24bd6vbLZdscYaTpDW5nTJ/rNX+oUF609HvYHwsGZ884S+yMgzLfhNihb6ivFn43rSeAiElMZeboKmd0Ws+gAUfBBl47Cstl4L9PzIQ6PoAgbap3jFFLjXMe1HsWdGMj6PbRoISSlcmpo5TktY+Zlaev+1SiwkUbT48+DPQMLcBUqcSzqJ2EvM+0uhBQVYIIxOB0Kp5e+R4SGtHdODwxheewPCYIeqwxTCV6v9Wnka8+LBlFumA7hk3sXxhHRn9hGncpTJxvTSeUjAwShqUSIZXlcp7poxAWBQVp9Cw7kGSIbamYrjCXE7A+CQ9oWmMyAYVZR4zKcN+SFisLb/UNQqXcBE5b6GGnbO/CfTABPaX0TSDfVJ0dCsvLgOB87dXKpsSpCccx32H0z5YwSrX9d7j5dT9DHRSXap9Zk8aMN6/QfnyJrZW+vB4xhzd+6uHfDraLTY38K2TMs5G6MELDRfUSefSztUNgtUVG+VdxrgxA1ykz/B+ReXstwOmRpr7TZ6B+Z0/q3foxRFahmkxo+QV5InpNhtPhHlQ4N8TnT5pPTMhN2min5D5x/wsehE1isC1qtUAX9Qg92IU8vTEpFBBwu0zowsMjcDRK6SkKW2oAt13c//1oe39Mj/b5LwOfHiPn7WDVbvzo8cOgTjhojDbYEIIHHkxvcztZpAIBRjx5GeR0VeRbsoJHh14YLwJDMtk9Fk1 X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: afdaf19b-ad83-4871-b738-08d945c3970f X-MS-Exchange-CrossTenant-AuthSource: MW2PR0102MB3482.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2021 06:01:00.9581 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gPreIjFyH8cbNFHkltl2wlddjg263r8l76FmKpO6O6JTPQ3b7tQHj1uqeIl7Xa5ccU9xoDvllPE83HPxVLxUZdh0hem/EgTONwtLyE5GGUM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR01MB2592 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Adds device tree bindings for SMPro MFD driver found on the Mt.Jade hardware reference platform with Ampere's Altra Processor family. The SMpro co-processor on Ampere Altra processor family is to monitor and report various data included hwmon-related info, RAS errors, and other miscellaneous information. Signed-off-by: Quan Nguyen Reviewed-by: Rob Herring --- Changes in v5: + Dropped ../bindings/hwmon/ampere,ac01-hwmon.yaml file [Quan] + Removed patternProperties section and child DT nodes in example section [Quan] + Revised commit message [Quan] Changes in v4: + Revised the commit message to clarify how the specific info will be handled commented by Rob. Changes in v3: + Supported list of compatible string [Rob] + Introduced reg property in DT to specify reg offset [Rob] + Updated description and other minor changes in yaml file [Rob] Changes in v2: + Changed "ampere,ac01-smpro" to "ampere,smpro" [Quan] .../devicetree/bindings/mfd/ampere,smpro.yaml | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/ampere,smpro.yaml diff --git a/Documentation/devicetree/bindings/mfd/ampere,smpro.yaml b/Documentation/devicetree/bindings/mfd/ampere,smpro.yaml new file mode 100644 index 000000000000..8b48747e5de3 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/ampere,smpro.yaml @@ -0,0 +1,52 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/ampere,smpro.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Ampere Altra SMPro firmware driver + +maintainers: + - Quan Nguyen + +description: | + Ampere Altra SMPro firmware may contain different blocks like hardware + monitoring, error monitoring and other miscellaneous features. + +properties: + compatible: + enum: + - ampere,smpro + + reg: + description: + I2C device address. + maxItems: 1 + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + +required: + - "#address-cells" + - "#size-cells" + - compatible + - reg + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + smpro@4f { + compatible = "ampere,smpro"; + reg = <0x4f>; + #address-cells = <1>; + #size-cells = <0>; + }; + }; From patchwork Tue Jul 13 06:00:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quan Nguyen X-Patchwork-Id: 12372825 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C007AC11F68 for ; Tue, 13 Jul 2021 06:01:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9A41E61361 for ; Tue, 13 Jul 2021 06:01:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233638AbhGMGD6 (ORCPT ); Tue, 13 Jul 2021 02:03:58 -0400 Received: from mail-dm6nam08on2096.outbound.protection.outlook.com ([40.107.102.96]:14848 "EHLO NAM04-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233504AbhGMGD4 (ORCPT ); Tue, 13 Jul 2021 02:03:56 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hzEnahfJ9FjIyZVHBF2Izo+fYXR8t7f85avTap70sRU3VEuErSk2z876ovdvmuR7yNwk5fZUPSr0NTi0yJApeg0rgF9Vr/pXApk6TbF8V5FU1fgVfHK1JQ/gVMkvndCYk1mQYE/A/Bwixyj7RJGDpGjauMVqw8qZ1MKacvS/KpkymT8GWitLarvAHmo+H/37DWXEZcoEh1emOeMftduwMnVcfR6d8S4fMmKfrPCUqrbKkTs9svMxC5LIi+Ncw5gSMt39GuQ6LYH4c9HXHfdvsGRg6W+Uk3Lc04SYE0GChDZYJpzdC/doDSGwD8kacOCMwAdQLNP5d+k3uLXswGbMiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jdVT7SozrMy879stD8RvHLl7U6n+4sHk3ZrdKW0WzzU=; b=MoAjaj9BiTTlkufPZOdkwdJXT9oZrr+B5K0rclRcGKU+JB1EMLRbYumH9tCwt6UBu+zdrVzyLhG/Xot11zw3Ob9apLP+nfTi1JaNQiq2VEDG7T5aCH3fc1yPsPxRYMgVCjQdXrT8hMNhjAuLe4gRQUdlDTPlsxIYK9QnOrFXrEeSU2zt8xkeuDoXqurgWQFNU0NHmKTUYPQR0l6DJOtn2DFBedCsVuvq8ZwWeWgqlCSLQRC5EB62+f/GRZfKLzL4OsMtnP7na3mDCwPOoCxbBUOmjJ17GLP8kVEsnGgt7d+ZPhK04EKO/buLXB+SRXUdcNhsvAu50EbDVUXsXw3Blg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jdVT7SozrMy879stD8RvHLl7U6n+4sHk3ZrdKW0WzzU=; b=YBSdATJx96PfnoQEFllraPPHjOdef8NmTo9/XvqfCRToVF+RZ5YyZ0sHOMgpZ2oNx8CF4TsadHB1LyQRpQl7Uh7fAivHH3dTkp+lLmpALdeR1G8/ekjLqbOkAyoCLf38AEdlsUtNHhv9u9S1oggfCTrMl6hNCyTCcaYWZZ38IBY= Authentication-Results: jms.id.au; dkim=none (message not signed) header.d=none;jms.id.au; dmarc=none action=none header.from=os.amperecomputing.com; Received: from MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) by MWHPR01MB2592.prod.exchangelabs.com (2603:10b6:300:3e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.20; Tue, 13 Jul 2021 06:01:04 +0000 Received: from MW2PR0102MB3482.prod.exchangelabs.com ([fe80::452a:24fb:12cb:9d7e]) by MW2PR0102MB3482.prod.exchangelabs.com ([fe80::452a:24fb:12cb:9d7e%5]) with mapi id 15.20.4308.027; Tue, 13 Jul 2021 06:01:04 +0000 From: Quan Nguyen To: Joel Stanley , Andrew Jeffery , Jean Delvare , Guenter Roeck , Rob Herring , Lee Jones , Jonathan Corbet , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org Cc: Open Source Submission , Phong Vo , "Thang Q . Nguyen" Subject: [PATCH v5 2/4] mfd: smpro-mfd: Adds Ampere's Altra SMpro MFD driver Date: Tue, 13 Jul 2021 13:00:29 +0700 Message-Id: <20210713060031.31568-3-quan@os.amperecomputing.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210713060031.31568-1-quan@os.amperecomputing.com> References: <20210713060031.31568-1-quan@os.amperecomputing.com> X-ClientProxiedBy: HK2PR03CA0052.apcprd03.prod.outlook.com (2603:1096:202:17::22) To MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from hcm-sw-17.amperecomputing.com (118.69.219.201) by HK2PR03CA0052.apcprd03.prod.outlook.com (2603:1096:202:17::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.10 via Frontend Transport; Tue, 13 Jul 2021 06:01:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d593d9da-4508-46b8-5882-08d945c3995e X-MS-TrafficTypeDiagnostic: MWHPR01MB2592: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:751; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FjG7unxrNZiVBL9vG5T4XdEQ+YuKVVpEJKK9vwYQ/5cxGotudcSuxQaokK95SEp63GwwVZ5XxMe9xCYp5pSS7oEtQhdWHw83284uNhgadrFHlukAjLh3Qkb1VjqyNWjQ562+XDIlpurvBFd1iAVo1k+3uZVzMOHxCKkCae2KojhVKGobSeKWDHonrPYn8e8qcOa/P3AGoHY+W7Vr4W9wi6ZvJJ20gnGGSQ/dJI46VhBpWubxZrCJ0RoqH3E1YsPxc04xhzLNcVWbRYVt+ZzXjairj2zBQqblmkhGcU6i88680paNjAe7HcFr1l5qEovkWUOz5nr0eBB7jeDDfOi+wYYcIIm4OMWEbtm6bpIZjShbnCJcmzw3Nx6myEZ7y1HuVZrwTzDG+YAEqAgYud31jXRIlDxaQ9QNGh3NntsGggLtLP+5PA4QWWjWa9baCDWIsYdvKWF9BVQyfc3VWSxRNwUTa89dOjCxGp4FMxKY5x5uyfMxKKZIscIW4QkHjOADJ9KQrwKxZNts9DG1v0OIBDs9tSxVrcBCTAEWd7mWIvpgkIGzfSupPxoD4EKpyL4PRR6r9U++gZcESP9j3eye5kZbaPgdpufL7twohSjtsl4U2XIner6X0QnIPlzr8oqO/q05NTtpa8h0E3fB8IJt3kV5Iaj2sXbQkmicBGWjjsHcuq1oGNFiDSdJUxBoFTbUCboqaIAYXn0Je0+UIJJvhzA89btmIeIgyMKbah5mDZY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW2PR0102MB3482.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(39850400004)(376002)(136003)(396003)(366004)(2616005)(86362001)(110136005)(956004)(316002)(5660300002)(107886003)(66946007)(54906003)(66556008)(66476007)(4326008)(478600001)(38100700002)(38350700002)(6666004)(921005)(6512007)(52116002)(6506007)(83380400001)(26005)(2906002)(8676002)(7416002)(8936002)(186003)(1076003)(6486002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4CshMkAO02ox0e9SExgmsipfuXpgwVKjMVUomL31qkaIWCv/FvHbBzCzfpGE89lnNT9v6uQ3TMwBeJz6h62mZzKdgpOBF2P5iIvv67iEMdYCUw7Uz+6akjm0DNfifFf4YufFZRcX0gFoTK8LBruWCiqHofBDt2gYBoylmH0PiV1BxJ2qna0DO6sC4Qj9s1hQ6iRgYHsi3/BlDWOgED3MVRHHIMhzCl+da5bAAdXed3oCi0ExyLebUr8Zdp2dIKJCYe8AwARSBJwiij39rSDZUIulox6bHeIxIzoy5gbJqcedmXFY1kv9xd6XvvQczQssqW+fkBmMrRrHpvGPyuM0B0dJrzq7J5e1npbYLyJYdPDLvLVVkNlfaZBFY1Lyr+OHHuzuB5PejnzuBhpbYMapPn/S1Dc9w7aSOPJxMoVyEJCJo8PktBUY2+VwSByapdBMQcpR1P+Fhk2mVnQDj9JfGpsH8xTsiCnGVZmcHe7YlsEmkC9wdiS+VZq/bSVQimiGxt4cv3q3IbZrvzUhFu1hpQxncH7FgiD9j9cbwQFv8DXM1H8eWyaqlj8b9MsWvPPSO/IfemfXK8wpfpRnHWQA3YxfU5MmL6V+1aXwao/H1vU5/Gemmqr6qflHfSzZG8mr57Ff0FPUcfq181I1bS1qzjFhBzeJqDRZBUeccUOw4wmFVP4mdReTMTu+J79hv79aX/WdjED5q0ahPmo/nO1w29CnkPPTx+fjJ0vmlXNMTh12/B3wSZGTODa0PYkSLEE6YYlObORefxnDF486fdEH7Wql1Gn7nZVg7qgqpZGd96NqT1TqK1dRjp7QHRjX4fGVCKGj4DPHVRqJLfOvJCPFRrCuGNlt4M5fyMFkkU7KQkEZrwJMoMJUcaVmGVMR3B4wZlAndxOYHwN8XbEpNqkPeu4/43yWmu/lLywTdHwxkZvDcOas+rdF2t1HYJ/Ciu5mbIMP84X5OAqzo5PH62U9Bmqx8aVxOjfjzgDbngmn7JgNQVYN4nWV5/eo0Zlksgj//j9g8xwivSJ7v2v3URla7EPxItOy1Sfds+xTR73vBCFwIO71Y/PQtrbId43V7rButbZoPMb4dqPWoH2aAmL4Oywk6RETOY0Oy3ZfzZeUrxM6jOhMdaS64buqDpWHpg7BirmqiZeW+Nt2NupCoNwecNDZqaka2W4tT0t4rryBGEThaa+qwpoR7DDYab4V6vK+4mleTmFGvqjMRGFCaFMvahV05p4JAEdYFRtBXMqBDsmjiSX3MqT+E5NbV2OewCNMefX/Uwhz/hNlHTKMAHCN2IX82vtjHtVzvKUuMmW0iNKwFarEiTMn3JSOcy1Myyge X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: d593d9da-4508-46b8-5882-08d945c3995e X-MS-Exchange-CrossTenant-AuthSource: MW2PR0102MB3482.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2021 06:01:04.7589 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: m71O/7rhP/UI0ATFG7me9eWp8/6bJvt6g2oSCeJWAcPnuiFLTn89DZ4XmJaQ5RkDQZuwVAgbpkbmDHzSPG6fEf57fm0EE12GGJhHODExPr0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR01MB2592 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Adds Multi-function devices driver for SMpro co-processor found on the Mt.Jade hardware reference platform with Ampere's Altra processor family. Signed-off-by: Quan Nguyen --- Changes in v5: + Dropped the use of simple-mfd-i2c driver [Quan] + Introduced drivers/mfd/smpro-mfd.c driver to instantiate sub-devices. This is to avoid DT nodes without resource issue [Quan] + Revised commit message [Quan] Changes in v4: + Add "depends on I2C" to fix build issue found by kernel test robot [Guenter] Changes in v3: + None Changes in v2: + Used 'struct of_device_id's .data attribute [Lee Jones] drivers/mfd/Kconfig | 12 +++++++ drivers/mfd/Makefile | 1 + drivers/mfd/smpro-mfd.c | 74 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 drivers/mfd/smpro-mfd.c diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 6a3fd2d75f96..25e502cca32f 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -77,6 +77,18 @@ config MFD_AS3711 help Support for the AS3711 PMIC from AMS +config MFD_SMPRO + tristate "Ampere Computing MFD SMpro core driver" + depends on I2C + select MFD_CORE + select REGMAP_I2C + help + Say yes here to enable SMpro driver support for Ampere's Altra + processor family. + + Ampere's Altra SMpro exposes an I2C regmap interface that can + be accessed by child devices. + config MFD_AS3722 tristate "ams AS3722 Power Management IC" select MFD_CORE diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 8116c19d5fd4..046fd36de85a 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -268,6 +268,7 @@ obj-$(CONFIG_MFD_QCOM_PM8008) += qcom-pm8008.o obj-$(CONFIG_SGI_MFD_IOC3) += ioc3.o obj-$(CONFIG_MFD_SIMPLE_MFD_I2C) += simple-mfd-i2c.o +obj-$(CONFIG_MFD_SMPRO) += smpro-mfd.o obj-$(CONFIG_MFD_INTEL_M10_BMC) += intel-m10-bmc.o obj-$(CONFIG_MFD_ATC260X) += atc260x-core.o diff --git a/drivers/mfd/smpro-mfd.c b/drivers/mfd/smpro-mfd.c new file mode 100644 index 000000000000..b0cd3c248507 --- /dev/null +++ b/drivers/mfd/smpro-mfd.c @@ -0,0 +1,74 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Ampere Altra Family SMPro MFD - I2C + * + * Copyright (c) 2021, Ampere Computing LLC + * + * Author: Quan Nguyen + */ + +#include +#include +#include +#include +#include +#include + +/* Identification Registers */ +#define MANUFACTURER_ID_REG 0x02 +#define AMPERE_MANUFACTURER_ID 0xCD3A + +static const struct regmap_config simple_word_regmap_config = { + .reg_bits = 8, + .val_bits = 16, +}; + +static const struct mfd_cell smpro_devs[] = { + MFD_CELL_NAME("smpro-hwmon"), +}; + +static int smpro_mfd_probe(struct i2c_client *i2c) +{ + const struct regmap_config *config; + struct regmap *regmap; + unsigned int val; + int ret; + + config = device_get_match_data(&i2c->dev); + if (!config) + config = &simple_word_regmap_config; + + regmap = devm_regmap_init_i2c(i2c, config); + if (IS_ERR(regmap)) + return PTR_ERR(regmap); + + /* Check for valid ID */ + ret = regmap_read(regmap, MANUFACTURER_ID_REG, &val); + if (ret) + return ret; + + if (val != AMPERE_MANUFACTURER_ID) + return -ENODEV; + + return devm_mfd_add_devices(&i2c->dev, PLATFORM_DEVID_AUTO, + smpro_devs, ARRAY_SIZE(smpro_devs), NULL, 0, NULL); +} + +static const struct of_device_id smpro_mfd_of_match[] = { + { .compatible = "ampere,smpro", .data = &simple_word_regmap_config }, + {} +}; +MODULE_DEVICE_TABLE(of, smpro_mfd_of_match); + +static struct i2c_driver smpro_mfd_driver = { + .probe_new = smpro_mfd_probe, + .driver = { + .name = "smpro-mfd-i2c", + .of_match_table = smpro_mfd_of_match, + }, +}; +module_i2c_driver(smpro_mfd_driver); + +MODULE_AUTHOR("Quan Nguyen "); +MODULE_DESCRIPTION("SMPRO MFD - I2C driver"); +MODULE_LICENSE("GPL v2"); From patchwork Tue Jul 13 06:00:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quan Nguyen X-Patchwork-Id: 12372827 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18460C11F66 for ; Tue, 13 Jul 2021 06:01:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 00FA461260 for ; Tue, 13 Jul 2021 06:01:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233894AbhGMGEE (ORCPT ); Tue, 13 Jul 2021 02:04:04 -0400 Received: from mail-dm6nam08on2131.outbound.protection.outlook.com ([40.107.102.131]:2912 "EHLO NAM04-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233834AbhGMGEA (ORCPT ); Tue, 13 Jul 2021 02:04:00 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I7c8HkSUOMDbu3u0Ab6F2DeqOKtfMOVCnwQIkY8YOCww/M22fc6RQ9Z3RG2tQKhtgtCKg8W8L19x5a+nfTUkl/jHcKHaHbA8gL6LvdXo+SbbLQPgbntxFaxEO3ZqZ5z0xHqqagwOzKDhBxvR0VAysGsbwObO4TzReMMRG1e1uvo/pEswx9HDl2EU1YTspWLvtKnYKuqGLGRGSnN/IDJRuuhMvJLC2MF63Zh9kR2L+XPtFb+LmO1OzdiV+XitQOei922xBY0r3hIJdtQO+nWQmUGjXbC7WNHnDPa/lWpY07K0Cf06gfDdO5B4gyWjX5OpzZPq/SvVb5yDHCIslJFwBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RIlu4DeF4kqtom/eXIT7XoBEdgyX1aEz1LW7tPRDBVc=; b=gFeqWqv240r2K8hJcb8S/vzD2aNaobnFnQckYK+YZTucghvz1r9mjzo2jh3nQu6M+HI6C4Xp6udn8YixGZURRwd8n1HaLC8wV6O3Y6mrA/ud1TsOF0IMIrU+WvdfDgGvYRUz0hz2pS/0rcGsRqd+ThDyvomATK3UXs87yMF5P05xwfpdOc4g7nklKJjDto0hHXTKJSvQondqARmx6mly8fqG9T2SOTBEOgT5kRwQkzoxib+5ESyPbgfP9X5mwCtyoPsTS08/ucaf1hXt5zVyZxVE52NXfqmayFcK+vgN0pdmZiSb9rCu+20LNwbV8QGNJml01Gvsy0+NoqXcJ1fPnQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RIlu4DeF4kqtom/eXIT7XoBEdgyX1aEz1LW7tPRDBVc=; b=EQ/RlqHn+yeR025Y25KzkBzKMflIOOPfvizF6NwslffkuvSd6rad0KciRMeoyo/Fke6dEgZx/VByr3MQ7WGOVKalXBWmsiLYivPur5NDQNqvdyEQxDMMFguUMK0ycEgZXwkB6aZ9qFu72MXlA2z5sBEhqbBRqKjIFeTX7yauzqM= Authentication-Results: jms.id.au; dkim=none (message not signed) header.d=none;jms.id.au; dmarc=none action=none header.from=os.amperecomputing.com; Received: from MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) by MWHPR01MB2592.prod.exchangelabs.com (2603:10b6:300:3e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.20; Tue, 13 Jul 2021 06:01:08 +0000 Received: from MW2PR0102MB3482.prod.exchangelabs.com ([fe80::452a:24fb:12cb:9d7e]) by MW2PR0102MB3482.prod.exchangelabs.com ([fe80::452a:24fb:12cb:9d7e%5]) with mapi id 15.20.4308.027; Tue, 13 Jul 2021 06:01:08 +0000 From: Quan Nguyen To: Joel Stanley , Andrew Jeffery , Jean Delvare , Guenter Roeck , Rob Herring , Lee Jones , Jonathan Corbet , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org Cc: Open Source Submission , Phong Vo , "Thang Q . Nguyen" Subject: [PATCH v5 3/4] hwmon: smpro: Add Ampere's Altra smpro-hwmon driver Date: Tue, 13 Jul 2021 13:00:30 +0700 Message-Id: <20210713060031.31568-4-quan@os.amperecomputing.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210713060031.31568-1-quan@os.amperecomputing.com> References: <20210713060031.31568-1-quan@os.amperecomputing.com> X-ClientProxiedBy: HK2PR03CA0052.apcprd03.prod.outlook.com (2603:1096:202:17::22) To MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from hcm-sw-17.amperecomputing.com (118.69.219.201) by HK2PR03CA0052.apcprd03.prod.outlook.com (2603:1096:202:17::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.10 via Frontend Transport; Tue, 13 Jul 2021 06:01:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 07803524-da78-410e-a5f9-08d945c39bc0 X-MS-TrafficTypeDiagnostic: MWHPR01MB2592: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wz7kKy4tQuHr6P6KOLC+9afdeNsVukZe10xM8QVRBiRJUNAlOzuX71a0227ANo89+Yk47tcsCAh4wTJvpZTUKIN0ImJMhRJ1VtsT6M7IxRYtZHVrTQcMtTcsf+H3H8NzLkDgA846vNZz6dsKvz/A3ZqDCvp6cCZjlycZm58E4eXwpJoRkSzZWqdquxn+7UTk9GZHvr7Npd+sh37kdCJkBaiwY0FwvySTlCEhBkc7u4Ud49ytiohwWCsYJgOkJhgfFSFxg50zEDUCuzJGnQZlcwqu5IY9/mEv4GZsam3Rch1DXUQEPHCSWkhT/FT2+Amh9TIRUUpiWXwBvObi71RAg6KwZbpkVFDux0UGLIW40hUOdA3Re60Pb06QwACJkYrookp4nKfArlJaKXVEVrGOxERmOA+g7tFzNx0vL54fij517Ncnq3NgPZFFuKdVyswUNLUIuE/gIPb9cSoDoQs3reEZ1LyKDsWO+GuV5XtUUtRKxONWTVVTGw3+AUQMns994WtUPzTOEds5aaeq0WLz1YOjchXn2F1qQ7hEfB+bnqiHNhtw5xB9T9gtztObJqW853pZ0ZVcLkLrFPL8i6QGBrOEk91jsUyhYKdkw5BD3oqk7dHyI0JOc8zZJwHr7p8DvkN1L2FecANAgPhQx1RiiobfBdYiaHEHMK4tm1GQ+hXaqNAcb5W3Qorvm5Ll4M6u3u4URkwfQRmEarAHcyMAufWwtUcDEARkJMjndz1h+Ko= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW2PR0102MB3482.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(39850400004)(376002)(136003)(396003)(366004)(2616005)(86362001)(110136005)(956004)(316002)(5660300002)(30864003)(107886003)(66946007)(54906003)(66556008)(66476007)(4326008)(478600001)(38100700002)(38350700002)(6666004)(921005)(6512007)(52116002)(6506007)(83380400001)(26005)(2906002)(8676002)(7416002)(8936002)(186003)(1076003)(6486002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iV6jz2zYed5LtbVcLQyevdhNvZers2D6Gd6rkLi6xtgyv5wO/IT8xjoxAk9A9VCZdjtb+tixw6tOVI2+t45Od/ZtCeYbHdQYqYVrlm2i9cMbMj8W36pWa+BfbsFmlzcpY5RHXzbfoRxpqkZCAH2sq/e7NHKlLITOJpu4R3cuGS1l6jIncWd/41gHicDrvFYeFZG5IAaA6krZwBQqbosJ82zq4fPfnQIiZlm9CiPctBMD6rOPFnQKhUc0Xpt6NBr82x7ra9DCtHxf99rsWPW1vZnNcNd2TQy0jrh/yq1ZOlqmShNn7zHXNkHK8dVbSrqa26QO7f69LMZ98EZkD8d6QXhST4B4XHpnyIrbUCwd3rp5Zam2G1IHELFC+CxnVsBb5GcoAvWiUwOUx6hC2Iss+b93ckAeeLBNUG1feJHTFDsMVggagw4gI9J9/Z6drWJpipMimGdRSIJBhq7/h2P0b1WYi9j7IY+FqGvk/rQALGm5+k182Jw37h3j1Y0OMrWpfNUbevhi0UBMl0hgLvokUrPGahH1/PJe+9cQwfPfgrBKgn9FRuhkz66n4S3JSbFCmatQN5IiABs2rqF/VbGw2PbPTKCRTbFYVWO+5zObQeHWSrKZYaluKQXNpa7DZQ4ANzwywItG/Y7ZAvhMtAqW+w5AH9qp9PC517/XvGN6r+bcey2IQw3uM7UBn2YNsuZKn9j6dWNzFDo506ybfDQY/O5b8QEhPmgEbp4RRTjZ1Ig0FKQnjhQU4Ou2Sd11n7DjzDP6zR2hjiCxc0GCN9LOz9A/UcWS9p+6Lj7Q+00ZcHpx3fPo7sPy4ngwU1pyozeuDtzAT7W1bVOcQFKBCMhheTuU5rYdRUwImOYO3wrMNv6oIVDIC52KsMMl/+4Fb3EUNZmPfnclvUwIXaba+JfNZxXJwl+L/SsqdNWtxZLg6Ok3k3lB+gCV8Sldo9+8IL5dFM4vIq5D4RUMwE1HGMwt8kCuKm8qaovBlOzBlygRR9DrEdySAGA3IoIr3w9U/iMYvaEeEoXfKvfG5ZCPHwbjMXF0vSZiadyPAr4Uz2xfzzAH2c4p9yKZRBruB1Mjdmgd2kXEZOq6SI/vulPFkTwAL/evHWu0k381rAzPTmKTI6JuCmRi/MBZkkeak8H6oezAzwa3sbB1j2y0BFKNF2ZFcXmg92ZC6vIwZaQ397Ku+z1SYUTj8rf4n15w68ma5gkWbqMAPhMrzFs6B6XjzO6m+GgJ3zL6jaNU3QG7VilJRTIW6G4kOrbYNAJBRRk6qpKmr+51Cq2C+42ZXZbLtwzxqmWvgc4CNxuJ0Y312CRd0jxXsev0/x8Il8E82zrm9Tgi X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 07803524-da78-410e-a5f9-08d945c39bc0 X-MS-Exchange-CrossTenant-AuthSource: MW2PR0102MB3482.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2021 06:01:08.6647 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: H54LqFG+OoX3ZWjNXI2mZfQL6rrTRlInUaS8KpAE6677MZWkjPIlC/XO/NQtqVUP/LXE81j6dCv9NtRUOQmOqE3goEE0TNivzW6Hi2f/6eM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR01MB2592 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org This commit adds support for Ampere SMpro hwmon driver. This driver supports accessing various CPU sensors provided by the SMpro co-processor including temperature, power, voltages, and current. Signed-off-by: Quan Nguyen Reviewed-by: Guenter Roeck --- Changes in v5: + Drop ManufacturerID checking when probe as it was checked during smpro-mfd probing [Quan] + Drop the use of register offset [Quan] + Removed the use of compatible string as it is instantiated by smpro-mfd driver [Quan] + Thanks Guenter for the Reviewed-by in last version, but it was not added because there's some changes in this version. Really appreciate if you could help again, thank you. Changes in v4: + Returned regmap_read() error code [Guenter] Changes in v3: + Handled negative temperature value [Guenter] + Returned -ENODEV if Manufacturer ID is wrong [Guenter] + Refactored smpro_read_string() and smpro_temp_read() [Guenter] + Removed smpro_write() function [Guenter] + Added minor refactor changes [Quan] Changes in v2: + Removed "virtual" sensors [Guenter] + Reported SOC_TDP as "Socket TDP" using max attributes [Guenter] + Corrected return error code when host is turn off [Guenter] + Reported MEM HOT Threshold for all DIMMs as temp*_crit [Guenter] + Removed license info as SPDX-License-Identifier existed [Guenter] + Added is_visible() support [Guenter] + Used HWMON_CHANNEL_INFO() macro and LABEL attributes [Guenter] + Made is_valid_id() return boolean [Guenter] + Returned -EPROBE_DEFER when smpro reg inaccessible [Guenter] + Removed unnecessary error message when dev register fail [Guenter] + Removed Socket TDP sensor [Quan] + Included sensor type and channel in labels [Quan] + Refactorized code to fix checkpatch.pl --strict complaint [Quan] drivers/hwmon/Kconfig | 8 + drivers/hwmon/Makefile | 1 + drivers/hwmon/smpro-hwmon.c | 463 ++++++++++++++++++++++++++++++++++++ 3 files changed, 472 insertions(+) create mode 100644 drivers/hwmon/smpro-hwmon.c diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index e3675377bc5d..903c5ef79a5a 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -67,6 +67,14 @@ config SENSORS_ABITUGURU3 This driver can also be built as a module. If so, the module will be called abituguru3. +config SENSORS_SMPRO + tristate "Ampere's Altra SMpro hardware monitoring driver" + depends on MFD_SMPRO + help + If you say yes here you get support for the thermal, voltage, + current and power sensors of Ampere's Altra processor family SoC + with SMpro co-processor. + config SENSORS_AD7314 tristate "Analog Devices AD7314 and compatibles" depends on SPI diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index d712c61c1f5e..9de5cd9911b0 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -175,6 +175,7 @@ obj-$(CONFIG_SENSORS_SHT4x) += sht4x.o obj-$(CONFIG_SENSORS_SHTC1) += shtc1.o obj-$(CONFIG_SENSORS_SIS5595) += sis5595.o obj-$(CONFIG_SENSORS_SMM665) += smm665.o +obj-$(CONFIG_SENSORS_SMPRO) += smpro-hwmon.o obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o diff --git a/drivers/hwmon/smpro-hwmon.c b/drivers/hwmon/smpro-hwmon.c new file mode 100644 index 000000000000..b01ceea33ddd --- /dev/null +++ b/drivers/hwmon/smpro-hwmon.c @@ -0,0 +1,463 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Ampere Computing SoC's SMPro Hardware Monitoring Driver + * + * Copyright (c) 2021, Ampere Computing LLC + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Logical Power Sensor Registers */ +#define SOC_TEMP 0x10 +#define SOC_VRD_TEMP 0x11 +#define DIMM_VRD_TEMP 0x12 +#define CORE_VRD_TEMP 0x13 +#define CH0_DIMM_TEMP 0x14 +#define CH1_DIMM_TEMP 0x15 +#define CH2_DIMM_TEMP 0x16 +#define CH3_DIMM_TEMP 0x17 +#define CH4_DIMM_TEMP 0x18 +#define CH5_DIMM_TEMP 0x19 +#define CH6_DIMM_TEMP 0x1A +#define CH7_DIMM_TEMP 0x1B +#define RCA_VRD_TEMP 0x1C + +#define CORE_VRD_PWR 0x20 +#define SOC_PWR 0x21 +#define DIMM_VRD1_PWR 0x22 +#define DIMM_VRD2_PWR 0x23 +#define CORE_VRD_PWR_MW 0x26 +#define SOC_PWR_MW 0x27 +#define DIMM_VRD1_PWR_MW 0x28 +#define DIMM_VRD2_PWR_MW 0x29 +#define RCA_VRD_PWR 0x2A +#define RCA_VRD_PWR_MW 0x2B + +#define MEM_HOT_THRESHOLD 0x32 +#define SOC_VR_HOT_THRESHOLD 0x33 +#define CORE_VRD_VOLT 0x34 +#define SOC_VRD_VOLT 0x35 +#define DIMM_VRD1_VOLT 0x36 +#define DIMM_VRD2_VOLT 0x37 +#define RCA_VRD_VOLT 0x38 + +#define CORE_VRD_CURR 0x39 +#define SOC_VRD_CURR 0x3A +#define DIMM_VRD1_CURR 0x3B +#define DIMM_VRD2_CURR 0x3C +#define RCA_VRD_CURR 0x3D + +struct smpro_hwmon { + struct regmap *regmap; +}; + +struct smpro_sensor { + const u8 reg; + const u8 reg_ext; + const char *label; +}; + +static const struct smpro_sensor temperature[] = { + { + .reg = SOC_TEMP, + .label = "temp1 SoC" + }, + { + .reg = SOC_VRD_TEMP, + .reg_ext = SOC_VR_HOT_THRESHOLD, + .label = "temp2 SoC VRD" + }, + { + .reg = DIMM_VRD_TEMP, + .label = "temp3 DIMM VRD" + }, + { + .reg = CORE_VRD_TEMP, + .label = "temp4 CORE VRD" + }, + { + .reg = CH0_DIMM_TEMP, + .reg_ext = MEM_HOT_THRESHOLD, + .label = "temp5 CH0 DIMM" + }, + { + .reg = CH1_DIMM_TEMP, + .reg_ext = MEM_HOT_THRESHOLD, + .label = "temp6 CH1 DIMM" + }, + { + .reg = CH2_DIMM_TEMP, + .reg_ext = MEM_HOT_THRESHOLD, + .label = "temp7 CH2 DIMM" + }, + { + .reg = CH3_DIMM_TEMP, + .reg_ext = MEM_HOT_THRESHOLD, + .label = "temp8 CH3 DIMM" + }, + { + .reg = CH4_DIMM_TEMP, + .reg_ext = MEM_HOT_THRESHOLD, + .label = "temp9 CH4 DIMM" + }, + { + .reg = CH5_DIMM_TEMP, + .reg_ext = MEM_HOT_THRESHOLD, + .label = "temp10 CH5 DIMM" + }, + { + .reg = CH6_DIMM_TEMP, + .reg_ext = MEM_HOT_THRESHOLD, + .label = "temp11 CH6 DIMM" + }, + { + .reg = CH7_DIMM_TEMP, + .reg_ext = MEM_HOT_THRESHOLD, + .label = "temp12 CH7 DIMM" + }, + { + .reg = RCA_VRD_TEMP, + .label = "temp13 RCA VRD" + }, +}; + +static const struct smpro_sensor voltage[] = { + { + .reg = CORE_VRD_VOLT, + .label = "vout0 CORE VRD" + }, + { + .reg = SOC_VRD_VOLT, + .label = "vout1 SoC VRD" + }, + { + .reg = DIMM_VRD1_VOLT, + .label = "vout2 DIMM VRD1" + }, + { + .reg = DIMM_VRD2_VOLT, + .label = "vout3 DIMM VRD2" + }, + { + .reg = RCA_VRD_VOLT, + .label = "vout4 RCA VRD" + }, +}; + +static const struct smpro_sensor curr_sensor[] = { + { + .reg = CORE_VRD_CURR, + .label = "iout1 CORE VRD" + }, + { + .reg = SOC_VRD_CURR, + .label = "iout2 SoC VRD" + }, + { + .reg = DIMM_VRD1_CURR, + .label = "iout3 DIMM VRD1" + }, + { + .reg = DIMM_VRD2_CURR, + .label = "iout4 DIMM VRD2" + }, + { + .reg = RCA_VRD_CURR, + .label = "iout5 RCA VRD" + }, +}; + +static const struct smpro_sensor power[] = { + { + .reg = CORE_VRD_PWR, + .reg_ext = CORE_VRD_PWR_MW, + .label = "power1 CORE VRD" + }, + { + .reg = SOC_PWR, + .reg_ext = SOC_PWR_MW, + .label = "power2 SoC" + }, + { + .reg = DIMM_VRD1_PWR, + .reg_ext = DIMM_VRD1_PWR_MW, + .label = "power3 DIMM VRD1" + }, + { + .reg = DIMM_VRD2_PWR, + .reg_ext = DIMM_VRD2_PWR_MW, + .label = "power4 DIMM VRD2" + }, + { + .reg = RCA_VRD_PWR, + .reg_ext = RCA_VRD_PWR_MW, + .label = "power5 RCA VRD" + }, +}; + +static int smpro_read_temp(struct device *dev, u32 attr, int channel, long *val) +{ + struct smpro_hwmon *hwmon = dev_get_drvdata(dev); + unsigned int value; + int ret; + + switch (attr) { + case hwmon_temp_input: + ret = regmap_read(hwmon->regmap, temperature[channel].reg, &value); + if (ret) + return ret; + break; + case hwmon_temp_crit: + ret = regmap_read(hwmon->regmap, temperature[channel].reg_ext, &value); + if (ret) + return ret; + break; + default: + return -EOPNOTSUPP; + } + + *val = sign_extend32(value, 8) * 1000; + return 0; +} + +static int smpro_read_in(struct device *dev, u32 attr, int channel, long *val) +{ + struct smpro_hwmon *hwmon = dev_get_drvdata(dev); + unsigned int value; + int ret; + + switch (attr) { + case hwmon_in_input: + ret = regmap_read(hwmon->regmap, voltage[channel].reg, &value); + if (ret < 0) + return ret; + /* 15-bit value in 1mV */ + *val = value & 0x7fff; + return 0; + default: + return -EOPNOTSUPP; + } +} + +static int smpro_read_curr(struct device *dev, u32 attr, int channel, long *val) +{ + struct smpro_hwmon *hwmon = dev_get_drvdata(dev); + unsigned int value; + int ret; + + switch (attr) { + case hwmon_curr_input: + ret = regmap_read(hwmon->regmap, curr_sensor[channel].reg, &value); + if (ret < 0) + return ret; + /* Scale reported by the hardware is 1mA */ + *val = value & 0x7fff; + return 0; + default: + return -EOPNOTSUPP; + } +} + +static int smpro_read_power(struct device *dev, u32 attr, int channel, long *val_pwr) +{ + struct smpro_hwmon *hwmon = dev_get_drvdata(dev); + unsigned int val = 0, val_mw = 0; + int ret; + + switch (attr) { + case hwmon_power_input: + ret = regmap_read(hwmon->regmap, power[channel].reg, &val); + if (ret) + return ret; + + ret = regmap_read(hwmon->regmap, power[channel].reg_ext, &val_mw); + if (ret) + return ret; + + *val_pwr = val * 1000000 + val_mw * 1000; + return 0; + + default: + return -EOPNOTSUPP; + } +} + +static int smpro_read(struct device *dev, enum hwmon_sensor_types type, + u32 attr, int channel, long *val) +{ + switch (type) { + case hwmon_temp: + return smpro_read_temp(dev, attr, channel, val); + case hwmon_in: + return smpro_read_in(dev, attr, channel, val); + case hwmon_power: + return smpro_read_power(dev, attr, channel, val); + case hwmon_curr: + return smpro_read_curr(dev, attr, channel, val); + default: + return -EOPNOTSUPP; + } +} + +static int smpro_read_string(struct device *dev, enum hwmon_sensor_types type, + u32 attr, int channel, const char **str) +{ + switch (type) { + case hwmon_temp: + switch (attr) { + case hwmon_temp_label: + *str = temperature[channel].label; + return 0; + default: + break; + } + break; + + case hwmon_in: + switch (attr) { + case hwmon_in_label: + *str = voltage[channel].label; + return 0; + default: + break; + } + break; + + case hwmon_curr: + switch (attr) { + case hwmon_curr_label: + *str = curr_sensor[channel].label; + return 0; + default: + break; + } + break; + + case hwmon_power: + switch (attr) { + case hwmon_power_label: + *str = power[channel].label; + return 0; + default: + break; + } + break; + default: + break; + } + + return -EOPNOTSUPP; +} + +static umode_t smpro_is_visible(const void *data, enum hwmon_sensor_types type, + u32 attr, int channel) +{ + const struct smpro_hwmon *hwmon = data; + unsigned int value; + int ret; + + switch (type) { + case hwmon_temp: + switch (attr) { + case hwmon_temp_input: + case hwmon_temp_label: + case hwmon_temp_crit: + ret = regmap_read(hwmon->regmap, temperature[channel].reg, &value); + if (ret || value == 0xFFFF) + return 0; + break; + } + default: + break; + } + + return 0444; +} + +static const struct hwmon_channel_info *smpro_info[] = { + HWMON_CHANNEL_INFO(temp, + HWMON_T_INPUT | HWMON_T_LABEL, + HWMON_T_INPUT | HWMON_T_LABEL | HWMON_T_CRIT, + HWMON_T_INPUT | HWMON_T_LABEL, + HWMON_T_INPUT | HWMON_T_LABEL, + HWMON_T_INPUT | HWMON_T_LABEL | HWMON_T_CRIT, + HWMON_T_INPUT | HWMON_T_LABEL | HWMON_T_CRIT, + HWMON_T_INPUT | HWMON_T_LABEL | HWMON_T_CRIT, + HWMON_T_INPUT | HWMON_T_LABEL | HWMON_T_CRIT, + HWMON_T_INPUT | HWMON_T_LABEL | HWMON_T_CRIT, + HWMON_T_INPUT | HWMON_T_LABEL | HWMON_T_CRIT, + HWMON_T_INPUT | HWMON_T_LABEL | HWMON_T_CRIT, + HWMON_T_INPUT | HWMON_T_LABEL | HWMON_T_CRIT, + HWMON_T_INPUT | HWMON_T_LABEL), + HWMON_CHANNEL_INFO(in, + HWMON_I_INPUT | HWMON_I_LABEL, + HWMON_I_INPUT | HWMON_I_LABEL, + HWMON_I_INPUT | HWMON_I_LABEL, + HWMON_I_INPUT | HWMON_I_LABEL, + HWMON_I_INPUT | HWMON_I_LABEL), + HWMON_CHANNEL_INFO(power, + HWMON_P_INPUT | HWMON_P_LABEL, + HWMON_P_INPUT | HWMON_P_LABEL, + HWMON_P_INPUT | HWMON_P_LABEL, + HWMON_P_INPUT | HWMON_P_LABEL, + HWMON_P_INPUT | HWMON_P_LABEL), + HWMON_CHANNEL_INFO(curr, + HWMON_C_INPUT | HWMON_C_LABEL, + HWMON_C_INPUT | HWMON_C_LABEL, + HWMON_C_INPUT | HWMON_C_LABEL, + HWMON_C_INPUT | HWMON_C_LABEL, + HWMON_C_INPUT | HWMON_C_LABEL), + NULL +}; + +static const struct hwmon_ops smpro_hwmon_ops = { + .is_visible = smpro_is_visible, + .read = smpro_read, + .read_string = smpro_read_string, +}; + +static const struct hwmon_chip_info smpro_chip_info = { + .ops = &smpro_hwmon_ops, + .info = smpro_info, +}; + +static int smpro_hwmon_probe(struct platform_device *pdev) +{ + struct smpro_hwmon *hwmon; + struct device *hwmon_dev; + + hwmon = devm_kzalloc(&pdev->dev, sizeof(struct smpro_hwmon), GFP_KERNEL); + if (!hwmon) + return -ENOMEM; + + hwmon->regmap = dev_get_regmap(pdev->dev.parent, NULL); + if (!hwmon->regmap) + return -ENODEV; + + hwmon_dev = devm_hwmon_device_register_with_info(&pdev->dev, "smpro_hwmon", + hwmon, &smpro_chip_info, NULL); + + return PTR_ERR_OR_ZERO(hwmon_dev); +} + +static struct platform_driver smpro_hwmon_driver = { + .probe = smpro_hwmon_probe, + .driver = { + .name = "smpro-hwmon", + }, +}; + +module_platform_driver(smpro_hwmon_driver); + +MODULE_AUTHOR("Thu Nguyen "); +MODULE_AUTHOR("Quan Nguyen "); +MODULE_DESCRIPTION("Ampere Altra SMPro hwmon driver"); +MODULE_LICENSE("GPL v2"); From patchwork Tue Jul 13 06:00:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quan Nguyen X-Patchwork-Id: 12372829 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EF06C07E96 for ; Tue, 13 Jul 2021 06:01:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5AFF860FEE for ; Tue, 13 Jul 2021 06:01:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233852AbhGMGEF (ORCPT ); Tue, 13 Jul 2021 02:04:05 -0400 Received: from mail-dm6nam08on2131.outbound.protection.outlook.com ([40.107.102.131]:2912 "EHLO NAM04-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233887AbhGMGEE (ORCPT ); Tue, 13 Jul 2021 02:04:04 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hCOpk1rUqx4zeelDYOK0mlxfFQWv5pqnprKysrkpHtp48G49Khp4vp7vuLGlFMaXim71KpUOVO6cYWJ9mIfgkY8l+YVnEVFbkEht+57b+lm0LzYhJQG7eZTJdzYaQvDmAN/xtA7EQemUJw57kKmHUK2043hQkgj2ZVDmruASowcqegcf1VWIK3Aor50bjX2MOL+sgfkeJ/npRh/MMBmnDVV3Zvr9gEriz/dLhb0eFi/Uwwpr3d2YrOXzGlS5k2x5VeW2XBxoLYLna6eFlXYBf5qVTTZVXSFf32Go/QOuUq7y3NA0OJJlv1Id8my6A/im4McCbIycbzYGrykKvxq5TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lBQREZWovQNCc9Is2Jae8kyMwstggOes3QZqJ2XU5vw=; b=GQPhQN/V8Co/FjwekxEJne2gK+DAfp4UJZTsCi1J6TntANt/Ul93PWynwCAV57wOu78tYe14k0YDdybS6PU4gq52qUG8Jn09u7mwfiiD9l0smGO8T+yy6qFBk3boQ0Ta8C0xvCUxyWsex54njV873gC/e5EMim58tXa3/m2cwkrvWJplAlW4TyMOhjjTwZTk4n11MMp/Le2nrVkDmVU9mdlzP3RLZezKGnczVaUkKS1Dnsj+Taj5kYc7hgQzR7o3+flWoHkcnS8GjM+eP19Pc+58Jzipjslj0FKuExqKNseIXl13ESskwUDN/bL3cIgsKvokxH9FOY9toxwUDhy8OA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lBQREZWovQNCc9Is2Jae8kyMwstggOes3QZqJ2XU5vw=; b=rhCC5qPAdBCtewB7nPQokl+QPW32vqRBkiyFIbs7kFj1deDRxpeCF7x2LdXAdfD3HC63pAmpJBiGq8a+MaHoBu7pN0s7cfuxw/PoOAukZM7p8QgeBLTC7TqYVL5A4AH977NDkMSzpRvETjndiS4bDkIV3EMHslChI3h+PizT9Eo= Authentication-Results: jms.id.au; dkim=none (message not signed) header.d=none;jms.id.au; dmarc=none action=none header.from=os.amperecomputing.com; Received: from MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) by MWHPR01MB2592.prod.exchangelabs.com (2603:10b6:300:3e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.20; Tue, 13 Jul 2021 06:01:12 +0000 Received: from MW2PR0102MB3482.prod.exchangelabs.com ([fe80::452a:24fb:12cb:9d7e]) by MW2PR0102MB3482.prod.exchangelabs.com ([fe80::452a:24fb:12cb:9d7e%5]) with mapi id 15.20.4308.027; Tue, 13 Jul 2021 06:01:12 +0000 From: Quan Nguyen To: Joel Stanley , Andrew Jeffery , Jean Delvare , Guenter Roeck , Rob Herring , Lee Jones , Jonathan Corbet , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org Cc: Open Source Submission , Phong Vo , "Thang Q . Nguyen" Subject: [PATCH v5 4/4] docs: hwmon: (smpro-hwmon) Add documentation Date: Tue, 13 Jul 2021 13:00:31 +0700 Message-Id: <20210713060031.31568-5-quan@os.amperecomputing.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210713060031.31568-1-quan@os.amperecomputing.com> References: <20210713060031.31568-1-quan@os.amperecomputing.com> X-ClientProxiedBy: HK2PR03CA0052.apcprd03.prod.outlook.com (2603:1096:202:17::22) To MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from hcm-sw-17.amperecomputing.com (118.69.219.201) by HK2PR03CA0052.apcprd03.prod.outlook.com (2603:1096:202:17::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.10 via Frontend Transport; Tue, 13 Jul 2021 06:01:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 43451686-dcf4-454a-e413-08d945c39e06 X-MS-TrafficTypeDiagnostic: MWHPR01MB2592: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ngABFzCSVXpF1C48gkIo+YpMZw1nT9BIGjhe6C6gOaBzswQCKhc3p5k/UY029T5COU1z0w6wkOaJFNTrJT8F38VEq4Nu6ZufD9yOmEJK9GDhPGQqJ6VEEToAKiiUAaBQi8hI6TPwBhDrXngXANs/lKqE2pnSnsqPgIVWx068hAZBwSNhpFtzxyFxk5Mtry/4ktqxSN807UmFtZu0ICqWqPW4vaElglRQRAO9TfDE8ber0Gejm/m17aAMyk+KXbCICf7W+Ph3v7fBh6pXpz2F8bONJHsJtJseRk8K4GGj/O1ANQ8HwbyLZftyDwtQ00bgsGwMq87vFALozUWsa8pN3I7GlffNwBHGiYxNO8xWkxCR0xl1VRpDTtNQAp84z18dTv3tE1kY3CiWUed32tT9ENGEofSbUgqmpIUCtqYZ2TmjBR8LfcLkE6jHEyLkCWth4MfrzI5p265mcAQsXrQgyGQoyl0+RAiikCY/7fNA9NR/er78kwEoWfA0wMzrWo9JsbIIbYo71g/c3GX4pjnvfvYdiJjPnYmH/UpbScG4POxcthpr54QV8aULga4zZOjiSEeGEAQTOCG0nmpFIhR2aiddHWwiG/sbeJDb5PAmzfs047vu+UjyleYTeuB6kKK21sS5voLYCHiPi/NUXGx6QQGqKw5qyMxie5qOoxV3OV7sJve2DlM25NxeZNzt4q8rbFYKtfH3Z0boSa6P/BNpfZiUu5EAmU+L+7p1EfsDKJM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW2PR0102MB3482.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(39850400004)(376002)(136003)(396003)(366004)(2616005)(86362001)(110136005)(956004)(316002)(5660300002)(107886003)(66946007)(54906003)(66556008)(66476007)(4326008)(478600001)(38100700002)(38350700002)(6666004)(921005)(6512007)(52116002)(6506007)(83380400001)(26005)(2906002)(8676002)(7416002)(8936002)(186003)(1076003)(6486002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5hpEjD6H4Lg6vH7khlo83nWCYadxF+9CLbC9GTWTQqqhaTvzc4Zd6h26qNQXsAWbDrKZitwmovNYuC94zGQLQR/Ca//v8SM0iuw8nR+6zpheiB+Mc6xo1XgkfdBx9FJjrIKUSGQFcL3ppBli2hS0ebQHsf2rUFdYcsZ4RI4PUR7nljwaK5NKaER6sJFnlfiNoRzWx+HgnB9iammq+4se2970+8LOnO+aCI7/pSrLgrOBQ6iGnzL9ape4lfE2NrfelnuNXZeorz56XMYXtGNdeLoGzwcGaM1YrS+eh5TEQyqwOzWDpzgnk2wvuvgYG7ew+7ikqGUkTxlq+X40oaXldRXcu5BmzPYDOIMJ2ouyCnLwrUhiTUt4Rc1HtSrisBsk1gZD9hAZbXO6IDgiZrnua9Ru7sqEmGc8NjIUYF+GymvffaPw+YxeT/85RANiZ/zdjiAROYp40Tl7PJVh7dRw0k1ARLWwrTiFd+EfochLF2ayX11zRbehPGsjJ68dtgUukJ8ZmwCTWdD+47rDgnNN2yBlsWzSIttGUjdVlhXNG+22P6HaRiTJgkQ0cdjcCvAmeD2XgFda5XHe6XhWLpA9Azg+W+eS7eE4gWfSGMiHYXLr3kS5OQaWpEZ7jflfovmUMm4j9WznIJX7Wm8p8I3KbnUJPS3mpGL+MEBjj7CHmBIgC2vRsfhHxSzgden7Ciupe3jZoZm3WChvG1YIsVZEthpuLLI5X8XxGow8AjGHj6ql2/dDvpthGZnWnmmbBLC0ed3JwRa5jlVvZtdjRZGnj3Ndl9HOKvWO9yynXnxY/alw4jUVL0IQCGGWupmf6V0uslYOlSfj2lsicBCkOZ0BLckyoMurO6yrU9doI3ckP4vGfTJIW1N5D3s4UGmxpx/kfjOAzpS9NUIGimLrjFNYzqBnrayon3+vUhobw2UMCqKvNT66BM/McBty1zOWY2WW+m3U8OW/EMQTow3FNZRrF3Y4VkoLv0x5wauygb6gqiW9oWMmHWJaVg110TbGJ6IfJ+W+0Xj8mCXAEv82Ndwf/cXoXS4jLR434MhrnHSYy5LsGdjA8xTpb+BNgg0ClCcZMNNi+dXekUCHdNBPQE0rIFG7nlsmue162mEtRYMcTa/dwfTZPomUyttapewBT0QpL5ioat4JI3roq766PTCdTUZ6ZbyyPgfAEHy3eCG+id1S0BVNo9yGiNEwMoNUX9NukaO/ygpO5vUaZyeoz5oM5W6GbPwd3buUubiG1y5m20UtA58ZirKfWtG5GNyEZztlFr0Cjy9anfwXoYCUkl6TLF1KP4apA854BE03bb3HPRr4fVIX+v4rSb1VEYvt7V9C X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 43451686-dcf4-454a-e413-08d945c39e06 X-MS-Exchange-CrossTenant-AuthSource: MW2PR0102MB3482.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2021 06:01:12.5324 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vZg56d0yq6LySWPCm0/58v+Bc20f6ZrxKactSTLZ3KtG9mBBFg8ztbDupGW5iGOj+rFhDeDYaG85KdJFir0V2wQeD7YfQA+r0CgTJt0BzVc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR01MB2592 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Add documentation for the Ampere(R)'s Altra(R) SMpro hwmon driver. Signed-off-by: Thu Nguyen Signed-off-by: Quan Nguyen Reviewed-by: Guenter Roeck --- Changes in v5: + None Changes in v4: + None Changes in v3: + None Changes in v2: + Removed "virtual" sensors [Guenter] + Fixed typo "mili" to "milli", "nanoWatt" to "microWatt" [Guenter] + Reported SOC_TDP as "Socket TDP" using max attributes [Guenter] + Clarified "highest" meaning in documentation [Guenter] + Reported MEM HOT Threshold for all DIMMs as temp*_crit [Guenter] + Removed Socket TDP sensor [Quan] + Included sensor type and channel in labels [Quan] Documentation/hwmon/index.rst | 1 + Documentation/hwmon/smpro-hwmon.rst | 101 ++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 Documentation/hwmon/smpro-hwmon.rst diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst index bc01601ea81a..b6579882f51b 100644 --- a/Documentation/hwmon/index.rst +++ b/Documentation/hwmon/index.rst @@ -172,6 +172,7 @@ Hardware Monitoring Kernel Drivers sis5595 sl28cpld smm665 + smpro-hwmon smsc47b397 smsc47m192 smsc47m1 diff --git a/Documentation/hwmon/smpro-hwmon.rst b/Documentation/hwmon/smpro-hwmon.rst new file mode 100644 index 000000000000..f978b1370e16 --- /dev/null +++ b/Documentation/hwmon/smpro-hwmon.rst @@ -0,0 +1,101 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +Kernel driver Ampere(R)'s Altra(R) SMpro hwmon +============================================== + +Supported chips: + + * Ampere(R) Altra(R) + + Prefix: 'smpro' + + Reference: Altra SoC BMC Interface Specification + +Author: Thu Nguyen + +Description +----------- +This driver supports hardware monitoring for Ampere(R) Altra(R) SoC's based on the +SMpro co-processor (SMpro). +The following sensor types are supported by the driver: + + * temperature + * voltage + * current + * power + +The SMpro interface provides the registers to query the various sensors and +their values which are then exported to userspace by this driver. + +Usage Notes +----------- + +SMpro hwmon driver creates at least two sysfs files for each sensor. + +* File ``_label`` reports the sensor label. +* File ``_input`` returns the sensor value. + +The sysfs files are allocated in the SMpro root fs folder. +There is one root folder for each SMpro instance. + +When the SoC is turned off, the driver will fail to read registers +and return -ENXIO. + +Sysfs entries +------------- + +The following sysfs files are supported: + +* Ampere(R) Altra(R): + +============ ============= ====== =============================================== +Name Unit Perm Description +temp1_input milli Celsius RO SoC temperature +temp2_input milli Celsius RO Max temperature reported among SoC VRDs +temp2_crit milli Celsius RO SoC VRD HOT Threshold temperature +temp3_input milli Celsius RO Max temperature reported among DIMM VRDs +temp4_input milli Celsius RO Max temperature reported among Core VRDs +temp5_input milli Celsius RO Temperature of DIMM0 on CH0 +temp5_crit milli Celsius RO MEM HOT Threshold for all DIMMs +temp6_input milli Celsius RO Temperature of DIMM0 on CH1 +temp6_crit milli Celsius RO MEM HOT Threshold for all DIMMs +temp7_input milli Celsius RO Temperature of DIMM0 on CH2 +temp7_crit milli Celsius RO MEM HOT Threshold for all DIMMs +temp8_input milli Celsius RO Temperature of DIMM0 on CH3 +temp8_crit milli Celsius RO MEM HOT Threshold for all DIMMs +temp9_input milli Celsius RO Temperature of DIMM0 on CH4 +temp9_crit milli Celsius RO MEM HOT Threshold for all DIMMs +temp10_input milli Celsius RO Temperature of DIMM0 on CH5 +temp10_crit milli Celsius RO MEM HOT Threshold for all DIMMs +temp11_input milli Celsius RO Temperature of DIMM0 on CH6 +temp11_crit milli Celsius RO MEM HOT Threshold for all DIMMs +temp12_input milli Celsius RO Temperature of DIMM0 on CH7 +temp12_crit milli Celsius RO MEM HOT Threshold for all DIMMs +temp13_input milli Celsius RO Max temperature reported among RCA VRDs +in0_input milli Volts RO Core voltage +in1_input milli Volts RO SoC voltage +in2_input milli Volts RO DIMM VRD1 voltage +in3_input milli Volts RO DIMM VRD2 voltage +in4_input milli Volts RO RCA VRD voltage +cur1_input milli Amperes RO Core VRD current +cur2_input milli Amperes RO SoC VRD current +cur3_input milli Amperes RO DIMM VRD1 current +cur4_input milli Amperes RO DIMM VRD2 current +cur5_input milli Amperes RO RCA VRD current +power1_input micro Watts RO Core VRD power +power2_input micro Watts RO SoC VRD power +power3_input micro Watts RO DIMM VRD1 power +power4_input micro Watts RO DIMM VRD2 power +power5_input micro Watts RO RCA VRD power +============ ============= ====== =============================================== + +Example:: + + # cat in0_input + 830 + # cat temp1_input + 37000 + # cat curr1_input + 9000 + # cat power5_input + 19500000