MLK-22406 usb: typec: tcpm: create parter for source only port
authorLi Jun <jun.li@nxp.com>
Wed, 7 Aug 2019 07:43:08 +0000 (15:43 +0800)
committerLi Jun <jun.li@nxp.com>
Fri, 9 Aug 2019 07:53:47 +0000 (15:53 +0800)
After the hack of moving forward tcpm state machine for source
only port but with usb data device mode support, we need further
to create its partner, so app(like android) can use it to judge if
the connection exists or not.

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

index 5645e5e..f5f44b6 100644 (file)
@@ -3227,9 +3227,10 @@ static void run_state_machine(struct tcpm_port *port)
                if (ret < 0)
                        tcpm_set_state(port, SNK_UNATTACHED, 0);
                else if (port->port_type == TYPEC_PORT_SRC &&
-                        port->typec_caps.data == TYPEC_PORT_DRD)
+                        port->typec_caps.data == TYPEC_PORT_DRD) {
+                       tcpm_typec_connect(port);
                        tcpm_log(port, "Keep at SNK_ATTACHED for USB data.");
-               else
+               else
                        tcpm_set_state(port, SNK_STARTUP, 0);
                break;
        case SNK_STARTUP: