summaryrefslogtreecommitdiff
path: root/driver/ppc/sn5s330.h
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2018-01-25 16:13:22 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-01-31 22:38:56 -0800
commit11bda19561bd4d5dcbc6419e08ee94c05e9ae862 (patch)
treedbde4b8307382e30986031f809b8684aeb5ba757 /driver/ppc/sn5s330.h
parenteb60e291e8c7c178e0814c5d2a5cbe6c207182d2 (diff)
downloadchrome-ec-11bda19561bd4d5dcbc6419e08ee94c05e9ae862.tar.gz
sn5s330: Enable VBUS interrupts
If the sn5s330 PPC is being used to detect VBUS presence (CONFIG_USB_PD_VBUS_DETECT_PPC), then enable interrupts and call usb_charger_vbus_change when VBUS_GOOD changes. BUG=b:72007153,b:72007492 BRANCH=none TEST=Connect 3A and 1A USB-A chargers to each of Grunt's USB-C ports, check that BC1.2 detection is working: With 1A: > chgsup port=0/1, type=7, cur=500mA, vtg=5000mV, lsm=1 With 3A: > chgsup port=0/1, type=7, cur=2400mA, vtg=5000mV, lsm=1 TEST=Boot Grunt to OS, then connect USB2 mouse or USB3 flash drive to each of Grunt's USB-C ports. Devices do not work due to b:71772180, but gpioget shows EC is setting USB_C0/1_BC12_VBUS_ON_L correctly. Change-Id: Iffc352105a321997adb364b9fbb8bafef248c224 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/887938 Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'driver/ppc/sn5s330.h')
-rw-r--r--driver/ppc/sn5s330.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/driver/ppc/sn5s330.h b/driver/ppc/sn5s330.h
index 18f1929c0f..e8850faf57 100644
--- a/driver/ppc/sn5s330.h
+++ b/driver/ppc/sn5s330.h
@@ -120,13 +120,23 @@ enum sn5s330_pp_idx {
*/
#define SN5S330_ILIM_PP1_MASK (1 << 4)
+/*
+ * INT_MASK_RISE/FALL_EDGE_3
+ *
+ * The VBUS_GOOD bit indicates VBUS has increased beyond a 4.0V threshold.
+ * For rising edge registers, this indicates VBUS has risen above 4.0V.
+ * For falling edge registers, this indicates VBUS has fallen below 4.0V.
+ */
+#define SN5S330_VBUS_GOOD_MASK (1 << 0)
+
extern const struct ppc_drv sn5s330_drv;
/**
* Interrupt Handler for the SN5S330.
*
* By default, the only interrupt sources that are unmasked are overcurrent
- * conditions for PP1.
+ * conditions for PP1, and VBUS_GOOD if PPC is being used to detect VBUS
+ * (CONFIG_USB_PD_VBUS_DETECT_PPC).
*
* @param port: The Type-C port which triggered the interrupt.
*/