hwmon: (ina2xx) Use shunt voltage to calculate current
authorGuenter Roeck <linux@roeck-us.net>
Thu, 29 Aug 2024 00:21:41 +0000 (17:21 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Fri, 30 Aug 2024 15:34:23 +0000 (08:34 -0700)
commit63fb21afc1f5b2af746f332710491c61e2ad6d74
treeb2018086c2b51750da9318ad52a48ae8a638bd66
parent4d5c2d986757e4d6f56761af8ab689218a2bc432
hwmon: (ina2xx) Use shunt voltage to calculate current

Since the shunt voltage and the current register report the same values
when the chip is calibrated, we can calculate the current directly
from the shunt voltage without relying on chip calibration.

With this change, the current register is no longer accessed. Its
register address is only used to indicate if reading or writing
current or shunt voltage is desired when accessing registers.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/ina2xx.c