mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
usb_charger: disconnect usb switch until connection is debounced
Re-order logic in BC1.2 detection task so that we open the USB switches immediately upon detecting a connection, then debounce the connection, then reset the pericom and determine BC1.2 charger type. This fixes two problems: - Problem where host could enumerate dut, detect disconnect, and then re-enumerate. - Problem where sometimes dut would detect a host workstation as a proprietary charger because we weren't delaying long enough after opening USB switches before triggering pericom reset. BUG=chrome-os-partner:47219 BRANCH=smaug TEST=tested by connecting workstation to ryu (tested both pluggin in A side first and C side first). Without this patch, my workstation often see's disconnect and reconnect. With this change we only get one connect. Change-Id: I07cc3473ff32953fad3cc6d1db01b86b44969c4e Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/311804 Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
@@ -113,15 +113,18 @@ static void usb_charger_bc12_detect(int port)
|
||||
|
||||
/* Debounce pin plug order if we detect a charger */
|
||||
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 */
|
||||
/*
|
||||
* Ensure D+/D- are open before resetting
|
||||
* Note: we can't simply call pi3usb9281_set_switches() because
|
||||
* another task might override it and set the switches closed.
|
||||
*/
|
||||
pi3usb9281_set_switch_manual(port, 1);
|
||||
pi3usb9281_set_pins(port, 0);
|
||||
/* Let D+/D- relax to their idle state */
|
||||
msleep(40);
|
||||
|
||||
/* Delay to debounce pin attach order */
|
||||
msleep(USB_CHG_DEBOUNCE_DELAY_MS);
|
||||
|
||||
/*
|
||||
* Trigger chip reset to refresh detection registers.
|
||||
|
||||
Reference in New Issue
Block a user