diff options
author | Scott <scollyer@chromium.org> | 2015-07-30 15:10:11 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-08-21 08:10:03 +0000 |
commit | d862dd05982198a2f5d450820a02172e0ba6396b (patch) | |
tree | c9c96e5ea91537a3aae99370952eb2a13156a1af /include | |
parent | 646760bb20fde94683d3be2fa4b046d47933d85f (diff) | |
download | chrome-ec-d862dd05982198a2f5d450820a02172e0ba6396b.tar.gz |
pd: Enable detection of VBUS via the TCPM/TCPCI interface
Modified TCPC layer to utilize the Power_Status and Power_Status_Mask
registers. VBUS status is stored in Power_Status and when a change
is detected, it's communicated to the TCPM via the ALERT# line.
BUG=chrome-os-partner:43440
BRANCH=none
TEST=Tested the feature on Glados and Oak connecting to both Ziger
and Samus. Verfied that VBUS status is communicated via the TCPCI and
that PD contracts are established without using the VBUS_WAKE GPIO
lines on Glados and Oak.
Change-Id: Ie5aa32eecc887f3cb00880a285f1e710b7064384
Signed-off-by: Scott Collyer <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/289931
Reviewed-by: Rong Chang <rongchang@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Rong Chang <rongchang@chromium.org>
Tested-by: Rong Chang <rongchang@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/config.h | 7 | ||||
-rw-r--r-- | include/usb_pd_tcpc.h | 8 | ||||
-rw-r--r-- | include/usb_pd_tcpm.h | 19 |
3 files changed, 34 insertions, 0 deletions
diff --git a/include/config.h b/include/config.h index 7172f54697..a7555c4acc 100644 --- a/include/config.h +++ b/include/config.h @@ -1628,6 +1628,13 @@ #undef CONFIG_USB_PD_TCPM_STUB #undef CONFIG_USB_PD_TCPM_TCPCI +/* + * Use this option if the TCPC port controller is on a seperate chip from + * the TCPM layer and if VUBS detect GPIO is not available on the TCPM + * mcu. + */ +#undef CONFIG_USB_PD_TCPM_VBUS + /* Define the type-c port controller I2C base address. */ #undef CONFIG_TCPC_I2C_BASE_ADDR diff --git a/include/usb_pd_tcpc.h b/include/usb_pd_tcpc.h index 64d68f1f3a..a640714c4f 100644 --- a/include/usb_pd_tcpc.h +++ b/include/usb_pd_tcpc.h @@ -35,4 +35,12 @@ void tcpc_i2c_process(int read, int port, int len, uint8_t *payload, void (*send_response)(int)); +/** + * Handle VBUS wake interrupts + * + * @param signal The VBUS wake interrupt signal + */ +void pd_vbus_evt_p0(enum gpio_signal signal); +void pd_vbus_evt_p1(enum gpio_signal signal); + #endif /* __CROS_EC_USB_PD_TCPC_H */ diff --git a/include/usb_pd_tcpm.h b/include/usb_pd_tcpm.h index bd4803bf03..8d446bcae8 100644 --- a/include/usb_pd_tcpm.h +++ b/include/usb_pd_tcpm.h @@ -113,6 +113,15 @@ int tcpm_alert_mask_set(int port, uint16_t mask); int tcpm_get_cc(int port, int *cc1, int *cc2); /** + * Read VBUS + * + * @param port Type-C port number + * + * @return 0 => VBUS not detected, 1 => VBUS detected + */ +int tcpm_get_vbus_level(int port); + +/** * Set the CC pull resistor. This sets our role as either source or sink. * * @param port Type-C port number @@ -133,6 +142,16 @@ int tcpm_set_cc(int port, int pull); int tcpm_set_polarity(int port, int polarity); /** + * Set TCPC Power Status Mask + * + * @param port Type-C port number + * @param mask => new mask value + * + * @return EC_SUCCESS or error + */ +int tcpm_set_power_status_mask(int port, uint8_t mask); + +/** * Set Vconn. * * @param port Type-C port number |