diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2014-11-19 10:59:31 -0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-11-21 02:44:56 +0000 |
commit | 911e21ccc12617c36caa1bb0a5c35ee7902f38c4 (patch) | |
tree | 9b82a0d58859b518d2e1390512c449c0bc2425e5 /board/plankton/usb_pd_policy.c | |
parent | 905fc1cf6f469581154fe7ed3bc29cf766be1241 (diff) | |
download | chrome-ec-911e21ccc12617c36caa1bb0a5c35ee7902f38c4.tar.gz |
pd: wait tSnkTransition after ACCEPT to change voltage
Ensure that the PD source changes the output voltage after
tSnkTransition delay after having sent the ACCEPT message
(rather than before).
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=samus
BUG=chrome-os-partner:33684
TEST=connect Zinger to a PD power sink and monitor VBUS and CC while
doing a 20V to 5V transition.
Change-Id: If86f59eec67630491f4e8dc13a52015ac2de918a
Reviewed-on: https://chromium-review.googlesource.com/230805
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board/plankton/usb_pd_policy.c')
-rw-r--r-- | board/plankton/usb_pd_policy.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/board/plankton/usb_pd_policy.c b/board/plankton/usb_pd_policy.c index b2fb708888..ad691f6187 100644 --- a/board/plankton/usb_pd_policy.c +++ b/board/plankton/usb_pd_policy.c @@ -117,8 +117,7 @@ void pd_set_max_voltage(unsigned mv) select_mv = mv; } -int requested_voltage_idx; -int pd_request_voltage(uint32_t rdo) +int pd_check_requested_voltage(uint32_t rdo) { int op_ma = rdo & 0x3FF; int max_ma = (rdo >> 10) & 0x3FF; @@ -137,21 +136,23 @@ int pd_request_voltage(uint32_t rdo) if (max_ma > pdo_ma) return EC_ERROR_INVAL; /* too much max current */ - CPRINTF("Switch to %d V %d mA (for %d/%d mA)\n", + 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); - requested_voltage_idx = idx; - return EC_SUCCESS; } +void pd_transition_voltage(int idx) +{ + gpio_set_level(GPIO_USBC_VSEL_0, idx >= 2); + gpio_set_level(GPIO_USBC_VSEL_1, idx >= 3); +} + int pd_set_power_supply_ready(int port) { /* Output the correct voltage */ gpio_set_level(GPIO_VBUS_CHARGER_EN, 1); - gpio_set_level(GPIO_USBC_VSEL_0, requested_voltage_idx >= 2); - gpio_set_level(GPIO_USBC_VSEL_1, requested_voltage_idx >= 3); return EC_SUCCESS; } @@ -159,7 +160,6 @@ int pd_set_power_supply_ready(int port) void pd_power_supply_reset(int port) { /* Kill VBUS */ - requested_voltage_idx = 0; gpio_set_level(GPIO_VBUS_CHARGER_EN, 0); gpio_set_level(GPIO_USBC_VSEL_0, 0); gpio_set_level(GPIO_USBC_VSEL_1, 0); |