Re: [PATCH 2/2] usb: musb: notify USB_EVENT_ENUMERATED from musb_gadget_vbus_draw()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 22, 2010 at 2:09 PM, Felipe Balbi <balbi@xxxxxx> wrote:
> On Wed, Sep 22, 2010 at 03:31:50AM -0500, Maulik Mankad wrote:
>>
>> On Wed, Sep 22, 2010 at 1:22 PM, Krogerus Heikki (EXT-Teleca/Helsinki)
>> <ext-heikki.krogerus@xxxxxxxxx> wrote:
>>>
>>> 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);
>>> +
>>
>> You will need an atomic notifier since this gets called from Interrupt
>> context.
>
> true, we need to patch otg notifier to change into atomic_notifier
> instead of blocking.
>

How about adding two notifiers as below?

(1) The existing "otg" notifier that notifies about the VBUS presence
/ absence can be used to kick start charger type detection.
     Since TWL interrupts happens in thread context this can remain as
a blocking notifier.

(2) Another "current change" notifier that MUSB driver uses to notify
the current that battery driver can draw under various bus states like
 USB_STATE_NOTATTACHED (0 mA), USB_STATE_SUSPENDED (< 2.5mA),
USB_STATE_DEFAULT (100 mA) and USB_STATE_CONFIGURED (<500 mA) which
needs to be an atomic notifier.

Regards,
Maulik
--
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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux