summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2015-02-26 09:39:41 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-02-27 02:21:31 +0000
commit28b14468137d816575ef286f314c857bd92fdd7e (patch)
tree0618731ab6a20d41fe1d5606c54b53d383ca1d41
parentc7bc5965faa2c0c8cc267acc75e784c345dbe8dc (diff)
downloadchrome-ec-28b14468137d816575ef286f314c857bd92fdd7e.tar.gz
samus_pd: Skip pericom detection if we're sourcing VBUS
If we're sourcing VBUS, there is no need to proceed with the pericom debounce / reset procedure, since we know that we're not charging. BUG=chrome-os-partner:37137 TEST=Manual on Samus. Insert USB keyboard, verify that pericom reset doesn't occur. Insert SDP port + Apple charger, verify that pericom reset / redetection still occurs. BRANCH=Samus Change-Id: I1a616f6e2287cd474b94e8fb61c19514d2ec2042 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/254140 Reviewed-by: Alec Berg <alecaberg@chromium.org>
-rw-r--r--board/samus_pd/board.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/board/samus_pd/board.c b/board/samus_pd/board.c
index b98eb1552e..0c996d5b6d 100644
--- a/board/samus_pd/board.c
+++ b/board/samus_pd/board.c
@@ -160,6 +160,7 @@ void set_usb_switches(int port, int open)
void usb_charger_task(void)
{
int port = (task_get_current() == TASK_ID_USB_CHG_P0 ? 0 : 1);
+ int vbus_source = (port == 0 ? GPIO_USB_C0_5V_EN : GPIO_USB_C1_5V_EN);
int device_type, charger_status;
struct charge_port_info charge;
int type;
@@ -169,9 +170,14 @@ void usb_charger_task(void)
/* Read interrupt register to clear on chip */
pi3usb9281_get_interrupts(port);
- /* Set device type */
- device_type = pi3usb9281_get_device_type(port);
- charger_status = pi3usb9281_get_charger_status(port);
+ if (gpio_get_level(vbus_source)) {
+ /* If we're sourcing VBUS then we're not charging */
+ device_type = charger_status = 0;
+ } else {
+ /* Set device type */
+ device_type = pi3usb9281_get_device_type(port);
+ charger_status = pi3usb9281_get_charger_status(port);
+ }
/* Debounce pin plug order if we detect a charger */
if (device_type || PI3USB9281_CHG_STATUS_ANY(charger_status)) {
@@ -213,19 +219,19 @@ void usb_charger_task(void)
charger_status = pi3usb9281_get_charger_status(port);
}
- if (PI3USB9281_CHG_STATUS_ANY(charger_status))
- type = CHARGE_SUPPLIER_PROPRIETARY;
- else if (device_type & PI3USB9281_TYPE_CDP)
- type = CHARGE_SUPPLIER_BC12_CDP;
- else if (device_type & PI3USB9281_TYPE_DCP)
- type = CHARGE_SUPPLIER_BC12_DCP;
- else if (device_type & PI3USB9281_TYPE_SDP)
- type = CHARGE_SUPPLIER_BC12_SDP;
- else
- type = CHARGE_SUPPLIER_OTHER;
-
/* Attachment: decode + update available charge */
if (device_type || PI3USB9281_CHG_STATUS_ANY(charger_status)) {
+ if (PI3USB9281_CHG_STATUS_ANY(charger_status))
+ type = CHARGE_SUPPLIER_PROPRIETARY;
+ else if (device_type & PI3USB9281_TYPE_CDP)
+ type = CHARGE_SUPPLIER_BC12_CDP;
+ else if (device_type & PI3USB9281_TYPE_DCP)
+ type = CHARGE_SUPPLIER_BC12_DCP;
+ else if (device_type & PI3USB9281_TYPE_SDP)
+ type = CHARGE_SUPPLIER_BC12_SDP;
+ else
+ type = CHARGE_SUPPLIER_OTHER;
+
charge.current = pi3usb9281_get_ilim(device_type,
charger_status);
charge_manager_update_charge(type, port, &charge);