Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 0fc34a9f authored by Harry Yang's avatar Harry Yang Committed by Guru Das Srinagesh
Browse files

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: default avatarHarry Yang <harryy@codeaurora.org>
Signed-off-by: default avatarGuru Das Srinagesh <gurus@codeaurora.org>
parent 01697ba5
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment