From patchwork Wed Oct 25 10:34:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Leitner X-Patchwork-Id: 13435924 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3777DC25B6B for ; Wed, 25 Oct 2023 10:35:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234914AbjJYKfY (ORCPT ); Wed, 25 Oct 2023 06:35:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234851AbjJYKfC (ORCPT ); Wed, 25 Oct 2023 06:35:02 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E77E01716; Wed, 25 Oct 2023 03:34:49 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPS id 52F3FC433C8; Wed, 25 Oct 2023 10:34:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1698230089; bh=To9+llqVwQfE3FZYma/wWqALeRFyp/9+Ac4qHFPwfQc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=FzwS0199WwjkV+1Fcqqi4ZRw1eaGO+ES2LrQBDkUR31aV8WgtrVT3vIreqzuijz23 L+I6kRnSBpcZSvM86a4uSv00LdXn3DSCpV/qeflzVWjoeAd/UCZKATVZH/McGVLU9s /2HnfOaLHV9h4ND45wlFwyKG5WxR0m/iNBddLuDE= Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 266FAC25B6B; Wed, 25 Oct 2023 10:34:49 +0000 (UTC) From: Richard Leitner Date: Wed, 25 Oct 2023 10:34:11 +0000 Subject: [PATCH 1/4] MAINTAINERS: Add entry for ina238 driver MIME-Version: 1.0 Message-Id: <20231025-ina237-v1-1-a0196119720c@linux.dev> References: <20231025-ina237-v1-0-a0196119720c@linux.dev> In-Reply-To: <20231025-ina237-v1-0-a0196119720c@linux.dev> To: Guenter Roeck , Jean Delvare , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, Richard Leitner X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1698230088; l=764; i=richard.leitner@linux.dev; s=20231025; h=from:subject:message-id; bh=To9+llqVwQfE3FZYma/wWqALeRFyp/9+Ac4qHFPwfQc=; =?utf-8?q?b=3DGbcBOmbxKW/N?= =?utf-8?q?aOZK/tWlRFetfHjOKl+VCAXOa2pUDIWUfcoEjx++tHSDimH9wHPkypn2z8yR908y?= oV7A1CFxDLcMhgE5pRVfnFfPrGx+xr9d6mKqdI52FLyq7kX1jBXV X-Developer-Key: i=richard.leitner@linux.dev; a=ed25519; pk=ZYa5+0m9RFYtnNU6DLet7sHyPehnVHa0ucJlYiAu2NU= X-Endpoint-Received: by B4 Relay for richard.leitner@linux.dev/20231025 with auth_id=90 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org The ina238 driver is available since 2021 but lacks a MAINTAINERS entry file. Therefore add the missing entry now. Signed-off-by: Richard Leitner --- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 668d1e24452d..28f91c8a2e1c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10267,6 +10267,12 @@ F: Documentation/hwmon/ina2xx.rst F: drivers/hwmon/ina2xx.c F: include/linux/platform_data/ina2xx.h +INA238 HARDWARE MONITOR DRIVER +M: Guenter Roeck +L: linux-hwmon@vger.kernel.org +S: Maintained +F: drivers/hwmon/ina238.c + INDEX OF FURTHER KERNEL DOCUMENTATION M: Carlos Bilbao S: Maintained From patchwork Wed Oct 25 10:34:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Leitner X-Patchwork-Id: 13435925 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF2D9C25B6F for ; Wed, 25 Oct 2023 10:35:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343592AbjJYKfZ (ORCPT ); Wed, 25 Oct 2023 06:35:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234854AbjJYKfC (ORCPT ); Wed, 25 Oct 2023 06:35:02 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B2F21718; Wed, 25 Oct 2023 03:34:50 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPS id 5D48CC433A9; Wed, 25 Oct 2023 10:34:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1698230089; bh=i2xaXqOVgU88Uvg3QDgHjQjoR8ujrvuCPuyxLV6Xtz4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=IveYCGBPkLzyDWD2vMUNdTgoYO0lOeBomBtiGi/LsxivNdwrcc48Y/gXA+ypOBn4K HIaDa54lSyssv3B+j40INE0lDtVkcVzaye2cB0w9KF3/x9O8k2evuwWiZtaNMH3upz 3pL5AuYsjGl/CDRQrorHhUOM3KZ6ycdeox8KW5N4= Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D2FEC25B6E; Wed, 25 Oct 2023 10:34:49 +0000 (UTC) From: Richard Leitner Date: Wed, 25 Oct 2023 10:34:12 +0000 Subject: [PATCH 2/4] dt-bindings: hwmon: add ti,ina238 MIME-Version: 1.0 Message-Id: <20231025-ina237-v1-2-a0196119720c@linux.dev> References: <20231025-ina237-v1-0-a0196119720c@linux.dev> In-Reply-To: <20231025-ina237-v1-0-a0196119720c@linux.dev> To: Guenter Roeck , Jean Delvare , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, Richard Leitner X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1698230088; l=2124; i=richard.leitner@linux.dev; s=20231025; h=from:subject:message-id; bh=i2xaXqOVgU88Uvg3QDgHjQjoR8ujrvuCPuyxLV6Xtz4=; =?utf-8?q?b=3Dyuv9v7Sy8wlR?= =?utf-8?q?5MraQ2EgcTULWV5JPbnedvH4packoK616Xqds4Mm9TEg6QErN/mLJKfPfxhhqp4c?= CD7JxoP4Bq3qpgWMbMbjwAsk960HEgsqRRKpjySvzmZZnznGL4HR X-Developer-Key: i=richard.leitner@linux.dev; a=ed25519; pk=ZYa5+0m9RFYtnNU6DLet7sHyPehnVHa0ucJlYiAu2NU= X-Endpoint-Received: by B4 Relay for richard.leitner@linux.dev/20231025 with auth_id=90 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org The ina238 driver is available since 2021 but lacks a dt-bindings file. Therefore add the missing file now. Mention Jean Delvare and Guenter Roeck as maintainers as reported by the get_maintainer.pl script. Signed-off-by: Richard Leitner --- .../devicetree/bindings/hwmon/ti,ina238.yaml | 46 ++++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 47 insertions(+) diff --git a/Documentation/devicetree/bindings/hwmon/ti,ina238.yaml b/Documentation/devicetree/bindings/hwmon/ti,ina238.yaml new file mode 100644 index 000000000000..aba89e5f34b3 --- /dev/null +++ b/Documentation/devicetree/bindings/hwmon/ti,ina238.yaml @@ -0,0 +1,46 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- + +$id: http://devicetree.org/schemas/hwmon/ti,ina238.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Texas Instruments INA238 power/voltage monitors + +maintainers: + - Jean Delvare + - Guenter Roeck + +description: | + The INA238 is an ultra-precise digital power monitor with a + 16-bit delta-sigma ADC specifically designed for current-sensing + applications. + + Datasheets: + https://www.ti.com/lit/ds/symlink/ina238.pdf + +properties: + compatible: + enum: + - ti,ina238 + + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + power-sensor@40 { + compatible = "ti,ina238"; + reg = <0x40>; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 28f91c8a2e1c..13858bd6a3d4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10271,6 +10271,7 @@ INA238 HARDWARE MONITOR DRIVER M: Guenter Roeck L: linux-hwmon@vger.kernel.org S: Maintained +F: Documentation/devicetree/bindings/hwmon/ti,ina238.yaml F: drivers/hwmon/ina238.c INDEX OF FURTHER KERNEL DOCUMENTATION From patchwork Wed Oct 25 10:34:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Leitner X-Patchwork-Id: 13435928 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B42D9C25B6B for ; Wed, 25 Oct 2023 10:35:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234896AbjJYKf2 (ORCPT ); Wed, 25 Oct 2023 06:35:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234831AbjJYKfC (ORCPT ); Wed, 25 Oct 2023 06:35:02 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 737F7171A; Wed, 25 Oct 2023 03:34:50 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPS id 732DBC433B6; Wed, 25 Oct 2023 10:34:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1698230089; bh=DtHEPpID31tWjOLNIsg0s4zUFeieNUVEZ4/N6Xx8pBg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=BjiBDWUMuj2tkWUwTUmXk+7PGrVIGz3zwiAzUlyvkvPp4VSCBA9MDde6zGjkgQOIR +N8gsK0fk7EF3dkwYdCFXB+4GHIAxC/+1Npnj7ZZNjgX8FvG3t5RKQtskoGVjq9Psm wkk1VeOCjKG18kaHLbgBzXqLcilm9k5W9YMqUkEI= Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AD4BC25B47; Wed, 25 Oct 2023 10:34:49 +0000 (UTC) From: Richard Leitner Date: Wed, 25 Oct 2023 10:34:13 +0000 Subject: [PATCH 3/4] hwmon: ina238: add ina237 support MIME-Version: 1.0 Message-Id: <20231025-ina237-v1-3-a0196119720c@linux.dev> References: <20231025-ina237-v1-0-a0196119720c@linux.dev> In-Reply-To: <20231025-ina237-v1-0-a0196119720c@linux.dev> To: Guenter Roeck , Jean Delvare , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, Richard Leitner X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1698230088; l=1834; i=richard.leitner@linux.dev; s=20231025; h=from:subject:message-id; bh=DtHEPpID31tWjOLNIsg0s4zUFeieNUVEZ4/N6Xx8pBg=; =?utf-8?q?b=3Dcbexpn9jwDnL?= =?utf-8?q?m+iezslfz1ab3VC6XgcxtDK5rB8jqIMYOYfLU10JVG6RexSObUWxYfv/lSVZWjUN?= mndptX2xClpQW5585VXATi/o+DZCXtdCE+kJlqIZpCmvIIwi3Ljr X-Developer-Key: i=richard.leitner@linux.dev; a=ed25519; pk=ZYa5+0m9RFYtnNU6DLet7sHyPehnVHa0ucJlYiAu2NU= X-Endpoint-Received: by B4 Relay for richard.leitner@linux.dev/20231025 with auth_id=90 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org The INA237 "85-V, 16-Bit, Precision Power Monitor With I2C Interface" is basically the same as INA328. Therefore add a corresponding compatible to the driver. According to the datasheet the main difference is the current and power monitoring accuracy: +------------------------+---------------+---------------+ | | INA238 | INA237 | +------------------------+---------------+---------------+ | Offset voltage | +/- 5µV | +/- 50µV | | Offset drift | +/- 0.02µV/°C | +/- 0.02µV/°C | | Gain error | +/- 0.1% | +/- 0.3% | | Gain error drift | +/- 25ppm/°C | +/- 50ppm/°C | | Common mode rejection | 140dB | 120dB | | Power accuracy | 0.7% | 1.6% | +------------------------+---------------+---------------+ As well as the missing DEVICE_ID register at 0x3F, which is currently not in use by the driver. Signed-off-by: Richard Leitner --- drivers/hwmon/ina238.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/ina238.c b/drivers/hwmon/ina238.c index f519c22d3907..ca9f5d2c811b 100644 --- a/drivers/hwmon/ina238.c +++ b/drivers/hwmon/ina238.c @@ -33,7 +33,7 @@ #define INA238_BUS_UNDER_VOLTAGE 0xf #define INA238_TEMP_LIMIT 0x10 #define INA238_POWER_LIMIT 0x11 -#define INA238_DEVICE_ID 0x3f +#define INA238_DEVICE_ID 0x3f /* not available on INA237 */ #define INA238_CONFIG_ADCRANGE BIT(4) @@ -622,6 +622,7 @@ static const struct i2c_device_id ina238_id[] = { MODULE_DEVICE_TABLE(i2c, ina238_id); static const struct of_device_id __maybe_unused ina238_of_match[] = { + { .compatible = "ti,ina237" }, { .compatible = "ti,ina238" }, { }, }; From patchwork Wed Oct 25 10:34:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Leitner X-Patchwork-Id: 13435926 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC19DC25B47 for ; Wed, 25 Oct 2023 10:35:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234938AbjJYKf0 (ORCPT ); Wed, 25 Oct 2023 06:35:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234617AbjJYKfC (ORCPT ); Wed, 25 Oct 2023 06:35:02 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5298C1719; Wed, 25 Oct 2023 03:34:50 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPS id 75C4AC433AD; Wed, 25 Oct 2023 10:34:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1698230089; bh=2UlV2SAeLThisZx2CDUzVQIsXFCsdphm0WX5MqF/paA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=0Z1BfXWgfx5rvEQovfZHR5PrOerqx9mtKj0gvUKkZkvLL/uGDjnqG7M8qQEBqsGWE FBRvTxMCS6UaSA6UX29G/K9+PczmVEOaeELWTjn0aGlf2dtH/1OKCeP6tTf+4GlS95 +t0vUgeDr1AUmkRnqwma+kPTgNod/r0EHNBtZFRs= Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 599C7C25B6F; Wed, 25 Oct 2023 10:34:49 +0000 (UTC) From: Richard Leitner Date: Wed, 25 Oct 2023 10:34:14 +0000 Subject: [PATCH 4/4] dt-bindings: hwmon: ti,ina238: add ti,ina237 MIME-Version: 1.0 Message-Id: <20231025-ina237-v1-4-a0196119720c@linux.dev> References: <20231025-ina237-v1-0-a0196119720c@linux.dev> In-Reply-To: <20231025-ina237-v1-0-a0196119720c@linux.dev> To: Guenter Roeck , Jean Delvare , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, Richard Leitner X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1698230088; l=666; i=richard.leitner@linux.dev; s=20231025; h=from:subject:message-id; bh=2UlV2SAeLThisZx2CDUzVQIsXFCsdphm0WX5MqF/paA=; =?utf-8?q?b=3DqVMEmSxVR/Bx?= =?utf-8?q?f6+PrpumfMpyFJL40+yFqvVmuDr8yuDujWEFxZ2CGxoNMGcrHJR8tHp9Rf4n02pU?= YDhZzYxyBzu4oeagPUqVG4mczsszD7wqGMgouzCpDI++hLYnLHSe X-Developer-Key: i=richard.leitner@linux.dev; a=ed25519; pk=ZYa5+0m9RFYtnNU6DLet7sHyPehnVHa0ucJlYiAu2NU= X-Endpoint-Received: by B4 Relay for richard.leitner@linux.dev/20231025 with auth_id=90 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Add ti,ina237 binding to ti,ina238 as they share the same driver. Signed-off-by: Richard Leitner --- Documentation/devicetree/bindings/hwmon/ti,ina238.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/hwmon/ti,ina238.yaml b/Documentation/devicetree/bindings/hwmon/ti,ina238.yaml index aba89e5f34b3..17408076696c 100644 --- a/Documentation/devicetree/bindings/hwmon/ti,ina238.yaml +++ b/Documentation/devicetree/bindings/hwmon/ti,ina238.yaml @@ -22,6 +22,7 @@ description: | properties: compatible: enum: + - ti,ina237 - ti,ina238 reg: