diff options
| author | Guenter Roeck <linux@roeck-us.net> | 2025-08-31 09:39:53 -0700 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2025-09-07 16:35:03 -0700 |
| commit | 248fd3b96d08c2a5736ca8395470544f23fe1f5c (patch) | |
| tree | 8e0abb01cd006428782dee5a3db4ea8809b9e459 /drivers/hwmon | |
| parent | d153106bd4fd63eb8d3557277a3d4ee5dbbed3b0 (diff) | |
| download | net-248fd3b96d08c2a5736ca8395470544f23fe1f5c.tar.gz | |
hwmon: (ina238) Add support for INA780
INA780 is similar to the other chips in the series, but does not
support the shunt voltage register. Shunt voltage limit registers
have been renamed to current limit registers, but are otherwise
identical.
While the chip does not directly report the shunt voltage, report
it anyway by calculating its value from the current register.
Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>
Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Tested-by: Chris Packham <chris.packham@alliedtelesis.co.nz> # INA780
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
| -rw-r--r-- | drivers/hwmon/Kconfig | 6 | ||||
| -rw-r--r-- | drivers/hwmon/ina238.c | 17 |
2 files changed, 19 insertions, 4 deletions
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 6bdce991f5f01a..c044c26fbd114d 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -2256,9 +2256,9 @@ config SENSORS_INA238 depends on I2C select REGMAP_I2C help - If you say yes here you get support for INA228, INA237, INA238, and - SQ52206 power monitor chips. This driver supports voltage, current, - power, energy, and temperature measurements as well as alarm + If you say yes here you get support for INA228, INA237, INA238, + INA780, and SQ52206 power monitor chips. This driver supports voltage, + current, power, energy, and temperature measurements as well as alarm configuration. This driver can also be built as a module. If so, the module diff --git a/drivers/hwmon/ina238.c b/drivers/hwmon/ina238.c index da5b43184dd1e2..98255619adeb72 100644 --- a/drivers/hwmon/ina238.c +++ b/drivers/hwmon/ina238.c @@ -101,7 +101,7 @@ static const struct regmap_config ina238_regmap_config = { .val_bits = 16, }; -enum ina238_ids { ina228, ina237, ina238, sq52206 }; +enum ina238_ids { ina228, ina237, ina238, ina780, sq52206 }; struct ina238_config { 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, .temp_resolution = 12, }, + [ina780] = { + .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 = 2400, + }, [sq52206] = { .has_20bit_voltage_current = false, .has_energy = true, @@ -836,6 +846,7 @@ static const struct i2c_device_id ina238_id[] = { { "ina228", ina228 }, { "ina237", ina237 }, { "ina238", ina238 }, + { "ina780", ina780 }, { "sq52206", sq52206 }, { } }; @@ -855,6 +866,10 @@ static const struct of_device_id __maybe_unused ina238_of_match[] = { .data = (void *)ina238 }, { + .compatible = "ti,ina780", + .data = (void *)ina780 + }, + { .compatible = "silergy,sq52206", .data = (void *)sq52206 }, |
