From patchwork Fri Aug 25 16:42:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ninad Malwade X-Patchwork-Id: 13366146 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7685CC71134 for ; Fri, 25 Aug 2023 16:44:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244440AbjHYQnu (ORCPT ); Fri, 25 Aug 2023 12:43:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344099AbjHYQne (ORCPT ); Fri, 25 Aug 2023 12:43:34 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2063.outbound.protection.outlook.com [40.107.243.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05ED2212C; Fri, 25 Aug 2023 09:43:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=obsqsJzGECb9G5U30EL7SrXtq3usoW1BENiv6bViEUSe9/yVm+rbYUb747XAMyxvE57lh8r+Qsnroh5VahqNU08P2ke8lsd57uqcD1egN7L+a9Q0nzOB2B1ZK3LmN07cSuRiPsxQpJhvofMAEqV8Gh+X6P30ouAdjWaNMJodvSZ0P+qAlL9KQTZK5PPLQUbXqHYGWJr5V+k3y84GHKnCkXUfprz30Mu/h9zLHnWcif55JCxwPD1Fr1NEog/l/iWF7eRY8I6dQLVH/uK/uUFknN1gnh3ZKQLmTlDUt59XhhjlEW8QmqMJLZxBptu5QyAINT+87Wpl18aAwFeM3eYA+Q== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yyy97ePwUcdz2l/7eJX1rTa/CnJVGwXQDZ9V79Skt9E=; b=h/dcTLqjD81qu2nl28bbT4h/VplriAY0e/u6+vXAu3N9NlRj0pb6DRzpZOH96ggiOphxf64Cf5UE/b7WhWqg8+zCr6IQgT558o1BJaSU1ZBo59DVrzeTk6EH8cfn++nEkiPgi0B/GVNG4HoMfR7/q4JdvWJ7NOq6wnDgrTBT9t19j3WdPYfZE3ub+UFFYWdXGzZ3MOuQx5T9UcsRmC4DvaDgmkU8cogXi/0xTVyBR039M3HHoowtKBKvpG4ldKY77Po2IdKQUcpCosI+zoi/vKy7I1X0KfFhq99cDDosbU6ZajyTrFAJO5GxF6xyDzOunlYvy5l/vHxPbrQqD/R/rQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=suse.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yyy97ePwUcdz2l/7eJX1rTa/CnJVGwXQDZ9V79Skt9E=; b=Sahh4zh4H0ZuK5XE5O/DKBUfi8oYp0LmUNBDJJqKk2j4x5Wzo/qm8pGSG5MhlxbADInv64RsBB9JKOMSDyNHViElW5TJhY+Qudf0otjPvU3BYbWnqVp01+HHTuiMannLs8dNy+heLIas2jwcdAXpQvEUlYJJqCw/MZH5TDqMhgsT/kffF1T2AKUdKdWuTHYSQ57ORdYwc2EWcemXSG24iMuzmbahw/Vr7FqPpgP8/PAW2nkSdxNjiyunuSzrWuPU6doxKgcUckxbXx89aIWL1xkIJOe+IVVqO8BiTuQU/6lzd1yenZh2rMUQmzqL4lpDNlxj8NeXsm+bC+0pZv/1KQ== Received: from MW4PR04CA0210.namprd04.prod.outlook.com (2603:10b6:303:86::35) by MN0PR12MB6222.namprd12.prod.outlook.com (2603:10b6:208:3c2::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.27; Fri, 25 Aug 2023 16:43:07 +0000 Received: from CO1PEPF000042AB.namprd03.prod.outlook.com (2603:10b6:303:86:cafe::fc) by MW4PR04CA0210.outlook.office365.com (2603:10b6:303:86::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.30 via Frontend Transport; Fri, 25 Aug 2023 16:43:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1PEPF000042AB.mail.protection.outlook.com (10.167.243.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.15 via Frontend Transport; Fri, 25 Aug 2023 16:43:06 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Fri, 25 Aug 2023 09:42:58 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Fri, 25 Aug 2023 09:42:58 -0700 Received: from nmalwade-dt.nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Fri, 25 Aug 2023 09:42:56 -0700 From: Ninad Malwade To: , , , , , , , , , CC: Ninad Malwade , Thierry Reding Subject: [PATCH V2 1/4] dt-bindings: hwmon: ina3221: Convert to json-schema Date: Sat, 26 Aug 2023 00:42:46 +0800 Message-ID: <20230825164249.22860-2-nmalwade@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230825164249.22860-1-nmalwade@nvidia.com> References: <20230825164249.22860-1-nmalwade@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000042AB:EE_|MN0PR12MB6222:EE_ X-MS-Office365-Filtering-Correlation-Id: 7d3c550a-bf8b-4576-9974-08dba58a5bd0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MKbl5IwROQyPr8IGUIFzo88UsbtaMcqq9cppjT77k8Boa6GsBMGT+xW6MBpvL94Y/hW8momf+nGc8HYkyx/oAYqh0fniZTjlmRdtApQiUCWY+Y0wg+ehjv1gvJvwvcwOKsQNsw3vvQkVOjJ6bu6yPNuAqQ+qL1KFHS3SfsgKvcSGePM7uGgEy0djUdwGETSVb20tgVyeLGTXkxwvOr4xsjclYybSdgd6+QUlKA+03VlyglhFJljZtHfm54JbQm3IZmuYyyKyIilItmn1oI1OgJxU7bEvsClaQkkzaX+PDN0nGTYRtIx4o+/yOPx5m5tz06J2eh/Paivm455dpag4yFMSJi8tgTNUQ8QMSLEkyOFMFBMZAKHIMDGCM3k19I0XucItC3EluB9xW8RpG3NIIXqtDahhOTsSiigX0WPjw19eRqM3NbXQKxzMeq8Nn3PEMc9Qtv0swrE6BcZ7E9sXWy97bTyglYLP67BkwR2FSTyUJ6zSqDFWYamGqRuQmIxjx3rZfa8OUOn7WL+y//njegUZiUzSzeIO/CtEhImsFepE0HygQiTBQbHMg3uiJgAMtpTXvHuxC49yTdieua7v2nEL6VZO3GVg2xgvBwxaiio4wmflCXAhmjnue5xghQ0FabUyAMLxPaUims1Rs2W4zS2A0R//z5CScwzQ01yoF0WUhUkq68CWwT4oxqFzSSrS227CtPnu9RWiOOlC2HTmVYTlvPgnmKIjiwY3ySm2GtflEDKcf/BXg8dOla01xayY1RhCcD3fAxCtPbKVCQKYrgPrAgUGKjyLcUtsMHlAIRE= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(346002)(376002)(39860400002)(396003)(136003)(1800799009)(451199024)(82310400011)(186009)(36840700001)(46966006)(40470700004)(40460700003)(36860700001)(83380400001)(336012)(426003)(107886003)(1076003)(2616005)(47076005)(41300700001)(316002)(70206006)(70586007)(8676002)(2906002)(54906003)(5660300002)(4326008)(40480700001)(8936002)(110136005)(478600001)(7696005)(6666004)(966005)(26005)(82740400003)(86362001)(356005)(7636003)(921005)(36756003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2023 16:43:06.6743 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7d3c550a-bf8b-4576-9974-08dba58a5bd0 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000042AB.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6222 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Convert the TI INA3221 bindings from the free-form text format to json-schema. Signed-off-by: Thierry Reding Signed-off-by: Ninad Malwade --- .../devicetree/bindings/hwmon/ina3221.txt | 54 --------- .../devicetree/bindings/hwmon/ti,ina3221.yaml | 109 ++++++++++++++++++ 2 files changed, 109 insertions(+), 54 deletions(-) delete mode 100644 Documentation/devicetree/bindings/hwmon/ina3221.txt create mode 100644 Documentation/devicetree/bindings/hwmon/ti,ina3221.yaml diff --git a/Documentation/devicetree/bindings/hwmon/ina3221.txt b/Documentation/devicetree/bindings/hwmon/ina3221.txt deleted file mode 100644 index fa63b6171407..000000000000 --- a/Documentation/devicetree/bindings/hwmon/ina3221.txt +++ /dev/null @@ -1,54 +0,0 @@ -Texas Instruments INA3221 Device Tree Bindings - -1) ina3221 node - Required properties: - - compatible: Must be "ti,ina3221" - - reg: I2C address - - Optional properties: - - ti,single-shot: This chip has two power modes: single-shot (chip takes one - measurement and then shuts itself down) and continuous ( - chip takes continuous measurements). The continuous mode is - more reliable and suitable for hardware monitor type device, - but the single-shot mode is more power-friendly and useful - for battery-powered device which cares power consumptions - while still needs some measurements occasionally. - If this property is present, the single-shot mode will be - used, instead of the default continuous one for monitoring. - - = The node contains optional child nodes for three channels = - = Each child node describes the information of input source = - - - #address-cells: Required only if a child node is present. Must be 1. - - #size-cells: Required only if a child node is present. Must be 0. - -2) child nodes - Required properties: - - reg: Must be 0, 1 or 2, corresponding to IN1, IN2 or IN3 port of INA3221 - - Optional properties: - - label: Name of the input source - - shunt-resistor-micro-ohms: Shunt resistor value in micro-Ohm - -Example: - -ina3221@40 { - compatible = "ti,ina3221"; - reg = <0x40>; - #address-cells = <1>; - #size-cells = <0>; - - input@0 { - reg = <0x0>; - status = "disabled"; - }; - input@1 { - reg = <0x1>; - shunt-resistor-micro-ohms = <5000>; - }; - input@2 { - reg = <0x2>; - label = "VDD_5V"; - shunt-resistor-micro-ohms = <5000>; - }; -}; diff --git a/Documentation/devicetree/bindings/hwmon/ti,ina3221.yaml b/Documentation/devicetree/bindings/hwmon/ti,ina3221.yaml new file mode 100644 index 000000000000..0c6d41423d8c --- /dev/null +++ b/Documentation/devicetree/bindings/hwmon/ti,ina3221.yaml @@ -0,0 +1,109 @@ +# SPDX-License-Identifier: GPL-2.0-only +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hwmon/ti,ina3221.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Texas Instruments INA3221 Current and Voltage Monitor + +maintainers: + - Jean Delvare + - Guenter Roeck + +properties: + compatible: + const: ti,ina3221 + + reg: + maxItems: 1 + + ti,single-shot: + description: | + This chip has two power modes: single-shot (chip takes one measurement + and then shuts itself down) and continuous (chip takes continuous + measurements). The continuous mode is more reliable and suitable for + hardware monitor type device, but the single-shot mode is more power- + friendly and useful for battery-powered device which cares power + consumptions while still needs some measurements occasionally. + + If this property is present, the single-shot mode will be used, instead + of the default continuous one for monitoring. + $ref: /schemas/types.yaml#/definitions/flag + + "#address-cells": + description: Required only if a child node is present. + const: 1 + + "#size-cells": + description: Required only if a child node is present. + const: 0 + +patternProperties: + "^input@[0-2]$": + description: The node contains optional child nodes for three channels. + Each child node describes the information of input source. + type: object + properties: + reg: + description: Must be 0, 1 and 2, corresponding to the IN1, IN2 or IN3 + ports of the INA3221, respectively. + enum: [ 0, 1, 2 ] + + label: + description: name of the input source + + shunt-resistor-micro-ohms: + description: shunt resistor value in micro-Ohm + + additionalProperties: false + + required: + - reg + +additionalProperties: false + +required: + - compatible + - reg + +examples: + - | + #include + #include + #include + + i2c@3160000 { + compatible = "nvidia,tegra186-i2c"; + reg = <0x03160000 0x10000>; + interrupts = ; + clocks = <&bpmp TEGRA186_CLK_I2C1>; + clock-names = "div-clk"; + resets = <&bpmp TEGRA186_RESET_I2C1>; + reset-names = "i2c"; + + #address-cells = <1>; + #size-cells = <0>; + + ina3221@40 { + compatible = "ti,ina3221"; + reg = <0x40>; + #address-cells = <1>; + #size-cells = <0>; + + input@0 { + reg = <0x0>; + status = "disabled"; + }; + + input@1 { + reg = <0x1>; + shunt-resistor-micro-ohms = <5000>; + }; + + input@2 { + reg = <0x2>; + label = "VDD_5V"; + shunt-resistor-micro-ohms = <5000>; + }; + }; + }; From patchwork Fri Aug 25 16:42:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ninad Malwade X-Patchwork-Id: 13366150 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 293C3EE49B4 for ; Fri, 25 Aug 2023 16:44:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344058AbjHYQnw (ORCPT ); Fri, 25 Aug 2023 12:43:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344124AbjHYQnn (ORCPT ); Fri, 25 Aug 2023 12:43:43 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2075.outbound.protection.outlook.com [40.107.94.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76DE8196; Fri, 25 Aug 2023 09:43:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DXsWOc3Jz9D3VK8flopU0SQ07I9H2jYi9O7aQvGMvawuLcNrGG0eqI3rziaDGmU8Y8vvA9pC6qxZcmpV6hiE7wzKxV42zjoECNYeqHbPHxonBCVda+44vAXZK3+2yzrqvXr/JMXq90zaoWMZaYToQiCbVPpvgjZbfhywDozhBmVCl8B6BZU1LLKEA+CnoBJke9BvQ53NxtAGRq7Fy2XOSAkALp53EwMw/Eatkp46P3wlK6pRPfQL/86JissBFUV3tawQB/jAWdkl7bLfjkteHSE3jn6V3dw3gLjJbgRFquchFuUK2NGV41gocJw2Ny9beR+RWVTdDQ2z4UOv+emDjw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=X7iVn//U8LB3QGgd28OLAICo2WU9Y/GE+U8nsmcz8fU=; b=IRZDsSNk8eVMT4RVc44Xe35aifJw5a8bRgXVthBOpiyvMjfOUD0BcKOAGAASH5F8H/DqkZkhTp6bsldOoNyfVfyHVrjUsTs1pvrqiSHp+rXrl6bch2zivGfumsn+ePsA1VOaHIqdFqu4qiUtDUxo7c5URQ4N7oPwDw3xCA+ZYWqfrrQ0riE71+orcO+FP2LBuDorH3+ug1GFz0QifKcCgS7OdiU5ngUNoDtUp4A5OAdcPNM36fOOxUP9UO3YyqJgOkD4W1ZpxUtorZo6GhU8Khhx043NTpqxuvX1USDm2e+0UVPKpsm+hawmdLfnqXMlplSS5GEdjjhMah/awlZ+Xg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=suse.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=X7iVn//U8LB3QGgd28OLAICo2WU9Y/GE+U8nsmcz8fU=; b=MNWCb1IiZ3SOyJh1exOllRNhhHa5bDCqYorh85F9dh23rTWBAgW/AWWayBx7ODN2obJUzl0NcgD/gJBZ5lWHbTXta5tkQmShUqSVqpgk4V0bggRGTDcQV9yv7sTpF2ek2ThH/i4sfr48kqgllWobIW8fIVnRZ3zqzRNJmTPlZWI2W/E+n/aoqrDVmc1DrvAfclWiZowaeYBcvemJqHqegh+e+/NAluclRa5AZnW7MFvXvA4kpP3nhDxMgmCOZ9nfIA7c1kdYmGifCEuk1dkc5ckxeafihc/JTIR9cBRxyCHWSEd+EFrEESbOtWZr9eSbGzUy2xmmcsXunX6R5iab8g== Received: from SA9PR10CA0005.namprd10.prod.outlook.com (2603:10b6:806:a7::10) by BN9PR12MB5355.namprd12.prod.outlook.com (2603:10b6:408:104::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.29; Fri, 25 Aug 2023 16:43:26 +0000 Received: from SN1PEPF000252A0.namprd05.prod.outlook.com (2603:10b6:806:a7:cafe::e7) by SA9PR10CA0005.outlook.office365.com (2603:10b6:806:a7::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.30 via Frontend Transport; Fri, 25 Aug 2023 16:43:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SN1PEPF000252A0.mail.protection.outlook.com (10.167.242.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.15 via Frontend Transport; Fri, 25 Aug 2023 16:43:26 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Fri, 25 Aug 2023 09:43:15 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Fri, 25 Aug 2023 09:43:14 -0700 Received: from nmalwade-dt.nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Fri, 25 Aug 2023 09:43:12 -0700 From: Ninad Malwade To: , , , , , , , , , CC: Ninad Malwade Subject: [PATCH V2 2/4] dt-bindings: hwmon: ina3221: Add summation-bypass Date: Sat, 26 Aug 2023 00:42:47 +0800 Message-ID: <20230825164249.22860-3-nmalwade@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230825164249.22860-1-nmalwade@nvidia.com> References: <20230825164249.22860-1-nmalwade@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000252A0:EE_|BN9PR12MB5355:EE_ X-MS-Office365-Filtering-Correlation-Id: 51094fbb-c9a6-48c7-4688-08dba58a679c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Je50Tv7TCLF9VO2th4HubcuF22YALTDZ/QQI1/QjmEjjicAYxHS5sXo9nUQLiII5Qaw8t48mN5awntsduPuBD/7TC+yvbX29Q4bl1/6sjThpHqd5qxwv/8S6K6vUrAgumFeWzymQQXI9+H9fKJQyE3/Wlgq7yKV2003xNCXj+Mf5KpjcKMgt+fZ2JrXmBDEoeEYiH/Qoiphe1fC+vd/Wtlh55P/x47Fg80hJKpJYK4M7JNPjjqnXxCRVlhg9ghhsX/YlgRe7Fr62Q1ThVldbitFHJyRbvCNYkSiDY/VkCK6HU2UeCmPvmeIdfYfZei08WVWt5BF8ANexul6nGSmfFPzEIpDOJFc7xZh3WQd45xXfZvKU1mCHHDOvYvxi94gJ1FJ4Z8XBsd9/m09zn74nNUBiKnFolKg16VkruIQ5xvCHfYtyLEEUNWOjWKF2T9bfbV7BtD2FmMRVl9OnkC5ubcejRLv8pGnEnYHOxcmitU6rzy6twO6Jb9BZ8fInc6JEOBOoXI6ed207+Jxj414smesKjsANIwgd8p78YPqohHucKfrLJclWuXKq13Va/PssQxNvWbBhUkBl04QmTZgA129nV5GhdJOvXgdp9p+MF49oee88XFAk6jcyFimQZCIF1BATV7JM80fDulmjIr5oasbqzF4lRdzuD8YlCzpGFxic7i947eJtDKI7AewAbEWqeyQ0eKHKK29meW+bbVKTORNseCBVDdjPPm+e3gk9De8S9ePAHGrNLwFIcD2tFJUs X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(346002)(136003)(396003)(376002)(39860400002)(82310400011)(1800799009)(451199024)(186009)(36840700001)(40470700004)(46966006)(1076003)(36860700001)(336012)(83380400001)(478600001)(26005)(47076005)(40480700001)(2616005)(5660300002)(426003)(107886003)(2906002)(8676002)(8936002)(4326008)(921005)(356005)(7636003)(82740400003)(40460700003)(70206006)(70586007)(86362001)(110136005)(41300700001)(36756003)(7696005)(6666004)(316002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2023 16:43:26.4015 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 51094fbb-c9a6-48c7-4688-08dba58a679c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF000252A0.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5355 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org The INA3221 has a critical alert pin that can be controlled by the summation control function. This function adds the single shunt-voltage conversions for the desired channels in order to compare the combined sum to the programmed limit. The Shunt-Voltage Sum Limit register contains the programmed value that is compared to the value in the Shunt-Voltage Sum register in order to determine if the total summed limit is exceeded. If the shunt-voltage sum limit value is exceeded, the critical alert pin pulls low. For the summation limit to have a meaningful value, it is necessary to use the same shunt-resistor value on all included channels. Add a new property, 'summation-bypass', to allow specific channels to be excluded from the summation control function if the shunt resistor is different to other channels. Signed-off-by: Jon Hunter Signed-off-by: Ninad Malwade --- .../devicetree/bindings/hwmon/ti,ina3221.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Documentation/devicetree/bindings/hwmon/ti,ina3221.yaml b/Documentation/devicetree/bindings/hwmon/ti,ina3221.yaml index 0c6d41423d8c..20c23febf575 100644 --- a/Documentation/devicetree/bindings/hwmon/ti,ina3221.yaml +++ b/Documentation/devicetree/bindings/hwmon/ti,ina3221.yaml @@ -55,6 +55,24 @@ patternProperties: shunt-resistor-micro-ohms: description: shunt resistor value in micro-Ohm + summation-bypass: + description: | + The INA3221 has a critical alert pin that can be controlled by the + summation control function. This function adds the single + shunt-voltage conversions for the desired channels in order to + compare the combined sum to the programmed limit. The Shunt-Voltage + Sum Limit register contains the programmed value that is compared + to the value in the Shunt-Voltage Sum register in order to + determine if the total summed limit is exceeded. If the + shunt-voltage sum limit value is exceeded, the critical alert pin + pulls low. + + For the summation limit to have a meaningful value, it is necessary + to use the same shunt-resistor value on all included channels. If + this is not the case for specific channels, then the + 'summation-bypass' can be populated for a specific channel to + exclude from the summation control function. + additionalProperties: false required: From patchwork Fri Aug 25 16:42:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ninad Malwade X-Patchwork-Id: 13366148 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEBE2EE49AB for ; Fri, 25 Aug 2023 16:44:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344063AbjHYQnx (ORCPT ); Fri, 25 Aug 2023 12:43:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344135AbjHYQnp (ORCPT ); Fri, 25 Aug 2023 12:43:45 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2079.outbound.protection.outlook.com [40.107.92.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C801212E; Fri, 25 Aug 2023 09:43:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CTfSwRclI37O6bFT5f6LhTpCSOaQ18KKZ58pzZLPyS9Y8H14A26EpW4kmSmENvmPddVh3akmefQIIepynS3+ak5tORwWz41pNErfm9aMlqr8dD2VSBmmMm+FF0C3qPf21V7mhcCJWvO8uKbqkYZuquxFV4A3FRmt18TI9epqenIfPSv0GVC/7v67L/MLy569K18Vtg4zionBtdxIQi9qfTAieTPxmwqR/rZkW4avuUsBjYGbrAi37csxagca+QKx/Y5lZd8v9PgDZCNgVeUIHmT2I5FokRjDtrFDOU2vEE0keBXq2UeewSk+PVQtH6xIlEr54SOxag3zpYlP+bOl7Q== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ki4tdagOTrRBIXC4pe1zPlpWgKKFBU8yjVrGXG1MgfQ=; b=g8NK6zX2liI0h4Dlz/P6Nr453KqBopy/mQ2bNemVVoBZ1m+32urZheGizv96+aWlwtTpmwbDtr3F3WEdfcsgJkbjenXoyzMC80CT3pyS2mGIyxadjbq1JYMj8Isgom7ensCASW0B1sLIz8xpFrFnSBANx5skx2IMPnW4Ejy+ddGqL6nVjBQJDqfOvuJlF0zZJDzyfhdiVd8W5I+404t8b4M+rcNmEZ+IeIQO6ErMs6cuZsHywKr9AWaylxOl6/ebvoz+rqZ3S4oHwFm0O/rqq1oqFeTaNMq6cX2/xamucH3JyS0/edDWQs+izyO5hhLVCA1KjzaCq2GbEKYMrRFCVw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=suse.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ki4tdagOTrRBIXC4pe1zPlpWgKKFBU8yjVrGXG1MgfQ=; b=eVrhxTXnb8qokU+E/qpCxT2ap+pOFQXY05HISzh8RbS7hmwk2ktK6wFk5Tpq5RIIH+0kFzpcwuHrUYXkbDvClthexVP7uYXyklQJS7vpYGtAzfcK8xl773ydqLvGpWn4wv8KpyA3kRoSO0NDmFLsjlsVJraGh2+TnuePU4CCdPXuAqGjr2hv3V71oh7bFrtVo3cG1yuIPXlfqIaCvvJ8oR747JUKMVZN7T2wFwXUjmspPhjn80YKnWXXLmGYBD6uV5WosUwjshgHkRnyIpUG0lKFoR6VtqGHTkbgWxQ40DrPwndWVnH01nW9bVF9Jk5GUWWTgbYZgoaA7uuwABHtQg== Received: from PH7PR13CA0023.namprd13.prod.outlook.com (2603:10b6:510:174::23) by MW4PR12MB5628.namprd12.prod.outlook.com (2603:10b6:303:185::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.27; Fri, 25 Aug 2023 16:43:31 +0000 Received: from SN1PEPF000252A4.namprd05.prod.outlook.com (2603:10b6:510:174:cafe::bb) by PH7PR13CA0023.outlook.office365.com (2603:10b6:510:174::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6723.20 via Frontend Transport; Fri, 25 Aug 2023 16:43:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SN1PEPF000252A4.mail.protection.outlook.com (10.167.242.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.14 via Frontend Transport; Fri, 25 Aug 2023 16:43:30 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Fri, 25 Aug 2023 09:43:19 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Fri, 25 Aug 2023 09:43:18 -0700 Received: from nmalwade-dt.nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Fri, 25 Aug 2023 09:43:16 -0700 From: Ninad Malwade To: , , , , , , , , , CC: Ninad Malwade , Rajkumar Kasirajan Subject: [PATCH V2 3/4] hwmon: ina3221: add support for summation channel control Date: Sat, 26 Aug 2023 00:42:48 +0800 Message-ID: <20230825164249.22860-4-nmalwade@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230825164249.22860-1-nmalwade@nvidia.com> References: <20230825164249.22860-1-nmalwade@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000252A4:EE_|MW4PR12MB5628:EE_ X-MS-Office365-Filtering-Correlation-Id: 863fba2b-d68f-4fa6-303a-08dba58a6a56 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TsGI2ebRWmxnkrcGc2bF9NLODkHgnDfKls/J0wzy+0fsTigCKD320cE/Qdcmz6WFBF8QS3LAuZreFgybXAJnlnjnPIvqdAjk+XX3zfOZMywB/uDUi1vzqj2VpDbsK8uV3c2VeDNPVe25peYWsQLYGRlpJvGZnkNBnSvVadYIuCGCsILy2X9iwsRT+iE55ImQD0ezXbwVQfDiJqCIahAS4AFBSWwj4wTLWfGT8gntDq2BjjMXwa2roDmPefwcU2rmVrNSggHGL7sryHboyc0Grm3DDCH/1+/+wj1U+LLb2VVhYg0l3hxuDPeHa/kJ+69Nf5zWi0J/0nYCVhU8KV4C+lxHbEnvnP56kkxzcA8sZpmS1jAsob4dPQ4mm/pAi8UFnflBwbSIrWEOBdZgw0hNSCpcJpljwK6Q9aB0W++WsPDUOZ+z1+Clwz0pk6euIrW75UIjrj3KPQ1HJdacbZN6Tl09wTr5VTbgfMKxtBtuzTsOwigccpoMYkupaUbLESdQ+mO3BP5CnafH6LDSKsXsjQ15POcQjlU8+5Nmlj9J1hn8oWj3EpJaB0NtYQfkhDon3W6d+WfZw1AEyzuU3CSvkA7Q8sJWkrxnM3Xq0+nsENU6DPantwNjI6Boa5bzhOEWxySBbHeMvz90kWBYckh+jqjSo3i17mrpHD/XXNNl3/N1RN2RbynbsjGwkmR9hgAOlSTjCe8Ggwxy5tPjTXJ3Nq0umEnKY/JQXL5T27LAxEUJJIv1GDAFOaOjGIb3Ww4k X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(396003)(136003)(346002)(39860400002)(376002)(451199024)(186009)(1800799009)(82310400011)(36840700001)(40470700004)(46966006)(54906003)(7696005)(70586007)(316002)(70206006)(478600001)(110136005)(26005)(36860700001)(6666004)(7636003)(356005)(40480700001)(921005)(82740400003)(41300700001)(86362001)(2906002)(4326008)(8676002)(8936002)(1076003)(40460700003)(2616005)(107886003)(5660300002)(83380400001)(36756003)(336012)(47076005)(426003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2023 16:43:30.9597 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 863fba2b-d68f-4fa6-303a-08dba58a6a56 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF000252A4.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB5628 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org The INA3221 allows the Critical alert pin to be controlled by the summation control function. This function adds the single shunt-voltage conversions for the desired channels in order to compare the combined sum to the programmed limit. The Shunt-Voltage Sum Limit register contains the programmed value that is compared to the value in the Shunt-Voltage Sum register in order to determine if the total summed limit is exceeded. If the shunt-voltage sum limit value is exceeded, the Critical alert pin pulls low. For the summation limit to have a meaningful value, we have to use the same shunt-resistor value on all included channels. Unless equal shunt-resistor values are used for each channel, we can't use summation control function to add the individual conversion values directly together in the Shunt-Voltage Sum register to report the total current. To address this we add support to BYPASS channels via kernel device tree property "summation-bypass". The channel which has this property would be excluded from the calculation of summation control function, so we can easily exclude the one which uses different shunt-resistor value or bus voltage. For example, summation control function calculates Shunt-Voltage Sum like - input_shunt_voltage_summaion = input_shunt_voltage_channel1 + input_shunt_voltage_channel2 + input_shunt_voltage_channel3 But if we want the summation to consider only channel1 and channel3, we can add 'summation-bypass' property in device tree node of channel2. Then the calculation will skip channel2. - input_shunt_voltage_summaion = input_shunt_voltage_channel1 + input_shunt_voltage_channel3 Please note that we only want the channel to be skipped for summation control function rather than completely disabled. Therefore, even if we add the device tree node, the functionality of the single channel would still be retained. The below sysfs nodes are added to check if the channel is included or excluded from the summation control function. in*_sum_bypass = 0 --> channel voltage is included for sum of shunt voltages. in*_sum_bypass = 1 --> channel voltage is excluded for sum of shunt voltages. Signed-off-by: Rajkumar Kasirajan Signed-off-by: Ninad Malwade --- drivers/hwmon/ina3221.c | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/ina3221.c b/drivers/hwmon/ina3221.c index 5ab944056ec0..093ebf9f1f8d 100644 --- a/drivers/hwmon/ina3221.c +++ b/drivers/hwmon/ina3221.c @@ -104,6 +104,7 @@ struct ina3221_input { const char *label; int shunt_resistor; bool disconnected; + bool summation_bypass; }; /** @@ -125,6 +126,7 @@ struct ina3221_data { struct mutex lock; u32 reg_config; int summation_shunt_resistor; + u32 summation_channel_control; bool single_shot; }; @@ -154,7 +156,8 @@ static inline int ina3221_summation_shunt_resistor(struct ina3221_data *ina) int i, shunt_resistor = 0; for (i = 0; i < INA3221_NUM_CHANNELS; i++) { - if (input[i].disconnected || !input[i].shunt_resistor) + if (input[i].disconnected || !input[i].shunt_resistor || + input[i].summation_bypass) continue; if (!shunt_resistor) { /* Found the reference shunt resistor value */ @@ -731,10 +734,29 @@ static SENSOR_DEVICE_ATTR_RW(shunt1_resistor, ina3221_shunt, INA3221_CHANNEL1); static SENSOR_DEVICE_ATTR_RW(shunt2_resistor, ina3221_shunt, INA3221_CHANNEL2); static SENSOR_DEVICE_ATTR_RW(shunt3_resistor, ina3221_shunt, INA3221_CHANNEL3); +static ssize_t ina3221_summation_bypass_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct sensor_device_attribute *sd_attr = to_sensor_dev_attr(attr); + struct ina3221_data *ina = dev_get_drvdata(dev); + unsigned int channel = sd_attr->index; + struct ina3221_input *input = &ina->inputs[channel]; + + return sysfs_emit(buf, "%d\n", input->summation_bypass); +} + +/* summation bypass */ +static SENSOR_DEVICE_ATTR_RO(in1_sum_bypass, ina3221_summation_bypass, INA3221_CHANNEL1); +static SENSOR_DEVICE_ATTR_RO(in2_sum_bypass, ina3221_summation_bypass, INA3221_CHANNEL2); +static SENSOR_DEVICE_ATTR_RO(in3_sum_bypass, ina3221_summation_bypass, INA3221_CHANNEL3); + static struct attribute *ina3221_attrs[] = { &sensor_dev_attr_shunt1_resistor.dev_attr.attr, &sensor_dev_attr_shunt2_resistor.dev_attr.attr, &sensor_dev_attr_shunt3_resistor.dev_attr.attr, + &sensor_dev_attr_in1_sum_bypass.dev_attr.attr, + &sensor_dev_attr_in2_sum_bypass.dev_attr.attr, + &sensor_dev_attr_in3_sum_bypass.dev_attr.attr, NULL, }; ATTRIBUTE_GROUPS(ina3221); @@ -786,6 +808,9 @@ static int ina3221_probe_child_from_dt(struct device *dev, /* Save the connected input label if available */ of_property_read_string(child, "label", &input->label); + /* summation channel control */ + input->summation_bypass = of_property_read_bool(child, "summation-bypass"); + /* Overwrite default shunt resistor value optionally */ if (!of_property_read_u32(child, "shunt-resistor-micro-ohms", &val)) { if (val < 1 || val > INT_MAX) { @@ -873,6 +898,10 @@ static int ina3221_probe(struct i2c_client *client) /* Initialize summation_shunt_resistor for summation channel control */ ina->summation_shunt_resistor = ina3221_summation_shunt_resistor(ina); + for (i = 0; i < INA3221_NUM_CHANNELS; i++) { + if (!ina->inputs[i].summation_bypass) + ina->summation_channel_control |= (BIT(14 - i)); + } ina->pm_dev = dev; mutex_init(&ina->lock); @@ -978,13 +1007,13 @@ static int ina3221_resume(struct device *dev) /* Initialize summation channel control */ if (ina->summation_shunt_resistor) { /* - * Take all three channels into summation by default - * Shunt measurements of disconnected channels should - * be 0, so it does not matter for summation. + * Sum only channels that are not 'bypassed' for summation + * by default. Shunt measurements of disconnected channels + * should be 0, so it does not matter for summation. */ ret = regmap_update_bits(ina->regmap, INA3221_MASK_ENABLE, INA3221_MASK_ENABLE_SCC_MASK, - INA3221_MASK_ENABLE_SCC_MASK); + ina->summation_channel_control); if (ret) { dev_err(dev, "Unable to control summation channel\n"); return ret; From patchwork Fri Aug 25 16:42:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ninad Malwade X-Patchwork-Id: 13366149 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 487CFEE49B5 for ; Fri, 25 Aug 2023 16:44:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344066AbjHYQnx (ORCPT ); Fri, 25 Aug 2023 12:43:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344132AbjHYQnp (ORCPT ); Fri, 25 Aug 2023 12:43:45 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2056.outbound.protection.outlook.com [40.107.94.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEA031A5; Fri, 25 Aug 2023 09:43:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EKXKDskUoooIfepIUB+UMx0ZgJTnKua/AjTbT7bWcJTXWEtHMFr4/0qr8rX6HBGW3QnydTZf8nG7m+EiSiLl9lvuS1i1ALaRAtD7gPoEaqsQvwh3IawNW1BSojmlRHB+WoiDsMK9EmfdybqbJRP3+csnzGgHE5x2lQRDIjoFxzEg/asdPK4MU9x4I3dWH7ovsnUhfft8m63KgPblDq+XEyQY1jnckgHPL/YsrAQhuIGUcJO2dmob/KiUCivjGeyuySEFxDJlEl3DF3C+pHw0tPGKpFHm/ZJimKkQN/eTBv/EO8IdFDoXv2lq+oUTHL/AqTdiKZtOMNf4OqKrkYThoQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bh5mufYmVRXWAODrWKhzz8funJb4a3JxG2HZVEHRGlQ=; b=FK1iOMVf7hDdRKOLJ0YeZY1EvDSUBbLzQZz4HZ76tCbNH5j+A1C3LAaTkGq21Z+ECw/Ow7Z0Ucy/bIcKvKdms2iUlMu9f5227lUcDrbhP1uJ73rdep/kZd58QKK07ExJSnl5p0pM4O0OXHrGgHAwowRfn6yQppiYut2oXl34V5tUxedSF2dUGUEKdY5elRDLKLyCYj2AziE9y8MyznS5y5bJY+y40yTLN9H5/n7MpJy6UZ5vKpuBI0oMxpM9nBLJX1haTgGvmdXipZWkHE/i6limB4lbuXHG2n2vkchwNVs+GAdPOYZFy/B+VeXbOylH7ysymbNVeUmxJT2TPoGaSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=suse.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bh5mufYmVRXWAODrWKhzz8funJb4a3JxG2HZVEHRGlQ=; b=sO0t3L1dIfrOAlBAJARIfkqOQnccaoqz4EBvtyGvzoWWjiyQcXBZX79CjckoF/pHbRXe9Q+qQu3h9jCQvFDzIDwp/f5353ltu3ywfdVKO6KGcN11IZzzxctKUyb2hT9Cg0CYYEbySXKI5nK1qjSQdtwfhNmLlJ3bmvXzMQM2JHdpLX4XFE24VD1u0lM2tm2/edP8CJ9XKaYtyO74MNHYv+ARrOXtfIG73EjdlBvMkX9LvZJOum7kMvo0qCUHc5zag60JuJD/wcOAmHdqmsZWoQrOmFb1XpVdfvDqDO/gBZwkSv03cMY23cV1Cd1BQkE5VwPConWErTy09TF9FXhmlQ== Received: from DM6PR02CA0121.namprd02.prod.outlook.com (2603:10b6:5:1b4::23) by PH8PR12MB6844.namprd12.prod.outlook.com (2603:10b6:510:1cb::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.27; Fri, 25 Aug 2023 16:43:34 +0000 Received: from SN1PEPF0002529F.namprd05.prod.outlook.com (2603:10b6:5:1b4:cafe::b3) by DM6PR02CA0121.outlook.office365.com (2603:10b6:5:1b4::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.30 via Frontend Transport; Fri, 25 Aug 2023 16:43:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SN1PEPF0002529F.mail.protection.outlook.com (10.167.242.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.15 via Frontend Transport; Fri, 25 Aug 2023 16:43:33 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Fri, 25 Aug 2023 09:43:22 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Fri, 25 Aug 2023 09:43:22 -0700 Received: from nmalwade-dt.nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Fri, 25 Aug 2023 09:43:20 -0700 From: Ninad Malwade To: , , , , , , , , , CC: Ninad Malwade Subject: [PATCH V2 4/4] arm64: tegra: Populate ina3221 for Tegra234 boards Date: Sat, 26 Aug 2023 00:42:49 +0800 Message-ID: <20230825164249.22860-5-nmalwade@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230825164249.22860-1-nmalwade@nvidia.com> References: <20230825164249.22860-1-nmalwade@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002529F:EE_|PH8PR12MB6844:EE_ X-MS-Office365-Filtering-Correlation-Id: b665b799-ee50-412d-b666-08dba58a6bfa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wGD8+cX/gKYhgfwvkNbXMJSGiHKyptzfgnAcqZkrp2YXTfJtY9HCe7/avvIIT4Jwbvr2kUx4TRv4kM/iiw16O/QjcqJ+4AcjhoWQQn+K/NInWw/3hOKhEBGk0MQoxWESaHfVw/7CaeuYvhwqeV6v1kHlbwx1Lr06VHar0t9HEJiuqOdIpo+B8Ky1969GnA/n2X5Z1DTr5nzUCVoiXBiZmjkOvEruxgRVP/rtX7AkbWaDb7txyIzI9iIr2KnBe95mbzTKLV9o3C/los1YYRw6AOGUJ2ypSqmUY10O6SmbIX7q+4PSNbFvQrSQy+wHtmL5xOrcS9XgrUGqOmK378PAxImuNziEFyTT7ZO6Prp1nG36k4e84UA2t3UnQ1Q+L6MrYHfK2SCUBc4dcm++tQctXVXuURaBQl5M01AB4bl9bhsjs5bR8pnGKLQakwSkojd7P8mPgqfdojJpUIP0Htt6L2GnF9jhUs22oVolKqcjQ+o1nwXjTNczacGuV0YiOBwDA+kwFnTD9l9+IB3WgJr6aczGOR4RKy/bny/zGY7LPZtnQalXGl2rrHJXnlQSy5/3g/0puvVhMZpTgFYXpjPfs5lUM+iMagtsPSXYECz9GPB/GfPhhEuN5O85t8mWDAyxiYU9dIEhrCe0Iiufg2zbT1MxVzOd2o6BBpvbENw/8swVTYGIrAfc1RJx12oo13ZvHzqCYMqReiPC22OJvihigr6U4Jg66qcPIq2B1fXVyc13zWYBm3HWp/VH//V7cJ9z X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(346002)(376002)(39860400002)(396003)(136003)(1800799009)(451199024)(82310400011)(186009)(36840700001)(46966006)(40470700004)(40460700003)(36860700001)(83380400001)(336012)(426003)(107886003)(1076003)(2616005)(47076005)(41300700001)(316002)(70206006)(70586007)(8676002)(2906002)(5660300002)(4326008)(40480700001)(8936002)(110136005)(478600001)(7696005)(6666004)(26005)(82740400003)(86362001)(356005)(7636003)(921005)(36756003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2023 16:43:33.7469 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b665b799-ee50-412d-b666-08dba58a6bfa X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF0002529F.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6844 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Populate the ina3221 current/voltage monitor sensors for the various Tegra234 boards. The ina3221 sensors are located on the Tegra234 module boards. The sensor configuration for the Jetson AGX Orin and NVIDIA IGX Orin boards are the same and the sensor configuration for Jetson Orin NX and Jetson Orin Nano are the same. Signed-off-by: Jon Hunter Signed-off-by: Ninad Malwade --- .../arm64/boot/dts/nvidia/tegra234-p3701.dtsi | 53 +++++++++++++++++++ .../arm64/boot/dts/nvidia/tegra234-p3767.dtsi | 29 ++++++++++ 2 files changed, 82 insertions(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra234-p3701.dtsi b/arch/arm64/boot/dts/nvidia/tegra234-p3701.dtsi index 5e7797df50c2..aaab248c8844 100644 --- a/arch/arm64/boot/dts/nvidia/tegra234-p3701.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra234-p3701.dtsi @@ -1987,5 +1987,58 @@ status = "okay"; }; }; + + i2c@c240000 { + status = "okay"; + + ina3221@40 { + compatible = "ti,ina3221"; + reg = <0x40>; + #address-cells = <1>; + #size-cells = <0>; + + input@0 { + reg = <0x0>; + label = "VDD_GPU_SOC"; + shunt-resistor-micro-ohms = <2000>; + }; + + input@1 { + reg = <0x1>; + label = "VDD_CPU_CV"; + shunt-resistor-micro-ohms = <2000>; + }; + + input@2 { + reg = <0x2>; + label = "VIN_SYS_5V0"; + shunt-resistor-micro-ohms = <2000>; + summation-bypass; + }; + }; + + ina3221@41 { + compatible = "ti,ina3221"; + reg = <0x41>; + #address-cells = <1>; + #size-cells = <0>; + + input@0 { + reg = <0x0>; + status = "disabled"; + }; + + input@1 { + reg = <0x1>; + label = "VDDQ_VDD2_1V8AO"; + shunt-resistor-micro-ohms = <2000>; + }; + + input@2 { + reg = <0x2>; + status = "disabled"; + }; + }; + }; }; }; diff --git a/arch/arm64/boot/dts/nvidia/tegra234-p3767.dtsi b/arch/arm64/boot/dts/nvidia/tegra234-p3767.dtsi index fe08e131b7b9..e4ce7da7850c 100644 --- a/arch/arm64/boot/dts/nvidia/tegra234-p3767.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra234-p3767.dtsi @@ -55,6 +55,35 @@ avdd-usb-supply = <&vdd_3v3_ao>; }; + i2c@c240000 { + status = "okay"; + + ina3221@40 { + compatible = "ti,ina3221"; + reg = <0x40>; + #address-cells = <1>; + #size-cells = <0>; + + input@0 { + reg = <0x0>; + label = "VDD_IN"; + shunt-resistor-micro-ohms = <5000>; + }; + + input@1 { + reg = <0x1>; + label = "VDD_CPU_GPU_CV"; + shunt-resistor-micro-ohms = <5000>; + }; + + input@2 { + reg = <0x2>; + label = "VDD_SOC"; + shunt-resistor-micro-ohms = <5000>; + }; + }; + }; + rtc@c2a0000 { status = "okay"; };