From patchwork Thu Apr 22 09:08:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quan Nguyen X-Patchwork-Id: 12218087 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 B165CC433ED for ; Thu, 22 Apr 2021 09:09:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7C6C46145F for ; Thu, 22 Apr 2021 09:09:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235592AbhDVJJt (ORCPT ); Thu, 22 Apr 2021 05:09:49 -0400 Received: from mail-bn8nam11on2128.outbound.protection.outlook.com ([40.107.236.128]:5558 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S235535AbhDVJJt (ORCPT ); Thu, 22 Apr 2021 05:09:49 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f69BRt8hoil2Cl5XG2FneVts0RNVyeo4kIghU/7/hBTVVASVCfhAEOqALGqGcQKVdEWKSkxOP3L25qRAE7kf1ukLOCP9cXzj8ftKJncIpPEi6r/7OKhxUwT0NyAOSv8klZeY+D8hXYnP38rr3AcosZoBy7kDs4c4FH4e1gpSjJ2qPgxsMghByb5DIDEHakLS1JHPa2Z0y3YK+jizW+kgOAmI+K/lMiiJpJJbC4xmJeMpx+c5nW6Xb2yKujDXOdWsowjXG5IG6cEDj1fBSXDnlCfNBW8iyb4gd+p50MiWCfQEMTQJKJ7ilsaoaAIyMc8f1V6GkmhC/R6Mi1atP//4DA== 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=TvsFEWtR7/OzkGsfwajmEBUP81MrV2hyr6yOzzEqSCU=; b=g4i+2i/moad6eBasnMASVWwn5gptaK4LFJlI6tEzmobkwia/L4S1GnFYBdlY8fRZau00Y679lvUH+f/OD+BMd3nBPfWAIxz1J7sJ7F5wh7IijCZjP1oTIpWjW/Gwuizo6UrBhNppqK+HwoOYODUQCWQkiDg9Md5qrAkBHwnRwAaf6xtdNKDPaIxcp2Mn55NRVpHKHNfVL4dhvuM7fuhsNRDW6Kproe29XjDq6ySejWaJeZ9OoSdoKIEEw3X+COzE6ozjWGz3aE92RJKHxwwfrBtK/VGVSMvA3EerP6MK8pR7JixAlsi6ujKDmbePwRCgLFZzb4Hvqq5C/3KVW4BdYw== 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=TvsFEWtR7/OzkGsfwajmEBUP81MrV2hyr6yOzzEqSCU=; b=mhdDYm6oCqgd47q/6Z7mUzrTSRKtTVp/zVTgm3G7x/a3Ryz5vea10FH9wXXxCRSNpL/uA2fSA93AWq+YUt1MDrq0z2b0PnrucszSQcaQ4MFU/t+QOvlHf8woy7qS8B394Z0ME7BwFAU2kvV73HDM+iy05WT0wjHnbwTRHHdjTQU= 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 MW4PR01MB6356.prod.exchangelabs.com (2603:10b6:303:66::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.16; Thu, 22 Apr 2021 09:09:10 +0000 Received: from MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503]) by MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503%5]) with mapi id 15.20.4042.024; Thu, 22 Apr 2021 09:09:10 +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 v4 1/4] dt-bindings: mfd: Add bindings for Ampere Altra SMPro drivers Date: Thu, 22 Apr 2021 16:08:40 +0700 Message-Id: <20210422090843.4614-2-quan@os.amperecomputing.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210422090843.4614-1-quan@os.amperecomputing.com> References: <20210422090843.4614-1-quan@os.amperecomputing.com> X-Originating-IP: [118.69.219.201] X-ClientProxiedBy: HKAPR04CA0011.apcprd04.prod.outlook.com (2603:1096:203:d0::21) 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 HKAPR04CA0011.apcprd04.prod.outlook.com (2603:1096:203:d0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.22 via Frontend Transport; Thu, 22 Apr 2021 09:09:06 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ec5a3f3e-c2ad-44fb-14cb-08d9056e4a2e X-MS-TrafficTypeDiagnostic: MW4PR01MB6356: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:765; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Rz1MqroghHi6Qv/VN6stBFYZkDYMI8uNOfFzQ0ZLrBWUd4uVhvNqLdeTlSPCwKDpFQVfxyxO5uelHX5MOoK/EwyGF65YSfsXADMPf1hXR0od9jtm5L+H5wceRzwkRDHeJaa7I+SVBvSyu163oQTjjVNwIC4Aq6FdAbH9dqv2s2qYjStQvvdECyCnlamNr9E84phnJIDUU9pWmBNVEz0cs+yS4T/enOdOU1GePAdM1ZjDeDsqGJJd6U7ZIFkWUuG+AaZOQ8JFmYxsPr2GdDAtDo8D/+vYusvRfblAqrDTZHr2QgVKol5rtcRfxXc4o4/Ew67x2DQ0eS/9pJvn+IX9AwtxZD3EUA6gdX77BDvYHYBgLCKmnoL00fer4ZvXniFvQQJviSgtek1wvF83lNJ7g1fHonMDYWddzPIf16LZq+O5REI+M2jnFYnAXnCEbQ4sURoZIllISne3AZDhHmCty8Z0hgLh8fEYB28s3Vi4laNQA8hCTlqFz0QYLX0L+jpLn8t9htsfoHAZGjRrtOj7r0F6sdWX3MDrJbt+Iy9fPNWdxsZ5ATPy6+JhGRD5c1kJWTdRNgKlGFHHrzjrnRRH/ROl9EMO2gGGyNcLDFPGQLQtBSjp37rGelWqf+9o0K49ibRSJ7O4BFRknQyIuvcU27z6w/7Y6mF19bm7wGxSIcQK2H7rOY5DGVZR9h5MaTppvilZzivNW/B34Av9thDALw== 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)(396003)(136003)(39850400004)(376002)(366004)(346002)(110136005)(38100700002)(26005)(107886003)(5660300002)(86362001)(956004)(2906002)(6512007)(1076003)(6666004)(316002)(8676002)(186003)(83380400001)(66476007)(4326008)(16526019)(66556008)(52116002)(966005)(38350700002)(921005)(7416002)(2616005)(8936002)(478600001)(6486002)(66946007)(54906003)(6506007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 0LkDuBovKvIdhraorrp0/0rlFg86RvtgOgdTm0pFXv6aZHH3MKo5rRBhyxNKXFaiFDb2+b9pYM8lvWljZ9RV8XN+b7Pt1CzUmusUZaXTmvtamU+g8WxGxtg4yNGowyrMcUDwm9fC3D/CDc+q2xNihJ+84Q9ZWBZaN2yMBu4y6iH6a02/TNYOqPwFSlCtlb7wA8c3ik1Dgjz3J6AYe9vpUQ7yBSwtubhpJpczkocMPR3kV7L6v9WwcHjnQOUE+shNZ/Qcyp6RoQ7nMuhCbC72GBADTRg5hUzb214t7OvFcpYfNb4NdK7VkSrnBKBQVBC/fzj1KQVK4YczJHKzVb7mRGA/Bg0l5YCA5+9D7vpXJbRum10WVfYCj9hBvTpnbU5TO5HntWiffqAeUPRL5gT0LLMI1gn8XNEC1QUWYhd6hNTzTalzS2HmcsaNUBI+/gDXXYLBkqaFxHT8upQcCb6WAWws5ogU7A+M4BXO5WLT8crHTlu7unJo4oaVumBB+AIprDgPft3kaVdgyJh7Xf3pmLRYIKOcYWdy9nOSMbWxMDhUzSB8TBrN25qK1etxjSaPTIVDWpyoNiV/1zwYq14hptsQEp0KDCL/8Qk6ZhsvN/m5rt5/WvdFAI1gkdCxqvAIbbuAuQfopdw3jJkKXr2Q7WsqSbJ78ffjj8In0GIFUMtJS9tW/dtSVqClHJhlpa2m9BHrS62QE69DHLJGqszub4oqg8FzzwH9iOxw3p5H6qcGVypoBCTKbOrQhXbWr/NA+MYoQQJOWa7MKdbaMqQVb2Px5fHicFQJHR/v/xxWb3yVbjaElFzHPll+bVNcxlvRz9sIfmTr/b3sIUKXFMztytvrQAG/3Dxn5AKEBSJYWAWPqJfLVri3nQYYC2M+rrYrzcZgD+ACXzUPwiDzE5xrnepFG6QFb6ZQjzvppGcS/TZIoP3fUST3RUhG7p1qR5zdRYuBmTkwpaZpYnKfpye5OzUupDX+au/OGDgSHazflOsLPRHK1o6zW4OmU5373/xL7fAyK0K2xDarBvu+zTKWv7uYGR5ACqm5xMFSSXd8Q+wi9I67J6hSwTJBkRXu4wmi3lnY7XXMnjFngl4CGXTJt7Q1+bmmvKYjZXH97xpCDQYxj0o4eJt+YN4rGhUXwe0qzVItD3CGOMl8upGchf/TLkvDm/sERMXLvQpk3u8myVc/cIzPT98UzHnhjD911oa/2x+quLqmMSruTMGH87hxXJQ4XwLL68ArKcvo/JG5gecG4LRrIwv7DKFjxsktiRDOqqhh1nu7i3S8N+DftIVrYcpbKBXQk26ifEgeGKroNJ0dGEzCnYe9lLhCTICaMkWa X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec5a3f3e-c2ad-44fb-14cb-08d9056e4a2e X-MS-Exchange-CrossTenant-AuthSource: MW2PR0102MB3482.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2021 09:09:10.2688 (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: otNcfXVF4Rp1LGELML/VfgnMW/raX6/rkNtMT4C+RwoTqF92UiP+ytbl1p/B8/W6F5NQ0RDsqZKu5qW5Y7bfsMyqznCEPKpwPEtuZaa0iqo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR01MB6356 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Adds device tree bindings for SMPro 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. This parent SMPro MFD driver creates a single simple register map to be shared by all sub-devices and leave all the specific to be handled by the child drivers. Signed-off-by: Quan Nguyen Signed-off-by: Michael Walle Signed-off-by: Lee Jones --- 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] .../bindings/hwmon/ampere,ac01-hwmon.yaml | 28 +++++ .../devicetree/bindings/mfd/ampere,smpro.yaml | 105 ++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/ampere,ac01-hwmon.yaml create mode 100644 Documentation/devicetree/bindings/mfd/ampere,smpro.yaml diff --git a/Documentation/devicetree/bindings/hwmon/ampere,ac01-hwmon.yaml b/Documentation/devicetree/bindings/hwmon/ampere,ac01-hwmon.yaml new file mode 100644 index 000000000000..fbf7ec754160 --- /dev/null +++ b/Documentation/devicetree/bindings/hwmon/ampere,ac01-hwmon.yaml @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hwmon/ampere,ac01-hwmon.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Hardware monitoring driver for the Ampere Altra SMPro + +maintainers: + - Quan Nguyen + +description: | + This module is part of the Ampere Altra SMPro multi-function device. For more + details see ../mfd/ampere,smpro.yaml. + +properties: + compatible: + enum: + - ampere,ac01-hwmon + + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false diff --git a/Documentation/devicetree/bindings/mfd/ampere,smpro.yaml b/Documentation/devicetree/bindings/mfd/ampere,smpro.yaml new file mode 100644 index 000000000000..5613c420869e --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/ampere,smpro.yaml @@ -0,0 +1,105 @@ +# 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 + +patternProperties: + "^hwmon(@[0-9a-f]+)?$": + $ref: ../hwmon/ampere,ac01-hwmon.yaml + + "^misc(@[0-9a-f]+)?$": + type: object + description: | + This module is part of the Ampere Altra SMPro multi-function device + to support miscellaneous features + properties: + compatible: + enum: + - ampere,ac01-misc + reg: + maxItems: 1 + + required: + - compatible + - reg + + "^errmon(@[0-9a-f]+)?$": + type: object + description: | + This module is part of the Ampere Altra SMPro multi-function device + that supports error monitoring feature. + + properties: + compatible: + enum: + - ampere,ac01-errmon + reg: + maxItems: 1 + + required: + - compatible + - reg + +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>; + + hwmon@10 { + compatible = "ampere,ac01-hwmon"; + reg = <0x10>; + }; + + misc@b0 { + compatible = "ampere,ac01-misc"; + reg = <0xb0>; + }; + + errmon@80 { + compatible = "ampere,ac01-errmon"; + reg = <0x80>; + }; + + }; + }; From patchwork Thu Apr 22 09:08:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quan Nguyen X-Patchwork-Id: 12218089 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 61D8EC433B4 for ; Thu, 22 Apr 2021 09:09:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2D93A6145A for ; Thu, 22 Apr 2021 09:09:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235599AbhDVJJv (ORCPT ); Thu, 22 Apr 2021 05:09:51 -0400 Received: from mail-bn8nam11on2128.outbound.protection.outlook.com ([40.107.236.128]:5558 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S235491AbhDVJJu (ORCPT ); Thu, 22 Apr 2021 05:09:50 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lDhSMjpKMl9de0zCVO5/m1a0MeKlkdwAV8W3PkTGhALGJBkELUeAt8h4WoW45WrYGEoJACI+94QG4lz7hGI3JpeKHc/y/Q2JRoULng+7IPWgoAZqLuiMZdrYowOYSKsVr6JS+2/xODGkqINNLTmtPvqHMtcHmYmySxs6SUCNOxXuUTecYKRNmrcwB8MQvG/MbAUhuffQs2tBLNVugV71/g2OboLtbuBnRixgd15wOAYuh+4mzIeFL5uO9JD4nh6i7vNkzXhm/6QJjIsYEdeYoeXA03dIrMOTtRl1rkMLlTdsaMRKOEIkU3VuIreRdRGawmtkajeX7U0njsJH7evM4w== 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=ORDiNLCx24eLLZ2e/hdi11I+0SG2S7JQgFXHc+FNmS4=; b=Myvh2H6Yfnij08rcP6H36UbsNW+Bho2JRNWZIkDJTHw9u1q2Q9fvTc8jqKxN65VRbGakL1z81eNI2GLoXD/R9xdwhsgbDN/bVZkTkX7dQdGVle/AUqjGig1/ljTgshWLrZSnHL6zaZuc61h2C0RowmDM5T1VDtP8Kscz9+02tD9HYwXMwoEZNcPEVa7OZKOUpj/1iWf2QJAb3iP5GvtFSXRsyHrouc7dzQSww/cYTkFlXDxbjdCqW4YfZKYhPYcA9OjU3rD1k1riSkp3fGgFJsqyFFelxTojOMqYTd21HWMTtO4i1+TqVtMOdSg6BExRm8DoXnpS5Ba/4CzUwHaLZw== 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=ORDiNLCx24eLLZ2e/hdi11I+0SG2S7JQgFXHc+FNmS4=; b=q12zZJKK6KKoNkjW+aRq6yxHD8+wg7hDFO7zVEXKIxZXmaVxNo0Aa95SecPia6DDzO5B73rbF3F4+oTXAp1/C7R9UlzdZOlFtLjC3ywmHFTa90k/NqeHmvvbvn5xt/WbTtY/wzZcGiMD6Z9fpgb6663YI7q5CE5qxTF+XplgqCE= 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 MW4PR01MB6356.prod.exchangelabs.com (2603:10b6:303:66::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.16; Thu, 22 Apr 2021 09:09:14 +0000 Received: from MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503]) by MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503%5]) with mapi id 15.20.4042.024; Thu, 22 Apr 2021 09:09:14 +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 v4 2/4] mfd: simple-mfd-i2c: Adds Ampere's Altra SMpro support Date: Thu, 22 Apr 2021 16:08:41 +0700 Message-Id: <20210422090843.4614-3-quan@os.amperecomputing.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210422090843.4614-1-quan@os.amperecomputing.com> References: <20210422090843.4614-1-quan@os.amperecomputing.com> X-Originating-IP: [118.69.219.201] X-ClientProxiedBy: HKAPR04CA0011.apcprd04.prod.outlook.com (2603:1096:203:d0::21) 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 HKAPR04CA0011.apcprd04.prod.outlook.com (2603:1096:203:d0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.22 via Frontend Transport; Thu, 22 Apr 2021 09:09:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3655f894-4e1f-4cd0-f0b0-08d9056e4c96 X-MS-TrafficTypeDiagnostic: MW4PR01MB6356: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 10tuTmfynHEYsMt/rOoriw2qM6rl2jhjyAd1zVDKQ7wmE+za8vCMQzOIi5eyOXpS52YzdsM8SISDFk3auuFp9l+piitGrEog+8SrjPXu1j8r+B8AnH+HiRaQ5FxeZYfuggPKJbkqy4lrPJveoZ/IT30A1ypOf/HjmpKASLFZ/FjPnWpsDWqpY308wid4LsmBC8RMagKO5VPz8RMusDODjSDBlJIhDZpTz9pH6Jut9IJVy0s1EcSxsJVVeLn5mY1kXri0nzZwBI4sORqHTZkbpHUdFvhftO+YFVp5o4g1CZeBtpysMwLbMrfzvZvvQLp6+AeLKnCBUtdsJlrQnsRmNR09F82gjne9/vmm8+LqmRoI+uveaS4QqSNQvH2IODP2kNLmRtjIsxzsng8eJmBPdISFv8OL8KT/z7FQzyKoYhUrgDfk00DYh6GwjFA4H61ki/JjN2PyMTM5xpxmPIG+vatO4a4y5l7E6wmzaIFsnsK9a4LxD+F5CIDp7l8UEh6Ty3jlszQi6eoCP81Ghrni8FVhAPqemu3vopLM5BzswtAPXjMpshjUlbVessJoonuEt2RgML5NP61/QHjbw03TE4drJ0qr6mSR4L1NZ4gPD84Apn9R34/Huxkb2rGfXd9r0kWUtd6JfMINt55FOYIr+BbkVHeXzIHK+pGRLnvfCVY= 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)(396003)(136003)(39850400004)(376002)(366004)(346002)(110136005)(38100700002)(26005)(107886003)(5660300002)(86362001)(956004)(2906002)(6512007)(1076003)(6666004)(316002)(8676002)(186003)(83380400001)(66476007)(4326008)(16526019)(66556008)(52116002)(38350700002)(921005)(7416002)(2616005)(8936002)(478600001)(6486002)(66946007)(54906003)(6506007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: +5ueedYNwe5PVd0w8YlvmGIC6zyLtK0nr+ebE/G1zJb0kifHB7C1szmSKiwm610NlLAkBVekKj/sbGOCBdzsl8+a065w2yTA1bGSHLQfMFKP08imCnAPjHHYhhE7oMAAc3vOAWCdMKUHf0vf2mQpUz5JCxsz3CczdSu7NxECaPp1idA0yXzlUGfN664j+y5Nn6kECBCp+0O/kHkvqgVWOl/KCgnaXcnzFqWWXJMwKYyjkYT0hPIC3NCSLfix7Lf+3/srgpaSjYcrsPnTyAaHLF8b/Kz/QciXaQAUftnR+hd7pxyEqEvR4uIzx86lJs5WN3/lalO5PI2f34M/n3NsYY7+iMU+vuD5VaHFKDzEWb1Lmr30AjHi0pf5tQLc29Z054tdKtGpx2UHGpNv4/+bCpdK8Ajel6UHKL1oKGk1gNMNhotarCKpLHhFCiWHXeP1ykl1yUp0ZzdofWl9BkV2nC+HN7yCjgAcxX5pJvMFig+2sEqPu6S5gDovtSLKbRaK/GgE6+C5sSfQRbnWGYyhaULQSXi+bdgZg7hpqNXBRoU2dirMsFYJeinj8RZKIsU7mOftip+4kvEdBTnApOrcEOy8Fd1XzGK0Yqn8RxmktElSvD2nLv6K+UpoM52tut916AXkeuUyl9kV02A/deo3KWE9zjQRmuNPCv4cZ8V9QIiRzFz2ov+L3dPM3lehgXv0itXyRIVk7MJgbDqO1zJ/QUs507LDSWtKfEcIyukvZj8gHzDaV6m/PK8bvDk7l6m9OB6+ZziFif/KOU8xZNp2UBVaBro/NN3EOQ/ZkuB9NfNTbHRRxUsS3YIfu8w3pwojuS4nfJt0kLEiMMXL0pz8e60cvp2Dz5F00gJM83UkFe6VvGqIWTshA+0YDy6sYFqpYPbMjY1rjr/LubhzIaFDVZ95aamFJGBrywT8iyJL40zELAdkYvx7ILy/M3Erke9JhyNxyoN6OaVdgR1amhZYFsaWf6SKW7ShM5aTjm3uRKbzhKDaobNMkqDiUTYzCNy+iv4a1KtcXYRZWSIl8RC8Sn5gtejQoEhO74ClKPYZsPiLQt9LlzN9p7iyRdZINy0XQo8NdEiVi8+2/l0H3Dh9B/2rTTK+UMBW/LnZZOWhzPPhcVWrLmlPjPJvVMqscWn82ivsE7PfJIkS9LTkYpiDZbNvsja2Au1oOBbayIE6WRcBHcINJMPvpXV/xZQ5D5fdHjUOrFkLDGkbpq+d/Z62Vr4dNKE/eonCj1DCcqopE/dQ7aQjqMgk94boFeW6x4Jxv8oqT9eHrKveXFkz1B35WFL8UO6bksCR+XG4uzTcJbNYpmb5UuMA2h4E1DUgpMYB X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3655f894-4e1f-4cd0-f0b0-08d9056e4c96 X-MS-Exchange-CrossTenant-AuthSource: MW2PR0102MB3482.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2021 09:09:14.2655 (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: ZTqErKle1wBD2DaAOMzDizLwdIpe9REkEvCplSquvh3GKx4POtMeVwNZ+jgKf87MGMRb3vPIldI7H1J62zWYpA0a/mmYLdRBB8y44Xoibvk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR01MB6356 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Adds simple register map MFD driver for SMpro co-processor found on the Mt.Jade hardware reference platform with Ampere's Altra processor family. Signed-off-by: Quan Nguyen Acked-for-MFD-by: Lee Jones --- 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 | 11 +++++++++++ drivers/mfd/simple-mfd-i2c.c | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index d07e8cf93286..10713b0e260e 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -77,6 +77,17 @@ 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_SIMPLE_MFD_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/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c index 87f684cff9a1..9a44655f5592 100644 --- a/drivers/mfd/simple-mfd-i2c.c +++ b/drivers/mfd/simple-mfd-i2c.c @@ -21,6 +21,11 @@ static const struct regmap_config simple_regmap_config = { .val_bits = 8, }; +static const struct regmap_config simple_word_regmap_config = { + .reg_bits = 8, + .val_bits = 16, +}; + static int simple_mfd_i2c_probe(struct i2c_client *i2c) { const struct regmap_config *config; @@ -39,6 +44,7 @@ static int simple_mfd_i2c_probe(struct i2c_client *i2c) static const struct of_device_id simple_mfd_i2c_of_match[] = { { .compatible = "kontron,sl28cpld" }, + { .compatible = "ampere,smpro", .data = &simple_word_regmap_config }, {} }; MODULE_DEVICE_TABLE(of, simple_mfd_i2c_of_match); From patchwork Thu Apr 22 09:08:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quan Nguyen X-Patchwork-Id: 12218091 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 2F23CC43603 for ; Thu, 22 Apr 2021 09:09:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E04B8613D5 for ; Thu, 22 Apr 2021 09:09:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235635AbhDVJJ6 (ORCPT ); Thu, 22 Apr 2021 05:09:58 -0400 Received: from mail-co1nam11on2132.outbound.protection.outlook.com ([40.107.220.132]:32390 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S235612AbhDVJJy (ORCPT ); Thu, 22 Apr 2021 05:09:54 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cJXVJhZ5tBgW32eno1Sa98R6aBUjDlP7/7oLuNWCAYPURdWLTsox7UE5Bdtl1jFEG8wYLaFUDvsJ+Ypkmxzz8CwzBNBqJVCK1tiA8xZqzfNOZoYU1qEl/cGc97NAjGBZ5iV8JK2ZFw38OW+eDyDj9HrvoEuMllP8kL5dXF5FcDcxcvw8EGC6dbFuvBkaI78jBsGeqrQ9Z9lrvEUvEZkSqCWeXSw44nD97beim2+9Oz9RDitP9BKqTVdApcSQ/Z81mFg+BGGUuq8xGYob/T5yUSk2HyQhCnjtSOAw8wEXS/ahavZB34SiYcCfvxE5Fpp59BynOVT2saMXzSdZ9aIblg== 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=RHtZZScaAQ4w+1Op5oHwedgahJ+rkBXX1HxSVVtbzcc=; b=NW0hCDrIgeCSe+KZeJRjSUHpAW6Nx+OaW0Ai5izSZCrHldAnyD+rHgafiqigNFwg1w69i/LdihGCtn3IaBswsEJDEN6R+hM0aDlPCf0JfcxL0s7T1JnrUzqb5ybFPJsQ4Jbgb5Td9TQVvm8tCMd/u6tUAJC4bM/4Ewv/1RAzCScqSZL4XK5+j10GLUTZm8z3qfkI8jutcrvBJG4LAmzq4Dz+rQlay31EyCjEez/5HbUXx9wNYl6z0ZZGx5yec7SB6brYmPB8VGfnE92cpsyn/QlLmUaGz87c+j02Mffz6pRDcegr1f31XskVUC2hmdl1oqKkvquQE5sR2myTU+UIug== 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=RHtZZScaAQ4w+1Op5oHwedgahJ+rkBXX1HxSVVtbzcc=; b=drRg57wu+u14+XtcrY88YZSTKJA1CsPRdrVqZeoZDzTTVhl9+zL2ipuwbKxCJ5nIdXFDUYpUdFmLt+a2o5imQCAQpfFAIuMY8gGHlnPFZDs/nmRPvL/b5pHk+/eyQ/t4XVmWMc4sre9+AZVsIvbzqhy6EzmuBiyKL/B6WDTZKaU= 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 MW4PR01MB6356.prod.exchangelabs.com (2603:10b6:303:66::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.16; Thu, 22 Apr 2021 09:09:18 +0000 Received: from MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503]) by MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503%5]) with mapi id 15.20.4042.024; Thu, 22 Apr 2021 09:09:18 +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 v4 3/4] hwmon: smpro: Add Ampere's Altra smpro-hwmon driver Date: Thu, 22 Apr 2021 16:08:42 +0700 Message-Id: <20210422090843.4614-4-quan@os.amperecomputing.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210422090843.4614-1-quan@os.amperecomputing.com> References: <20210422090843.4614-1-quan@os.amperecomputing.com> X-Originating-IP: [118.69.219.201] X-ClientProxiedBy: HKAPR04CA0011.apcprd04.prod.outlook.com (2603:1096:203:d0::21) 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 HKAPR04CA0011.apcprd04.prod.outlook.com (2603:1096:203:d0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.22 via Frontend Transport; Thu, 22 Apr 2021 09:09:14 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c1f086dd-5bcd-421e-1b50-08d9056e4ef7 X-MS-TrafficTypeDiagnostic: MW4PR01MB6356: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2276; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M3kmuZtV21gIGOjOEr41DDQm3+mCAX+f/HQaaoT93WmWUKn1y+G9lIH1pcrWo4t8upPj+IZxfsD+1b9F14hC9SgeOUcNjyVZVWHpHshb9/nNe+u2sx/XHvuJs4vjy2pDv0UGKS5Cm8O0GE8sjxUe2d7s7FcUKmzVRk9I+fPO/kHAtFRHliJGc60vRpR9RC2mB20mNeIVR69nyr7MVGqi2N1nfDdEj56xFJ+ikC00+ANMZwhfGo75AZJQ3gfI7GetyP3bFDLlzQW/n6/jmwrEj7pyqQn5Hf5OP7T6QmIz4JJxD06OxWrgyB8IfS3T20qkSmARNuHm534j8TgrN9P/EJbj5CMc+crYVZNjcidMmecIUNo5um3ZqA4zf97uRtBlDPIWkPDiaEkLI1IbM3pY6JDtOI72LzSKQG7nBCD+jHVmY627DRgSwVukgk8hXfURZ5uxTRYLqW4eiXG64EFNToi1TlcJxe6vfc/XmiU/qfM6UEHBBubzAirajyEbt89h8tVAHUFzGnA6gaDEdasQAyr6WyLJT5GmTAJrByMll2cvpfL3J0o+1LIPTI8glI3mSBPV78gyKfB83Dl4HsBn3XKXBqSSNkhUxfxSu7/ydenIQGG+eSZy4+p4G+4kuYy4eYoh00yeZX5yku9YTIZe43oxp1vU1r9dKAvMxuQUUM8= 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)(396003)(136003)(39850400004)(376002)(366004)(346002)(110136005)(38100700002)(26005)(107886003)(5660300002)(86362001)(956004)(2906002)(6512007)(1076003)(6666004)(316002)(8676002)(186003)(83380400001)(66476007)(4326008)(16526019)(66556008)(52116002)(38350700002)(921005)(7416002)(2616005)(30864003)(8936002)(478600001)(6486002)(66946007)(54906003)(6506007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: Mlt1PfaR/+ar/fPeDUDY/wBH5SHb1OgN6LAVkZ2l1G8NvFtQyNWyXLmDN+K7sugLnZEwzHuuHqjOU+K+weDw+KELxt/PaxWMBYPsf2NrBNGHwM++yAe3n2ne/joG0GhPqimrq8BrB8n0I5ID8kvjvlm1PHL/KeEBztafvv2u3Pk1YWI8UW/x63dtzSKPnzrQZ/LJ+GY5fWuVAXBXVB5ZLrWH6cuUCmNwreaBHE4GbNTd+8oIlpKkq/QlXZzCYbanR8wPFYF/29d8DOclBXA/DeC1uxl5PSGCwl6DEpCR7eXLMGf+zb2ua9o9rxSfV5BdKem0KqLnZ4wYZYyeZu6qhtPZ8EHAVIdi/SuKDI6mE6W+FrxvwqxYfZ/uRz2dkgrfqeGh+Vz2Bbz39v9DfD56gZyNJqziP+2GKjvtzDJ2ZLrmlyfbHExljuXQQglsAZxp2aVUsa0KVYknucRf/bQDTeknm8NnSfKmATA2t5FPi4RjI1Xe8lt6nwuH6zN8t28wDnN6B+bWztAblfgkc1TkxJe/P0TEb6QlpR9Ky6kuTM9h/rUClD+vZV34eZYvYrJHTPkP9Xk91qfd1ZKbIefe3pAlo/NNt2QMKMCaxhYIS2HorOd/hZ5DPs+IkczDWBN7WD6Um9Bi6zRc9f7xd+cdSIdxGiEDuplYOGcId/SrEL8xNjvsXdhXcBxxIaTe/z3g8n7vqzsA7bGOLtdoKSIzQtMWNCfAgYLRp1twJTG2dV+HXsPkyHeaBIQPtvt7kh5+KtmLCNBpqpuNws/12CSd0VzOLdusEgMkOiuRz6LxsAqpBuxuobqMQKYBO4kmjE1b1cVY77peBdMgLdnEOnH4AQQuIo3C6Jil21BaHxaDAAg6/OF6OdROu/UfzJ1UbcJpQSA5ui/tRbBkGPsW0gmm8OtrvAMqvYCRDcCY9fKegGDlwb64OO/ec6rbnWxtbUrtcrxG4g9GdTb3uGzvnnYdsxFVYW197V9njKr3Sf//ery7FYgZJfjQPNBMb8gSxWRfx9ukpJORH59ltvtbx65xHQW8LiuXMMPsIvFwJVfbVt4VnPchrcQWI+FSIqNoS495e+DhN55EJugWdOQuOJMci4k2FqBM0EiWMqw8B60M7o4xSIbVylDgWCfouqXPI6kvFmUAc6EEIS821r6csCUOxQsJAuhWfNM2Pux5O1AnolpHwuqdkscPK+O1OSArfXRRgPRrx8MMfqcoS71zJHC5YKIMDzz+eueqbHuDRCrZMX5fhc+jmkCi+k8fV9bBd0BTSibSfMnATZ3jiiewco/H55Id/0SoBbTy2atGql8o4FFxj2PGhpb/TwgJQbBLmkfe X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1f086dd-5bcd-421e-1b50-08d9056e4ef7 X-MS-Exchange-CrossTenant-AuthSource: MW2PR0102MB3482.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2021 09:09:18.2652 (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: SWDJRFtQXs73EdZ78nPAuK25OSxj/rfC/a6E9kGSoErnn149zoZI5hb9LNFHa1za+3/u6AGNxhNEvzVfnfGs6KkBKYpf0JKCpyMQavHtlhU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR01MB6356 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 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 | 491 ++++++++++++++++++++++++++++++++++++ 3 files changed, 500 insertions(+) create mode 100644 drivers/hwmon/smpro-hwmon.c diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 0ddc974b102e..ba4b5a911baf 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 59e78bc212cf..b25391f9c651 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -174,6 +174,7 @@ obj-$(CONFIG_SENSORS_SHT3x) += sht3x.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..1be3d98e73c7 --- /dev/null +++ b/drivers/hwmon/smpro-hwmon.c @@ -0,0 +1,491 @@ +// 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 + +/* Identification Registers */ +#define MANUFACTURER_ID_REG 0x02 +#define AMPERE_MANUFACTURER_ID 0xCD3A + +/* Logical Power Sensor Registers */ +#define SOC_TEMP 0x00 +#define SOC_VRD_TEMP 0x01 +#define DIMM_VRD_TEMP 0x02 +#define CORE_VRD_TEMP 0x03 +#define CH0_DIMM_TEMP 0x04 +#define CH1_DIMM_TEMP 0x05 +#define CH2_DIMM_TEMP 0x06 +#define CH3_DIMM_TEMP 0x07 +#define CH4_DIMM_TEMP 0x08 +#define CH5_DIMM_TEMP 0x09 +#define CH6_DIMM_TEMP 0x0A +#define CH7_DIMM_TEMP 0x0B +#define RCA_VRD_TEMP 0x0C + +#define CORE_VRD_PWR 0x10 +#define SOC_PWR 0x11 +#define DIMM_VRD1_PWR 0x12 +#define DIMM_VRD2_PWR 0x13 +#define CORE_VRD_PWR_MW 0x16 +#define SOC_PWR_MW 0x17 +#define DIMM_VRD1_PWR_MW 0x18 +#define DIMM_VRD2_PWR_MW 0x19 +#define RCA_VRD_PWR 0x1A +#define RCA_VRD_PWR_MW 0x1B + +#define MEM_HOT_THRESHOLD 0x22 +#define SOC_VR_HOT_THRESHOLD 0x23 +#define CORE_VRD_VOLT 0x24 +#define SOC_VRD_VOLT 0x25 +#define DIMM_VRD1_VOLT 0x26 +#define DIMM_VRD2_VOLT 0x27 +#define RCA_VRD_VOLT 0x28 + +#define CORE_VRD_CURR 0x29 +#define SOC_VRD_CURR 0x2A +#define DIMM_VRD1_CURR 0x2B +#define DIMM_VRD2_CURR 0x2C +#define RCA_VRD_CURR 0x2D + +struct smpro_hwmon { + struct regmap *regmap; + u32 offset; +}; + +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, hwmon->offset + temperature[channel].reg, &value); + if (ret) + return ret; + break; + case hwmon_temp_crit: + ret = regmap_read(hwmon->regmap, + hwmon->offset + 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, hwmon->offset + 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, hwmon->offset + 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, hwmon->offset + power[channel].reg, &val); + if (ret) + return ret; + + ret = regmap_read(hwmon->regmap, hwmon->offset + 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, + hwmon->offset + 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; + unsigned int val; + int ret; + + 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; + + ret = device_property_read_u32(&pdev->dev, "reg", &hwmon->offset); + if (ret) + return -EINVAL; + + /* Check for valid ID */ + ret = regmap_read(hwmon->regmap, MANUFACTURER_ID_REG, &val); + if (ret) + return ret; + + if (val != AMPERE_MANUFACTURER_ID) + 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 const struct of_device_id smpro_hwmon_of_match[] = { + { .compatible = "ampere,ac01-hwmon" }, + {} +}; +MODULE_DEVICE_TABLE(of, smpro_hwmon_of_match); + +static struct platform_driver smpro_hwmon_driver = { + .probe = smpro_hwmon_probe, + .driver = { + .name = "smpro-hwmon", + .of_match_table = smpro_hwmon_of_match, + }, +}; + +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 Thu Apr 22 09:08:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quan Nguyen X-Patchwork-Id: 12218093 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 DA0B4C433ED for ; Thu, 22 Apr 2021 09:09:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A421661459 for ; Thu, 22 Apr 2021 09:09:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235655AbhDVJKG (ORCPT ); Thu, 22 Apr 2021 05:10:06 -0400 Received: from mail-co1nam11on2112.outbound.protection.outlook.com ([40.107.220.112]:32864 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S235659AbhDVJJ6 (ORCPT ); Thu, 22 Apr 2021 05:09:58 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z6vklRxQoDLUJfuQ7GIp05eBngkBEfFctg2EXadYzw/6zWunkWAnO/pdzWuUDU/Pxh24OZsMGdtYqBf7PuhV4QtcQL3KGgQzlCXAD2u56r1HYUDpxfNiFj9auIdLiw9NGBQtlNcn6UBrtMfYvKey9i18oQPd71loTGFIKhD7BNYEWxm8DItiOmH2uE+rRUYf8WEL7en4bxJHdNN2AualSSOYFJxTfvDZxr1+Eyz7I/q14RXwh3G9UplMC3Ekmt8Gn84lU8KDtLC53QG+8JAmI7k6fNLsVe4wTVFfRk0GFtY84Bvkf53HbwMVjAD836l8Nv3SfddP8/G91Es7ADe2Cg== 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=jmRWFMCUEMT+cz4GcPH/zDJcrRXlqg8GmLXCr741EyQ=; b=WzzQxFWhAik/V6NtmWycw5QX1cCKvnmTSfTv89sQj3Koo4i+9lnXoesUrAhWcO4D4EgDKIQoXdNAZa29QNrktoaO/lEtXxKXCT71cNzKnQe7ObtyIZJ4Lg3UR2aklcw23Uf3xd/ZrcnN4wIJ6BcljftdYJTnTg5j8+Bmm/pGMqb9EkZzmpBQROk2coV9XH2NWkoZF39pSyF0vSIk6I29BmP4VFGzKSxcJ5xU0uLuRo8hCERSn5ZZuMbEOt2aCm5bbv9ehG8gw40SuahF7SCwiguSI6WGoQVqE6lwVM539MExa+lWcU2yfbpLrm0dQgiowM3lAKcNHysrXbXuTAmXnA== 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=jmRWFMCUEMT+cz4GcPH/zDJcrRXlqg8GmLXCr741EyQ=; b=rB4bDemzBcEz0pmBplkhP4a81ooc80VYvCaeqLyU/aqKxaSWvLum0cJ8upJ6hN7ZPSOI811BGtLD7OhKyRRdtZImj210gboRHJnb70Zjl0IRtMgcUbNeceLsLKyr3dukicuyTWIF7CeWtWE6tTqSR2Q/t/YS0ho5LVgdHIC6t14= 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 MW4PR01MB6356.prod.exchangelabs.com (2603:10b6:303:66::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.16; Thu, 22 Apr 2021 09:09:22 +0000 Received: from MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503]) by MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503%5]) with mapi id 15.20.4042.024; Thu, 22 Apr 2021 09:09:22 +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 v4 4/4] docs: hwmon: (smpro-hwmon) Add documentation Date: Thu, 22 Apr 2021 16:08:43 +0700 Message-Id: <20210422090843.4614-5-quan@os.amperecomputing.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210422090843.4614-1-quan@os.amperecomputing.com> References: <20210422090843.4614-1-quan@os.amperecomputing.com> X-Originating-IP: [118.69.219.201] X-ClientProxiedBy: HKAPR04CA0011.apcprd04.prod.outlook.com (2603:1096:203:d0::21) 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 HKAPR04CA0011.apcprd04.prod.outlook.com (2603:1096:203:d0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.22 via Frontend Transport; Thu, 22 Apr 2021 09:09:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d6257fa2-3e15-406a-15fa-08d9056e515b X-MS-TrafficTypeDiagnostic: MW4PR01MB6356: 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: OGutW08rP8lwUNv3Zgs9Q//bWIgfqkJjuUuWBRY21RSoqOCdI+tJvTNgZ30PF4eF9mOvf1fkQqa/g16LHC1RXD1UzT9lpphylTge+gldaPvIq3mfXCBKW0rBeK1F3fkx9SySr2pnWTRInJyvvQIlMAGu9XtU7SMbJQFARP2rACar/6ZEMUKVBBHVOtwoVwkhkhh9DdaYOyJoZzSVQad0jP9NovCuvK107K91Z1AZ4ar6GyJrdl1apTnEpSFhf4XMz37IdNmgMIXX6I1/kjzeLJM7XDdszBRD1ZDuVV6ThIQiyQIPaVTRScKFvQSoWpsZoVzqbILp8CjU3EVKsLgwE0uspNWt7EUsxIBfWJV4WWbG/vD/ydBRkN8/WdcPplAZs1BhyElvAfPSmAIMb2WW9phZshgwc1+qusa4uk8xo6yF3rD7DysjvToVYGmcjOq92tJIQGtjbKDEFfEcRL4YMUf9PowG0a31Srl0jeonnJSMLJt/9MJDQ0AldcunJTNhYcLmMHToJP6eWKtPggvP+M3uPU6xsVXBwwzJdsFWygPHLHLA9mz8O6WRDW1CHQJzDTv5yJtMA/9jfdmjVYgaZuDrlRIsQdJwvMeGPJd5fdfswJ1AL81on+XcZ6Pwx5UJAUKprTTTudo5HD5GiDo1K4owcudCK959cr5yu34utMg= 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)(396003)(136003)(39850400004)(376002)(366004)(346002)(110136005)(38100700002)(26005)(107886003)(5660300002)(86362001)(956004)(2906002)(6512007)(1076003)(6666004)(316002)(8676002)(186003)(83380400001)(66476007)(4326008)(16526019)(66556008)(52116002)(38350700002)(921005)(7416002)(2616005)(8936002)(478600001)(6486002)(66946007)(54906003)(6506007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: M0xsnyCf5rcBQ7TkwE2TB5XkBMs3L/nO7EZ3tZkHxX1VVGSt1pjmIXa9TKyJqaQDwerfb/xbBQXzMHG73qtuLxAf4TkypuZWlTI0q8Z5J7Xt7AhyuHQPUBSkexFzvyuerg78wqBKLa/UwP2s51JKCT3sgFXMmkNT0DMGe4Av1uJg337PTP8yO3UysX3YVOw6y+q+uKACGbTt+SkU4mqD17+aBUAz/ASRRohMwzKMcddwwmqbOzP4GimAuqV4B2YNHws6I/8wPNL0ERheb1imP0NL5lPeqjXfK9ZIFk5lk8Sil6DDtFAOxXTgAerwrvOP/lH6AjeD8ea1uu4YbockThxJiGMHMP/TPZTK6ePBOOMf7kgpj4hYQn+M9v9uao5qv9k4w6JhZH2G6/LGqV1OhsTqcYmUHsRXsaz+o8CQnZvZZP6aeUshbAaoe7vch4q6FQ9NUtp+PCnV7ehrPPVzFVfWpSguF6ZYmuxQlmM2VcGn4AL9uWrIr80pAye+gSFH4UcOzgpMN8bJnLJIVK9RLBacZq4MnJX3cobEEwnG52HsQic+ovJ5hGvX2oEvXyf/cy30+vpCf7Jz6zNojemj42KDyDVkPYoSGZLcDBWvKccF5pe7u5emiiy7gW9foDjHXUM5b7J2POjKWROX7puLXwVnYiVcgEDBM6cDi77ArnvoP4VQehJUPTH7gqNetVvRsO/wV4QKYOHF7zw8/a2ryN4YTfWg3iorZUg7/mHZI5Q7gl3G92EZQnkuLVK8ZydjdYP8ciY1kYI2A32H6Coqy2tSbNdV77860BnQc8riCLoh6+QGG/dWHpYHFP33+HiWiuH+wyVryMqC2hSFOLp/8QUDwEOrFp6o7eDtLSt+xBNsplvaMGqLdJzPmnirYTJgP3yOVdw8KgSEN9LmOGmW9uw52YWUfPX/yfumf8CBCXUdild9AnrbN+1GlhK2yX80rHwK7USHSFnBJ0T66mw+4JlZepKK4XXMQ6OPQU8TBUE4NMkTnve74W08fzeqs1eSysCpeJLJvOwj1C69ZeuvZGwHFYNYm5+UnZr1fb0DypkxvgmXXD4k38nVE0zh72h1m4ASTvqlkqzGgzqbraz3eaveE87/W1QH8mah74Hs7BvKMyAwi2yuusUF2o8PyqrOHmGOtXHSQ3fEWqmxFSh2ZU66QTycfgpd4VS413T6s7+TsQNTxzNi0xnW+dcukkv8MpqCPnG++abo3MhiMAvklBJB9A83krhIWIoHyVG7D+CM/g8+qLNf4EvfFuk+Oko5HoxFIAPFXKtJBQtdYrORK9TahtoJBAsOUXr0sW5dp6evghcTQoERP66CZYisuPAL X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: d6257fa2-3e15-406a-15fa-08d9056e515b X-MS-Exchange-CrossTenant-AuthSource: MW2PR0102MB3482.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2021 09:09:22.2868 (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: JzqU6EJjqfwyS2nZ5DwcgNul7Y4XCachP0kmZ2VFJa7zhLi0msAXznWgdOcCIhVzNsQWWcchwVpzehfIGHooMZxual2UoKdI5ByEaY99Ins= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR01MB6356 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 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 48bfa7887dd4..3e3631b253b6 100644 --- a/Documentation/hwmon/index.rst +++ b/Documentation/hwmon/index.rst @@ -166,6 +166,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