Skip to contentSkip to conversation

hwmon: TI INA236 support

PATCH In review Florian Fainelli 3 participants 7 messages Nov 30

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover hwmon: TI INA236 support

This patch series adds support for the TI INA236 power monitor which is virtually identical to the existing TI INA232.

Yuval Raviv (2):
dt-bindings: hwmon: ina2xx: add ti,ina236 compatible
hwmon: ina2xx: add support for TI INA236 power monitor

 .../devicetree/bindings/hwmon/ti,ina2xx.yaml  |  3 +++
 drivers/hwmon/ina2xx.c                        | 21 +++++++++++++++++++
 2 files changed, 24 insertions(+)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/2 dt-bindings: hwmon: ina2xx: add ti,ina236 compatible

From: Yuval Raviv <[email protected]>

The INA236 is electrically identical to the already-supported INA232 (same calibration/shunt/bus-voltage/power-LSB characteristics, no configurable shunt-gain). Add it to the compatible enum and to the same ti,shunt-gain/ti,maximum-expected-current-microamp exclusion lists as INA232.

[florian: commit message, description]
---
 Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml +3 -0
index a79ade3142fa..410d2deddcae 100644
@@ -31,6 +31,7 @@ properties:
       - ti,ina232
       - ti,ina233
       - ti,ina234
+      - ti,ina236
       - ti,ina237
       - ti,ina238
       - ti,ina260
@@ -117,6 +118,7 @@ allOf:
               - ti,ina231
               - ti,ina232
               - ti,ina234
+              - ti,ina236
               - ti,ina237
               - ti,ina238
               - ti,ina260
@@ -140,6 +142,7 @@ allOf:
               - ti,ina231
               - ti,ina232
               - ti,ina234
+              - ti,ina236
               - ti,ina260
               - ti,ina700
               - ti,ina780
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/2 hwmon: ina2xx: add support for TI INA236 power monitor

In reply to Florian Fainelli

From: Yuval Raviv <[email protected]>

The INA236 shares the same electrical characteristics as the already supported INA232 (calibration value, shunt/bus-voltage/power LSBs, alert support, update interval), so it reuses that configuration verbatim. Add it to the chip enum, config table, I2C device ID table and OF match table.

[florian: forward porting, commit message, comments]
---
 drivers/hwmon/ina2xx.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
drivers/hwmon/ina2xx.c +21 -0
index aa5b39a87622..82598d3fac90 100644
@@ -126,6 +126,7 @@ enum ina2xx_ids {
 	ina226,
 	ina232,
 	ina234,
+	ina236,
 	ina260,
 	sy24655
 };
@@ -225,6 +226,21 @@ static const struct ina2xx_config ina2xx_config[] = {
 		.current_shift = 0,
 		.has_update_interval = true,
 	},
+	[ina236] = {
+		/* same electrical characteristics as ina232 */
+		.config_default = INA226_CONFIG_DEFAULT,
+		.calibration_value = 2048,
+		.shunt_div = 400,
+		.shunt_voltage_shift = 0,
+		.bus_voltage_shift = 0,
+		.bus_voltage_lsb = 1600,
+		.power_lsb_factor = 32,
+		.has_alerts = true,
+		.has_ishunt = false,
+		.has_power_average = false,
+		.current_shift = 0,
+		.has_update_interval = true,
+	},
 	[ina260] = {
 		.config_default = INA260_CONFIG_DEFAULT,
 		.shunt_div = 400,
@@ -1140,6 +1156,7 @@ static const struct i2c_device_id ina2xx_id[] = {
 	{ .name = "ina231", .driver_data = ina226 },
 	{ .name = "ina232", .driver_data = ina232 },
 	{ .name = "ina234", .driver_data = ina234 },
+	{ .name = "ina236", .driver_data = ina236 },
 	{ .name = "ina260", .driver_data = ina260 },
 	{ .name = "sy24655", .driver_data = sy24655 },
 	{ }
@@ -1179,6 +1196,10 @@ static const struct of_device_id __maybe_unused ina2xx_of_match[] = {
 		.compatible = "ti,ina234",
 		.data = (void *)ina234
 	},
+	{
+		.compatible = "ti,ina236",
+		.data = (void *)ina236
+	},
 	{
 		.compatible = "ti,ina260",
 		.data = (void *)ina260
Signature · 1 line
2.34.1
#3 lore raw

Re: [PATCH 2/2] hwmon: ina2xx: add support for TI INA236 power monitor

Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Low] hwmon: ina2xx: redundant ina236 enum and duplicate ina2xx_config entry - [Low] hwmon: ina2xx: missing…

Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [Low] hwmon: ina2xx: redundant ina236 enum and duplicate ina2xx_config entry
- [Low] hwmon: ina2xx: missing INA236 in Documentation/hwmon/ina2xx.rst and Kconfig
--

commit 351424d3ad21da9a6be43b706bb618d413e818b0
Author: Yuval Raviv <[email protected]>

hwmon: ina2xx: add support for TI INA236 power monitor

This commit adds support for the Texas Instruments INA236 power monitor to the ina2xx driver by adding an enum value, configuration table entry, and I2C and OF match table entries.

Quoted 24 lines
drivers/hwmon/ina2xx.c +9 -0
index 19b35f3bf3a3c..3cacf07f805d5 100644
@@ -126,6 +126,7 @@ enum ina2xx_ids {
 	ina226,
 	ina232,
 	ina234,
+	ina236,
 	ina260,
 	sy24655
 };
@@ -225,6 +226,21 @@ static const struct ina2xx_config ina2xx_config[] = {
 		.current_shift = 0,
 		.has_update_interval = true,
 	},
+	[ina236] = {
+		/* same electrical characteristics as ina232 */
+		.config_default = INA226_CONFIG_DEFAULT,
+		.calibration_value = 2048,
+		.shunt_div = 400,
+		.shunt_voltage_shift = 0,
+		.bus_voltage_shift = 0,
+		.bus_voltage_lsb = 1600,

drivers/hwmon/ina2xx.c static const struct ina2xx_config ina2xx_config[] = { · line 246

Quoted 10 lines
drivers/hwmon/ina2xx.c +7 -0
+		.power_lsb_factor = 32,
+		.has_alerts = true,
+		.has_ishunt = false,
+		.has_power_average = false,
+		.current_shift = 0,
+		.has_update_interval = true,
+	},
 	[ina260] = {
 		.config_default = INA260_CONFIG_DEFAULT,
 		.shunt_div = 400,

[Severity: Low]
Since INA236 uses the exact same configuration as INA232 and no code path in the driver distinguishes between them, could the ina236 entries in ina2xx_id[] and ina2xx_of_match[] point directly to ina232 instead of adding a separate enum value and duplicating ina2xx_config[ina232]? Other compatible chips in this driver (ina220 using ina219, and ina230/ina231 using ina226) share the existing enum ID directly.

drivers/hwmon/ina2xx.c static const struct i2c_device_id ina2xx_id[] = { · line 1162

Quoted 8 lines
drivers/hwmon/ina2xx.c +1 -0
@@ -1140,6 +1156,7 @@ static const struct i2c_device_id ina2xx_id[] = {
 	{ .name = "ina231", .driver_data = ina226 },
 	{ .name = "ina232", .driver_data = ina232 },
 	{ .name = "ina234", .driver_data = ina234 },
+	{ .name = "ina236", .driver_data = ina236 },
 	{ .name = "ina260", .driver_data = ina260 },
 	{ .name = "sy24655", .driver_data = sy24655 },
 	{ }

[Severity: Low]
Should Documentation/hwmon/ina2xx.rst and the SENSORS_INA2XX help text in drivers/hwmon/Kconfig also be updated to list INA236 among the supported chips, per Documentation/hwmon/submitting-patches.rst?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#4 lore raw

Re: [PATCH 2/2] hwmon: ina2xx: add support for TI INA236 power monitor

Quoted 52 lines · On 11/30/26 14:38, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [Low] hwmon: ina2xx: redundant ina236 enum and duplicate ina2xx_config entry
- [Low] hwmon: ina2xx: missing INA236 in Documentation/hwmon/ina2xx.rst and Kconfig
--

commit 351424d3ad21da9a6be43b706bb618d413e818b0
Author: Yuval Raviv <[email protected]>

hwmon: ina2xx: add support for TI INA236 power monitor

This commit adds support for the Texas Instruments INA236 power monitor to the ina2xx driver by adding an enum value, configuration table entry, and I2C and OF match table entries.

Quoted 24 lines
drivers/hwmon/ina2xx.c +9 -0
index 19b35f3bf3a3c..3cacf07f805d5 100644
@@ -126,6 +126,7 @@ enum ina2xx_ids {
  	ina226,
  	ina232,
  	ina234,
+	ina236,
  	ina260,
  	sy24655
  };
@@ -225,6 +226,21 @@ static const struct ina2xx_config ina2xx_config[] = {
  		.current_shift = 0,
  		.has_update_interval = true,
  	},
+	[ina236] = {
+		/* same electrical characteristics as ina232 */
+		.config_default = INA226_CONFIG_DEFAULT,
+		.calibration_value = 2048,
+		.shunt_div = 400,
+		.shunt_voltage_shift = 0,
+		.bus_voltage_shift = 0,
+		.bus_voltage_lsb = 1600,

drivers/hwmon/ina2xx.c static const struct ina2xx_config ina2xx_config[] = { · line 246

Quoted 10 lines
drivers/hwmon/ina2xx.c +7 -0
+		.power_lsb_factor = 32,
+		.has_alerts = true,
+		.has_ishunt = false,
+		.has_power_average = false,
+		.current_shift = 0,
+		.has_update_interval = true,
+	},
  	[ina260] = {
  		.config_default = INA260_CONFIG_DEFAULT,
  		.shunt_div = 400,
Quoted 7 lines

[Severity: Low]
Since INA236 uses the exact same configuration as INA232 and no code path in the driver distinguishes between them, could the ina236 entries in ina2xx_id[] and ina2xx_of_match[] point directly to ina232 instead of adding a separate enum value and duplicating ina2xx_config[ina232]? Other compatible chips in this driver (ina220 using ina219, and ina230/ina231 using ina226) share the existing enum ID directly.

Yes, will do.

Quoted 14 lines

drivers/hwmon/ina2xx.c static const struct i2c_device_id ina2xx_id[] = { · line 1162

Quoted 9 lines
drivers/hwmon/ina2xx.c +1 -0
@@ -1140,6 +1156,7 @@ static const struct i2c_device_id ina2xx_id[] = {
  	{ .name = "ina231", .driver_data = ina226 },
  	{ .name = "ina232", .driver_data = ina232 },
  	{ .name = "ina234", .driver_data = ina234 },
+	{ .name = "ina236", .driver_data = ina236 },
  	{ .name = "ina260", .driver_data = ina260 },
  	{ .name = "sy24655", .driver_data = sy24655 },
  	{ }

[Severity: Low]
Should Documentation/hwmon/ina2xx.rst and the SENSORS_INA2XX help text in drivers/hwmon/Kconfig also be updated to list INA236 among the supported chips, per Documentation/hwmon/submitting-patches.rst?

Yes both ina2xx.rst and Kconfig should be amended to include support for the INA236. In fact, INA232 is not documented consistently everywhere so I will start with a patch adding the missing entry and then add INA236 on top.

Signature · 1 line
Florian
maintainer
#5 lore raw

Re: [PATCH 2/2] hwmon: ina2xx: add support for TI INA236 power monitor

In reply to [email protected]
Quoted 52 lines · On 11/30/26 14:38, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [Low] hwmon: ina2xx: redundant ina236 enum and duplicate ina2xx_config entry
- [Low] hwmon: ina2xx: missing INA236 in Documentation/hwmon/ina2xx.rst and Kconfig
--

commit 351424d3ad21da9a6be43b706bb618d413e818b0
Author: Yuval Raviv <[email protected]>

hwmon: ina2xx: add support for TI INA236 power monitor

This commit adds support for the Texas Instruments INA236 power monitor to the ina2xx driver by adding an enum value, configuration table entry, and I2C and OF match table entries.

Quoted 24 lines
drivers/hwmon/ina2xx.c +9 -0
index 19b35f3bf3a3c..3cacf07f805d5 100644
@@ -126,6 +126,7 @@ enum ina2xx_ids {
  	ina226,
  	ina232,
  	ina234,
+	ina236,
  	ina260,
  	sy24655
  };
@@ -225,6 +226,21 @@ static const struct ina2xx_config ina2xx_config[] = {
  		.current_shift = 0,
  		.has_update_interval = true,
  	},
+	[ina236] = {
+		/* same electrical characteristics as ina232 */
+		.config_default = INA226_CONFIG_DEFAULT,
+		.calibration_value = 2048,
+		.shunt_div = 400,
+		.shunt_voltage_shift = 0,
+		.bus_voltage_shift = 0,
+		.bus_voltage_lsb = 1600,

drivers/hwmon/ina2xx.c static const struct ina2xx_config ina2xx_config[] = { · line 246

Quoted 10 lines
drivers/hwmon/ina2xx.c +7 -0
+		.power_lsb_factor = 32,
+		.has_alerts = true,
+		.has_ishunt = false,
+		.has_power_average = false,
+		.current_shift = 0,
+		.has_update_interval = true,
+	},
  	[ina260] = {
  		.config_default = INA260_CONFIG_DEFAULT,
  		.shunt_div = 400,
Quoted 8 lines

[Severity: Low]
Since INA236 uses the exact same configuration as INA232 and no code path in the driver distinguishes between them, could the ina236 entries in ina2xx_id[] and ina2xx_of_match[] point directly to ina232 instead of adding a separate enum value and duplicating ina2xx_config[ina232]? Other compatible chips in this driver (ina220 using ina219, and ina230/ina231 using ina226) share the existing enum ID directly.

I agree.

Quoted 5 lines
Quoted 5 lines
drivers/hwmon/ina2xx.c +1 -0
@@ -1140,6 +1156,7 @@ static const struct i2c_device_id ina2xx_id[] = {
  	{ .name = "ina231", .driver_data = ina226 },
  	{ .name = "ina232", .driver_data = ina232 },
  	{ .name = "ina234", .driver_data = ina234 },
+	{ .name = "ina236", .driver_data = ina236 },
Quoted 9 lines

drivers/hwmon/ina2xx.c static const struct i2c_device_id ina2xx_id[] = { · line 1162

Quoted 3 lines
drivers/hwmon/ina2xx.c +0 -0
  	{ .name = "ina260", .driver_data = ina260 },
  	{ .name = "sy24655", .driver_data = sy24655 },
  	{ }

[Severity: Low]
Should Documentation/hwmon/ina2xx.rst and the SENSORS_INA2XX help text in drivers/hwmon/Kconfig also be updated to list INA236 among the supported chips, per Documentation/hwmon/submitting-patches.rst?

Same here.

Thanks,
Guenter

#6 lore raw
In reply to Florian Fainelli
Sashiko has finished reviewing this 2-patch series:

Sashiko has finished reviewing this 2-patch series:

- Patch 1: no issues found.
- Patch 2 ("hwmon: ina2xx: add support for TI INA236 power monitor"): 2 potential issues (2 Low)

A detailed review has been sent as a separate reply to patch 2.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]