summaryrefslogtreecommitdiff
path: root/board/primus
diff options
context:
space:
mode:
authorCaveh Jalali <caveh@chromium.org>2021-06-10 01:56:46 -0700
committerCommit Bot <commit-bot@chromium.org>2021-06-12 02:26:00 +0000
commit077bb92c4a41db95d1dd1f824c19f87ac0b1d715 (patch)
tree4d2c32cfdef977c991cc96ff15ce0e4d881e11c2 /board/primus
parentfd2276ad5b6403338df5dd096195cb5ceadaeae6 (diff)
downloadchrome-ec-077bb92c4a41db95d1dd1f824c19f87ac0b1d715.tar.gz
bb_retimer: Return status from bb_retimer_power_handle()
This allows the implementation of bb_retimer_power_handle() to return a status value indicating whether the request was successful. The default implementation simply controls a GPIO and is expected to succeed unconditionally. More complex implementations may run into failure cases that leave the BB unreachable. When this happens, device initialization returns an error so the caller can take mitigating action. USB MUX operations tend to be called from timing sensitive code paths in the TCPM, so careful error handling helps avoid cascading problems like PD negotiation failures. BRANCH=none BUG=b:181743576,b:188826559 TEST=buildall passes, PD still works on brya Change-Id: If79078be26e47d758e2cd6cc385ff2b34fecff63 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2954198 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Boris Mittelberg <bmbm@google.com>
Diffstat (limited to 'board/primus')
-rw-r--r--board/primus/usbc_config.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/board/primus/usbc_config.c b/board/primus/usbc_config.c
index 5fa69121db..f6770c8f27 100644
--- a/board/primus/usbc_config.c
+++ b/board/primus/usbc_config.c
@@ -187,7 +187,7 @@ void config_usb_db_type(void)
CPRINTS("Configured USB DB type number is %d", db_type);
}
-__override void bb_retimer_power_handle(const struct usb_mux *me, int on_off)
+__override int bb_retimer_power_handle(const struct usb_mux *me, int on_off)
{
enum ioex_signal rst_signal;
@@ -199,7 +199,7 @@ __override void bb_retimer_power_handle(const struct usb_mux *me, int on_off)
} else if (me->usb_port == USBC_PORT_C2) {
rst_signal = IOEX_USB_C2_RT_RST_ODL;
} else {
- return;
+ return EC_ERROR_INVAL;
}
/*
@@ -224,6 +224,7 @@ __override void bb_retimer_power_handle(const struct usb_mux *me, int on_off)
ioex_set_level(rst_signal, 0);
msleep(1);
}
+ return EC_SUCCESS;
}
void board_reset_pd_mcu(void)