Re: [PATCH] chipidea: Fix issue in reconnecing gadget without insmod/rmmod
From: Peter Chen
Date: Fri Apr 14 2017 - 05:39:21 EST
On Wed, Apr 12, 2017 at 06:18:20PM +0530, Niranjan Dighe wrote:
> > Hi Niranjan,
> >
> > When working with iAP device, there are two role-switch methods
> > - Through OTG FSM, and using sysfs entries under
> > /sys/bus/platform/devices/ci_hdrc.0/inputs
> > but you may need to patch code to keep vbus always on for A-device,
> > it is not compliance with OTG spec.
> > - Using role interface under debugfs (I move it under sysfs for v4.12).
> > But you need to patch the code and let the A-device switch back to
> > host after iAP is disconnected.
> >
> > You don't need to use above two methods together, I suggest using the
> > 2nd method since OTG FSM is hard to maintain due to no mandatory use
> > case for it.
> >
> > --
> >
> > Best Regards,
> > Peter Chen
>
> Thank you Peter for your response.
>
> Yes, I will try to switch the role on disconnection of iAP device to Host. If
> I understand correctly I have to do something like this -
>
> ci_role_stop(ci); //Gadget role stop
> ret = ci_role_start(ci, role); //Host role start
>
Applying below patch [1] first.
- When your app detects the board needs to switch role to gadget, do
echo gadget > /sys/bus/platform/devices/ci_hdrc.0/role
- When your app detects the iAP devices is disconnected from the board, do
echo host > /sys/bus/platform/devices/ci_hdrc.0/role
[1] https://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.git/commit/?h=ci-for-usb-next
--
Best Regards,
Peter Chen