summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaveh Jalali <caveh@chromium.org>2022-09-21 18:36:14 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-10-11 23:26:45 +0000
commit4f3b9e49ebe3e0b2581941ca42ea22afe230e36c (patch)
tree6eb62822321189c44a514c0ea2ea59c781737c94
parente2ee6117a4d1b17437e3cae5cc588a55514a1a36 (diff)
downloadchrome-ec-4f3b9e49ebe3e0b2581941ca42ea22afe230e36c.tar.gz
banshee: Switch to usb_mux idle API
We now have an API for putting muxes in idle mode which can be used instead of board specific code, so switch to it. BRANCH=none BUG=b:245753005 TEST='make buildall' passes Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: I00d7d2b26d736e9615fa562a786a9271f314d7d4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3914991 Reviewed-by: Boris Mittelberg <bmbm@google.com>
-rw-r--r--board/banshee/board.c25
-rw-r--r--board/banshee/usbc_config.c11
2 files changed, 11 insertions, 25 deletions
diff --git a/board/banshee/board.c b/board/banshee/board.c
index 611686f88d..73363e8935 100644
--- a/board/banshee/board.c
+++ b/board/banshee/board.c
@@ -16,7 +16,6 @@
#include "hooks.h"
#include "driver/als_tcs3400.h"
#include "driver/charger/isl9241.h"
-#include "driver/retimer/bb_retimer.h"
#include "fw_config.h"
#include "hooks.h"
#include "keyboard_customization.h"
@@ -36,39 +35,15 @@
#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
-/*
- * USBA card connect to chromebook the USB_3_CONNECTION
- * bit would be enable.
- * It will increase BBR power consumption, so clear
- * USB3_Connection bit in S0ix and enable when return S0.
- */
-void set_bb_retimer_usb3_state(bool enable)
-{
- mux_state_t mux_state = 0;
-
- for (int i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) {
- const struct usb_mux *mux = usb_muxes[i].mux;
-
- mux_state = usb_mux_get(i);
-
- if ((mux_state & USB_PD_MUX_USB_ENABLED)) {
- bb_retimer_set_usb3(mux, enable);
- }
- }
-}
-
/* Called on AP S3 -> S0 transition */
static void board_chipset_resume(void)
{
- if (chipset_in_state(CHIPSET_STATE_ON))
- set_bb_retimer_usb3_state(true);
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT);
/* Called on AP S0 -> S3 transition */
static void board_chipset_suspend(void)
{
- set_bb_retimer_usb3_state(false);
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
diff --git a/board/banshee/usbc_config.c b/board/banshee/usbc_config.c
index 7840b865ab..2b9d28f0e1 100644
--- a/board/banshee/usbc_config.c
+++ b/board/banshee/usbc_config.c
@@ -150,6 +150,14 @@ const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
.mux = &(const struct usb_mux) {
.usb_port = USBC_PORT_C0,
+ /*
+ * When a USB-A card is connected to the
+ * chromebook, the USB_3_CONNECTION bit will be
+ * enabled. This increases BBR power
+ * consumption, so clear the USB3_CONNECTION bit
+ * in S0ix and re-enable when returning to S0.
+ */
+ .flags = USB_MUX_FLAG_CAN_IDLE,
.driver = &bb_usb_retimer,
.hpd_update = bb_retimer_hpd_update,
.i2c_port = I2C_PORT_USB_C0_C1_MUX,
@@ -160,6 +168,7 @@ const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C1] = {
.mux = &(const struct usb_mux) {
.usb_port = USBC_PORT_C1,
+ .flags = USB_MUX_FLAG_CAN_IDLE,
.driver = &bb_usb_retimer,
.hpd_update = bb_retimer_hpd_update,
.i2c_port = I2C_PORT_USB_C0_C1_MUX,
@@ -170,6 +179,7 @@ const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C2] = {
.mux = &(const struct usb_mux) {
.usb_port = USBC_PORT_C2,
+ .flags = USB_MUX_FLAG_CAN_IDLE,
.driver = &bb_usb_retimer,
.hpd_update = bb_retimer_hpd_update,
.i2c_port = I2C_PORT_USB_C2_C3_MUX,
@@ -180,6 +190,7 @@ const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C3] = {
.mux = &(const struct usb_mux) {
.usb_port = USBC_PORT_C3,
+ .flags = USB_MUX_FLAG_CAN_IDLE,
.driver = &bb_usb_retimer,
.hpd_update = bb_retimer_hpd_update,
.i2c_port = I2C_PORT_USB_C2_C3_MUX,