From patchwork Wed May 29 09:47:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amna Waseem X-Patchwork-Id: 13678577 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2082.outbound.protection.outlook.com [40.107.21.82]) (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 E230C16EC12; Wed, 29 May 2024 09:47:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716976078; cv=fail; b=mxMCf/t67r0gx8jhHTOXfzg65M935jx30TsiQcadBYqJrL+eyqpT5vgMhZMD7QxTwAlZrRZXh56jMDCVcUybUbkPaC824t9U1nl/otRn3S2m1DQ7FZI5tdVATHv3pi6DfMJyjbvFfWZ9WREVB1Hf8YQVk2zjINBsu06KvGnBzgc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716976078; c=relaxed/simple; bh=QtFI7CreFFbBGPrCfYrDu+3YvF2hDagPnDTWtnn68Xs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=IWRMyMW4VVINggPSU060IPA6QxO2s7KqpqnOw+kiQ1VR6hzdyF5PLtrCAeG2FvYP0XJahgw+is9gt4ltqhXzt+tZe+KH64H2fZXAoGrTIn6yrSHsBNCbMur+t1/TbNtcqAs+I5RD221QXq06HFmIIa4gSLdgp3WDfIElYaTnR4o= 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=qoxTJSlH; arc=fail smtp.client-ip=40.107.21.82 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="qoxTJSlH" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eFg2suisJvfPuq9j8ubs3zpDf6zVmblSJmcCfNQizytjFg/oFIpfD1rO70ajRx/ZmrLjba9U9zTF+nsyzYfBrC6UyAjrSUV4UBzlPNZjQ8fWMkh9chT2m4ofeQ+kLNe8hA9P1p26PtckvUE+YZM2BRcvVtLFt/CQnaegdNJPGpT1fOYcg8lBMjCbZx/2Z/KY6bp9tqbzsEIOuCitMSPeu8a0eAJrxeDntQdk5Y6qu+U3uovDei4ZwDBycUNDnmniQ/hO2yQfLS2KrCuSe5sUj+FWxqsTFJ2J3SQLbAZIekpAMJ6KbyNHN1RwqJSzW/Yjv8vgr3C6crZGLp3zrC1bpw== 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=N4tRu2bF+DkzMwBEDj/T9HHanHKPhHWvbUHJifa09Jo=; b=Zxo4SgjRZneC4v3GGHknWf/Q6mLfHB9weJs1tO34KvKRoSGCQyF6CVzvgQwur+FHpwbtz9OORVqjRPOJbA/PnW5al7fUxu7scaFQcLH+51/h017FUsr6jp4KP9eG4qayIsOilqO7ahFDkrKcSEFcGP6EPSyuz/YpQ89+hiI92g9JoltPEVdORd1PvnmV3dWdHsMpfd6B6HTfXO5YFRW/39yu0EZqQIABu9GJQl1qVLsm5L9+DT+WZmS8GYztZ1PaZx0uB7hffFpjTjuvW8yHhTY66YLBN9l8xwC0HV/nGGkHW7vxxJbhTFxRLC8Yk+Oxnf4bNBR+pC1K3pnHP9kA2w== 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=N4tRu2bF+DkzMwBEDj/T9HHanHKPhHWvbUHJifa09Jo=; b=qoxTJSlHPcKGaPT1EfVxHNqfHHZJTEYWIURsK3/Ocan8eLuzXuQfExvdOH6WNVjyKl0/lmUEsWU5EVol9wfAt34PHXyrn/fBLogB/7TTFVZ4fjpt8JNIszEwo8hGP5cFC3Z0S4SZ7+DJU7UCp0gCCHUxFxZTfesGbMImw//F7e4= Received: from AS4P250CA0003.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:5df::19) by AS2PR02MB10374.eurprd02.prod.outlook.com (2603:10a6:20b:545::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.30; Wed, 29 May 2024 09:47:51 +0000 Received: from AM4PEPF00027A5D.eurprd04.prod.outlook.com (2603:10a6:20b:5df:cafe::e2) by AS4P250CA0003.outlook.office365.com (2603:10a6:20b:5df::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.19 via Frontend Transport; Wed, 29 May 2024 09:47:51 +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 AM4PEPF00027A5D.mail.protection.outlook.com (10.167.16.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7633.15 via Frontend Transport; Wed, 29 May 2024 09:47:51 +0000 Received: from SE-MAIL21W.axis.com (10.20.40.16) 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; Wed, 29 May 2024 11:47:50 +0200 Received: from se-mail02w.axis.com (10.20.40.8) by SE-MAIL21W.axis.com (10.20.40.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 29 May 2024 11:47:50 +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; Wed, 29 May 2024 11:47:50 +0200 Received: from lnxamnaw.se.axis.com (unknown [10.92.129.190]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id 690F1AF6; Wed, 29 May 2024 11:47:50 +0200 (CEST) Received: by lnxamnaw.se.axis.com (Postfix, from userid 12778) id 5F2E32066B0; Wed, 29 May 2024 11:47:45 +0200 (CEST) From: Amna Waseem Date: Wed, 29 May 2024 11:47:44 +0200 Subject: [PATCH v2 1/2] dt-bindings: hwmon: ti,ina2xx: Add ti,alert-polarity property Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240529-apol-ina2xx-fix-v2-1-ee2d76142de2@axis.com> References: <20240529-apol-ina2xx-fix-v2-0-ee2d76142de2@axis.com> In-Reply-To: <20240529-apol-ina2xx-fix-v2-0-ee2d76142de2@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: AM4PEPF00027A5D:EE_|AS2PR02MB10374:EE_ X-MS-Office365-Filtering-Correlation-Id: 3e2725f1-ad43-49de-7abb-08dc7fc46814 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|36860700004|82310400017|1800799015; X-Microsoft-Antispam-Message-Info: =?utf-8?q?8DVnR0TSHkDAA6TcocoNRU7a8IeMkw5?= =?utf-8?q?imdUEB5d6fZhTlA1RBf8LvRGHRCYx6eXN+rtbUpqCz864+hEyHIA1nZIQkNjJ/nZU?= =?utf-8?q?/j9ma2qv5C/olOdmKF3J29e7TYSlzwAt3GSXk61OH/8X8AUN2R2djAp+Cqhj9Xb3N?= =?utf-8?q?aSzF0Izzak9UxFgmZJmQxPa0ypz75SmLQdz+C8elevo/Tv2Aj2wM1qVwkoU2mq3bZ?= =?utf-8?q?Rai1pZWwaNxDSbeOkThZALZstjzLuBXS74bk7A780vcp17/KcOuR8N/+RvjFt4DeQ?= =?utf-8?q?xz5LY2tueOfXwi8unlbaaz81oozKr1zhioIozew5ZYSaShW/w1vnn+g3hXZK3mRu/?= =?utf-8?q?2DpJPpq4x7LKupapiL6kwocPVHgbEcFFjUZ0fY0R4KlYXTx5J/M8lEprA9x2mcEUZ?= =?utf-8?q?Knh8PwBbIV1pU/TEsCzSgFKhFUIm29RYUO7X5Hys5JtR4QbjodlYRnkKcLSJfq0P6?= =?utf-8?q?d6HNy6/U+zGTyaZ9eLRqxV7COLNRJSe0sotAexXWNuU+RjpSRkn3k2aa7913jVvHc?= =?utf-8?q?U75wkCveqw+D3N2mOATXclQomhF2KAQyw8WaTQ2NtoWOOaS4+WEdnzkBDWYj/0c2j?= =?utf-8?q?hX/+04hKhD1DkO8Gxb3jQ/bWk46c3MzeXTECNLk+mEVwIufHvkhD8iabtvCrpCB2J?= =?utf-8?q?RH5R76pj8f4o1V5dxmkBWjOG3dKSNGMAlhNFgxJH4gRa0dGNN7S+8jd8+/uJxIwBw?= =?utf-8?q?MLsJx/XAba+gyOymmdSxhFL2OOGOjZTlLQnL2vdaTIoa152eNt2VU3055Ew9Rgx5k?= =?utf-8?q?PGDdPowG9Acg4VO4LepKFSFqaV/qMVZX5WvzS9IOUZF/+0SNLHCXGt4jY1fgw6UOJ?= =?utf-8?q?TH5xImyOHOdmYLn+GjKJ33DGR0cgbZAzIo6uq4iSVSelfiDjcbYw3IQWuteY3/L9l?= =?utf-8?q?BonUVn0K903uoNYhUGWh4TbHodml2+MHIm83MI+WKf3QDI5gmEN0HRxR3CMbg9LSN?= =?utf-8?q?6Mqk7smIqZbMj1rjHn7aYz+oYnQgmzEL3nP8H/LB53Qt/HDK5Jd1w+1tziRzL72Qz?= =?utf-8?q?CFjnkf+k3SoVlQ8HG82VxcZHsRrwQJuXSkT/qgRDtq7JmziWvDgCx4oGJj5yanI4A?= =?utf-8?q?91wgMS7mZzYqCtGSjeTXDvxZCBVk3dQW1XhE5+zALO9nBQTKdJqDM4dXMi1BITxYK?= =?utf-8?q?k9hU5BPAbA/aexvzqpkfAhaK/kmOz1Mn55dOxF0LVwAJ5oKPwDR0W1ld7WVWrtWUq?= =?utf-8?q?Cw9vx9HbhRFhJk3qqKFTsqM/2n6+5HnNwUSvfSVniuWjULByATOv1/P9HfqyO4Pxh?= =?utf-8?q?5QoAJhPCg0/qYDUDQdG4pGaBkVa7LUmnkQyAqJGV0IYjbnWq62QSynPQ=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)(376005)(36860700004)(82310400017)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 May 2024 09:47:51.5945 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3e2725f1-ad43-49de-7abb-08dc7fc46814 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: AM4PEPF00027A5D.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR02MB10374 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..5a16d2d94587 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: + description: Alert polarity bit value of Mask/Enable register. Alert pin is + asserted based on the value of Alert polarity Bit. 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). + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1] + required: - compatible - reg @@ -88,5 +96,6 @@ examples: label = "vdd_3v0"; shunt-resistor = <1000>; vs-supply = <&vdd_3v0>; + ti,alert-polarity = <1>; }; }; From patchwork Wed May 29 09:47:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amna Waseem X-Patchwork-Id: 13678575 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2085.outbound.protection.outlook.com [40.107.13.85]) (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 98D0716E89B; Wed, 29 May 2024 09:47:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.13.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716976076; cv=fail; b=USAc/CEmfmtRhh2hftdr4V/0zDAzjHsTzFFt1m5dW//FTZsywMIf67jKw0RhY65h+CjFGtKx5bUuLKGkFgJraUYmaCqwSlfwe925okV3w7YQzSHpanPuoiQotyyON1i1+tgxykPtbO1+CKvf7gBdZns6iJ9rTtLGuLW7+frmYrY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716976076; c=relaxed/simple; bh=KPWu1TWHkt0rKiViYB8JKDO/5UTs051XhH3aPPWbMrs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=BrrjQONPXsieuR6YKgbvTZDTLd4kmDV3Rgbg+ysBLSpVWN8CNS76oM65aIpnnhR+movHtriDQmGMdzZDE/rs05M4vzbHcIcg8dNbrqlQX/g2Mirm8K/eRRaXxDNDUSzF1cyGXGgOZr1gnhaxF3M7dpxIyUf8G+9vMORMUy3VR50= 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=JLZy5vcV; arc=fail smtp.client-ip=40.107.13.85 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="JLZy5vcV" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CEPM/Ix0IrYNxZWJ/QernNEqLRPFM/WdQK92H6aAuOvLTbbsR4cKRoO0MtTBY9VpnYgSXbouX5POkyXCa+R6pnNuY/s7qVdJ5SbvS8lwdVstSfBCycwK+xETe9mMkzG2k3dLrqi06lFVwniM0P3X3X3XqLXd8ApUbJsjbnPrPcS+3QA64n/NKjRhTL6DNR9AxI5JSvsviVbmj5VtEQR78Tlpspnz16ZFnze067HFSHG3kGMza+lf9MPgNH/FQc3xzv/CZ2hD8UfBg1m7k4rQrTuWebb5CLgf+2l4/2ZDGpFgpxkIZCBoql9Bzgv/M8clLvUj5CqhNwCipOEx+aQ0Aw== 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=TrLpnh9+fkESpl7UMWXjl6VDbeYtSTYo1enDU0wBgcc=; b=Xwaj4TtF46+59wEY0l2RbALSvFNVvoiEj4zzqwwyamKSyt5/c2aku1zql5mlK6s9/GUhLA+/MpPKEinOSuIV5glvAJwdisJRY6fJrKt/d0zue1bxeBJa5Q53iU3Vu/YELK1y0K2LurCpzHfgEFaYUZ6WFp8auv8p+pBconaLVLnyUvE404ExqaSOb0TZPP27QAEUIzxq6jfKHjWJpsIBsR/cdbRizR+ZWds5KOjomftivsEnfth7wST8oojOURjO5+noXZaD/hZNhywmNC46upztQCNZMCf9b0XdqT9oL3VoKfJbvMWUcLtXu2lC3tbJ02MIjfNU6IgQBXhoc/7t6A== 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=TrLpnh9+fkESpl7UMWXjl6VDbeYtSTYo1enDU0wBgcc=; b=JLZy5vcVhrQaMe0c0n2R50vmS3ieR6PUmY1a8kdl/jY/7MZA6xH4k2QRAbwhKjDanbIQqo/k8MuJaXfIsMUBanD9zL3XxVsrzC9NZ3i+qa58jsU/AaziiqFmUro8hDAUqL1rQd4pS1MJLGKplYNz+uzBzRiayghFtlBq0WvYW4c= Received: from AS4P250CA0003.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:5df::19) by PA4PR02MB6702.eurprd02.prod.outlook.com (2603:10a6:102:fa::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.22; Wed, 29 May 2024 09:47:51 +0000 Received: from AM4PEPF00027A5D.eurprd04.prod.outlook.com (2603:10a6:20b:5df:cafe::e2) by AS4P250CA0003.outlook.office365.com (2603:10a6:20b:5df::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.19 via Frontend Transport; Wed, 29 May 2024 09:47:51 +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 AM4PEPF00027A5D.mail.protection.outlook.com (10.167.16.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7633.15 via Frontend Transport; Wed, 29 May 2024 09:47:50 +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; Wed, 29 May 2024 11:47:50 +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; Wed, 29 May 2024 11:47:50 +0200 Received: from lnxamnaw.se.axis.com (unknown [10.92.129.190]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id 682E02243; Wed, 29 May 2024 11:47:50 +0200 (CEST) Received: by lnxamnaw.se.axis.com (Postfix, from userid 12778) id 638AD2069D6; Wed, 29 May 2024 11:47:45 +0200 (CEST) From: Amna Waseem Date: Wed, 29 May 2024 11:47:45 +0200 Subject: [PATCH v2 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: <20240529-apol-ina2xx-fix-v2-2-ee2d76142de2@axis.com> References: <20240529-apol-ina2xx-fix-v2-0-ee2d76142de2@axis.com> In-Reply-To: <20240529-apol-ina2xx-fix-v2-0-ee2d76142de2@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: AM4PEPF00027A5D:EE_|PA4PR02MB6702:EE_ X-MS-Office365-Filtering-Correlation-Id: 62cdfb0d-0253-4518-43d0-08dc7fc467bc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|82310400017|1800799015|36860700004; X-Microsoft-Antispam-Message-Info: =?utf-8?q?p/bWOuoWi/SbKEargfmJME0rI5b8SwS?= =?utf-8?q?wy65qqThvaFMrdfrJeW9RqvL2Jd2uedpeqPy1DqOC0vYlrXeBumoO0xUocUwioORY?= =?utf-8?q?ShZIh03xxQw8zQ/wBfk+QcL66dYf8yCLfjiyV20NR7df+C5nQRsdGOKgXnvBXXbIJ?= =?utf-8?q?xbiBolo4O0Q1u7dcvXgOZHXbG30mhnVcbiHI/XJS4zGMESztu2vecJsrjudnVHXxd?= =?utf-8?q?QWAMvr/lWDtDMpDSoFfaGDABXkyWC5IS4vlX8R/YD75bGT+9iKA+SpsOCXPdybw09?= =?utf-8?q?2DhKHxroDwRa0TIeDTVzWVnQev5Nm8fAKObgdrJDt/fMoSBE/uumpuQ3Z541w+8bq?= =?utf-8?q?RGe9Y1McKouf1SWk6jub09bZUmfOTb5iThtiESaVXPJxdK0lVMbKpCL5NjdyU7J6x?= =?utf-8?q?ZYwxlnYtFzssnE5ajqo2hTdnL8acUzXSS2kGSBBkgOQiK7tVoXl5yZD0A3BnIZzR8?= =?utf-8?q?sepHvanBdCnDodx7aZ/32coiuqLKUQyWdXbPmI8RoED1G5VBKrxrBpfiSx1gFZ5+e?= =?utf-8?q?RMWu4QAcLQBgnU4k9vfeLIThydVbsOZaSYJWp7HAarPQhuw9AdHz6WFqQ6PxBVDor?= =?utf-8?q?DRYxKzoEYkH2cq18Upbcbfk4FO+8Wbhw1E6+2PDXHarPSgm9fCWL8yquPO6px2dmB?= =?utf-8?q?FEZjblIOSMRTNyploywyWKYh+gbNCjdOtt+waH70x53U2mL70h+ZTqRpe2ItZKhLH?= =?utf-8?q?7RXus5bsStscy09G/rDmEhYzlBI/r+rxM05zmsvvDZN/AMOuYjHhiF2gsE8LDtLqH?= =?utf-8?q?EPh59tibELBkm5M9qWcBY13IGkWxsiqz48WVdlK+k+s86X5s2sUB6+i0f2aoDvX7V?= =?utf-8?q?w7l7JgBwMzcxJ4dHXNj1J+cilLUsBk9s0LNxH2iI6oN6XRGJdccHyb8uPXYf9UCR2?= =?utf-8?q?523tViY1MmXs9puxlbuAn/O0DwwtPwwSj4be0UhZzkZw4w2gjwpD2hYC5pOmOvHG8?= =?utf-8?q?zAtZeI+lxXjO24C8bTT1Vj0Vpe4l8kis12r1+JRDU4QxgohiubOn1pQpLj7Ksz5Fi?= =?utf-8?q?qhJ8quqnKOPbDnubFC0aSanG1ECeVO+xDjAl98XWh6BCipFYqMZ+s7Px+5dJy8w5U?= =?utf-8?q?k2+OBG6/V0HRcjEeltV6FfmvcrgOdzdqCoABjYsbcGY0d0U9NBn3bkt0OoFwsrSbf?= =?utf-8?q?d0rr8U/7EfSyZmmGp/VA6upvQbmmv4CyxNgJPnLol/rAiD4CKbl3WKpODRTaXJv72?= =?utf-8?q?VilXXjt/VjEJqD59Yp1yLIls9dP9YhUJh0TdXXS6dcMnTtu76vmRNYZzwgFws56Zk?= =?utf-8?q?5U0fJhzx37cCnZ2fLnEvqsFn6nYB+KlsaRP9CooY/a3dKMZPPCjzeGZ0=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)(376005)(82310400017)(1800799015)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 May 2024 09:47:50.9539 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 62cdfb0d-0253-4518-43d0-08dc7fc467bc 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: AM4PEPF00027A5D.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR02MB6702 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 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index d8415d1f21fc..9afaabdc367d 100644 --- a/drivers/hwmon/ina2xx.c +++ b/drivers/hwmon/ina2xx.c @@ -73,6 +73,9 @@ #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) + /* 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 +181,21 @@ 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) +{ + int ret; + + if (val > INT_MAX || !(val == 0 || val == 1)) + return -EINVAL; + + ret = regmap_update_bits(data->regmap, INA226_MASK_ENABLE, + INA226_ALERT_POLARITY_MASK, + INA226_SHIFT_ALERT_POLARITY(val)); + + return ret; +} + /* * Calibration register is set to the best value, which eliminates * truncation errors on calculating current register in hardware. @@ -659,6 +677,15 @@ static int ina2xx_probe(struct i2c_client *client) if (ret) return dev_err_probe(dev, ret, "failed to enable vs regulator\n"); + if (!of_property_read_u32(dev->of_node, "ti,alert-polarity", &val)) { + ret = ina2xx_set_alert_polarity(data, val); + if (ret < 0) { + return dev_err_probe( + dev, ret, + "failed to set APOL bit of Enable/Mask register\n"); + } + } + ret = ina2xx_init(data); if (ret < 0) { dev_err(dev, "error configuring the device: %d\n", ret);