> -----Original Message----- > From: Peter Chen > Sent: 2019年8月7日 10:41 > To: Jun Li <jun.li@xxxxxxx>; Peter Chen <hzpeterchen@xxxxxxxxx> > Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>; dl-linux-imx > <linux-imx@xxxxxxx>; USB list <linux-usb@xxxxxxxxxxxxxxx> > Subject: RE: [PATCH 2/5] usb: chipidea: add role switch class support > > > > > > > > > > > > > > > > > > > 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. Sorry, I re-checked the latest tcpm code found there is already USB_ROLE_NONE setting for not disconnect, so we are fine to handle it in usb controller driver, will post v2 for this soon. Li Jun > > Peter