diff options
author | Alec Berg <alecaberg@chromium.org> | 2015-10-13 13:51:26 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-10-13 18:44:01 -0700 |
commit | 89067fc458d8533a74e45a1285091dda7a96669e (patch) | |
tree | 7736222d644ef1ae412b4d9cd9c3e91e72834263 /board/pdeval-stm32f072/usb_pd_policy.c | |
parent | 6b498ef31825ae4da01b26644c232726fbcf3a75 (diff) | |
download | chrome-ec-89067fc458d8533a74e45a1285091dda7a96669e.tar.gz |
cleanup: pd: remove duplicate code for checking request msg
Remove duplicate code for checking request message, but keep
a board specific check of the request message for custom checks
needed on zinger and plankton.
BUG=chrome-os-partner:42490
BRANCH=none
TEST=make -j buildall. run on samus and connect a hoho, make
sure we successfully negotiate a contract.
Change-Id: I7398953a158d340e3e113f5a816b55445a857711
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/305374
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board/pdeval-stm32f072/usb_pd_policy.c')
-rw-r--r-- | board/pdeval-stm32f072/usb_pd_policy.c | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/board/pdeval-stm32f072/usb_pd_policy.c b/board/pdeval-stm32f072/usb_pd_policy.c index 35762bde39..b7c069c555 100644 --- a/board/pdeval-stm32f072/usb_pd_policy.c +++ b/board/pdeval-stm32f072/usb_pd_policy.c @@ -39,32 +39,6 @@ int pd_is_valid_input_voltage(int mv) return 1; } -int pd_check_requested_voltage(uint32_t rdo) -{ - int max_ma = rdo & 0x3FF; - int op_ma = (rdo >> 10) & 0x3FF; - int idx = rdo >> 28; - uint32_t pdo; - uint32_t pdo_ma; - - if (!idx || idx > pd_src_pdo_cnt) - return EC_ERROR_INVAL; /* Invalid index */ - - /* check current ... */ - pdo = pd_src_pdo[idx - 1]; - pdo_ma = (pdo & 0x3ff); - if (op_ma > pdo_ma) - return EC_ERROR_INVAL; /* too much op current */ - if (max_ma > pdo_ma) - return EC_ERROR_INVAL; /* too much max current */ - - CPRINTF("Requested %d V %d mA (for %d/%d mA)\n", - ((pdo >> 10) & 0x3ff) * 50, (pdo & 0x3ff) * 10, - ((rdo >> 10) & 0x3ff) * 10, (rdo & 0x3ff) * 10); - - return EC_SUCCESS; -} - void pd_transition_voltage(int idx) { /* No-operation: we are always 5V */ |