From 69541025b4fcc2314d7434f7ae07c80a2c099279 Mon Sep 17 00:00:00 2001 From: Li Jun Date: Fri, 28 Jul 2017 16:55:33 +0800 Subject: [PATCH] MLK-16013-29 staging: 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 --- drivers/staging/typec/tcpm.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c index 07241e529828..9ec07ce47373 100644 --- a/drivers/staging/typec/tcpm.c +++ b/drivers/staging/typec/tcpm.c @@ -1423,11 +1423,17 @@ 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; - 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