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 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>

+28 -5
+9 -1
Documentation/hwmon/ina238.rst
··· 32 32 Datasheet: 33 33 https://www.ti.com/lit/gpn/ina238 34 34 35 + * Texas Instruments INA780 36 + 37 + Datasheet: 38 + https://www.ti.com/product/ina780a 39 + 35 40 * Silergy SQ52206 36 41 37 42 Prefix: 'SQ52206' ··· 60 55 INA237 is a functionally equivalent variant of INA238 with slightly 61 56 different accuracy. INA228 is another variant of INA238 with higher ADC 62 57 resolution. This chip also reports the energy. 58 + 59 + INA780 is a variant of the chip series with built-in shunt resistor. 60 + It also reports the energy. 63 61 64 62 SQ52206 is a mostly compatible chip from Sylergy. It reports the energy 65 63 as well as the peak power consumption. ··· 96 88 curr1_max_alarm Maximum current alarm 97 89 98 90 energy1_input Energy measurement (uJ) 99 - (SQ52206 and INA237 only) 91 + (SQ52206, INA237, and INA780 only) 100 92 101 93 temp1_input Die temperature measurement (mC) 102 94 temp1_max Maximum die temperature threshold (mC)
+3 -3
drivers/hwmon/Kconfig
··· 2256 2256 depends on I2C 2257 2257 select REGMAP_I2C 2258 2258 help 2259 - If you say yes here you get support for INA228, INA237, INA238, and 2260 - SQ52206 power monitor chips. This driver supports voltage, current, 2261 - power, energy, and temperature measurements as well as alarm 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 2262 configuration. 2263 2263 2264 2264 This driver can also be built as a module. If so, the module
+16 -1
drivers/hwmon/ina238.c
··· 101 101 .val_bits = 16, 102 102 }; 103 103 104 - enum ina238_ids { ina228, ina237, ina238, sq52206 }; 104 + enum ina238_ids { ina228, ina237, ina238, 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 + [ina780] = { 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 = 2400, 157 167 }, 158 168 [sq52206] = { 159 169 .has_20bit_voltage_current = false, ··· 846 836 { "ina228", ina228 }, 847 837 { "ina237", ina237 }, 848 838 { "ina238", ina238 }, 839 + { "ina780", ina780 }, 849 840 { "sq52206", sq52206 }, 850 841 { } 851 842 }; ··· 864 853 { 865 854 .compatible = "ti,ina238", 866 855 .data = (void *)ina238 856 + }, 857 + { 858 + .compatible = "ti,ina780", 859 + .data = (void *)ina780 867 860 }, 868 861 { 869 862 .compatible = "silergy,sq52206",