From patchwork Wed May 29 06:07:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amna Waseem X-Patchwork-Id: 13677903 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2049.outbound.protection.outlook.com [40.107.8.49]) (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 D01BE15D5A4; Wed, 29 May 2024 06:07:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.8.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716962844; cv=fail; b=AGUqUnQ6zBl+TDM6IMaOSBpfUj3eKVuBvr8797MqNycAcPwXGDKH83bzft+t/fJPO84Rr1fRF1JKl5SuZHObAULECOqzT24o4dC5AVxsCW0QMwIQRkyCavQo/RlIplcfsW8+x5A/UqeCLMBeFfPASI+bwCNU3ynzysGe8RwHyi4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716962844; c=relaxed/simple; bh=yI6eddubAbsVQ+HgVAdMTT9pHpEt0ixb4KJcY3b/OYI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=XzDo/KF5B9qLfyu53ZoS+moe/Jc0AaCegvIx59wuREOTqMV3F7Jlq6HCbegjMjvR9rQmp/zLfUgWjM3WH2Y2d2pbZj/n3Wstui6TrGmIvXrzSY4/8CH39uyUaAOv0aRr3dSiRJb/aHNtAnxEJ7Dt8tgaYeCtUhcJ0QKocH3mZHs= 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=EBQCr/ra; arc=fail smtp.client-ip=40.107.8.49 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="EBQCr/ra" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=femCDfiZkHvY6sRc5FhomfPXnPv0K/JEeZXb6LMD/NJSWRQnxdztsmti4qPsTDjoYLPUgvNauGtZr6HNFzV+PD1xkkdpFICQLsq2VZmDGxzqqTHie/GACzfrfmtf5+haQpL180IWbFZBEKSxLjKhAxE4drymALfCLP0E2vFR7w/KOCL08yVcZevxSdmPfjWB+lrKDDEvBvNu7orO4lVGfFUhosBG1Re27qRxnW/p8gN3EubgLf27ZwqOiUoUCe9OUAgc3YZa83xYTLAfiJkVvrwblcbyUp2cY6ZO+Td/qDNNvfaGmiXEAg8m49kRRbCice1CVvdId2shq/CSIJ/8Bg== 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=8Gv49MuucCYTODADqy4bh4cjAN5zqZsTfGFMtbZ3pPo=; b=UAGl9YT6I2ri2bTD5XpAzlsiirzTYZ24Eko8dhzrJ5vRw112LXJwvc6cKkj7qNf5swjfUWcmTP11LfYrDZyp8rXgsSlRz+egxDxbQ+c+bjAqvcoX5mGhXH1067lOc57of80LCR4l4FWfR/LOtqVBAzrXIX+yfw7iTvaLjurY/SWCJ8JlZR56PGbrytSrzdcfbD5WydCeaqNNVFXL1BjxrAu+wTR7lUy86n6g5ToXkJIR2p985N4NvNNm5PNSntrMzyaBfy37vFfbtus/16UhyD20ULJkL2TsIThzHP9Co/93Zkf2ruZqV3RGS1D7qF9at+n6gVL4pI9/Qzwy/95/VQ== 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=8Gv49MuucCYTODADqy4bh4cjAN5zqZsTfGFMtbZ3pPo=; b=EBQCr/raKe8+bZXd83LTe5IZagjnxx8hxNQnofgarkUeRsWHXyIVGsD5jFSNxzdLEdaXNNMGvPOqdTQVcHV/HU+M6fSWUCo3dYE8CkHYLEUkD2AFhKqQOW6EbDgo/gpiuqHAk2ALbsqzpvhYoh/W/yaNXiUs2u/zDfQB2YWoUvI= Received: from AS9PR04CA0129.eurprd04.prod.outlook.com (2603:10a6:20b:531::9) by GV2PR02MB8650.eurprd02.prod.outlook.com (2603:10a6:150:74::22) 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 06:07:17 +0000 Received: from AMS0EPF000001A9.eurprd05.prod.outlook.com (2603:10a6:20b:531:cafe::58) by AS9PR04CA0129.outlook.office365.com (2603:10a6:20b:531::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.18 via Frontend Transport; Wed, 29 May 2024 06:07:17 +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 AMS0EPF000001A9.mail.protection.outlook.com (10.167.16.149) 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 06:07:17 +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 08:07:17 +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 08:07:17 +0200 Received: from lnxamnaw.se.axis.com (unknown [10.92.129.190]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id 2516E1E0B; Wed, 29 May 2024 08:07:17 +0200 (CEST) Received: by lnxamnaw.se.axis.com (Postfix, from userid 12778) id 1A3D62069D6; Wed, 29 May 2024 08:07:17 +0200 (CEST) From: Amna Waseem Date: Wed, 29 May 2024 08:07:14 +0200 Subject: [PATCH 1/2] dt-bindings: hwmon: ti,ina2xx: Add 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-v1-1-77b4b382190f@axis.com> References: <20240529-apol-ina2xx-fix-v1-0-77b4b382190f@axis.com> In-Reply-To: <20240529-apol-ina2xx-fix-v1-0-77b4b382190f@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: AMS0EPF000001A9:EE_|GV2PR02MB8650:EE_ X-MS-Office365-Filtering-Correlation-Id: 7d687d43-6ab3-469b-4d4c-08dc7fa59800 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|36860700004|376005|1800799015|82310400017; X-Microsoft-Antispam-Message-Info: =?utf-8?q?7JTR3UDz/zy/fx/iHu+xLCgemDzTvSY?= =?utf-8?q?HNzr3a4JbHe34pcY3mpQrGAHAWM+DWp/h8xvr+b/bZYOsGkYxY7VpaXtNXbhFQnof?= =?utf-8?q?Jfl13ynbwE6Qqz5iB5aJOMi0+0ZZSqcYaRnBkV3HGbpZNkaVHVLA1qIgiNyCeEsav?= =?utf-8?q?K8W74W9JAvbw+mwJjx+fWgVm7mix0IJ7r+gpDn+GewYGacfcjSmRV0brsalTAieHe?= =?utf-8?q?nvPEKCIn/wTgxaAloLH31mi0Rg2TVuQC+/pJn8gB5DHFitGxWoMU1sl0PYes2fflm?= =?utf-8?q?fXdw8uguXra5BLvfjd1ZrjmrIvvJQo7d/N/KLPXKe2G67LSK5P36SkITLZWrTeoFD?= =?utf-8?q?khZhu6/DEl/TRy/pp3zLBF4rjBlxBznmgzTelrxJAFTBJdPAlFPolVJEffbTWd/yx?= =?utf-8?q?PHaqcT2j6I95ZKNRDm8cN34SKtUpCK7wvlNBtJ0+7x0H1ktrRptScOHS2M6zUP8SS?= =?utf-8?q?iVkdlYpHbSbzMuy42oCQAriv5F6YAWHASwEsEPohm67v+TWr7fahM9z3uX7K6Ip0u?= =?utf-8?q?tsncGPu9gEMyae6hwCSZcbLCc6X3dpJsskq/9EBI+zv3HZHUvkO1A9v0xOywOn8UL?= =?utf-8?q?QomI1dDhiz8kuZuT4fj66CY9E/yEKpEu+DBM9f50pomY77Kb6sS0tUzxbw+ujSWTm?= =?utf-8?q?03x01XOWPehQSV43Ci5snBIDEE9DwiqRlVxNmJuln/6zXlzsYWRZn7fmHjZBUWnd7?= =?utf-8?q?SCvh+WX4v9y4pQWbH/yLL8KZxbrJ2mOLGuAoDTxoc4/iwVzu8LmfEJv+5ordyc97x?= =?utf-8?q?TudltXTQjxPG1cOwASvG0Rs0WtCMkZrZmvuaJ8lUkaZkenuThX0nnAYxw+n0ufRIW?= =?utf-8?q?IlCnWgm6GUrD3uAEUTYmfl+0sI1tEB+WphNhGs5n0fb0SaYhWAN/3JRpPuU+zcJUp?= =?utf-8?q?r8YwrgfKfihLmlGqqvG/63viKqitlWnXRDQmYaBuOAOpt3ZlPNi1ZToxTnzJHo4Ve?= =?utf-8?q?FYRp6MIrKqxKQTTm8/lo0X2hB1gVKI3PgOuB6zUwFJhUbu7zmLpjAcdiZYzTpgVWO?= =?utf-8?q?WpeeHa9eu7SmPa/BLGri+/4K5ZCakZnQ9pvPn5V3R4wW0PTpNlJ/9Ln+yjl63IZm4?= =?utf-8?q?qc4aE73X1uO1iwj8JvqIuPmGcRAaN4vEotyqAF09BTmekVyXsMyjibYbki8a4PF5f?= =?utf-8?q?Xg4GmLhlViKsS/IyMtXlbGrrKKZGKHRtv3CFLXXZ9psfjYdGKzT391wNL4k7O7Zr+?= =?utf-8?q?gKSFaMXnxicQWBoxMoUBHiZ3JOMgf0mTk95SXrv99ssFX+sww1QFiWfWQchCodHeW?= =?utf-8?q?g9J1UZ8BnJaTbF9cCV7gdH8chEX+pLYYgoc0Pa6i7bQwamzRBs/mMMdI=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)(36860700004)(376005)(1800799015)(82310400017);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 May 2024 06:07:17.5787 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7d687d43-6ab3-469b-4d4c-08dc7fa59800 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: AMS0EPF000001A9.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR02MB8650 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. To configure it to active high, set alert-polarity property value to 1. 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..a3f0fd71fcc6 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. + 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 active low. + 0 selects active low, 1 selects active high. + $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>; + alert-polarity = <1>; }; }; From patchwork Wed May 29 06:07:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amna Waseem X-Patchwork-Id: 13677901 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2071.outbound.protection.outlook.com [40.107.20.71]) (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 C556415D5A1; Wed, 29 May 2024 06:07:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.71 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716962843; cv=fail; b=a29pnIBNL+jADZT608rJ+KBdtRm5fp45En1ykhKhlxJVn2tR/zc4wP+D0JPLhyNbc+kdHUWefs8l1ho2KJqQctWr6Wzj8kDlgayLz60y8MRijf3puXZhRyKI66Yv1mKkXbIx75vgbM32x7HlnmLR0sHkbubZwnqXIg/B6cWcGHY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716962843; c=relaxed/simple; bh=c3nY3mwN6jz4DqaJfWXUWcUNXcqKlAoSOA28e751IVg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=n7o0+Q6OTPvJBkpsnvM0RGg2b6cPJTRr5jwAnCAnT1Wdv9r0kNW0klntrgPWiCgWL/SZQfUFSChir0X6QqmfB3ZjtdXW9J9ENcqugAamjcWoxAFzOq1K5liFuEuD8n8/zqkZBHDAe3WEpqNPU3H/lf2tG++lJq3E5Vi1zGj8oA8= 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=GDZjUMjg; arc=fail smtp.client-ip=40.107.20.71 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="GDZjUMjg" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g8h4xhd9tptq115iRyDB5SWm+rMhI+VwsmdEz7E5ki+p0K5lHGfom8zh4sHxwueDcesgK6OWNQRGUe34CaW+gcQ6/Ukw6cP6BW7oXK/t+mukbGmYLTMKekY0jj/XV6fhU3m6yqiVL4ygwD8D1nU/61+0FVs+08O398AAueLJMl4mhkv7hdCmIcGpWyg28rvWbiTTFjMv2w4aunIvy/631oVPeDD94Zcb3pKPZ1aF5FTMUKMpAUEJWR8x6iFoUG1vVoDYCW4TShBZZpamj3CjJCsUbTLO+KolFLHPnOKIN0zxJXXBDBTkjhWgN+Ixo42VaVZLFLd2gd2CatmGAtaldA== 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=N2IxADBIWTdmK6FdzFFyOSBMwe6IlF0rxniiTKDwA5M=; b=mJsJAeNeVGMmxIgYJAy+m6VCj6fubzNLQEf160TSP3IZYxv07rZbxO1vpuTarb2XBYHIOFt5Mum560OH09raX7pxpw3AZ7OhDlWfHlwgBLJ2N9b13qs7U7WQH2QCTjjIJ7bCTCW6llBD5umArqXNy5PcIueOTKHQqm5c4AQFWJPkHbKf9da216RnFGnwuS8PFXb72Xhlfn1gkD9iLuiBz+0Jg7epavEsndAshKC3q/yATlwTOx+dSzH3eJPKLg/C1rF7isl5Hx2aAKL472rIALlazyR7/0vJ4YJP4n0egFMnGD4pNW+kCCGR2fDps9zt+g1i6ErYY7vxWKcaG52SjA== 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=N2IxADBIWTdmK6FdzFFyOSBMwe6IlF0rxniiTKDwA5M=; b=GDZjUMjgVZrCWYfatPNtPcBegkaMkG19FAwlvvNN5orNTWlKr18YrFY9oAGTyNY2bZ8J+3qLHh8dqemtaIiQ/ON2+OlLWZT6k8w4Oj+fp8ysK60nJ9vjT2OkD0/zepNks3wxOhWvwDqfxdMZHG9w8KzYioEhinyy2vA/RtF6BXU= Received: from AS9PR04CA0115.eurprd04.prod.outlook.com (2603:10a6:20b:531::25) by AS8PR02MB9233.eurprd02.prod.outlook.com (2603:10a6:20b:5b1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.34; Wed, 29 May 2024 06:07:18 +0000 Received: from AMS0EPF000001A9.eurprd05.prod.outlook.com (2603:10a6:20b:531:cafe::d9) by AS9PR04CA0115.outlook.office365.com (2603:10a6:20b:531::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.30 via Frontend Transport; Wed, 29 May 2024 06:07:18 +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 AMS0EPF000001A9.mail.protection.outlook.com (10.167.16.149) 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 06:07:18 +0000 Received: from SE-MAILARCH01W.axis.com (10.20.40.15) 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 08:07:17 +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.2375.34; Wed, 29 May 2024 08:07:17 +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 08:07:17 +0200 Received: from lnxamnaw.se.axis.com (unknown [10.92.129.190]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id 26EC41E15; Wed, 29 May 2024 08:07:17 +0200 (CEST) Received: by lnxamnaw.se.axis.com (Postfix, from userid 12778) id 23A04206972; Wed, 29 May 2024 08:07:17 +0200 (CEST) From: Amna Waseem Date: Wed, 29 May 2024 08:07:15 +0200 Subject: [PATCH 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-v1-2-77b4b382190f@axis.com> References: <20240529-apol-ina2xx-fix-v1-0-77b4b382190f@axis.com> In-Reply-To: <20240529-apol-ina2xx-fix-v1-0-77b4b382190f@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: AMS0EPF000001A9:EE_|AS8PR02MB9233:EE_ X-MS-Office365-Filtering-Correlation-Id: 7f70a1e7-396a-48a7-3360-08dc7fa59888 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?skXT+Ynk5PtN/rNF13H90ajBuVrkUdf?= =?utf-8?q?feHRQwn/gmzZp3VlgJfxUgqdKDSR4FCfb6WGBj23D18fSBETBqB1cnbsuy6/zykdK?= =?utf-8?q?D2rZS5fQ2zuqaaUnjdNtkNEPas1BkqOJd7AhOmn5NMOzHS4AZ7n2ucMQ+WRL4EGna?= =?utf-8?q?8FiOG6APTLs8eIE6aA73s3ylRkZNDPAWI7fz1mJ8i0CLePARGxUF7e+PL62jV1Jx0?= =?utf-8?q?IkVbfh0KzDClEXklUAIs6Yjsk7k0upVrbCh+oJVHYBNajhWjgwl6a0gPox22QsgH2?= =?utf-8?q?2rhPZxNRlFMn4v0vE1YT09VfsdSn2MCO4LlwpnLAqJ5yYtmC7f6oOEHjGrUwJFyfk?= =?utf-8?q?g6ew4Ctcvc11gNhn4TpPIrD3gwCzw1TbaOXunGvZ5ECp2lI+PEHrCZZodZXrx8daO?= =?utf-8?q?L2BnzdaUllxAGF+RASw87Lf/3eYbz+UUWZB+g8H6xJ2hEUQrKEuS2ZPcAx0b0zF11?= =?utf-8?q?Yi50VcM9H+9NJtMniflOMiFqkOn78GYL6QJehcGfOtNNEYUlbZvb1/MKei+EEOghc?= =?utf-8?q?cEjnAibn5mfPnuCWrO++21Kemf+naYfqN7WG16lfN1JUOvoHEexMnqw4HbvCUlcFt?= =?utf-8?q?uKDSe6e5+WBmdaUgD7bETOdh2WmU5Q9JmAwD1+lZKwCgF6kcpJ9Ns9aLlhT/sPxeo?= =?utf-8?q?GfcmWqj4W4Acyr81jG0E6IDMfeGOY4Vl8Y2Li1K29O3Qp3PAWM3xB+2HJP8pcRSR2?= =?utf-8?q?OTCX87zunUkuKfptne9QD6g5t7CS7x/KMB6DggMgAg1YrG4qnB1TrV2s/nyWrNC3j?= =?utf-8?q?xDAJmmH3YZxV0T3IorIWcuiC5gC5msFxeSHtQ+lBsomXSD9P4BRHwu1MJsZGDiZld?= =?utf-8?q?RpIR/gqm71LITk43WyKrYf3YRn0tJ6l1mG7F+ll9venL7Ef2m38tuyS0UYwlYh342?= =?utf-8?q?4GcY/hmSS6GEMgH08VsiXwJKfKFmg+MZYu3RH3CN7EFGzXbmKxaPcgSC1c7IQsvTa?= =?utf-8?q?7tyc2TVR+IjafnuwpZege3iquhOphBQ1ytRE70MuJFAl5d4HADPFhRJZh+iHSXxvn?= =?utf-8?q?jQGCvCSmb6bEUvkMDgsOB5WkSiX9G1oL4wOx9RT8JnteSAEIhBe6hBQQ4aDvq6VHk?= =?utf-8?q?q8dpA531wCJqmdOUvMi7kHps80+4D8j+O/Ce+2xx9YOezMyccXvFULSJxA5m7egJv?= =?utf-8?q?5AbzoYgeF33wKFBcF+cm+sR4kS2Ez8lJAAsjnB+/ci0u0eSwMB5soWsGM/XXqt57t?= =?utf-8?q?OxpsnVmmEOMLr+WnJ6sO7k0zgrljxu6cC0pnyCuvTu5KeiaHtavJg5kuvzOgscrRz?= =?utf-8?q?mTqVfUZblPde7LOn07RNfJJMcq6nGSAf94NT7QkBtHybcVZMwCa15VuI=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)(1800799015)(376005)(82310400017)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 May 2024 06:07:18.4693 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7f70a1e7-396a-48a7-3360-08dc7fa59888 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: AMS0EPF000001A9.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR02MB9233 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 | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index d8415d1f21fc..b58e795bdc8f 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,23 @@ 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; + + mutex_lock(&data->config_lock); + ret = regmap_update_bits(data->regmap, INA226_MASK_ENABLE, + INA226_ALERT_POLARITY_MASK, + INA226_SHIFT_ALERT_POLARITY(val)); + + mutex_unlock(&data->config_lock); + return ret; +} + /* * Calibration register is set to the best value, which eliminates * truncation errors on calculating current register in hardware. @@ -659,6 +679,14 @@ 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, "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);