summaryrefslogtreecommitdiff
path: root/board/zinger
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-10-13 13:51:26 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-10-13 18:44:01 -0700
commit89067fc458d8533a74e45a1285091dda7a96669e (patch)
tree7736222d644ef1ae412b4d9cd9c3e91e72834263 /board/zinger
parent6b498ef31825ae4da01b26644c232726fbcf3a75 (diff)
downloadchrome-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/zinger')
-rw-r--r--board/zinger/usb_pd_policy.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/board/zinger/usb_pd_policy.c b/board/zinger/usb_pd_policy.c
index 2f5b6c3e99..477060d17d 100644
--- a/board/zinger/usb_pd_policy.c
+++ b/board/zinger/usb_pd_policy.c
@@ -198,33 +198,18 @@ static int discharge_volt_idx;
/* output current measurement */
int vbus_amp;
-int pd_check_requested_voltage(uint32_t rdo)
+int pd_board_check_request(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;
+ int idx = RDO_POS(rdo);
/* fault condition or output disabled: reject transitions */
if (fault != FAULT_OK || !output_is_enabled())
return EC_ERROR_INVAL;
+ /* Invalid index */
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 */
-
- debug_printf("Requested %d V %d mA (for %d/%d mA)\n",
- ((pdo >> 10) & 0x3ff) * 50, (pdo & 0x3ff) * 10,
- ((rdo >> 10) & 0x3ff) * 10, (rdo & 0x3ff) * 10);
- /* Accept the requested voltage */
+ return EC_ERROR_INVAL;
+
return EC_SUCCESS;
}