Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754096AbdDNJjM (ORCPT ); Fri, 14 Apr 2017 05:39:12 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:33869 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753617AbdDNJjK (ORCPT ); Fri, 14 Apr 2017 05:39:10 -0400 Date: Fri, 14 Apr 2017 17:38:55 +0800 From: Peter Chen To: Niranjan Dighe Cc: Peter.Chen@freescale.com, Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] chipidea: Fix issue in reconnecing gadget without insmod/rmmod Message-ID: <20170414093855.GA28433@b29397-desktop> References: <20170411151624.GA4703@scoobydoo> <20170412115142.GA18380@b29397-desktop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1472 Lines: 41 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