From patchwork Mon Jun 3 10:08:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amna Waseem X-Patchwork-Id: 13683570 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2047.outbound.protection.outlook.com [40.107.21.47]) (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 056968060E; Mon, 3 Jun 2024 10:08:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717409324; cv=fail; b=L5f9efL8HfbLH9YRwJC2yquH9QEoS8Jv07a6fc9od22R24Ntw9Y263Wo321snZUQt3nUDZ8nUpajZf2WcqbJtl17EW72jXKY9by7l4hF4AovfVOvkIEVh9o5iCbZaqCVvg3HIPcKFPk2nXEs0oZgAPbAJKBtONYlXA1J3J7QbFs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717409324; c=relaxed/simple; bh=Aygr9R2mzS920fDPrA/NTOlPcNvSxjrZ/xf52JNeZeg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=mxNdiIXsSdF9e8xeUpR+93VXbUiv0QAvuTn2EJJaxlKSmRiy9J9dc64HqRhz7FM9GFqRGaVP2PAHzm5xmqPAw3r2Ipq8lqHGe2wqbLfisUTr9zP24eMwJK6pohRcMpIFZoNkAOJPzeHPzJleGZP7r71N8ji+Wzzm192qbkLDVwQ= 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=PebQwg5J; arc=fail smtp.client-ip=40.107.21.47 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="PebQwg5J" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D2aYfs0XSlK/GABIiPzAts+U2Cbc98C7a1rW7ljItiOecRxqexpyQF/aQYbyYG1h414oj7DtX2uhC4tRPbq4+IsTyPW14o5HdRwQarhbj7QwnsjEuyzOrtAFw/4eXjyGggN2rjBEmQjHTQdjQd6u7MSl/lavLtF2px3gZd68q1zLPMhshMSV+i8LQ+fjHP5kBSEKfZIo8KnhW2A4pINMlKBqfKfDoPvCQq2G1pauR32pOaJFoarnzIWQsZgt/qpPfiJ6bQxMd+aBjxxVHm9GsI/w6zu2GuPbBsSuspPt/ezCuW4wCiPis5rAeFr591zeD+5lngxdyEsgg76lM4TBlA== 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=IvL3szioCaYFHlThmgkmQihuVCjoMx5J+8dsuXXiv05BKHMl3zNzcPk7e+1dMCYNQW9Up+eUZlK+M/se10MgK2lPSg64GUvJbPHGeUMrgPh7OL+323A++lG3wGPNQjgjUenKT0ZQhe52Djd3nHIl3ADOKy8V1LCS/MVhAm3A7cFnIQ5e5cgunWO89K24Hrk7jwoeKEIrHvgDcVTUSSizcNz9ZWhiAtW1QMnOXU88pFmbuGazswEKqGLyvkB4n+A9m7bhIyg43NBX8r6MvSyWDeNywLdwqKtgscUg0vLaCVX1d2emKit7JkJ22bdM0hhRZYnGj6+f4kB94vpXiAxKog== 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=PebQwg5J9nOpzZVgQVSBwhQWqAf6X6w9ty9fiY8ZyT+3DMkua7DT0jE0e7X6djhjEj5W09A7GW4mP7KIuc1/FPHrPuc31ZdDX+XQg7yDN4KKLpiICKCB9KADZcuitoqM0qhtNgRzcc+2G+g1BpKxLM3ZtgG9ZrpihZ6HvBHk1hk= Received: from DBBPR09CA0003.eurprd09.prod.outlook.com (2603:10a6:10:c0::15) by VI1PR02MB6285.eurprd02.prod.outlook.com (2603:10a6:800:17c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.25; Mon, 3 Jun 2024 10:08:38 +0000 Received: from DB1PEPF000509E2.eurprd03.prod.outlook.com (2603:10a6:10:c0:cafe::7b) by DBBPR09CA0003.outlook.office365.com (2603:10a6:10:c0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.29 via Frontend Transport; Mon, 3 Jun 2024 10:08:38 +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 DB1PEPF000509E2.mail.protection.outlook.com (10.167.242.52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7633.15 via Frontend Transport; Mon, 3 Jun 2024 10:08:37 +0000 Received: from se-mail02w.axis.com (10.20.40.8) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 3 Jun 2024 12:08:37 +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; Mon, 3 Jun 2024 12:08:37 +0200 Received: from lnxamnaw.se.axis.com (unknown [10.92.129.190]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id 29E132A66; Mon, 3 Jun 2024 12:08:37 +0200 (CEST) Received: by lnxamnaw.se.axis.com (Postfix, from userid 12778) id 24C84205DA9; Mon, 3 Jun 2024 12:08:37 +0200 (CEST) From: Amna Waseem Date: Mon, 3 Jun 2024 12:08:34 +0200 Subject: [PATCH v3 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: <20240603-apol-ina2xx-fix-v3-1-b9eff3158e4e@axis.com> References: <20240603-apol-ina2xx-fix-v3-0-b9eff3158e4e@axis.com> In-Reply-To: <20240603-apol-ina2xx-fix-v3-0-b9eff3158e4e@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: DB1PEPF000509E2:EE_|VI1PR02MB6285:EE_ X-MS-Office365-Filtering-Correlation-Id: ebf3a412-f991-4e66-7c85-08dc83b522e1 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?hJUJp8mexfLuZoEYizlXAcrmabmqwtl?= =?utf-8?q?k3UhXyW8YnY4JVbywrInpxHOJ6B9RxljQDyBLVLSBkia11irxzTMB9kPiEzKq7E1/?= =?utf-8?q?CkoVPjRpz7vTN00CGFyVhtPihb5ZJBFmLv+/CeZlcBJwepB95i6dxlYKG/cN6sNfm?= =?utf-8?q?xDDtBPfRQtxoIUkgfS8tW8KpYokIIDt5iyiTcTWmKSrhRyCvBoo+WQlG5SR0r4zJM?= =?utf-8?q?uAf6F4cLgwZE6hM665EkwzY5FBAyfBn9Xh5eleCmQOmO1dQrSPIIlFu2nd9cCgDwz?= =?utf-8?q?CfAuUeN6vcA6jz604mkqH3skK6/fwmXeFwdPwxXcc/mXH+46hYCzIeZZdrj8cmp+0?= =?utf-8?q?pUtlhqx8pf9vZGtbbGmx6wCmvpFw44e/8JIJyuDSnVannneh21bu9+U1Q0Glq8fTx?= =?utf-8?q?NZTl7TjodrbL3yfYQmT9YylhEu6ZHFcGTS7NR77QYtQCEopTWwIV95mH4u/RQ6lt7?= =?utf-8?q?On7syLs1ubYA5HZlpB+FKBQdMGsHtzzSm1vCTs+rUDTEDXtJLuQfO4B3lZU5zQYdS?= =?utf-8?q?D9mOtVFMXHmVq1IAY4SYF/0dfhsJ+amU1CPvos6dv299RcVZbDgjORgNiOw2TLW3E?= =?utf-8?q?ZB8VmOQ+RPEdKHSpZbGAtQygaME7C+G0a6RGEi/WGBtYBNE8YsUdJJ1uwtaurXKoK?= =?utf-8?q?vn5N/ARYiDxUmkdy4iYHNupJVo2GbM5Koj7whMpbCTSABZXe0+vczJVmyQxYDO9G3?= =?utf-8?q?ijma+9+zQk805IMh7YwyoYOeMVXw/6rzMKfELVetXYpTJkkYJCqPpsY2kDI9Gfv/X?= =?utf-8?q?k7TE4LoCK+ORq7+U/zqxh76eZqgOAJQdLrPYym8pnHnct/FqHK/0oSqOsMVKuvGm0?= =?utf-8?q?9CK0wimSX3UnP72bzhejjD/sHDkTxg3p9SLY0kfdru0kqbPF+QcVtQdq+Qm7UTiY5?= =?utf-8?q?zfNx+Wz9xJxRQ8osJST42Dp7+Z+XJF1H05qXMcE8AOyw6mZbFucRm7FnC14QjUE7M?= =?utf-8?q?uckQIUbERoHUJCdD5ByoIFRzZMN7SuBGiRFjoR3eGh1Qqx0aBtcnMe1pjgKw/K3vP?= =?utf-8?q?5rqkipnU8NBUAGdC6+fGAuBDbvFpYvKiixqirGoYV84ZggUZXD4kt9TQrkp+JW1vu?= =?utf-8?q?mI8JyI4cV7g4YJBetrOJDnXPr/5ULwE53RykZLq0bIZ3iJC7pPY7w0LYV4Ip2NiKv?= =?utf-8?q?HYf46L2iFWOZveRSLPgI93xLdZ/bwW0r6VaB6gzT8QK2djzwlQmJ59gGatNq6D7mW?= =?utf-8?q?SdbK0Dx6zGTdi6xfr17/v8hdmr0UaFJ+dNmqjJye7+UBCQuTuU3MAY+FlnYOmXHme?= =?utf-8?q?mcotXBKRqZOX4N/mbEgOHeONPCiV3yzTM8ibckStA7yDJayKDiFsHl4pAVceaMrrr?= =?utf-8?q?kw5PpZuHNsvi?= 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: 03 Jun 2024 10:08:37.6508 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ebf3a412-f991-4e66-7c85-08dc83b522e1 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: DB1PEPF000509E2.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR02MB6285 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 Reviewed-by: Rob Herring (Arm) --- 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 Mon Jun 3 10:08:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amna Waseem X-Patchwork-Id: 13683569 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2078.outbound.protection.outlook.com [40.107.13.78]) (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 0A27B77A1E; Mon, 3 Jun 2024 10:08:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.13.78 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717409324; cv=fail; b=HdlhMIovcGrE03gBxD7MiIK64zlfzi0izyz7fR3UZgZrLw9Vi9dpG23KIyv8jmOoAWgoNjO3IPZApBrXVX1SFAn+GFMUj9hiMnZkNN9RICHhUe7CVtkKeQh4+pCrxDcS1oKXQdA4o4E/YdmZt0Gk9aFzE6wxh43SldsgP8zvdtk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717409324; c=relaxed/simple; bh=10WWr4BXdxpN57HgbbKe2H1s/iOU9aqVNgvZelJZb+k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=oOp08YiIPhO/WSf79HCBvB98yrVfoLH1YerDpCRXn2QdRQ296B+5yJxlY4y3u5ny7b0kKepUsREDm+GzZWjgHi+7HUYhjBGP+fSsKzPhbpiEz9y6YagTNT5DLBhc8n8IacLUL94wS2a9NmOl7PvwL0nM/KNHKd/jxTDACy/6ulA= 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=N0PQ9kSk; arc=fail smtp.client-ip=40.107.13.78 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="N0PQ9kSk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FSngYDkfqwfe2mggn3MMC51aUgjwCGKJ/iA7q4kIXjNPbJUvczvGD14TNF/nygMS6cyfLBT43Nzs0vfXUUEIqLIGna9do9HQ5w4YStziOYb6VgWu2cB+XIj5NcLmmi6zsC4Xv5RiAE/qvYth5rqQGjDnxC0YfH9d0+sin06FpnSFJ/2iy29YTC3XfD2ClV55SHho1qh/L1xj/+nVVOwq7nrYBb4hUCVUP1E8WvRElHE2Hg0ehQ/lGmsNo/dXuSyDbdfQHpIVsEiVOnWpXh4wXT0Wuq5pQsNEjQHTfaavhSseXBZryoZsudKBzRdJOJWYAi0SlasYC1NlsQgjEyP+nw== 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=ShG+Kb1J/1DQQx5GG2zUHffwVEiygeVlyCc/hbFC0mk=; b=f4qrpnLzZjcVKBYmmewaMnrIxBCabkO5EHS1Eph/ZLLQFpv72mu9gy+Sp2kPKvigt8XaVpX1c4YZq7MYY+kxBdCo4eNhF0wwmbiEfTtYULYWOqGhma7uQkD0vHHmWiKAE8Ti6L0eI+5P54YdDeChskvlIfE9fQ9s6bfN+y16L/33jKv9KPCPjEXWFo9LSNzxkNlzy3VetdwojiAGZHzoWJIwvYARDtvbRjZzORGtenLGDlTagNSyosYO5oPG1fxbLvoF58JQn8YD1zQdA6qp1+HZmXdVQuA3scFY5V17CoMMTpaM7oQamGq1p8xLfUooc2p+GzlAJV1p8FLKw1Ud8A== 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=ShG+Kb1J/1DQQx5GG2zUHffwVEiygeVlyCc/hbFC0mk=; b=N0PQ9kSkfISg1IeUFeYT4BG6nK2JBZPdM1jLTBnBpk9W9pfGQHQIc/ycDIC2Kjuo1wy9qmZl214ajPs9iB2YRGszoicp0GgswV49kuN4ET7tuGW5YNe2N5GUDXwyUn8R4ASv3Ap1usJed80t50Og4rXW79S8gYsMm8c6KtorTso= Received: from DU2PR04CA0276.eurprd04.prod.outlook.com (2603:10a6:10:28c::11) by AM9PR02MB6546.eurprd02.prod.outlook.com (2603:10a6:20b:2ca::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.25; Mon, 3 Jun 2024 10:08:38 +0000 Received: from DB3PEPF00008859.eurprd02.prod.outlook.com (2603:10a6:10:28c:cafe::27) by DU2PR04CA0276.outlook.office365.com (2603:10a6:10:28c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.27 via Frontend Transport; Mon, 3 Jun 2024 10:08:38 +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 DB3PEPF00008859.mail.protection.outlook.com (10.167.242.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7633.15 via Frontend Transport; Mon, 3 Jun 2024 10:08:37 +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; Mon, 3 Jun 2024 12:08:37 +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; Mon, 3 Jun 2024 12:08:37 +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; Mon, 3 Jun 2024 12:08:37 +0200 Received: from lnxamnaw.se.axis.com (unknown [10.92.129.190]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id 2D4F72A6A; Mon, 3 Jun 2024 12:08:37 +0200 (CEST) Received: by lnxamnaw.se.axis.com (Postfix, from userid 12778) id 29296206ACE; Mon, 3 Jun 2024 12:08:37 +0200 (CEST) From: Amna Waseem Date: Mon, 3 Jun 2024 12:08:35 +0200 Subject: [PATCH v3 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: <20240603-apol-ina2xx-fix-v3-2-b9eff3158e4e@axis.com> References: <20240603-apol-ina2xx-fix-v3-0-b9eff3158e4e@axis.com> In-Reply-To: <20240603-apol-ina2xx-fix-v3-0-b9eff3158e4e@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: DB3PEPF00008859:EE_|AM9PR02MB6546:EE_ X-MS-Office365-Filtering-Correlation-Id: 21456d1c-1f35-49d5-83fd-08dc83b522fa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|376005|82310400017|36860700004; X-Microsoft-Antispam-Message-Info: =?utf-8?q?3qy+t7bF5BuOFEKG02ih7PMXg9kY1KQ?= =?utf-8?q?eWNnxYDvazlRG+EJNNWHJ5dmGOjUpjT8X27K269A8ay3o+kqMUzTqy1KrRjK1LN+n?= =?utf-8?q?wd0fqDMj6odN69zclb5axmHWO8q8bBSfiPNDNYVojuTctsWnxkCd7E8sU5k6QQDFk?= =?utf-8?q?iwdZMXsEm+QrDrxgxf0YFeJgMVMk2BmXzgOB9kTfh+EL3f/i6Vg072du/DPWkfTyi?= =?utf-8?q?biU7Um0AQFMiIrD7P51OeA64Bp3nm6IphjFQeXu+5e4ZkZCuKX6wN0E/ps/4v5uhL?= =?utf-8?q?FD5FFvEnlq0+tomgQ/3qsGpZFxY8liQBsjslunkHn+hW0LA4PXYb4OTKxwWMr/eJA?= =?utf-8?q?2VwfTMVQq2tkaIVZn0X3/xoXIowyqefRmgNbcHTP4ejvc6TomqIy1uDRA5mCBWFcL?= =?utf-8?q?9qyVtjxTlN4C57T3w/ZKEi0innyFeFwpQgnVcdSUiN+PkjhURj5S3uRek39+aezwF?= =?utf-8?q?jp3KMVPsgy07CJpKJudeWyopLQpDYk2MoL1+aaZQYgf/EI8HZcXGMfGgR9tMyByS+?= =?utf-8?q?j0yy+CSqyCcsrQiIkuxnAUCI5P2N/YiAXQIEr/i7T2b/vvUM9CaKaDKVS5bz2nC7L?= =?utf-8?q?cgRLlYAB7mAi0KGV2D7THDP0zFVCcQGT1/i6MkyJh2bpLd695zZYrvQ/qRwu/PCrT?= =?utf-8?q?VRxUQn6vFEh/lZDOMqJegpQB6RbZMjFXQ17RszWKLvQMWcADlRJT4hrP3GJBkwxuL?= =?utf-8?q?GwbWN7zOuQmYlnLy400Wtlg8oQ4Ue7ekeKEAiJpIiX52jJeRB4147LlWjS7mI1Z4X?= =?utf-8?q?JKzVs6oTu1DrB83CgXe0ydKt1EzC335khZevz2sPT6PtJELkSVZKlyZRmXwznB+kB?= =?utf-8?q?SowvA1zrKxqJn/FHJfWTig5vx4krco6G1MIDsAHDab6pDypU7sp6GSRhHMkosdCx7?= =?utf-8?q?f/LPRYW1TqD7qRIvNHwvG2lbT76+NUvaIW4Chbj77I4OikvCFyBE6DFjxShsNhVJt?= =?utf-8?q?T4C6E7FKvlRreyNd57r1B2blkbjGQLrorh5EbbW0D45jUoL88IPrUJ/etlISZWZR4?= =?utf-8?q?qsEm/UTym1AQFtZmXUfx3k/9uAemzVuhuO0qnTwXeqe/lC5ntS9ucE12YGqawp6Rt?= =?utf-8?q?k5D/OQ3bPdBizWtUtHBmyCXaPmJTvv7Q4esGjFluRjpmY9WlGk9b+0rtH2OS1xMoy?= =?utf-8?q?l+jWgH2mAqr49BCzEWBiFbk9Z8flGSmjKYS6SogqKhyPesaVK2MZ03iM/rtTzgjEB?= =?utf-8?q?qIeHaasnykMtN3OxF4Ffz7DGbvtY/pDhTX0QLa1DVWlpdPBHp3UjAOpXzOZnrzMGc?= =?utf-8?q?1gc5MhTJZS6+b0/Cnz09qzE2A5iRacUf/eu1YsYWXJUVXhKycQtNQI7WqhzPrWsgp?= =?utf-8?q?O+aZLDEFHD/r?= 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)(1800799015)(376005)(82310400017)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2024 10:08:37.8148 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 21456d1c-1f35-49d5-83fd-08dc83b522fa 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: DB3PEPF00008859.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR02MB6546 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 | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index d8415d1f21fc..101346d26c88 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,17 @@ 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) +{ + if (!(val == 0 || val == 1)) + return -EINVAL; + + 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 +675,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);