power: pm8921-charger: fix reverse boosting
The reverse boosting of PM8921 may cause the USB to be
deemed as present even though it has been unplugged. This
causes unplug detection to fail and also break charging.
Fix this by disabling input regulation (vin_min) as well
as opening the OVP fets to allow capacitors to discharge.
Disabling input regulation nullifies reverse boosting. The usbin
voltage then is stuck at vph_pwr minus some diode drop across
fets. The CHG_GONE_IRQ is indicative of this condition.
This voltage is further reduced by opening up the ovp fets.
Note that before disabling input regulation we reduce the current
drawn from the usb to 500mA. It is expected that at such low current
the charger will not drop its voltage while input regulation remains
disabled.
The condition for detecting reverse boosting remains the same - input
regulation is active and the battery is supplying current instead of
getting charged.
Parameters allowing this workaround to be fine tuned:
param_vin_disable_counter:
max number of times vin_min is disabled, each iteration disables
input regulation for 20 milliseconds. The loop is exited if a
successful usb removal is detected.
param_open_ovp_counter:
number of times OVP fet is forced opened in steps of 20 millisecond.
The loop exits if a valid usb removal is detected.
Change-Id: Ic9e9ca4ef8585f70700053153c825e4f0df645b3
Signed-off-by:
David Keitel <dkeitel@codeaurora.org>
Loading
Please sign in to comment