From 3ab9b932311b596909a344a6a56742799c3e013e Mon Sep 17 00:00:00 2001 From: Pratham Pratap Date: Wed, 12 Aug 2020 16:14:22 +0530 Subject: [PATCH] usb: pd: Reset pd protocol during cable disconnect Consider a case where the device has initiated dr_swap to the connected PD charger to support type-C headset and charging concurrently. If the charger got disconnected at the same time when the driver was trying to change the data role then send_dr_swap flag will be set during disconnect. Upon next connect, since the flag is already set, the driver will not set the current_pr to sink and the PD state machine will not kick in causing the charger to be detected as DCP. Fix this by resetting the pd protocol during cable disconnect which will clear the flags. Change-Id: I282986b9d6df37a74d65eb80c1ebc5510add7fe9 Signed-off-by: Pratham Pratap --- drivers/usb/pd/policy_engine.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/pd/policy_engine.c b/drivers/usb/pd/policy_engine.c index b3d799dfab5b..a2522db7825e 100644 --- a/drivers/usb/pd/policy_engine.c +++ b/drivers/usb/pd/policy_engine.c @@ -3509,6 +3509,7 @@ static void handle_disconnect(struct usbpd *pd) pd->forced_pr = QTI_POWER_SUPPLY_TYPEC_PR_NONE; pd->current_state = PE_UNKNOWN; + pd_reset_protocol(pd); kobject_uevent(&pd->dev.kobj, KOBJ_CHANGE); typec_unregister_partner(pd->partner);