MLK-16013-31 staging: typec: Set to unattached state if souce disconnected
authorLi Jun <jun.li@nxp.com>
Fri, 28 Jul 2017 09:19:13 +0000 (17:19 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:36:21 +0000 (15:36 -0500)
In SNK_HARD_RESET_SINK_ON, if the source disconnected, we should set
state to be unattached state intead of startup sink.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
drivers/staging/typec/tcpm.c

index b2480d8..59f891d 100644 (file)
@@ -2571,7 +2571,10 @@ static void run_state_machine(struct tcpm_port *port)
                 * to PE_SNK_Transition_to_default.
                 */
                tcpm_set_attached_state(port, true);
-               tcpm_set_state(port, SNK_STARTUP, 0);
+               if (tcpm_port_is_disconnected(port))
+                       tcpm_set_state(port, unattached_state(port), 0);
+               else
+                       tcpm_set_state(port, SNK_STARTUP, 0);
                break;
 
        /* Soft_Reset states */