Loading
power: supply: qti_battery_charger: Keep device awake during notification
With charger mode enabled in android, device boots into charger
mode when it is powered on with USB insertion. In this mode,
health HAL and charger service handles the power supply uevents
sent from power supply framework to take certain actions. For
example, when the USB or travel adapter (TA) is removed, device
would shut down in 10 seconds.
With a TA connected, device can enter suspend whenever possible
during charging. When the TA is removed after the device has
entered suspend, device comes out of suspend upon the notification
received from charger firmware (CHGFW) over PMIC Glink. Battery
charger driver handles this and calls power_supply_changed on one
of the power supply devices. However, before this uevent is
received and handled by charger service in the userspace, device
can enter suspend immediately.
In a low power discharging state, device stays in this state for
minutes until it gets another notification from CHGFW for battery
power supply, a periodic event which makes charger service to
initiate a shutdown. This conflicts with the user expectation
where the device has to shutdown in 10 seconds upon TA removal.
Workaround this problem by keeping the device awake for at least
50 ms when a notification is received from CHGFW. This way,
userspace process like charger could get a chance to receive and
handle the power supply uevents.
Change-Id: I9ea78eb6565988ffac0e6c5eee1ccae8dc7e3e3a
Signed-off-by:
Subbaraman Narayanamurthy <subbaram@codeaurora.org>