On 31 March 2016 at 16:15, Felipe Balbi <balbi@xxxxxxxxxx> wrote: > > Hi Baolin, > > Baolin Wang <baolin.wang@xxxxxxxxxx> writes: >>>> >> Make sense. In our company's solution, charger detection can be done >>>> >> by hardware from PMIC at first, then it will not affect the DP/DM >>>> >> line when gadget starts to enumeration. >>>> > >>>> > I see, charger type detection is done automatically by PMIC when VBUS >>>> > is detected in your case, you just assume the process is complete >>>> > before SW do gadget connect. To make the framework common, you may do >>>> one time charger type check when vbus is on, and save it to avoid repeat >>>> charger type check. >>>> >>>> OK. I'll add one judgement to check if the charger type is set in >>>> 'usb_charger_detect_type()' function. >>> >>> Just adding a judgement isn't enough here, your framework should make sure >>> usb_charger_detect_type() is called before gadget connect, with that, the >>> existing caller place just gets the charger type from the saved value. >>> The real charger type detection done by usb_charger_detect_type() can >>> be called only when vbus is on. >>> e.g. maybe in usb_udc_vbus_handler() before usb_udc_connect_control(). >> >> Yeah, Like Felipe suggested, I think we need to introduce one >> 'charger_detect()' method to do the SW charger type detection at the >> right gadget state. Thanks for your comments. > > Just to be clear, we add ->charger_detect() when we know of a platform > which needs to manually detect the charger type. Until then, we ignore > that situation. It might be a good idea, however, do document this in > comments on your structure definition stating that if we need to detect > charger type, a new method should be added ;-) Make sense. Thanks. > > cheers > > -- > balbi -- Baolin.wang Best Regards -- 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