diff options
author | Scott <scollyer@chromium.org> | 2015-04-22 14:51:58 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-05-01 03:44:15 +0000 |
commit | 62080646fe4312de930e4c4d766106438eae5efc (patch) | |
tree | e8a2f41b7ad652f7c7d13e97fb92783dd8c012de /board/samus_pd | |
parent | bec640fad5741f5194a1920486a0f92aaf60b184 (diff) | |
download | chrome-ec-62080646fe4312de930e4c4d766106438eae5efc.tar.gz |
pd: Allow for setting USB mux when swapping into DFP role
- Added config option CONFIG_USBC_SS_MUX_DFP_ONLY
- If this options is enabled, then the mux is set to
TYPEC_USB_MUX only is data role is DFP.
- If this option is not enabled, the mux is set for
both UFP and DFP (i.e. RYU)
BUG=chrome-os-partner:39059
TEST=Manual samus to plankton, switching between source and sink modes.
Forced data role swap via ec console command.
BRANCH=Samus
Change-Id: Ibc2fb0ad42d0fe415d3338d38da94ad4b041513b
Signed-off-by: Scott Collyer <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/266916
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'board/samus_pd')
-rw-r--r-- | board/samus_pd/board.c | 22 | ||||
-rw-r--r-- | board/samus_pd/board.h | 4 | ||||
-rw-r--r-- | board/samus_pd/usb_pd_policy.c | 3 |
3 files changed, 16 insertions, 13 deletions
diff --git a/board/samus_pd/board.c b/board/samus_pd/board.c index 14c407f8df..13ccc90d37 100644 --- a/board/samus_pd/board.c +++ b/board/samus_pd/board.c @@ -157,14 +157,6 @@ void vbus1_evt(enum gpio_signal signal) task_wake(TASK_ID_PD_C1); } -void set_usb_switches(int port, int open) -{ - mutex_lock(&usb_switch_lock[port]); - usb_switch_state[port] = open; - pi3usb9281_set_switches(port, open); - mutex_unlock(&usb_switch_lock[port]); -} - /* Wait after a charger is detected to debounce pin contact order */ #define USB_CHG_DEBOUNCE_DELAY_MS 1000 /* @@ -558,6 +550,16 @@ const struct usb_port_mux usb_muxes[] = { }; BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == PD_PORT_COUNT); + +static void board_set_usb_switches(int port, int open) +{ + + mutex_lock(&usb_switch_lock[port]); + usb_switch_state[port] = open; + pi3usb9281_set_switches(port, open); + mutex_unlock(&usb_switch_lock[port]); +} + void board_set_usb_mux(int port, enum typec_mux mux, int polarity) { const struct usb_port_mux *usb_mux = usb_muxes + port; @@ -570,6 +572,10 @@ void board_set_usb_mux(int port, enum typec_mux mux, int polarity) gpio_set_level(usb_mux->ss1_dp_mode, 1); gpio_set_level(usb_mux->ss2_dp_mode, 1); + if ((mux == TYPEC_MUX_NONE) || (mux == TYPEC_MUX_USB)) + /* Set D+/D- switch to appropriate level */ + board_set_usb_switches(port, mux == TYPEC_MUX_NONE); + if (mux == TYPEC_MUX_NONE) /* everything is already disabled, we can return */ return; diff --git a/board/samus_pd/board.h b/board/samus_pd/board.h index 877e12798f..ea5a7ef290 100644 --- a/board/samus_pd/board.h +++ b/board/samus_pd/board.h @@ -59,6 +59,7 @@ #define CONFIG_USB_SWITCH_PI3USB9281 #undef CONFIG_USB_SWITCH_PI3USB9281_MUX_GPIO #define CONFIG_USB_SWITCH_PI3USB9281_MUX_GPIO GPIO_USB_C_BC12_SEL +#define CONFIG_USBC_SS_MUX_DFP_ONLY #define CONFIG_USBC_SS_MUX #define CONFIG_USBC_VCONN #define CONFIG_USBC_VCONN_SWAP @@ -138,9 +139,6 @@ int board_get_battery_soc(void); /* Send host event to AP */ void pd_send_host_event(int mask); -/* Update the state of the USB data switches */ -void set_usb_switches(int port, int open); - #endif /* !__ASSEMBLER__ */ #endif /* __BOARD_H */ diff --git a/board/samus_pd/usb_pd_policy.c b/board/samus_pd/usb_pd_policy.c index 3db584fbe5..431c281b1e 100644 --- a/board/samus_pd/usb_pd_policy.c +++ b/board/samus_pd/usb_pd_policy.c @@ -159,8 +159,7 @@ int pd_check_vconn_swap(int port) void pd_execute_data_swap(int port, int data_role) { - /* Open USB switches when taking UFP role */ - set_usb_switches(port, (data_role == PD_ROLE_UFP)); + } void pd_check_pr_role(int port, int pr_role, int flags) |