diff options
author | Alec Berg <alecaberg@chromium.org> | 2014-11-11 15:39:40 -0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-11-14 04:24:29 +0000 |
commit | 8e024350d3c81c7b1b76eac7ce0b419d6039dbb5 (patch) | |
tree | e3af8ce46ef928f5733a2198266af5143f1e4036 /board/zinger | |
parent | aad897775a77319e458be15a4d1d5a80a01359a1 (diff) | |
download | chrome-ec-8e024350d3c81c7b1b76eac7ce0b419d6039dbb5.tar.gz |
pd: add data role swap
Add support for DR_swap, data role swap command.
BUG=chrome-os-partner:33686, chrome-os-partner:28343
BRANCH=samus
TEST=test with samus and zinger. use "pd 1 swap data" command
and verify data role swaps by using twinkie and "pd 1 state".
Change-Id: I410309199cdeecb26847a6bf217523fdfe688cba
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/229192
Diffstat (limited to 'board/zinger')
-rw-r--r-- | board/zinger/usb_pd_policy.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/board/zinger/usb_pd_policy.c b/board/zinger/usb_pd_policy.c index c520a10d5b..be86f26271 100644 --- a/board/zinger/usb_pd_policy.c +++ b/board/zinger/usb_pd_policy.c @@ -146,11 +146,13 @@ static void discharge_voltage(int target_volt) /* ----------------------- USB Power delivery policy ---------------------- */ +#define PDO_FIXED_FLAGS (PDO_FIXED_EXTERNAL | PDO_FIXED_DATA_SWAP) + /* Power Delivery Objects */ const uint32_t pd_src_pdo[] = { - PDO_FIXED(5000, RATED_CURRENT, PDO_FIXED_EXTERNAL), - PDO_FIXED(12000, RATED_CURRENT, PDO_FIXED_EXTERNAL), - PDO_FIXED(20000, RATED_CURRENT, PDO_FIXED_EXTERNAL), + PDO_FIXED(5000, RATED_CURRENT, PDO_FIXED_FLAGS), + PDO_FIXED(12000, RATED_CURRENT, PDO_FIXED_FLAGS), + PDO_FIXED(20000, RATED_CURRENT, PDO_FIXED_FLAGS), }; const int pd_src_pdo_cnt = ARRAY_SIZE(pd_src_pdo); @@ -251,6 +253,17 @@ void pd_power_supply_reset(int port) discharge_voltage(voltages[0].ovp); } +int pd_data_swap(int port, int data_role) +{ + /* Allow data swap if we are a DFP, otherwise don't allow */ + return (data_role == PD_ROLE_DFP) ? 1 : 0; +} + +void pd_execute_data_swap(int port, int data_role) +{ + /* Do nothing */ +} + int pd_board_checks(void) { #ifdef CONFIG_HIBERNATE |