hwmon: qpnp-current: specify batfet status while calibrating
For internal Rsense or external Rsense, when current is requested by
BMS while battery fet (BATFET) is open, IADC switches to channel 5
even though channel 0 or channel 1 was requested. This is done so that
it returns the same value as offset calibration would have returned
resulting in 0mA of current.
This is okay for external Rsense since offset calibrations are done on
channel 5 which measures across same pins as those used for current
readings.
However this results in incorrect offset values for internal Rsense
because the offset calibrations happens on channel 6 which uses
different pins than channel 5.
Update the code to specify whether a calibration is being requested
while the battery fet is open. If it is open then use channel 5 for offset
calculations even when internal Rsense is used.
Change-Id: I1b36ea1d5dd078b177d6c5a92d7c49e8402c36dc
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
3 files changed