staging: typec: tcpm: Consider port_type while determining unattached_state
PATCH 7/11 staging: typec: tcpm: Consider port_type while determining unattached_state
While performing PORT_RESET, upon receiving the cc disconnect signal from the underlaying tcpc device, TCPM transitions into unattached state. Consider, the current type of port while determining the unattached state.
In the below logs, although the port_type was set to sink, TCPM transitioned into SRC_UNATTACHED.
[ 762.290654] state change SRC_READY -> PORT_RESET [ 762.324531] Setting voltage/current limit 0 mV 0 mA [ 762.327912] polarity 0 [ 762.334864] cc:=0 [ 762.347193] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms [ 762.347200] VBUS off [ 762.347203] CC1: 2 -> 0, CC2: 0 -> 0 [state PORT_RESET, polarity 0, disconnected] [ 762.347206] state change PORT_RESET -> SRC_UNATTACHED
Signed-off-by Badhri Jagan Sridharan <[email protected]>
--- drivers/staging/typec/tcpm.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/staging/typec/tcpm.c +9 -3
@@ -2117,10 +2117,16 @@ static inline enum tcpm_state ready_state(struct tcpm_port *port)static inline enum tcpm_state unattached_state (struct tcpm_port *port) { -if (port->pwr_role ==TYPEC_SOURCE ) +if (port->port_type ==TYPEC_PORT_DRP ) { +if (port->pwr_role ==TYPEC_SOURCE ) +return SRC_UNATTACHED ; +else +return SNK_UNATTACHED ; + }else if (port->port_type ==TYPEC_PORT_DFP ) {return SRC_UNATTACHED ; -else -return SNK_UNATTACHED ; + } + +return SNK_UNATTACHED ; }static void tcpm_check_send_discover (struct tcpm_port *port)
Signature · 1 line
2.14.1.342.g6490525c54-goog
Quoted 3 lines · Badhri Jagan Sridharan
While performing
PORT_RESET, upon receiving the cc disconnect signal from the underlaying tcpc device, TCPM transitions into unattached state. Consider, the current type of port while determining
stray ,; not really worth a resend.
Quoted 14 lines
the unattached state.
In the below logs, although the
port_typewas set to sink, TCPM transitioned intoSRC_UNATTACHED.[ 762.290654] state change SRC_READY -> PORT_RESET [ 762.324531] Setting voltage/current limit 0 mV 0 mA [ 762.327912] polarity 0 [ 762.334864] cc:=0 [ 762.347193] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms [ 762.347200] VBUS off [ 762.347203] CC1: 2 -> 0, CC2: 0 -> 0 [state PORT_RESET, polarity 0, disconnected] [ 762.347206] state change PORT_RESET -> SRC_UNATTACHED
Quoted 1 line
Signed-off-by Badhri Jagan Sridharan <[email protected]>
Reviewed-by Guenter Roeck <[email protected]>
Quoted 31 lines
--- drivers/staging/typec/tcpm.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)drivers/staging/typec/tcpm.c +9
-3@@ -2117,10 +2117,16 @@ static inline enum tcpm_state ready_state(struct tcpm_port *port)static inline enum tcpm_state unattached_state (struct tcpm_port *port) { -if (port->pwr_role ==TYPEC_SOURCE ) +if (port->port_type ==TYPEC_PORT_DRP ) { +if (port->pwr_role ==TYPEC_SOURCE ) +return SRC_UNATTACHED ; +else +return SNK_UNATTACHED ; + }else if (port->port_type ==TYPEC_PORT_DFP ) {return SRC_UNATTACHED ; -else -return SNK_UNATTACHED ; + } + +return SNK_UNATTACHED ; }static void tcpm_check_send_discover (struct tcpm_port *port)Signature · 1 line
2.14.1.342.g6490525c54-goog