> >
> >
> > > >
> > > > You may use connect bit at portsc since VBUS may not connect to SoC.
> > >
> > > By this way, disconnect can be decided but connect is a problem in
> > > current driver, as controller was stopped in low power mode so can't
> > > detect connection from host, unless we also update this behavior too.
> > >
> >
> > For connection, if current role is USB_ROLE_NONE, you may start device mode.
> 
> This is assuming set role only can be called one time between disconnect and
> connect to host, this may not always true, but this can be resolved, I think 
> we need
> handle the case device mode is started but connection does not happen, so the
> gadget need be stopped and enter low power mode again, if this approach is OK 
> to
> you, I will go in this direction for my v2.
> 
 
After thinking more, I think Type-C tcpm code should set usb_role correctly, it
knows physical connection status well,  and there are already USB_ROLE_NONE
references at tcpm now. Depending on USB device driver workaround to know 
USB_ROLE_NONE
is not a good solution. Look at another USB role driver, 
intel-xhci-usb-role-switch.c,
it could also get USB_ROLE_NONE state.

Peter

Reply via email to