From 936f0bad4806705cf8c6f9523a9e99ae2070aed4 Mon Sep 17 00:00:00 2001 From: Scott Collyer Date: Tue, 16 Oct 2018 16:44:36 -0700 Subject: ppc: syv682x: Add trigger for BC 1.2 when turning src path on/off When using the syv682x PPC for VBUS detection, VBUS changes need to result in a call to usb_charger_vbus_change() which will set an event to wake the USB_CHG_N task. This was being handled when the port was attached as a sink, but was not being done when the port was attached as source. This CL adds a call to usb_charger_vbus_change() when the source path is enabled or disabled. BRANCH=none BUG=b:113267982 TEST=On DragonEgg, connect a USB 2.0 keyboard and verfied that it enumerates. localhost ~ # lsusb Bus 003 Device 003: ID 046d:c31c Logitech, Inc. Keyboard K120 Change-Id: Ie26ad1a062320eb1290fe8c6f6f8b3de8261a03f Signed-off-by: Scott Collyer Reviewed-on: https://chromium-review.googlesource.com/1285295 Commit-Ready: Scott Collyer Tested-by: Scott Collyer Reviewed-by: Furquan Shaikh Reviewed-by: Jett Rink --- driver/ppc/syv682x.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/driver/ppc/syv682x.c b/driver/ppc/syv682x.c index ea6e83ae48..d7c050cbce 100644 --- a/driver/ppc/syv682x.c +++ b/driver/ppc/syv682x.c @@ -129,7 +129,7 @@ static int syv682x_vbus_source_enable(int port, int enable) } else if (flags[port] & SYV682X_FLAGS_SOURCE_ENABLED) { /* * For the disable case, make sure that VBUS was being sourced - * proir to disabling the source path. Because the source/sink + * prior to disabling the source path. Because the source/sink * paths can't be independently disabled, and this function will * get called as part of USB PD initialization, setting the * PWR_ENB always can lead to broken dead battery behavior. @@ -149,6 +149,14 @@ static int syv682x_vbus_source_enable(int port, int enable) else flags[port] &= ~SYV682X_FLAGS_SOURCE_ENABLED; +#if defined(CONFIG_USB_CHARGER) && defined(CONFIG_USB_PD_VBUS_DETECT_PPC) + /* + * Since the VBUS state could be changing here, need to wake the + * USB_CHG_N task so that BC 1.2 detection will be triggered. + */ + usb_charger_vbus_change(port, enable); +#endif + return EC_SUCCESS; } -- cgit v1.2.1