From patchwork Wed Sep 20 05:55:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Delphine CC Chiu X-Patchwork-Id: 1836998 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=wiwynn.com header.i=@wiwynn.com header.a=rsa-sha256 header.s=selector2 header.b=2BHdcFMe; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rr78t5JMqz1yhR for ; Wed, 20 Sep 2023 15:57:18 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=wiwynn.com header.i=@wiwynn.com header.a=rsa-sha256 header.s=selector2 header.b=2BHdcFMe; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Rr78t2M0Vz3c2b for ; Wed, 20 Sep 2023 15:57:18 +1000 (AEST) X-Original-To: openbmc@lists.ozlabs.org Delivered-To: openbmc@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=wiwynn.com header.i=@wiwynn.com header.a=rsa-sha256 header.s=selector2 header.b=2BHdcFMe; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=wiwynn.com (client-ip=2a01:111:f403:704b::618; helo=apc01-tyz-obe.outbound.protection.outlook.com; envelope-from=delphine_cc_chiu@wiwynn.com; receiver=lists.ozlabs.org) Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on20618.outbound.protection.outlook.com [IPv6:2a01:111:f403:704b::618]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Rr7712M2Hz2ygX for ; Wed, 20 Sep 2023 15:55:41 +1000 (AEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=meRBZ3dKZ5wT90A65WizZCHKHY/9m0x4Za4SZTOlXUV1IGonU+LgqzXA2FKizJFh4fATAf2exzI/oF2FycJDPWv6cI6MdHttjO/OPFkfFzuisjtgz/lOq1Cgs2kAh1KPO5ii3mDnO3sdq9dwWcH3Kay7Qr7VwRgox7VY0bDGFXlRfL9YncUDWjg/GMmi5eranCH9aJ/Tb80XWFR58omWPRpqQ4w4SLSUFIPvGcPLjvn7WBpTHXbiVsJAXpgRZ3bIS33LuJ7OngipEYkXJkQiDGroX7RP8S300kwmOo1N+Cum2pfgBtWmTBWOgugY4dcm36ovissx3qpHE6mgtoxn9g== 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=WE/fOaj/x+ZHUTB3X5c918nR23QEjN2cDNBUBKdFliE=; b=JWbnsw9iuQ7lasr2iYsjfTl9YS7/l3//QozSQ1C8CdSXJmn49GFq6He/H3eHeB/IORjRvwcnogXwG28Qg+v8Ci5HBxr2tcP+gInRnohfg0hSGDNyIomCZ3ejeiba+4U3XG7yDLoygeKrnRDWjHcElA0BUFum/weLPvBYdg24nlJ2IjFpIkWXM0QUK80JhkFN4+tvCzofuH8ne4vduL282pcpXDvV2lydQJaHPEFESEArAcaFZi6jhZrHYMWVXenr7VxItIEaLCj5UeFjlUzPSLwuXf51wIbzNrNZwFXECoTELw/4mgWhfKWSBvSB+QJhojGPghWIjDm6NneRoS0AjQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 211.20.1.79) smtp.rcpttodomain=jms.id.au smtp.mailfrom=wiwynn.com; dmarc=fail (p=quarantine sp=quarantine pct=100) action=quarantine header.from=wiwynn.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wiwynn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WE/fOaj/x+ZHUTB3X5c918nR23QEjN2cDNBUBKdFliE=; b=2BHdcFMeVFQsRrSzLjOghSxCMYS8ksInawSPVFyM5XukL4mbp93lIGROnG10hKRsep2l4Nwypjb8CA+Nd8YLr94UlbTXxSx2ahlVGk4KtRK8/z9PYo5izdAEwTOO3M8cnvB9yBUaDf4NiOPwIiA4tphCTwM6rVQelzu+BGGgLF/nxmqrrKG4PK5CoiN2vr+/jFonsd2pIzXFkqAGGpwpzosALZ7idrBmyon+HMwOID0yoVL2A5qOQEwoFjBhbQvyfw6+Ror3xPLj4D15+XGMtDY8gqDlEDssPhYVkiEfQt9VkdanItN4GJSqBvscrLLZS/tjthTtbrXmmF3gRSu4bg== Received: from PS2PR06CA0013.apcprd06.prod.outlook.com (2603:1096:300:56::25) by TYZPR04MB7302.apcprd04.prod.outlook.com (2603:1096:400:453::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.19; Wed, 20 Sep 2023 05:55:19 +0000 Received: from HK2PEPF00006FB1.apcprd02.prod.outlook.com (2603:1096:300:56:cafe::fb) by PS2PR06CA0013.outlook.office365.com (2603:1096:300:56::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.29 via Frontend Transport; Wed, 20 Sep 2023 05:55:19 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 211.20.1.79) smtp.mailfrom=wiwynn.com; dkim=none (message not signed) header.d=none;dmarc=fail action=quarantine header.from=wiwynn.com; Received-SPF: Fail (protection.outlook.com: domain of wiwynn.com does not designate 211.20.1.79 as permitted sender) receiver=protection.outlook.com; client-ip=211.20.1.79; helo=localhost.localdomain; Received: from localhost.localdomain (211.20.1.79) by HK2PEPF00006FB1.mail.protection.outlook.com (10.167.8.7) with Microsoft SMTP Server id 15.20.6792.20 via Frontend Transport; Wed, 20 Sep 2023 05:55:19 +0000 From: Delphine CC Chiu To: joel@jms.id.au, openbmc@lists.ozlabs.org, patrick@stwcx.xyz Subject: [PATCH linux dev-6.1 v2 1/2] dt-bindings: hwmon: add INA233 binding documents Date: Wed, 20 Sep 2023 13:55:13 +0800 Message-Id: <20230920055514.1668839-2-Delphine_CC_Chiu@wiwynn.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230920055514.1668839-1-Delphine_CC_Chiu@wiwynn.com> References: <20230920055514.1668839-1-Delphine_CC_Chiu@wiwynn.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HK2PEPF00006FB1:EE_|TYZPR04MB7302:EE_ X-MS-Office365-Filtering-Correlation-Id: da96d946-3d62-460e-a0b9-08dbb99e2bdd X-MS-Exchange-AtpMessageProperties: SA X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AZNu6vcunEUuJ88Lmj8SP5l+SJUqNsMYIxy0Bl2oErnmgzqgES3PSmPo1Bq1RC1aBhsnXehdskov4vbldLwECy8sERAl4zyBvmm6nwpvj8doggguQ3nXPpNQb5pkALoYG6XUAn8lP9OkVQheomxX+/nlGdt2IcYw9rkcD9c2g5/2zxVQoMeQDVD9O1HxBelM/f68eTAjCk6rAFwHHslFmwogVz8jS2IMf+F4QpNZJZANbdAOCrDMntXfTOIHeOx8gSHYa8DunSZNhG+bW3hJVjTa0U2myhrtQ7su1RqKJ+7gqy348YFqmt17+RhwaAX2NC451iZ7aovo5GdtfPlmuKwj8RVmGta9aDvKWfad/1b0vYOid8pClmV7N20THXNLGzVxC6Yu94l2sNP3lSF+V6OKIR5MXH2d1H8yGzHZy72W1wfEDySirduK9DLNlpXOuJlSi2pfxivtVdyDeuWisqtgBr1P2DcjDrQWqhEXJ5VFUG54+z0flr7WSBjZZHP+35sPQdt6BPQZaTTDX/GfzfPuZ3WGEPhd+0reuxpRwmri6LVpyTx7Cfc1fKzbBveICZA5dbmzIW/w5M4+eHEZtAj1rmV11co8HYhDiqg1kYV/P4rwHe3qdrjypXl3eCzBRRrbACjOgB9Lql0Mf+eGmzffvbj8VqhhMdA16fOea4ahxIj5dWb0QkNcsBF5yF5FLSZPyvAGTIwgcnM2Ke5nFg== X-Forefront-Antispam-Report: CIP:211.20.1.79;CTRY:TW;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:localhost.localdomain;PTR:211-20-1-79.hinet-ip.hinet.net;CAT:NONE;SFS:(13230031)(6069001)(4636009)(376002)(346002)(396003)(39850400004)(136003)(451199024)(1800799009)(186009)(82310400011)(36840700001)(46966006)(316002)(36736006)(70586007)(70206006)(40480700001)(478600001)(6666004)(81166007)(2906002)(36756003)(86362001)(41300700001)(5660300002)(4326008)(8676002)(8936002)(9316004)(336012)(1076003)(26005)(107886003)(36860700001)(2616005)(956004)(47076005)(82740400003)(6506007)(6486002)(356005)(6512007);DIR:OUT;SFP:1101; X-OriginatorOrg: wiwynn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2023 05:55:19.4035 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: da96d946-3d62-460e-a0b9-08dbb99e2bdd X-MS-Exchange-CrossTenant-Id: da6e0628-fc83-4caf-9dd2-73061cbab167 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=da6e0628-fc83-4caf-9dd2-73061cbab167;Ip=[211.20.1.79];Helo=[localhost.localdomain] X-MS-Exchange-CrossTenant-AuthSource: HK2PEPF00006FB1.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR04MB7302 X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Delphine CC Chiu Errors-To: openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "openbmc" Add INA233 binding documents for Yosemite V4 config. Signed-off-by: Delphine CC Chiu --- Changelog: v2 - Revise Makefile typo v1 - Add ina233 driver and binding document --- .../devicetree/bindings/hwmon/ina233.txt | 27 +++++++++++++++++++ MAINTAINERS | 6 +++++ 2 files changed, 33 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/ina233.txt diff --git a/Documentation/devicetree/bindings/hwmon/ina233.txt b/Documentation/devicetree/bindings/hwmon/ina233.txt new file mode 100644 index 000000000000..a1067788ec0c --- /dev/null +++ b/Documentation/devicetree/bindings/hwmon/ina233.txt @@ -0,0 +1,27 @@ +Bindings for the Maxim MAX31790 Intelligent Fan Controller +========================================================== + +Reference: + +https://pdf1.alldatasheet.com/datasheet-pdf/view/930928/TI1/INA233.html + +The INA233 device is a current, voltage and power monitor with an I2C-, SMBus-,and PMBus-compatible interface +that is compliant with digital bus voltages from 1.8 V to 5.0 V. +The device monitors and reports values for current, voltage and power. +The integrated power accumulator can be used for energy or average power calculations. +Programmable calibration value, conversion times and averaging when combined with an internal multiplier +enable direct readouts of current in amperes and power in watts. + +Required properties: +- compatible : ti,ina233 +- reg : I2C address +- resistor-calibration : MFR_CALIBRATION which will be set into register 0xd4 +- current-lsb : Current_LSB for calibration +Example: + + ina233@45 { + compatible = "ti,ina233"; + reg = <0x45>; + resistor-calibration = /bits/ 16 <0x0a00>; + current-lsb= /bits/ 16 <0x0001>; + }; diff --git a/MAINTAINERS b/MAINTAINERS index ccf8d060cd22..3fa307f1157d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10034,6 +10034,12 @@ F: Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml F: Documentation/hwmon/ina209.rst F: drivers/hwmon/ina209.c +INA233 HARDWARE MONITOR DRIVER +M: Delphine CC Chiu +S: Odd Fixes +F: Documentation/devicetree/bindings/hwmon/ina233.txt +F: drivers/hwmon/ina233.c + INA2XX HARDWARE MONITOR DRIVER M: Guenter Roeck L: linux-hwmon@vger.kernel.org From patchwork Wed Sep 20 05:55:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Delphine CC Chiu X-Patchwork-Id: 1836999 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=wiwynn.com header.i=@wiwynn.com header.a=rsa-sha256 header.s=selector2 header.b=Sri6dP6s; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rr79w6mymz1yhR for ; Wed, 20 Sep 2023 15:58:12 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=wiwynn.com header.i=@wiwynn.com header.a=rsa-sha256 header.s=selector2 header.b=Sri6dP6s; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Rr79w5fPjz3bWH for ; Wed, 20 Sep 2023 15:58:12 +1000 (AEST) X-Original-To: openbmc@lists.ozlabs.org Delivered-To: openbmc@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=wiwynn.com header.i=@wiwynn.com header.a=rsa-sha256 header.s=selector2 header.b=Sri6dP6s; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=wiwynn.com (client-ip=2a01:111:f403:704b::61f; helo=apc01-tyz-obe.outbound.protection.outlook.com; envelope-from=delphine_cc_chiu@wiwynn.com; receiver=lists.ozlabs.org) Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2061f.outbound.protection.outlook.com [IPv6:2a01:111:f403:704b::61f]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Rr7761RSDz3bWy for ; Wed, 20 Sep 2023 15:55:46 +1000 (AEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jvJM3quoPCtGkOVbvNZD2OMo+rhNYq10Q5/WXDpldbVGIrP2sPCvfca5VOKFKDVezAMWbIExtKXpxdG8Xb0op6yWWIwBbB3g6/8MCrdQAuKeT/TFcKcKgLVhs5Ubos21HoQGAGu7lIYwi0zlhE+ZDxrEVf5L4LOnnovBkUHIPTeT0oJs9qg+FC29UK5MTnOmwK3srS0X31m2MDm0UWTYAMJglsAfXZJHhxpOzUHBA08G7j0zEI99xYbZzsbZ4i72orTExf4engapIEUZ54cp1ryrQmdESfdg21dP8Vg4ebWtqc6mEaY5/qoLU+J2eT6UOAelo0GU3rF0a2AQqtIYyA== 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=SngvFZz0WrVr9my/V+zZcgZ5AXSnL7bYwQPBnDdHscM=; b=EKsuXswaOz+Ujd5Est/BFDOXVK5O1Qq00Dul/zQMCANEO7QKXpz9G2SdZ7mYHNSksC+PTiVeFrR0loaRLx0kXqOCVwOKA1/2eLF+xsNjtK4AMKeISEn4SxjuiuD/A9s+cZ/YaJNORceGFX269kW38UXrIO2J/VmBuNyKwAYMGWw5y9Rtm3Jhs3DEqNWI8k/3Un78PdLNDfHh+fCVeXYcuq9PN09ZP6xdcr0rxoI2f/gE5BELD3/TDHVKQuSdg4uZpaQO1RM3NFtof6DFZnXSa1w7BG1iZAMYCk428PKAy6Yhcbt40isbGCCuMmGkDA26MpEGZEmG3lcng9VxEOx+8Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 211.20.1.79) smtp.rcpttodomain=jms.id.au smtp.mailfrom=wiwynn.com; dmarc=fail (p=quarantine sp=quarantine pct=100) action=quarantine header.from=wiwynn.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wiwynn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SngvFZz0WrVr9my/V+zZcgZ5AXSnL7bYwQPBnDdHscM=; b=Sri6dP6skx3lEKGVxvDWqmoibm14CvKTetknBuk0CCuw6EamX9NlQeHj+EcKW5ail/K99tC8y7G75nOoIQYxb2x0APKdMUrQFcytyhlaOavI5ZJO4YnnlvjwFcO/UHDFSkwDAqvJZWDNWKwz5sXp9pIWmetXiaf2JyRQ8luG1F07zcsyOHgzk9/OkAFtGy7yZWMdvL4bmEj1dZY7k/pPTGKkTA3TWCRaKU7Cr6UjYniNOt/erUBdqgc1lX1ChvzDmxcNfhwMYb2+5E74zFFTjqVfmNrViBCPYY1B1hyxZFhvioMB8Jq4MEOpiGwrjRKcE80Euaou1aYkBpgGuUH/pA== Received: from PS2PR06CA0003.apcprd06.prod.outlook.com (2603:1096:300:56::15) by SEYPR04MB7632.apcprd04.prod.outlook.com (2603:1096:101:1dd::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.27; Wed, 20 Sep 2023 05:55:26 +0000 Received: from HK2PEPF00006FB1.apcprd02.prod.outlook.com (2603:1096:300:56:cafe::7f) by PS2PR06CA0003.outlook.office365.com (2603:1096:300:56::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.28 via Frontend Transport; Wed, 20 Sep 2023 05:55:26 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 211.20.1.79) smtp.mailfrom=wiwynn.com; dkim=none (message not signed) header.d=none;dmarc=fail action=quarantine header.from=wiwynn.com; Received-SPF: Fail (protection.outlook.com: domain of wiwynn.com does not designate 211.20.1.79 as permitted sender) receiver=protection.outlook.com; client-ip=211.20.1.79; helo=localhost.localdomain; Received: from localhost.localdomain (211.20.1.79) by HK2PEPF00006FB1.mail.protection.outlook.com (10.167.8.7) with Microsoft SMTP Server id 15.20.6792.20 via Frontend Transport; Wed, 20 Sep 2023 05:55:26 +0000 From: Delphine CC Chiu To: joel@jms.id.au, openbmc@lists.ozlabs.org, patrick@stwcx.xyz Subject: [PATCH linux dev-6.1 v2 2/2] hwmon: Add support for ina233 Date: Wed, 20 Sep 2023 13:55:14 +0800 Message-Id: <20230920055514.1668839-3-Delphine_CC_Chiu@wiwynn.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230920055514.1668839-1-Delphine_CC_Chiu@wiwynn.com> References: <20230920055514.1668839-1-Delphine_CC_Chiu@wiwynn.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HK2PEPF00006FB1:EE_|SEYPR04MB7632:EE_ X-MS-Office365-Filtering-Correlation-Id: 1fb4001d-775a-4fd1-1136-08dbb99e2fda X-MS-Exchange-AtpMessageProperties: SA X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GFLBuAewC68eRYQrRdeATyO/uqG6dii1xKv3zOLJgCA80QnXOvx1HX2NFUQxk9BDgHjqW54z/EeiW93WVf7HzqYKmn52CecOU0a7OofpHX9d76VUSUC6wKGNdyMWYxERTa06znPr2ZMFTlDa1j01ATm30kHI2qJncTAy7FZtuipfjJ5KCrUE/TxYNgoB8nowxYiQ1UBtY3/6BcK+4koatgvPnNY4a18QvgpZhsi12KZ/JP4N6eGjjEC/fFdcJMiFmvfAUdDVXJq3BPWy8Oj2N4UCxNLhl8veOqMcf0a/l1vofIVdZl8RWtH8WXJNxo3Hfwg4F7pBjYzl1aar8JLpWduYE1RDpHnjGyQa6rlBq6x837FxXDG4O4L9JQpeIRqM/VBRF7A3jfIIu53iOCKFM3Kmjz8ST1VYrB5ETEdE+ASs/sOBSnsuL7u9gcO0BEFd6SUTT8C4dYy0sUkdpK3W4MjoGowiI0HJWMXH4GZm3bJH6S6PsASDrDpoGfKhDI3qfvzsEaJyI2hGHkvbI4+IjiXhyembV8hSIFv1DlxSXwJ5gel+vZIqDr3vjUcBrvKBt05sUyPHCUwrGlv4zwbdLEztBt0lSXc48XIpjvwROBSlp1h7bQQs1pFDJAHBJCfLVGWx/TOiTmPd5wCOWC+yyTHiuBURLFQHePvHXqbITA4P9W9kkyUfFAhiqPwabejXCzNEYiDteHzFXisr1ZPLVw== X-Forefront-Antispam-Report: CIP:211.20.1.79;CTRY:TW;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:localhost.localdomain;PTR:211-20-1-79.hinet-ip.hinet.net;CAT:NONE;SFS:(13230031)(6069001)(4636009)(376002)(136003)(346002)(396003)(39860400002)(451199024)(1800799009)(82310400011)(186009)(46966006)(36840700001)(478600001)(41300700001)(83380400001)(5660300002)(40480700001)(36736006)(6666004)(2906002)(70586007)(316002)(70206006)(4326008)(8936002)(8676002)(6506007)(6486002)(6512007)(956004)(1076003)(26005)(2616005)(107886003)(336012)(36860700001)(47076005)(86362001)(82740400003)(9316004)(36756003)(356005)(81166007);DIR:OUT;SFP:1101; X-OriginatorOrg: wiwynn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2023 05:55:26.0911 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1fb4001d-775a-4fd1-1136-08dbb99e2fda X-MS-Exchange-CrossTenant-Id: da6e0628-fc83-4caf-9dd2-73061cbab167 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=da6e0628-fc83-4caf-9dd2-73061cbab167;Ip=[211.20.1.79];Helo=[localhost.localdomain] X-MS-Exchange-CrossTenant-AuthSource: HK2PEPF00006FB1.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR04MB7632 X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Delphine CC Chiu Errors-To: openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "openbmc" The INA233 device is a current, voltage and power monitor with an I2C-, SMBus-,and PMBus-compatible interface that is compliant with digital bus voltages from 1.8 V to 5.0 V. The device monitors and reports values for current, voltage and power. The integrated power accumulator can be used for energy or average power calculations. Programmable calibration value, conversion times and averaging when combined with an internal multiplier enable direct readouts of current in amperes and power in watts. Signed-off-by: Delphine CC Chiu --- Changelog: v2 - Revise Makefile typo v1 - Add ina233 driver and binding document --- drivers/hwmon/pmbus/Kconfig | 9 ++++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/ina233.c | 89 ++++++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 drivers/hwmon/pmbus/ina233.c diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig index a40fafa42d32..4a852de5c487 100644 --- a/drivers/hwmon/pmbus/Kconfig +++ b/drivers/hwmon/pmbus/Kconfig @@ -470,4 +470,13 @@ config SENSORS_ZL6100 This driver can also be built as a module. If so, the module will be called zl6100. +config SENSORS_INA233 + tristate "Texas Instruments INA233 and compatibles" + help + If you say yes here you get hardware monitoring support for Texas + Instruments INA233. + + This driver can also be built as a module. If so, the module will + be called ina233. + endif # PMBUS diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile index e1a68d740c59..e1e4b6f2e48a 100644 --- a/drivers/hwmon/pmbus/Makefile +++ b/drivers/hwmon/pmbus/Makefile @@ -49,3 +49,4 @@ obj-$(CONFIG_SENSORS_XDPE122) += xdpe12284.o obj-$(CONFIG_SENSORS_XDPE152) += xdpe152c4.o obj-$(CONFIG_SENSORS_ZL6100) += zl6100.o obj-$(CONFIG_SENSORS_PIM4328) += pim4328.o +obj-$(CONFIG_SENSORS_INA233) += ina233.o diff --git a/drivers/hwmon/pmbus/ina233.c b/drivers/hwmon/pmbus/ina233.c new file mode 100644 index 000000000000..393b595344c5 --- /dev/null +++ b/drivers/hwmon/pmbus/ina233.c @@ -0,0 +1,89 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Hardware monitoring driver for Texas Instruments INA233 + * + * Copyright (c) 2017 Google Inc + * + */ + +#include +#include +#include +#include +#include +#include "pmbus.h" + +#define MFR_CALIBRATION 0xd4 + +struct pmbus_driver_info ina233_info = { + .pages = 1, + .format[PSC_VOLTAGE_IN] = direct, + .format[PSC_VOLTAGE_OUT] = direct, + .format[PSC_CURRENT_IN] = direct, + .format[PSC_CURRENT_OUT] = direct, + .format[PSC_POWER] = direct, + .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT + | PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT + | PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_POUT, + .m[PSC_VOLTAGE_IN] = 8, + .m[PSC_VOLTAGE_OUT] = 8, + .R[PSC_VOLTAGE_IN] = 2, + .R[PSC_VOLTAGE_OUT] = 2, +}; + +static int ina233_probe(struct i2c_client *client) +{ + int ret; + u16 shunt; + u16 current_lsb; + of_property_read_u16(client->dev.of_node, "resistor-calibration", &shunt); + + ret = i2c_smbus_write_word_data(client, MFR_CALIBRATION, shunt); + if (ret < 0) { + dev_err(&client->dev, "Failed to set calibration\n"); + return ret; + } + ret = of_property_read_u16(client->dev.of_node, "current-lsb", ¤t_lsb); + if (ret < 0) { + dev_err(&client->dev, "Failed to set current_lsb\n"); + return ret; + } else { + // Referenced by table of Telemetryand WarningConversionCoefficients in datasheet + ina233_info.m[PSC_CURRENT_IN] = 1000 / current_lsb; + ina233_info.m[PSC_CURRENT_OUT] = 1000 / current_lsb; + ina233_info.m[PSC_POWER] = 40 / current_lsb; + } + + return pmbus_do_probe(client, &ina233_info); +} + +static const struct i2c_device_id ina233_id[] = { + {"ina233", 0}, + {} +}; + +MODULE_DEVICE_TABLE(i2c, ina233_id); + +static const struct of_device_id __maybe_unused ina233_of_match[] = { + { .compatible = "ti,ina233" }, + {} +}; + +MODULE_DEVICE_TABLE(of, ina233_of_match); + +static struct i2c_driver ina233_driver = { + .driver = { + .name = "ina233", + .of_match_table = of_match_ptr(ina233_of_match), + }, + .probe_new = ina233_probe, + .id_table = ina233_id, +}; + +module_i2c_driver(ina233_driver); + +MODULE_AUTHOR("Eli Huang "); +MODULE_DESCRIPTION("PMBus driver for Texas Instruments INA233 and compatible chips"); +MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(PMBUS); +