Re: [PATCH v9 0/4] Introduce usb charger framework to deal with the usb gadget power negotation

From: Peter Chen
Date: Tue Apr 05 2016 - 02:53:38 EST


On Fri, Apr 01, 2016 at 03:21:48PM +0800, Baolin Wang wrote:
> Currently the Linux kernel does not provide any standard integration of this
> feature that integrates the USB subsystem with the system power regulation
> provided by PMICs meaning that either vendors must add this in their kernels
> or USB gadget devices based on Linux (such as mobile phones) may not behave
> as they should. Thus provide a standard framework for doing this in kernel.
>
> Now introduce one user with wm831x_power to support and test the usb charger,
> which is pending testing. Moreover there may be other potential users will use
> it in future.
>
> Changes since v8:
> - Remove the bus type things.
> - Introduce one charger_detect() callback to detect charger type if it is needed.
> - Add some sysfs attributes for showing the charger type and state.
> - Change the charger current attributes to read only.
> - Move charger state and type definition to include/uapi.
> - Some other optimiazations.
>
> Baolin Wang (4):
> gadget: Introduce the usb charger framework
> gadget: Support for the usb charger framework
> gadget: Integrate with the usb gadget supporting for usb charger
> power: wm831x_power: Support USB charger current limit management
>

We are thinking USB charger framework for Freescale i.mx SoC series,
since our internal framework is not good enough.
So I have more questions for your framework since there are many
different USB charger designs, and I hope it is universal.

- I would like to see your all code to let the charger work, eg
you have said the charger detection is done by PMIC automatically,
but I did not find your PMIC code to read charger type.

Besides, how you can make sure the charger detection has finished
before the framework handles USB_CHARGER_PRESENT event?

- I commented the current limit at different situations for USB
charger last time, but I have not seen your further comments.
I would like give it again. For DCP, you can notify charger IC
once you get the charger type. But for CDP/SDP, you need to
notify charger IC after set configuration has finished, since
the host may still not be ready to give high current.

--

Best Regards,
Peter Chen