From patchwork Tue Jun 11 09:36:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amna Waseem X-Patchwork-Id: 13693360 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2066.outbound.protection.outlook.com [40.107.104.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C6022230F; Tue, 11 Jun 2024 09:36:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718098596; cv=fail; b=opLk2bEnzleR/wZfbHdExMmUDPxredk4TuVBXOfJIcY4aoj9v67ehywFwFBAP7UoCSzdi6murYZ8Kv+E9Yo1SL444xddM6ZnnIuqHVX8nv/I+NOK+7JkYNSe6U0RRoUtxdF/NzHfRx65pr39DSWbjBkvzXfB8rvzwynTaJwDYFQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718098596; c=relaxed/simple; bh=Aygr9R2mzS920fDPrA/NTOlPcNvSxjrZ/xf52JNeZeg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=bSwl+qHysBU5LSXHYtfDn2qcLi3dYPdFsceEDP5uDy+8iOI+2jDOVzgg8kJegg+tj5FVJa2leqlJ0LmiH3Uh6pJJDwrpPPOQ2ySo+pvaiZp9h4xJTy+ffbghBI8czi4Sf/j8gl2R2K6Kg9q5lzGtHTlGc7VoVl48Ps+gxxUnAZE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=axis.com; spf=pass smtp.mailfrom=axis.com; dkim=pass (1024-bit key) header.d=axis.com header.i=@axis.com header.b=FEDB4X7p; arc=fail smtp.client-ip=40.107.104.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=axis.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=axis.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=axis.com header.i=@axis.com header.b="FEDB4X7p" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sc/KHlG4L5Us6raHXTnGcSxERDwSLZhMkIfIg00wX5ogbEjfnsL5E3lio980Ycq7BZthdAdKE75/tSW6niVAhyh1+jZM+WBNQwpICE7sy/ZEeZH6BtRfPqy53nHsY7HdQAg+9fjAPz5vwHSmi3VB32GzdVC34NJySl9881QCKrMqc4K0+e2V3e11DgfM4kZQELe1AMG252OxlxjkIi4t5nkA7Z161Qe1Ite2c01LNcgaL925i9tznEL6XvvF6lrLI/hPFhArbnabTA/FodM4Y5OWyqJhoF0z6w9y87Qu6ZQtiSaXPdNdIy0kEiFF0A81fwreJiZIF9vJxvXDNvzzOw== 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=SnN5xWXK/p4vK+PGPC8m1Os43S1H1QsdFOPx/XaGFYI=; b=XRyEz0mqoE+mi3kAooY+EFZ2/sdshmVAdpxuaCNM3VNTzxLRBOPv+b2D272tFATKg0wvIywhdu1LBLw5XkIz5Uh08Wq/XzuP61BSNFR5A9Bgd5rk/xE2BD7w3vSLj+0XRiZJt63b8lcO1P7x99XCWhxv6W67kHURNeo0gisP0CXac4CHNZ6Ekvdy/za7iwpf0UslPwee84LlY5/BdETA6p8H3mpUOo6mnZvyjGBK/OpEgKAx/Sbg+g+AnzeZhEpGauxN+MUgpUwgoTKd+MsuF9eksCrJ3dlcx6IfuKSZw1LMawENKMQie/XQ9KE8v0QcozV013Fn9bWqboxEcFYTHg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=kernel.org smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SnN5xWXK/p4vK+PGPC8m1Os43S1H1QsdFOPx/XaGFYI=; b=FEDB4X7pEqNx4G7uwC6TYfoYujs8n1aNnKXUfefJK+U8dmC8tCuK7S/66nHCNBEsXgM1kjAg7bvTL2USsr1qMIhudHKcEcLI6QKZ4tYZQS5b8csVy17DRV5xh9IxUi8OAj/PeTFGQg8O4dqFxF1dbVUGn87r/VSujmYzGl8OPYQ= Received: from DUZPR01CA0184.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b3::7) by AM9PR02MB6643.eurprd02.prod.outlook.com (2603:10a6:20b:2ce::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.36; Tue, 11 Jun 2024 09:36:26 +0000 Received: from DB1PEPF000509ED.eurprd03.prod.outlook.com (2603:10a6:10:4b3:cafe::d6) by DUZPR01CA0184.outlook.office365.com (2603:10a6:10:4b3::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.17 via Frontend Transport; Tue, 11 Jun 2024 09:36:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by DB1PEPF000509ED.mail.protection.outlook.com (10.167.242.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Tue, 11 Jun 2024 09:36:30 +0000 Received: from SE-MAILARCH01W.axis.com (10.20.40.15) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 11 Jun 2024 11:36:28 +0200 Received: from se-mail02w.axis.com (10.20.40.8) by SE-MAILARCH01W.axis.com (10.20.40.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 11 Jun 2024 11:36:28 +0200 Received: from se-intmail01x.se.axis.com (10.0.5.60) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Tue, 11 Jun 2024 11:36:28 +0200 Received: from lnxamnaw.se.axis.com (unknown [10.92.129.190]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id 468923D46; Tue, 11 Jun 2024 11:36:28 +0200 (CEST) Received: by lnxamnaw.se.axis.com (Postfix, from userid 12778) id 448CA205FB3; Tue, 11 Jun 2024 11:36:28 +0200 (CEST) From: Amna Waseem Date: Tue, 11 Jun 2024 11:36:25 +0200 Subject: [PATCH v4 1/2] dt-bindings: hwmon: ti,ina2xx: Add ti,alert-polarity-active-high property Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240611-apol-ina2xx-fix-v4-1-8df1d2282fc5@axis.com> References: <20240611-apol-ina2xx-fix-v4-0-8df1d2282fc5@axis.com> In-Reply-To: <20240611-apol-ina2xx-fix-v4-0-8df1d2282fc5@axis.com> To: Jean Delvare , Guenter Roeck , "Rob Herring" , Krzysztof Kozlowski , "Conor Dooley" CC: Krzysztof Kozlowski , , , , Amna Waseem , X-Mailer: b4 0.13.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF000509ED:EE_|AM9PR02MB6643:EE_ X-MS-Office365-Filtering-Correlation-Id: 56702498-1fff-468c-7fbb-08dc89f9f98d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|82310400017|376005|1800799015|36860700004; X-Microsoft-Antispam-Message-Info: =?utf-8?q?5Hot0TkNf27qUc6kyTuh+LsusFYBKhF?= =?utf-8?q?xvIZHkrkyiSkbbEgP8RZJVa7cJqAZ+tykIhn1+6oiByt4DSIX/HnQjqFfP0ysdsg8?= =?utf-8?q?jEL69pVYjrjHS94LauHRiPEPnvUJgc4zs8mcZMsCJvfTHmF5AQoDJbJkE6qz72RzG?= =?utf-8?q?gobJSiyoPbG/oWUaLOGgJwg12yqZFNMCALlchbqtW+k4qr72+bXLEoVnvQVFhUw8+?= =?utf-8?q?fBr3jQV0Qmz0jfiI29XNWPbw9JfAUd+QTZvewNWJEY0DaIJj97G1Bkk6nRoGD2dnJ?= =?utf-8?q?cmiNVqMiBNjLvf/SWl1KG8qirSe0PvY/DQwcP3kCEuEoYT9dJFKuWnpHOXYpsoNgY?= =?utf-8?q?RzLKP1QMweiXjjWIQ6qVU4mhZ/7NzY43VHNLwIDkYpUtd5DFMqqvRyN7aajRMPPI+?= =?utf-8?q?ATBcq2xBTlT3w+RV7V1g/4K9lp0EZ1+X4i6vgYkxwwKIH+JAiouQp41pvlLDiswT6?= =?utf-8?q?heeERF99MFTlR00H0X5L0O3+GzsmY5wgFPJF1jsye0904hmxMQ1SLLHWrBJVBkAs5?= =?utf-8?q?9RH9k7d9Wr/SIo5K43hNNheTwQytQt3I97BOp1zr4oyI7E2TxY9hKqhFnN6C+CpYz?= =?utf-8?q?mNO7LVbC23JzXrSJzTZqGc3pWnt7ZEUC97IiA6+zncYxRIMiNwB6wk68lzsZE52VI?= =?utf-8?q?HhYGb39nH7Tdwn9wCfWND8rrZRyhRr/VUxE4FV1+2QHvVu/qni963Jj/wxQOxe/n5?= =?utf-8?q?ByCpoHkNfmB8Emiy3tu7CDkyG9JGt0wKUHRKtosGDYzJotAGKQv1/ukN/b2d1E34O?= =?utf-8?q?Jnsa3euIOSbuGL+5r5Yhte8x/hHJ/3Pwuoery8Hu/V+owPzsfQzsKF8UfiB4YCgVY?= =?utf-8?q?20dvdsgC4+/YCKc48D3/xPm5YXMOBY8oNuscW4vQj2CSHhvsgomRTMFpa2TflTvWG?= =?utf-8?q?xyxxbm2DgBKtp0VtEhJLo5drjP+bNLWIdrZDZ0V8LCAgnSUJkeC8Ah/eVBcIgnPg+?= =?utf-8?q?0iys8Tze7oq6S3gWgAkKBpK7IWMLghSWWLyuM/EOTueY0SEW4X1rmaV99ViGOSy3/?= =?utf-8?q?4cG0OPr979atYs3JABqk+uwRyV6Ml3knAOMcruj41WRfQU9c5rLnVrJ6Ze3o306Y9?= =?utf-8?q?r1oDzBD6XXtWAcKzFZ6rToGdI9C58B6sKrd2RxQ9+OnfG5zBX+os+4jnRkEJiXMCb?= =?utf-8?q?eeqCbrWqyBBgp4puXlGGuef7RLlkYIhhXglzg2hqqVbDXpgA+KpMdn1Wf9RFL4urZ?= =?utf-8?q?MxgaRFeJgxnCgGsFttZ91FEl3MKWTxzdAvnunBcmr+BmqGRarD+1Y3WTEYQ8awd3N?= =?utf-8?q?T7A5+rCAX0nkwG23U1WQijB2RFIMCfvnEWktWlXAVGNuQQuW5ATP+utKB8guSyxws?= =?utf-8?q?EgsDxMpMLIM+EbqjtI7XvMACnnNU98y1gg=3D=3D?= X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(82310400017)(376005)(1800799015)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2024 09:36:30.5648 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 56702498-1fff-468c-7fbb-08dc89f9f98d X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF000509ED.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR02MB6643 Add a property to the binding to configure the Alert Polarity. Alert pin is asserted based on the value of Alert Polarity bit of Mask/Enable register. It is by default 0 which means Alert pin is configured to be active low open collector. Value of 1 maps to Inverted (active high open collector). Signed-off-by: Amna Waseem --- Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml b/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml index df86c2c92037..9190ef0bda54 100644 --- a/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml +++ b/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml @@ -66,6 +66,14 @@ properties: description: phandle to the regulator that provides the VS supply typically in range from 2.7 V to 5.5 V. + ti,alert-polarity-active-high: + description: Alert pin is asserted based on the value of Alert polarity Bit + of Mask/Enable register. Default value is Normal (0 which maps to + active-low open collector). The other value is Inverted + (1 which maps to active-high open collector). Specify this property to set + the alert polarity to active-high. + $ref: /schemas/types.yaml#/definitions/flag + required: - compatible - reg @@ -88,5 +96,6 @@ examples: label = "vdd_3v0"; shunt-resistor = <1000>; vs-supply = <&vdd_3v0>; + ti,alert-polarity-active-high; }; }; From patchwork Tue Jun 11 09:36:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amna Waseem X-Patchwork-Id: 13693361 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2053.outbound.protection.outlook.com [40.107.6.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3B9617623D; Tue, 11 Jun 2024 09:36:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.6.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718098597; cv=fail; b=WMuQ0izuqlIfStOb1VztvfugaasATKYVdUqlUvZtwQRayv1xH/aEvgtg21Pa8/cDakfVRVq8QRE6mR80F+9/36au5wzGG70SOOH1nUpwtn8+GraEnKyuIMhBMNZNYqPoawVPzZipG/tvfVT2gaENWe9MrlxgSOG7wwPR1HDQm/I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718098597; c=relaxed/simple; bh=/pLFLvsmTvstIusxiLOXn00gR8P/rtdCps+6C+6HuYg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=eqqXtY5nB5P+GoQVMooM953JllJo4H5oGSxt1+Km3+Y65kwYwAGYSoASRd/8U2o0oMGCZNEOFmYPQvUe16nNqVH4PDGCRNvGSOEtn/eQd/NRZvW0ZyO29pip9qzT8F/Qfl04wOkpTKFNHW2EeDu+C698M4xGbjjGwCIp987ZJG0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=axis.com; spf=pass smtp.mailfrom=axis.com; dkim=pass (1024-bit key) header.d=axis.com header.i=@axis.com header.b=H0m8tWyo; arc=fail smtp.client-ip=40.107.6.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=axis.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=axis.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=axis.com header.i=@axis.com header.b="H0m8tWyo" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Anx5OQVF0fyeM6yWOZzTEiQcqJCXyXvot60Kt7rooK/awQsgthwZWwqzxj47TN65HnMqvplYl81g5GGHSx2qy7169nn0bgEjLjAXs0MM2ZzBsG31mI6pCltNqc8azOop91025aymArHaktMq/8mV4GdTm8somMfhvVrhVmo7V0Dog5YQWQDOJ5Zm0DugELzgptO7OB/C6D0w1jXwB0z45/GXIEt+fE31UC/a/afBOzsz6HfO9ppg44iokEShNNHGNxmsU/IQELJBqwPZtWGIBBKmwB5eH3H5PYSJLd8R4kc9kbQhbCxzO7nv4k794Wa/DSS1h1v4s+9kn0Ewip4X9A== 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=3LISKJW0Ft8RRdvxUOaTd+tMKHmGv1hfXEUZAakyH90=; b=SBc0tkCXseq9/93zMuwOHrPg3+qYwmkVZPlIRoTNlYOc2HXxGGCS+IQiHHXsGsp0izTAKl0B5EJ2Xy0Fw59xyaANoN51Idi0+M8hC9ZNOGBvme20Uf0tpdYTHJR1Q9YOIsHGUgcH4onm8VzItTHnhh9V8N1LYEWJpjXxrxMQTt/MszCTrgtVWt3cgHHUdKFZ+1AGXRgHKYn/bZ/YYHHvYnGxoSBeQyvJRlrzVJiKNwEBNVjcaPSINJ9mRqSL5ckd7d+SP9U0ne3aSVpwKAO5j5TsfQ1pJYaSCGkkRSUxXGGWB8L2FEqPS7JD880dc+XNzhrByvZPTsr7IDkjVzA/GQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=kernel.org smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3LISKJW0Ft8RRdvxUOaTd+tMKHmGv1hfXEUZAakyH90=; b=H0m8tWyoM0z0m2qQvbuPWIho/4j5gjHuvtSCGBerGxVIdXefRQ5TAAPKhdjiqrVE50FPalfQWT29DQ8qY9tN8TfUfKazfUr+HQXd10+umMC7iYym073y5Bs9o/Ig6ZqBeTyAj7AKoY1XsjQVhQMJnsyBKs3NLYI+w4h/XJFJ2Uo= Received: from DUZPR01CA0175.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b3::19) by PA4PR02MB8193.eurprd02.prod.outlook.com (2603:10a6:102:272::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.36; Tue, 11 Jun 2024 09:36:30 +0000 Received: from DB1PEPF000509ED.eurprd03.prod.outlook.com (2603:10a6:10:4b3:cafe::41) by DUZPR01CA0175.outlook.office365.com (2603:10a6:10:4b3::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.27 via Frontend Transport; Tue, 11 Jun 2024 09:36:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by DB1PEPF000509ED.mail.protection.outlook.com (10.167.242.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Tue, 11 Jun 2024 09:36:28 +0000 Received: from se-mail02w.axis.com (10.20.40.8) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 11 Jun 2024 11:36:28 +0200 Received: from se-intmail01x.se.axis.com (10.0.5.60) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Tue, 11 Jun 2024 11:36:28 +0200 Received: from lnxamnaw.se.axis.com (unknown [10.92.129.190]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id 4A6D4574A; Tue, 11 Jun 2024 11:36:28 +0200 (CEST) Received: by lnxamnaw.se.axis.com (Postfix, from userid 12778) id 47A90207290; Tue, 11 Jun 2024 11:36:28 +0200 (CEST) From: Amna Waseem Date: Tue, 11 Jun 2024 11:36:26 +0200 Subject: [PATCH v4 2/2] hwmon: (ina2xx) Add device tree support to pass alert polarity Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240611-apol-ina2xx-fix-v4-2-8df1d2282fc5@axis.com> References: <20240611-apol-ina2xx-fix-v4-0-8df1d2282fc5@axis.com> In-Reply-To: <20240611-apol-ina2xx-fix-v4-0-8df1d2282fc5@axis.com> To: Jean Delvare , Guenter Roeck , "Rob Herring" , Krzysztof Kozlowski , "Conor Dooley" CC: Krzysztof Kozlowski , , , , Amna Waseem , X-Mailer: b4 0.13.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF000509ED:EE_|PA4PR02MB8193:EE_ X-MS-Office365-Filtering-Correlation-Id: e9baa9c4-bf86-4c2b-2951-08dc89f9f893 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|82310400017|1800799015|376005|36860700004; X-Microsoft-Antispam-Message-Info: =?utf-8?q?dmA+ZgKiKRWuMxhQLp+WHL2WTzx73dO?= =?utf-8?q?MwiP0QbyG+/7qAZPjDRPl4b2O7dsDTPfGvsYla0bVf6ZBsX6g/VfZhLP16WEZfIrV?= =?utf-8?q?fOMm4uFG5zF5tOKMgeOFlvmILm4PJKSpUCTQquLWGgDKFyAexvBYytebB22dojImN?= =?utf-8?q?Fm8O2enVHpHAgQVyziS5pI7WTSL/j3liUBR/lQD0XAihckjEiMqpjz1hbCDx+Lifd?= =?utf-8?q?ZctHOWddHHZNDB0lZzjyE9Ez+y5TTu6r8iXgMYi+Ks9/cW3WfyM+YSqPJltAfoSRa?= =?utf-8?q?yEvZ+o2tkLkyqki8KZ+5CeQnY4kYvL7oyJ7e2Hw+IH6p8jlA9cQe2bFLfHXLF9x3Y?= =?utf-8?q?MQ6PPum0o8dNbtk3O1l+5/S5YH0ocsI3w2/8zOrF2zV0FanMTUxNsxPvbVBLbQGxb?= =?utf-8?q?Sc2ZBm5GjDOiL640x9M8jg2hqbQrHRhavFzPlriGi2Nov4E2kgDZmLIkD/7CkPPAr?= =?utf-8?q?QOlRoFiVcs7lwCeccoWXJ9Wd4vjUNrXbGkbvWCvbWfDaiqmU0MHQaav9RfhHS5JyM?= =?utf-8?q?GsGCC7cJCpiSsg7yUdzo49PvXKdeKtdAS0h+IMa4nA0aIsDok1jGA0c5RqqgR5YNl?= =?utf-8?q?UwmozkkQIZ53G0QgGbv272m6wJ2QoSlG3kVcpWcMQcppp3h5sgvhcTGzHdH9Y46lF?= =?utf-8?q?Grc8kfUEMi2PUVj+CCtfSlak9mIcvnEnT345COc8EwwaCzwlDJ1ThznGRoH/gTQU1?= =?utf-8?q?4XFsbr0iLvMybjCKxO+r7jhohnrQaeosUXx1FGjHcfZ6T9lHCeoZOLiX01rcRZSqb?= =?utf-8?q?Nf+d9TqwfkK9NE2a4GcEED8+Bo7FXMw0V7uk+YXtpiRqful+3wIMj1SBrVzzvy1i9?= =?utf-8?q?Eyd3CnkJWtJlFgBre3XhwaZtRy96JKqSnVjYQdHIatJO2fuIU2+el0zWI+3umahhI?= =?utf-8?q?o9z+WsXd6c2AADuIm0UDXCJO1dv7wpMbgA1SbyekimkJn83+WyY9gY9MB+iLRzUeO?= =?utf-8?q?9CtcjBeQbK7/gkRSeX2Ere7eqMWqDQawEZr4UA+MrqeUoCAqGCwqWtTNdNaFUiPAz?= =?utf-8?q?UQJZrnqZQx2ABFf5m06hNBx9JIqYg8cuiewi6DjY5o7HJO2dTh3heUK35kLpOIAT+?= =?utf-8?q?gBHLQU7ZWG42wwCMDOs3EP7+2q6WTiEMu2oU7h4dPE9rRTbDvPNPSTAO5lEaDExzT?= =?utf-8?q?Z4UjT4wvUzLqvGjeNMOaAMhz54rwsXBTuZSIgTwhWIHZn00QChSfCwV9cjOdAc2QK?= =?utf-8?q?p8REGNhHpRw6Mup79qjZRpwjH4w466uFW7ZqJtbTLCjLOtX+DcgHGZTaiGJlBStrl?= =?utf-8?q?iO+B5/27JnGVRqkZ/fVqRu/WGEzAn3EJ/Yk/hjL/G+RGapsweQATtuuwOZiCNyOg1?= =?utf-8?q?96hF1LFApwox+oeFEe4nlGBIO9Hdy4rlMw=3D=3D?= X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(82310400017)(1800799015)(376005)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2024 09:36:28.9243 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e9baa9c4-bf86-4c2b-2951-08dc89f9f893 X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF000509ED.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR02MB8193 The INA230 has an Alert pin which is asserted when the alert function selected in the Mask/Enable register exceeds the value programmed into the Alert Limit register. Assertion is based on the Alert Polarity Bit (APOL, bit 1 of the Mask/Enable register). It is default set to value 0 i.e Normal (active-low open collector). However, hardware can be designed in such a way that expects Alert pin to become active high if a user-defined threshold in Alert limit register has been exceeded. This patch adds a way to pass alert polarity value to the driver via device tree. Signed-off-by: Amna Waseem --- drivers/hwmon/ina2xx.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index d8415d1f21fc..f26ba479bf5c 100644 --- a/drivers/hwmon/ina2xx.c +++ b/drivers/hwmon/ina2xx.c @@ -73,6 +73,11 @@ #define INA226_READ_AVG(reg) (((reg) & INA226_AVG_RD_MASK) >> 9) #define INA226_SHIFT_AVG(val) ((val) << 9) +#define INA226_ALERT_POLARITY_MASK 0x0002 +#define INA226_SHIFT_ALERT_POLARITY(val) ((val) << 1) +#define INA226_ALERT_POL_LOW 0 +#define INA226_ALERT_POL_HIGH 1 + /* bit number of alert functions in Mask/Enable Register */ #define INA226_SHUNT_OVER_VOLTAGE_BIT 15 #define INA226_SHUNT_UNDER_VOLTAGE_BIT 14 @@ -178,6 +183,14 @@ static u16 ina226_interval_to_reg(int interval) return INA226_SHIFT_AVG(avg_bits); } +static int ina2xx_set_alert_polarity(struct ina2xx_data *data, + unsigned long val) +{ + return regmap_update_bits(data->regmap, INA226_MASK_ENABLE, + INA226_ALERT_POLARITY_MASK, + INA226_SHIFT_ALERT_POLARITY(val)); +} + /* * Calibration register is set to the best value, which eliminates * truncation errors on calculating current register in hardware. @@ -659,6 +672,25 @@ static int ina2xx_probe(struct i2c_client *client) if (ret) return dev_err_probe(dev, ret, "failed to enable vs regulator\n"); + if (chip == ina226) { + if (of_property_read_bool(dev->of_node, "ti,alert-polarity-active-high")) { + ret = ina2xx_set_alert_polarity(data, + INA226_ALERT_POL_HIGH); + if (ret < 0) { + return dev_err_probe(dev, ret, + "failed to set alert polarity active high\n"); + } + } else { + /* Set default value i.e active low */ + ret = ina2xx_set_alert_polarity(data, + INA226_ALERT_POL_LOW); + if (ret < 0) { + return dev_err_probe(dev, ret, + "failed to set alert polarity active low\n"); + } + } + } + ret = ina2xx_init(data); if (ret < 0) { dev_err(dev, "error configuring the device: %d\n", ret);