Skip to contentSkip to conversation

dt-bindings: hwmon: Add compatible for ti,ina260

PATCH In review Franz Forstmayr 4 participants 9 messages Feb 24, 2020 – May 19, 2020

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

PATCH 1/3 dt-bindings: hwmon: Add compatible for ti,ina260

Add initial support for power/current monitor INA260

---
 Documentation/devicetree/bindings/hwmon/ina2xx.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/hwmon/ina2xx.txt +1 -0
index 02af0d94e921..92983a224109 100644
@@ -8,6 +8,7 @@ Required properties:
 	- "ti,ina226" for ina226
 	- "ti,ina230" for ina230
 	- "ti,ina231" for ina231
+	- "ti,ina260" for ina260
 - reg: I2C address
 
 Optional properties:
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/3 docs: hwmon: Add support for ina2xx

Add documentation for INA260, power/current monitor with I2C interface.

---
 Documentation/hwmon/ina2xx.rst | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
Documentation/hwmon/ina2xx.rst +16 -3
index 94b9a260c518..74267dd433dd 100644
@@ -53,6 +53,16 @@ Supported chips:
 
 	       http://www.ti.com/
 
+  * Texas Instruments INA260
+
+    Prefix: 'ina260'
+
+    Addresses: I2C 0x40 - 0x4f
+
+    Datasheet: Publicly available at the Texas Instruments website
+
+         http://www.ti.com/
+
 Author: Lothar Felten <[email protected]>
 
 Description
@@ -72,14 +82,17 @@ INA230 and INA231 are high or low side current shunt and power monitors
 with an I2C interface. The chips monitor both a shunt voltage drop and
 bus supply voltage.
 
+INA260 is a high or low side current and power monitor with an integrated
+shunt and I2C interface.
+
 The shunt value in micro-ohms can be set via platform data or device tree at
 compile-time or via the shunt_resistor attribute in sysfs at run-time. Please
 refer to the Documentation/devicetree/bindings/hwmon/ina2xx.txt for bindings
 if the device tree is used.
 
-Additionally ina226 supports update_interval attribute as described in
-Documentation/hwmon/sysfs-interface.rst. Internally the interval is the sum of
-bus and shunt voltage conversion times multiplied by the averaging rate. We
+Additionally ina226 and ina260 supports update_interval attribute as described
+in Documentation/hwmon/sysfs-interface.rst. Internally the interval is the sum
+of bus and shunt voltage conversion times multiplied by the averaging rate. We
 don't touch the conversion times and only modify the number of averages. The
 lower limit of the update_interval is 2 ms, the upper limit is 2253 ms.
 The actual programmed interval may vary from the desired value.
Signature · 1 line
2.17.1
maintainer
#2 lore raw

Re: [PATCH 2/3] docs: hwmon: Add support for ina2xx

Quoted 2 lines · Franz Forstmayr

Add documentation for INA260, power/current monitor with I2C interface.

Subject should match description here (this patch does not add support for ina2xx).

Quoted 32 lines
---
  Documentation/hwmon/ina2xx.rst | 19 ++++++++++++++++---
  1 file changed, 16 insertions(+), 3 deletions(-)
Documentation/hwmon/ina2xx.rst +12 -0
index 94b9a260c518..74267dd433dd 100644
@@ -53,6 +53,16 @@ Supported chips:
 
  	       http://www.ti.com/
 
+  * Texas Instruments INA260
+
+    Prefix: 'ina260'
+
+    Addresses: I2C 0x40 - 0x4f
+
+    Datasheet: Publicly available at the Texas Instruments website
+
+         http://www.ti.com/
+
  Author: Lothar Felten <[email protected]>
 
  Description
@@ -72,14 +82,17 @@ INA230 and INA231 are high or low side current shunt and power monitors
  with an I2C interface. The chips monitor both a shunt voltage drop and
  bus supply voltage.
 
+INA260 is a high or low side current and power monitor with an integrated
+shunt and I2C interface.

Documentation/hwmon/ina2xx.rst INA230 and INA231 are high or low side current shunt and power monitors · line 93

Quoted 10 lines
Documentation/hwmon/ina2xx.rst +2 -3
+
  The shunt value in micro-ohms can be set via platform data or device tree at
  compile-time or via the shunt_resistor attribute in sysfs at run-time. Please
  refer to the Documentation/devicetree/bindings/hwmon/ina2xx.txt for bindings
  if the device tree is used.
 
-Additionally ina226 supports update_interval attribute as described in
-Documentation/hwmon/sysfs-interface.rst. Internally the interval is the sum of
-bus and shunt voltage conversion times multiplied by the averaging rate. We
+Additionally ina226 and ina260 supports update_interval attribute as described

s/supports/support/

Quoted 6 lines
Documentation/hwmon/ina2xx.rst +2 -0
+in Documentation/hwmon/sysfs-interface.rst. Internally the interval is the sum
+of bus and shunt voltage conversion times multiplied by the averaging rate. We
  don't touch the conversion times and only modify the number of averages. The
  lower limit of the update_interval is 2 ms, the upper limit is 2253 ms.
  The actual programmed interval may vary from the desired value.
#3 lore raw

PATCH 3/3 hwmon: (ina2xx) Add support for ina260

In reply to Franz Forstmayr

Add initial support for INA260 power monitor with integrated shunt. Registers are different from other INA2xx devices, that's why a small translation table is used.

---
 drivers/hwmon/Kconfig  |   5 +-
 drivers/hwmon/ina2xx.c | 144 ++++++++++++++++++++++++++++++++++-------
 2 files changed, 125 insertions(+), 24 deletions(-)
drivers/hwmon/Kconfig +3 -2
index 05a30832c6ba..2916a60dd9b1 100644
@@ -1683,11 +1683,12 @@ config SENSORS_INA2XX
 	select REGMAP_I2C
 	help
 	  If you say yes here you get support for INA219, INA220, INA226,
-	  INA230, and INA231 power monitor chips.
+	  INA230, INA231 and INA260 power monitor chips.
 
 	  The INA2xx driver is configured for the default configuration of
 	  the part as described in the datasheet.
-	  Default value for Rshunt is 10 mOhms.
+	  Default value for Rshunt is 10 mOhms, except for INA260 which has
+	  an 2 mOhm integrated shunt.
 	  This driver can also be built as a module. If so, the module
 	  will be called ina2xx.
 
drivers/hwmon/ina2xx.c +122 -22

261 lines not on this page · raw message

Signature · 1 line
2.17.1
maintainer
#4 lore raw

Re: [PATCH 3/3] hwmon: (ina2xx) Add support for ina260

Quoted 5 lines · Franz Forstmayr

Add initial support for INA260 power monitor with integrated shunt. Registers are different from other INA2xx devices, that's why a small translation table is used.

I think the chip is sufficiently different to other chips that a separate driver would make much more sense than adding support to the existing driver. There is no calibration, registers are different, the retry logic is not needed. A new driver could use the with_info API and would be much simpler while at the same time not messing up the existing driver.

Guenter

#5 lore raw

Re: [PATCH 3/3] hwmon: (ina2xx) Add support for ina260

Quoted 5 lines · Guenter Roeck
Quoted 4 lines · Franz Forstmayr

Add initial support for INA260 power monitor with integrated shunt. Registers are different from other INA2xx devices, that's why a small translation table is used.

Quoted 8 lines
Quoted 1 line

I think the chip is sufficiently different to other chips that a separate driver would make much more sense than adding support to the existing driver.
There is no calibration, registers are different, the retry logic is not needed. A new driver could use the with_info API and would be much simpler while at the same time not messing up the existing driver.

Isn't it also better to switch to IIO framework?
As we discussed in past there are two ina226 drivers. One in hwmon and second based on IIO framework (more advance one?) and would be good to deprecate hwmon one.
That's why separate driver is necessary.

Thanks,
Michal

maintainer
#6 lore raw

Re: [PATCH 3/3] hwmon: (ina2xx) Add support for ina260

Quoted 15 lines · Michal Simek
Quoted 5 lines · Guenter Roeck
Quoted 4 lines · Franz Forstmayr

Add initial support for INA260 power monitor with integrated shunt. Registers are different from other INA2xx devices, that's why a small translation table is used.

Quoted 8 lines
Quoted 1 line

I think the chip is sufficiently different to other chips that a separate driver would make much more sense than adding support to the existing driver.
There is no calibration, registers are different, the retry logic is not needed. A new driver could use the with_info API and would be much simpler while at the same time not messing up the existing driver.

Quoted 4 lines

Isn't it also better to switch to IIO framework?
As we discussed in past there are two ina226 drivers. One in hwmon and second based on IIO framework (more advance one?) and would be good to deprecate hwmon one.

"More advanced" is relative. The ina2xx driver in iio doesn't support alert limits (which is queued in the hwmon driver for 5.8), and the iio->hwmon bridge doesn't support it either. On top of that, there are existing users of the hwmon driver, which would have to be converted first. As for ina260, it would be up to the implementer to determine if alert limit support is needed or not, and which API would be appropriate for the intended use case.

Guenter

#7 lore raw

Re: [PATCH 3/3] hwmon: (ina2xx) Add support for ina260

Quoted 21 lines · Guenter Roeck
Quoted 15 lines · Michal Simek
Quoted 5 lines · Guenter Roeck
Quoted 4 lines · Franz Forstmayr

Add initial support for INA260 power monitor with integrated shunt. Registers are different from other INA2xx devices, that's why a small translation table is used.

Quoted 8 lines
Quoted 1 line

I think the chip is sufficiently different to other chips that a separate driver would make much more sense than adding support to the existing driver.
There is no calibration, registers are different, the retry logic is not needed. A new driver could use the with_info API and would be much simpler while at the same time not messing up the existing driver.

Quoted 4 lines

Isn't it also better to switch to IIO framework?
As we discussed in past there are two ina226 drivers. One in hwmon and second based on IIO framework (more advance one?) and would be good to deprecate hwmon one.

Quoted 7 lines

"More advanced" is relative. The ina2xx driver in iio doesn't support alert limits (which is queued in the hwmon driver for 5.8), and the iio->hwmon bridge doesn't support it either. On top of that, there are existing users of the hwmon driver, which would have to be converted first. As for ina260, it would be up to the implementer to determine if alert limit support is needed or not, and which API would be appropriate for the intended use case.

Good to know. If ina260 is done as separate driver I am fine with it.

Thanks,
Michal