summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2018-06-07 02:37:19 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-12-08 11:23:21 -0800
commit89e13f198fce934b0f1452255b15f6244dbcabb7 (patch)
treeffbdea99fdf4d6df1d2e4648eabe27d58fbcffa8 /driver
parent7f325f2e91482aee604de71f19f6669762594818 (diff)
downloadchrome-ec-89e13f198fce934b0f1452255b15f6244dbcabb7.tar.gz
cheza: Mux the 1st-plugged UFP port which is not a charger
There are 2 USB-C ports. A user may plug a USB-C to USB-A male cable to one of the ports; then EC should mux the port from USB hub to AP's primary USB controller, which is configured to do USB peripheral mode only. The policy is to mux the first-plugged UFP port to AP, with the following exception: * If the partner port does PD and it advertises the USB communications capable bit unset in the fixed-supply PDO, we believe the partner port is a pure charger. * If the BC1.2 chip detects the partner is not a SDP or CDP , we believe the partner port is not a workstation. Check the design doc at: http://go/cheza-hs-mux BRANCH=none BUG=b:74395451, b:110803836 TEST=Check the following scenario: * Plug charger w/ PD to P0, plug C-to-A to P1, check P1 mux to AP. * Plug charger through hub to P0, plug C-to-A to P1, check P1 mux to AP. * Continue the above case, boot into kernel and check USB peripheral mode. * Plug BC1.2 charger to P0, plug C-to-A to P1, check P1 mux to AP. * Plug charger w/o PD to P0, plug C-to-A to P1, check P0 mux to AP. * Swap P0 and P1 for the above cases and check the results. Change-Id: I4034fa66c0b27cc48d0959bb3f1750690ad5e3f7 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/1105404 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/bc12/pi3usb9281.c2
-rw-r--r--driver/pi3usb9281.h3
2 files changed, 4 insertions, 1 deletions
diff --git a/driver/bc12/pi3usb9281.c b/driver/bc12/pi3usb9281.c
index f1bd3ce8d4..06a1efba61 100644
--- a/driver/bc12/pi3usb9281.c
+++ b/driver/bc12/pi3usb9281.c
@@ -183,7 +183,7 @@ static int pi3usb9281_get_interrupts(int port)
return pi3usb9281_read(port, PI3USB9281_REG_INT);
}
-static int pi3usb9281_get_device_type(int port)
+int pi3usb9281_get_device_type(int port)
{
return pi3usb9281_read(port, PI3USB9281_REG_DEV_TYPE) & 0x77;
}
diff --git a/driver/pi3usb9281.h b/driver/pi3usb9281.h
index fe19f0e977..fd4375b9b1 100644
--- a/driver/pi3usb9281.h
+++ b/driver/pi3usb9281.h
@@ -74,4 +74,7 @@ extern struct pi3usb9281_config pi3usb9281_chips[];
/* Enable interrupts. */
int pi3usb9281_enable_interrupts(int port);
+/* Get the device type */
+int pi3usb9281_get_device_type(int port);
+
#endif /* __CROS_EC_PI3USB9281_H */