summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-04-03 18:16:53 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-04-07 03:41:09 +0000
commit30572cb5063aff322138de9466b11044b6f9a178 (patch)
treef2e36e2f9b831ebfff557ebc635b5d0bc86cdd9a /include
parent2d2d1e15cfd3a91c6d624d380ce44945855d0c83 (diff)
downloadchrome-ec-30572cb5063aff322138de9466b11044b6f9a178.tar.gz
samus: create USB PD device whitelist for allowing charging
Create a USB PD device whitelist for allowing charging by default from dual-role devices that don't set the externally powered bit. BUG=chrome-os-partner:38785 BRANCH=samus TEST=modify zinger and modify VID and PID to match white-listed entry. also modify zinger to remove externally powered bit and set dual-role power bits so that we treat as a dual-role device by default. when you plug in this modified zinger into samus, it still will not charge because the VID and PID are obtained after deciding to treat it as dual-role, but when you issue soft reset "pd 1 soft", it starts charging. the white-listed device will always ask for a power swap if it is a sink, so we will always get source cap after learning the VID/PID, which should correctly trigger changing the device to be treated as a dedicated charger. Change-Id: Ibe7ec57f842a0b9bfb02447baf5b3327217a9516 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/264015 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/usb_pd.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/usb_pd.h b/include/usb_pd.h
index ebed5c3554..75b0967406 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -573,6 +573,9 @@ struct pd_policy {
/* USB Vendor ID assigned to Google Inc. */
#define USB_VID_GOOGLE 0x18d1
+/* Other Vendor IDs */
+#define USB_VID_APPLE 0x05ac
+
/* Timeout for message receive in microseconds */
#define USB_PD_RX_TMOUT_US 1800
@@ -922,6 +925,17 @@ void pd_check_pr_role(int port, int pr_role, int flags);
void pd_check_dr_role(int port, int dr_role, int flags);
/**
+ * Check if we should charge from this device. This is
+ * basically a white-list for chargers that are dual-role,
+ * don't set the externally powered bit, but we should charge
+ * from by default.
+ *
+ * @param vid Port partner Vendor ID
+ * @param pid Port partner Product ID
+ */
+int pd_charge_from_device(uint16_t vid, uint16_t pid);
+
+/**
* Execute data swap.
*
* @param port USB-C port number
@@ -1004,6 +1018,14 @@ void pd_dfp_pe_init(int port);
uint16_t pd_get_identity_vid(int port);
/**
+ * Return the PID of the USB PD accessory connected to a specified port
+ *
+ * @param port USB-C port number
+ * @return the USB Product Identifier or 0 if it doesn't exist
+ */
+uint16_t pd_get_identity_pid(int port);
+
+/**
* Store Device ID & RW hash of device
*
* @param port USB-C port number