summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2014-07-07 19:20:35 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-07-08 19:30:36 +0000
commiteaddeb502e78f93c670fe47dc489090867ec838d (patch)
treef11f41af57b3e105c727488c0b76fe1a319b4544
parent3becb4c5c3267507fa6de7e99821783b1187e8d2 (diff)
downloadchrome-ec-eaddeb502e78f93c670fe47dc489090867ec838d.tar.gz
firefly: add VBUS detection
Enable the VBUS detection to be able to re-negociate a PD contract when we are losing power. The VBUS_WAKE GPIO is broken on the current hardware (not triggered when VBUS is 5V), so we fall back on using the ADC on VBUS_SENSE. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=With a Firefly connected to a Zinger,"fault" the power supply to get it to turn off its output. See Firefly detecting the cut-off and re-negotiating voltage. Change-Id: Ia5f0734cbd8f20d84ce170cea191410bb72a87c3 Reviewed-on: https://chromium-review.googlesource.com/206944 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/firefly/usb_pd_config.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/board/firefly/usb_pd_config.h b/board/firefly/usb_pd_config.h
index eea9688842..eb23bc830c 100644
--- a/board/firefly/usb_pd_config.h
+++ b/board/firefly/usb_pd_config.h
@@ -107,7 +107,8 @@ static inline int pd_adc_read(int cc)
static inline int pd_snk_is_vbus_provided(void)
{
- return 1;
+ /* VBUS_WAKE is broken (not detecting 5V), use the ADC instead */
+ return adc_read_channel(ADC_CH_VBUS_SENSE) > 4000;
}
/* Standard-current DFP : no-connect voltage is 1.55V */