diff options
author | William Wu <william.wu@rock-chips.com> | 2017-07-07 09:53:00 +0800 |
---|---|---|
committer | Huang, Tao <huangtao@rock-chips.com> | 2017-07-07 19:17:12 +0800 |
commit | f7169a90bc441107240c042440391310dd1b2ba1 (patch) | |
tree | cb677fa2b197737c9d1400797c112c05e3eb0a19 /drivers/power/rk818_charger.c | |
parent | 9aeb1194e3847cd519a1a81d3788f3fd66dd6043 (diff) |
power: rk818-charger: fix usb charger undetected
On some platforms (e.g. rk3399), we use extcon notify
framework to receive USB charger notifier from USB PHY
driver. Generally, the USB PHY driver uses a work to check
vbus status and the USB charger type every 2 seconds,
this polling mechanism may cause USB charger undetected
if we plug in/out USB charger quickly.
A typical error case is:
1. Plug in an USB DCP Adapter.
- USB PHY driver sends notifier to rk818-charger
2. Plug out the USB Adapter, and plug in again immediately
- rk818 detects plug out irq, and turns off charging
- USB PHY driver schedule work doesn't detect the plug
out/in operations, and doesn't send usb charger notifier
Fortunately, rk818 can detect plug in irq, so let's check
the USB charger type in rk818 plug in irq handler.
Change-Id: Iee45769c8a98c709da2dbfa514198ab0f648fd20
Signed-off-by: William Wu <william.wu@rock-chips.com>
Diffstat (limited to 'drivers/power/rk818_charger.c')
-rw-r--r-- | drivers/power/rk818_charger.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/power/rk818_charger.c b/drivers/power/rk818_charger.c index d785f89eb268..bd5b03e1f649 100644 --- a/drivers/power/rk818_charger.c +++ b/drivers/power/rk818_charger.c @@ -926,6 +926,9 @@ static void rk818_cg_irq_delay_work(struct work_struct *work) CG_INFO("pmic: plug in\n"); cg->plugin_trigger = 0; rk_send_wakeup_key(); + if (cg->pdata->extcon) + queue_delayed_work(cg->usb_charger_wq, &cg->usb_work, + msecs_to_jiffies(10)); } else if (cg->plugout_trigger) { CG_INFO("pmic: plug out\n"); cg->plugout_trigger = 0; |