Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+26 -6
+7 -2
Documentation/hwmon/ina238.rst
··· 32 32 Datasheet: 33 33 https://www.ti.com/lit/gpn/ina238 34 34 35 + * Texas Instruments INA700 36 + 37 + Datasheet: 38 + https://www.ti.com/product/ina700 39 + 35 40 * Texas Instruments INA780 36 41 37 42 Datasheet: ··· 66 61 different accuracy. INA228 is another variant of INA238 with higher ADC 67 62 resolution. This chip also reports the energy. 68 63 69 - INA780 is a variant of the chip series with built-in shunt resistor. 70 - It also reports the energy. 64 + INA700 and INA780 are variants of the chip series with built-in shunt resistor. 65 + They also report the energy. 71 66 72 67 SQ52206 is a mostly compatible chip from Sylergy. It reports the energy 73 68 as well as the peak power consumption.
+3 -3
drivers/hwmon/Kconfig
··· 2257 2257 select REGMAP_I2C 2258 2258 help 2259 2259 If you say yes here you get support for INA228, INA237, INA238, 2260 - INA780, and SQ52206 power monitor chips. This driver supports voltage, 2261 - current, power, energy, and temperature measurements as well as alarm 2262 - configuration. 2260 + INA700, INA780, and SQ52206 power monitor chips. This driver supports 2261 + voltage, current, power, energy, and temperature measurements as well 2262 + as alarm configuration. 2263 2263 2264 2264 This driver can also be built as a module. If so, the module 2265 2265 will be called ina238.
+16 -1
drivers/hwmon/ina238.c
··· 101 101 .val_bits = 16, 102 102 }; 103 103 104 - enum ina238_ids { ina228, ina237, ina238, ina780, sq52206 }; 104 + enum ina238_ids { ina228, ina237, ina238, ina700, ina780, sq52206 }; 105 105 106 106 struct ina238_config { 107 107 bool has_20bit_voltage_current; /* vshunt, vbus and current are 20-bit fields */ ··· 154 154 .config_default = INA238_CONFIG_DEFAULT, 155 155 .bus_voltage_lsb = INA238_BUS_VOLTAGE_LSB, 156 156 .temp_resolution = 12, 157 + }, 158 + [ina700] = { 159 + .has_20bit_voltage_current = false, 160 + .has_energy = true, 161 + .has_power_highest = false, 162 + .power_calculate_factor = 20, 163 + .config_default = INA238_CONFIG_DEFAULT, 164 + .bus_voltage_lsb = INA238_BUS_VOLTAGE_LSB, 165 + .temp_resolution = 12, 166 + .current_lsb = 480, 157 167 }, 158 168 [ina780] = { 159 169 .has_20bit_voltage_current = false, ··· 856 846 { "ina228", ina228 }, 857 847 { "ina237", ina237 }, 858 848 { "ina238", ina238 }, 849 + { "ina700", ina700 }, 859 850 { "ina780", ina780 }, 860 851 { "sq52206", sq52206 }, 861 852 { } ··· 875 864 { 876 865 .compatible = "ti,ina238", 877 866 .data = (void *)ina238 867 + }, 868 + { 869 + .compatible = "ti,ina700", 870 + .data = (void *)ina700 878 871 }, 879 872 { 880 873 .compatible = "ti,ina780",