In case the usb phy has the capability to detect usb charger type,
do it when vbus is on.

Signed-off-by: Li Jun <[email protected]>
---
 drivers/usb/chipidea/udc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index d68b125..63d311e 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1529,6 +1529,10 @@ static int ci_udc_vbus_session(struct usb_gadget 
*_gadget, int is_active)
                gadget_ready = 1;
        spin_unlock_irqrestore(&ci->lock, flags);
 
+       if (ci->usb_phy)
+               usb_phy_set_charger_state(ci->usb_phy, is_active ?
+                       USB_CHARGER_PRESENT : USB_CHARGER_ABSENT);
+
        if (gadget_ready) {
                if (is_active) {
                        pm_runtime_get_sync(&_gadget->dev);
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to