summaryrefslogtreecommitdiff
path: root/board/zinger
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2014-11-19 10:59:31 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-11-21 02:44:56 +0000
commit911e21ccc12617c36caa1bb0a5c35ee7902f38c4 (patch)
tree9b82a0d58859b518d2e1390512c449c0bc2425e5 /board/zinger
parent905fc1cf6f469581154fe7ed3bc29cf766be1241 (diff)
downloadchrome-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/zinger')
-rw-r--r--board/zinger/usb_pd_policy.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/board/zinger/usb_pd_policy.c b/board/zinger/usb_pd_policy.c
index 2c609eca2b..de8104fea5 100644
--- a/board/zinger/usb_pd_policy.c
+++ b/board/zinger/usb_pd_policy.c
@@ -180,7 +180,7 @@ static int last_volt_idx;
/* output current measurement */
int vbus_amp;
-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;
@@ -203,10 +203,15 @@ int pd_request_voltage(uint32_t rdo)
if (max_ma > pdo_ma)
return EC_ERROR_INVAL; /* too much max current */
- debug_printf("Switch to %d V %d mA (for %d/%d mA)\n",
+ 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_SUCCESS;
+}
+void pd_transition_voltage(int idx)
+{
if (idx - 1 < volt_idx) { /* down voltage transition */
/* Stop OCP monitoring */
adc_disable_watchdog();
@@ -224,8 +229,6 @@ int pd_request_voltage(uint32_t rdo)
last_volt_idx = volt_idx;
volt_idx = idx - 1;
set_output_voltage(voltages[volt_idx].select);
-
- return EC_SUCCESS;
}
int pd_set_power_supply_ready(int port)