On Wed, Mar 30, 2016 at 04:40:31PM +0800, Baolin Wang wrote: > >> > - Third, since composite driver covers 500mA (and more for CDP) after set > >> > configuration and 2mA after suspend, and vbus handler covers connect > >> > and disconnect. I can't see any reasons we need to notify gadget state > >> > for power driver, do we really need to have usb_charger_plug_by_gadget? > >> > >> In some solutions, gadget does not negotiate with the current. They > >> just send out one signal to power driver to set the current when the > >> gadget state is changed (plugin or not). So we need to check the > >> charger state by the gadget state to notify the charger IC to set > >> current. > >> > > > > Would you give some examples? > > OK. I explain it in detail. Now charger detection can be from gadget > itself or PMIC, and we focus on gadget detection. Charger IC (charger > driver) is separate with gadget. > When the usb cable is plugin, we need to report the plugin event to > charger driver to set current after setting configuration for gadget. > The usb charger is responsible for reporting plugin event to charger > driver. But how usb charger get the plugin event? It can get the > plugin event from gadget state (if the gadget state is more than > 'USB_STATE_ATTACHED', it means one cable plugin). So we need notify > gadget state to usb charger. >
Ok, I see, it only changes current limit at function usb_gadget_vbus_draw in your patch 2/4. Then, we need to make sure usb_charger_set_cur_limit_by_type is called before calling usb_gadget_set_state(gadget, USB_STATE_CONFIGURED). It seems you have not implemented usb_charger_plug_by_gadget in your patch set. -- Best Regards, Peter Chen