hwmon: (ina238) Add support for INA700

INA700 is register compatible to INA780 but has different current, power,
and energy LSB values.

While the chip does not directly report the shunt voltage, report
it anyway by calculating its value from the current register.

Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Tested-by: Chris Packham <chris.packham@alliedtelesis.co.nz> # INA780
Cc: Christian Kahr <christian.kahr@sie.at>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
Guenter Roeck 2025-08-31 17:54:16 -07:00
parent 7942ca9a47
commit 273bfedc00
3 changed files with 26 additions and 6 deletions

View File

@ -32,6 +32,11 @@ Supported chips:
Datasheet: Datasheet:
https://www.ti.com/lit/gpn/ina238 https://www.ti.com/lit/gpn/ina238
* Texas Instruments INA700
Datasheet:
https://www.ti.com/product/ina700
* Texas Instruments INA780 * Texas Instruments INA780
Datasheet: Datasheet:
@ -61,8 +66,8 @@ INA237 is a functionally equivalent variant of INA238 with slightly
different accuracy. INA228 is another variant of INA238 with higher ADC different accuracy. INA228 is another variant of INA238 with higher ADC
resolution. This chip also reports the energy. resolution. This chip also reports the energy.
INA780 is a variant of the chip series with built-in shunt resistor. INA700 and INA780 are variants of the chip series with built-in shunt resistor.
It also reports the energy. They also report the energy.
SQ52206 is a mostly compatible chip from Sylergy. It reports the energy SQ52206 is a mostly compatible chip from Sylergy. It reports the energy
as well as the peak power consumption. as well as the peak power consumption.

View File

@ -2257,9 +2257,9 @@ config SENSORS_INA238
select REGMAP_I2C select REGMAP_I2C
help help
If you say yes here you get support for INA228, INA237, INA238, If you say yes here you get support for INA228, INA237, INA238,
INA780, and SQ52206 power monitor chips. This driver supports voltage, INA700, INA780, and SQ52206 power monitor chips. This driver supports
current, power, energy, and temperature measurements as well as alarm voltage, current, power, energy, and temperature measurements as well
configuration. as alarm configuration.
This driver can also be built as a module. If so, the module This driver can also be built as a module. If so, the module
will be called ina238. will be called ina238.

View File

@ -101,7 +101,7 @@ static const struct regmap_config ina238_regmap_config = {
.val_bits = 16, .val_bits = 16,
}; };
enum ina238_ids { ina228, ina237, ina238, ina780, sq52206 }; enum ina238_ids { ina228, ina237, ina238, ina700, ina780, sq52206 };
struct ina238_config { struct ina238_config {
bool has_20bit_voltage_current; /* vshunt, vbus and current are 20-bit fields */ bool has_20bit_voltage_current; /* vshunt, vbus and current are 20-bit fields */
@ -155,6 +155,16 @@ static const struct ina238_config ina238_config[] = {
.bus_voltage_lsb = INA238_BUS_VOLTAGE_LSB, .bus_voltage_lsb = INA238_BUS_VOLTAGE_LSB,
.temp_resolution = 12, .temp_resolution = 12,
}, },
[ina700] = {
.has_20bit_voltage_current = false,
.has_energy = true,
.has_power_highest = false,
.power_calculate_factor = 20,
.config_default = INA238_CONFIG_DEFAULT,
.bus_voltage_lsb = INA238_BUS_VOLTAGE_LSB,
.temp_resolution = 12,
.current_lsb = 480,
},
[ina780] = { [ina780] = {
.has_20bit_voltage_current = false, .has_20bit_voltage_current = false,
.has_energy = true, .has_energy = true,
@ -846,6 +856,7 @@ static const struct i2c_device_id ina238_id[] = {
{ "ina228", ina228 }, { "ina228", ina228 },
{ "ina237", ina237 }, { "ina237", ina237 },
{ "ina238", ina238 }, { "ina238", ina238 },
{ "ina700", ina700 },
{ "ina780", ina780 }, { "ina780", ina780 },
{ "sq52206", sq52206 }, { "sq52206", sq52206 },
{ } { }
@ -865,6 +876,10 @@ static const struct of_device_id __maybe_unused ina238_of_match[] = {
.compatible = "ti,ina238", .compatible = "ti,ina238",
.data = (void *)ina238 .data = (void *)ina238
}, },
{
.compatible = "ti,ina700",
.data = (void *)ina700
},
{ {
.compatible = "ti,ina780", .compatible = "ti,ina780",
.data = (void *)ina780 .data = (void *)ina780