MLK-16013-35 staging: typec: Move to SRC_ATTACHED if condition is met
authorLi Jun <jun.li@nxp.com>
Fri, 28 Jul 2017 10:01:06 +0000 (18:01 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:36:21 +0000 (15:36 -0500)
If the other end is trying to be a sink and not driving vbus, we should
move to SRC_ATTACHED directly.

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

index 3a70f70..aa2206f 100644 (file)
@@ -2904,11 +2904,8 @@ static void _tcpm_cc_change(struct tcpm_port *port, enum typec_cc_status cc1,
        case SRC_TRYWAIT:
                /* Hand over to state machine if needed */
                if (!port->vbus_present && tcpm_port_is_source(port))
-                       new_state = SRC_ATTACHED;
-               else
-                       new_state = SRC_TRYWAIT_UNATTACHED;
-
-               if (new_state != port->delayed_state)
+                       tcpm_set_state(port, SRC_ATTACHED, 0);
+               else if (port->delayed_state != SRC_TRYWAIT_UNATTACHED)
                        tcpm_set_state(port, SRC_TRYWAIT, 0);
                break;
        case SNK_TRY_WAIT: