diff --git a/drivers/power/supply/qti_battery_charger.c b/drivers/power/supply/qti_battery_charger.c index 61ffc2282a0f..08a7c5c27532 100644 --- a/drivers/power/supply/qti_battery_charger.c +++ b/drivers/power/supply/qti_battery_charger.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -622,8 +623,18 @@ static void handle_notification(struct battery_chg_dev *bcdev, void *data, break; } - if (pst && pst->psy) + if (pst && pst->psy) { + /* + * For charger mode, keep the device awake at least for 50 ms + * so that device won't enter suspend when a non-SDP charger + * is removed. This would allow the userspace process like + * "charger" to be able to read power supply uevents to take + * appropriate actions (e.g. shutting down when the charger is + * unplugged). + */ power_supply_changed(pst->psy); + pm_wakeup_dev_event(bcdev->dev, 50, true); + } } static int battery_chg_callback(void *priv, void *data, size_t len)