OSDN Git Service

Merge "usb: pd: Re-check for disconnect after PR swap"
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / drivers / usb / pd / policy_engine.c
index 7d893c5..757ab00 100644 (file)
@@ -723,6 +723,15 @@ static void usbpd_set_state(struct usbpd *pd, enum usbpd_state next_state)
                break;
 
        /* Source states */
+       case PE_SRC_DISABLED:
+               /* are we still connected? */
+               if (pd->typec_mode == POWER_SUPPLY_TYPEC_NONE) {
+                       pd->current_pr = PR_NONE;
+                       kick_sm(pd, 0);
+               }
+
+               break;
+
        case PE_SRC_STARTUP:
                if (pd->current_dr == DR_NONE) {
                        pd->current_dr = DR_DFP;
@@ -853,6 +862,10 @@ static void usbpd_set_state(struct usbpd *pd, enum usbpd_state next_state)
 
        case PE_SRC_HARD_RESET:
        case PE_SNK_HARD_RESET:
+               /* are we still connected? */
+               if (pd->typec_mode == POWER_SUPPLY_TYPEC_NONE)
+                       pd->current_pr = PR_NONE;
+
                /* hard reset may sleep; handle it in the workqueue */
                kick_sm(pd, 0);
                break;