diff mbox series

[v2,1/2] hwmon: ina238: add ina237 support

Message ID 20231026-ina237-v2-1-dec44811a3c9@linux.dev (mailing list archive)
State Accepted
Headers show
Series hwmon: add ti,ina237 support to ina238 driver | expand

Commit Message

Richard Leitner Oct. 26, 2023, 7:08 a.m. UTC
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 <richard.leitner@linux.dev>
---
 drivers/hwmon/ina238.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Guenter Roeck Oct. 26, 2023, 2:48 p.m. UTC | #1
On Thu, Oct 26, 2023 at 09:08:49AM +0200, Richard Leitner wrote:
> 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 <richard.leitner@linux.dev>

Applied.

Thanks,
Guenter

> ---
>  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" },
>  	{ },
>  };
diff mbox series

Patch

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" },
 	{ },
 };