From: Heikki Krogerus <ext-heikki.krogerus@xxxxxxxxx> Inform charging HW/SW how much it's allowed to draw. Signed-off-by: Heikki Krogerus <ext-heikki.krogerus@xxxxxxxxx> --- drivers/usb/musb/musb_gadget.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 6fca870..40d3c13 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -1519,8 +1519,15 @@ static int musb_gadget_vbus_session(struct usb_gadget *gadget, int is_active) static int musb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA) { + static unsigned old_ma; struct musb *musb = gadget_to_musb(gadget); + if (mA != 0 && old_ma != mA) + blocking_notifier_call_chain(&musb->xceiv->notifier, + USB_EVENT_ENUMERATED, &mA); + + old_ma = mA; + if (!musb->xceiv->set_power) return -EOPNOTSUPP; return otg_set_power(musb->xceiv, mA); -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html