From 6080e37525a87ce6ff5f33a82f48331a8847ca36 Mon Sep 17 00:00:00 2001 From: Li Jun Date: Wed, 9 Jan 2019 12:28:35 +0530 Subject: [PATCH] MLK-16013-29 usb: typec: tcpm: Don't reset message id after soft reset If the power source sent soft reset and the other end accepted, we should not reset the message id as it was already updated by pd_transmit when handling the soft reset. Reviewed-by: Peter Chen Signed-off-by: Li Jun Signed-off-by: Vipul Kumar --- drivers/usb/typec/tcpm.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c index bd4bd2c80ea5..3632b25a8819 100644 --- a/drivers/usb/typec/tcpm.c +++ b/drivers/usb/typec/tcpm.c @@ -1793,12 +1793,18 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port, tcpm_set_state(port, SNK_TRANSITION_SINK, 0); break; case SOFT_RESET_SEND: - port->message_id = 0; port->rx_msgid = -1; - if (port->pwr_role == TYPEC_SOURCE) + /* + * After reset data sent, the msg id is updated + * by pd_transmit(0+1), now the other end gives + * an accept so we can go on with msg id 1. + */ + if (port->pwr_role == TYPEC_SOURCE) { next_state = SRC_SEND_CAPABILITIES; - else + } else { + port->message_id = 0; next_state = SNK_WAIT_CAPABILITIES; + } tcpm_set_state(port, next_state, 0); break; case DR_SWAP_SEND: -- 2.17.1