Re: Notifying Id/HNP status to HCD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 07, 2010 at 10:22:29AM -0400, Alan Stern wrote:
> On Tue, 7 Sep 2010, Pavan Kondeti wrote:
> 
> > I am developing OTG driver for MSM chips. I would like to start first with
> > with basic OTG (based on Id pin detection) then extend the driver to implement
> > OTG2.0 functionality (SRP and HNP).
> > 
> > When Id becomes false, HCD will be added and HCD will be removed when Id
> > becomes true. When VBUS becomes true (session valid), gadget is connected. We
> > have usb_gadget_vbus_connect to achieve the later. But a similar API is
> > missing for host.
> > 
> > I was working on 2.6.32 kernel and did not look at the recent kernel. It seems
> > usb/core/hcd.h is moved to include/linux/usb. So I can happily call
> > usb_add_hcd() and usb_remove_hcd() from OTG without introducing another API
> > between OTG-->HOST.
> 
> Is it really necessary to remove the HCD when the port is switched to 
> device mode?  Wouldn't it be good enough to unconfigure the root hub, 
> i.e., usb_set_configuration(hcd->self.root_hub, 0)?  And of course, to 
> reconfigure it when switching back to host mode.  (You could also clear 
> the HW_ACCESSIBLE flag if you wanted.)
> 

I am glad that you asked this question.

The reason for removing HCD upon id float is to guard against
1. sysfs/debugfs entries exposed by USB core/ehci
2. auto suspend (runtime suspend) and system suspend

I have started manipulating HW_ACCESSIBLE flag initially and faced some
problems. This was on 2.6.29 kernel. So I have decided to use usb_add_hcd and
usb_remove_hcd upon Id state change. But this is causing problems in meeting
HNP timings. When HNP is started, host is suspended by clearing HW_ACCESSIBLE
flag, disabling autosuspend, and changing it usb state to NOT_ATTACHED.

I really want to avoid calling usb_add_hcd() and usb_remove_hcd() and use the
same set of operations for both Id state change and HNP.

If we unconfigure the roothub, userspace may select it or autosuspend may
happen. How can we avoid autosuspend/system suspend and intrusion from
sysfs/debugfs without calling usb_remove_hcd?

Thanks,
Pavan

-- 
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux