From 1f55eea80994538350588eb27dce0ee791144e2e Mon Sep 17 00:00:00 2001 From: Alec Berg Date: Fri, 2 Jan 2015 14:12:26 -0800 Subject: [PATCH] pd: On invalid request, send reject and go to SRC_READY When a source gets an invalid request, send reject, but still go to SRC_READY state and keep the old power contract in place. BUG=chrome-os-partner:34987 BRANCH=samus TEST=load onto zinger. on samus add custom code to always send an invalid request. note that zinger still transitions to SRC_READY, samus still transitions to SNK_READY, data swap is still performed, discover identity is still performed, and samus still draws 5V/3A. Change-Id: I1213688f2b205636b3657afb1a4d8f7929bfe7ee Signed-off-by: Alec Berg Reviewed-on: https://chromium-review.googlesource.com/238250 Reviewed-by: Vincent Palatin --- common/usb_pd_protocol.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index dae4ae789f..124b9f9bc2 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -926,6 +926,8 @@ static void handle_data_request(int port, uint16_t head, } /* the message was incorrect or cannot be satisfied */ send_control(port, PD_CTRL_REJECT); + /* keep last contract in place (whether implicit or explicit) */ + set_state(port, PD_STATE_SRC_READY); break; case PD_DATA_BIST: /* currently only support sending bist carrier mode 2 */ @@ -1714,6 +1716,7 @@ void pd_task(void) * discover identity when we enter SRC_READY */ pd[port].flags |= PD_FLAGS_DATA_SWAPPED; + pd[port].flags |= PD_FLAGS_NEW_CONTRACT; /* reset various counters */ caps_count = 0; src_connected = 0;