> Subject: Bugged initial state with Chipidea driver
>
> Hi,
>
> In the Chipidea driver the extcon state is read early in the initialization
> and
> notifications for extcon events are only enabled at the end of the
> initialization. If the
> extcon state changes in between the driver will miss the change in extcon
> state and
> be a bad state.
Yes, it is the limitation, we need to move ci_extcon_register and update extcon
state in chipidea driver
before we read ID or VBUS value (through extcon)
> Here is what happens in my case:
> 1. EXTCON_USB_HOST=1, EXTCON_USB=1
Why the two events are both 1 at same time?
> 2. USB driver reads initial extcon state
> 3. EXTCON_USB_HOST=0
> 4. USB driver choses initial role
> 5. USB driver enables extcon notifiers then the USB driver is stuck
> in host mode until the EXTCON_USB_HOST value cycles again, when it should be
> in gadget mode. This happens every other boot because my EXTCON_USB_HOST
> value is unreliable during init.
>
> I have implemented a temporary solution for myself but if you propose a proper
> solution I can implement it and submit a patch.
>
Feel free to submit your patch.
> Additionally, I guess this could technically happen without extcon, but it is
> much less
> likely.
>
For non-extcon solution, the register (otgsc) reflect real-time vbus and id
value, so it
should be without problem you meet.
Peter
N�����r��y����b�X��ǧv�^�){.n�+����{������^n�r���z���h�����&���G���h�(�階�ݢj"���m������z�ޖ���f���h���~�m�