Re: [PATCH v12 2/4] gadget: Support for the usb charger framework

From: Baolin Wang
Date: Tue Jun 21 2016 - 07:29:55 EST


On 21 June 2016 at 18:27, Felipe Balbi <balbi@xxxxxxxxxx> wrote:
>
> Hi,
>
> Baolin Wang <baolin.wang@xxxxxxxxxx> writes:
>> For supporting the usb charger, it adds the usb_charger_init() and
>> usb_charger_exit() functions for usb charger initialization and exit.
>>
>> It will report to the usb charger when the gadget state is changed,
>> then the usb charger can do the power things.
>>
>> Signed-off-by: Baolin Wang <baolin.wang@xxxxxxxxxx>
>> Reviewed-by: Li Jun <jun.li@xxxxxxx>
>> Tested-by: Li Jun <jun.li@xxxxxxx>
>
> Before anything, I must say that I really liked this patch. It's

Thanks.

> minimaly invasive to udc core and does all the necessary changes. If it
> wasn't for the extra charger class, this would've been perfect.
>
> Can't you just tie a charger to a UDC and avoid the charger class
> completely?

Yeah, I also hope so. But we really want something to manage the
charger devices, do you have any good suggestion to avoid the 'class'
but also can manage the charger devices?

>
>> static inline int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
>> {
>> + if (gadget->charger)
>
> I guess you could do this check inside
> usb_gadget_set_cur_limit_by_type() itself.

OK.

>
> --
> balbi



--
Baolin.wang
Best Regards