]> git.ipfire.org Git - thirdparty/linux.git/commit
iio: adc: ina2xx: add INA236 support
authorChuang Zhu <git@chuang.cz>
Sun, 15 Mar 2026 18:23:04 +0000 (02:23 +0800)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 21 Mar 2026 19:44:15 +0000 (19:44 +0000)
commit733bcf18eab0cbcea7b1a85c967dc100945fffc3
tree3d7927b242a17926885f370e8b424f1a04ea5d46
parent54dde4b1ed85a60ce1bcd10cc6783b9a33ea78e3
iio: adc: ina2xx: add INA236 support

The calibration divisor is not directly specified in the datasheet, but can be calculated:

I = Current_LSB * Current
Current = ShuntVoltage * CAL / calibration_divisor
CAL = 0.00512 / (Current_LSB * Rshunt)
ShuntVoltage = Vshunt / ShuntVoltage_LSB

=> I = (0.00512 / (calibration_divisor*ShuntVoltage_LSB)) * (Vshunt / Rshunt)

Ohm's law, I = Vshunt / Rshunt
=> 0.00512 / (calibration_divisor*ShuntVoltage_LSB) = 1

ShuntVoltage_LSB = 2.5 uV = 0.0000025 V
=> calibration_divisor = 2048

Signed-off-by: Chuang Zhu <git@chuang.cz>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ina2xx-adc.c