diff options
Diffstat (limited to 'board/zinger')
-rw-r--r-- | board/zinger/usb_pd_policy.c | 25 |
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; } |