From 4e9330685211bfdbf0095678ba09d4d381b806f7 Mon Sep 17 00:00:00 2001 From: Jack Pham Date: Mon, 22 Aug 2016 16:53:59 -0700 Subject: usb: pd: Clear requested_voltage/current values on disconnect During valid sink hard reset, if requested_current was non-zero, the power_supply CURRENT_MAX property is set to 0 to tell the charger driver to suspend charging while the source resets. However, for non-PD sources this is not needed, and in fact would falsely tell the charger to suspend charging indefinitely since there is no event to restore a non-zero current vote. The bug here is that although there is a check for non-zero requested_current, this could be a stale value from a previous PD session, and a subsequent non-PD adapter plugin results in no charging. Fix this by clearing requested_voltage and requested_current on disconnect. Change-Id: Ie770546916e24faa2932b64dee6277435a27ce3b Signed-off-by: Jack Pham --- drivers/usb/pd/policy_engine.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/usb/pd') diff --git a/drivers/usb/pd/policy_engine.c b/drivers/usb/pd/policy_engine.c index b011efe189e7..fa7c5d5a5308 100644 --- a/drivers/usb/pd/policy_engine.c +++ b/drivers/usb/pd/policy_engine.c @@ -1250,6 +1250,8 @@ static void usbpd_sm(struct work_struct *w) pd->caps_count = 0; pd->hard_reset_count = 0; pd->src_cap_id = 0; + pd->requested_voltage = 0; + pd->requested_current = 0; memset(&pd->received_pdos, 0, sizeof(pd->received_pdos)); val.intval = 0; -- cgit v1.2.3