pi3usb9281: fix BC1.2 re-detection when using USB device mode

When the USB2.0 port is used in device mode, having the D+/D- lines
connected just before resetting the PI3USB9281 (for the 2nd detection
used a BC1.2 debouncing) triggers a misdetection where DCP chargers are
seen as Apple 2.4A chargers.
To avoid this, disconnect the D+/D- lines and let them relax before
triggering the PI3USB9281 reset.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=smaug
BUG=chrome-os-partner:42048
TEST=connect and disconnect a DCP charger to the Smaug type-C port
with the AP running, see it constantly detected as DCP and no Pericom
interrupt storm.

Change-Id: I8f6043439c2c6b52f2689b4947baffe51f62eba8
Reviewed-on: https://chromium-review.googlesource.com/282594
Reviewed-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Vincent Palatin
2015-06-29 17:22:42 -07:00
committed by ChromeOS Commit Bot
parent cdef497a4e
commit 0c331e6fcb

View File

@@ -69,6 +69,14 @@ void usb_charger_task(void)
if (device_type || PI3USB9281_CHG_STATUS_ANY(charger_status)) {
msleep(USB_CHG_DEBOUNCE_DELAY_MS);
/* next operation might trigger a detach interrupt */
pi3usb9281_disable_interrupts(port);
/* Ensure D+/D- are open before resetting */
pi3usb9281_set_switch_manual(port, 1);
pi3usb9281_set_pins(port, 0);
/* Let D+/D- relax to their idle state */
msleep(40);
/*
* Trigger chip reset to refresh detection registers.
* WARNING: This reset is acceptable for samus_pd,