power: smb5: Read USBIN voltage via MID_CHG for PM8150B
Currently, the charger driver uses the ADC_USB_IN_V_16 channel to read USBIN adaptor voltage. The problem with this channel is that overvoltage is observed to randomly occur while reading it, particularly when the voltages being read are greater than 9V. Therefore, switch to using the ADC_MID_CHG_DIV6 channel which is more stable. Now, this presents a new challenge - the reading from this channel goes low (< 1 V) if the voltage on this channel exceeds 10.5V. In this case, we provide an estimate of the voltage using alternate means: - For HVDCP2, we read status bits in a register; - For HVDCP3, we count the number of pulses accumulated so far and extrapolate the voltage from 5 V; and - For USB-PD, we calculate the average of min and max voltages. Change-Id: Id83e901806cc0d0f135ce3bd699d535407cf3dea Signed-off-by:Harry Yang <harryy@codeaurora.org> Signed-off-by:
Guru Das Srinagesh <gurus@codeaurora.org>
Loading
Please register or sign in to comment