Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1420168
| From | Peter Chen <hzpeterchen@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v9 08/14] usb: otg: add OTG/dual-role core |
| Date | 2016-06-12 08:40 +0200 |
| Message-ID | <rJ7dU-5dh-1@gated-at.bofh.it> (permalink) |
| References | (1 earlier) <rHHER-6Fd-19@gated-at.bofh.it> <rHIrf-6Wr-7@gated-at.bofh.it> <rHIKC-7iL-21@gated-at.bofh.it> <rHL5L-aT-5@gated-at.bofh.it> <rI2zE-3dZ-17@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, Jun 09, 2016 at 10:24:44AM +0300, Roger Quadros wrote:
> On 08/06/16 15:42, Peter Chen wrote:
> > On Wed, Jun 08, 2016 at 01:12:10PM +0300, Roger Quadros wrote:
> >> Hi,
> >>
> >> On 08/06/16 12:53, Peter Chen wrote:
> >>> On Wed, Jun 08, 2016 at 12:03:40PM +0300, Roger Quadros wrote:
> >>>> +int usb_otg_unregister(struct device *dev)
> >>>> +{
> >>>> + struct usb_otg *otg;
> >>>> +
> >>>> + mutex_lock(&otg_list_mutex);
> >>>> + otg = usb_otg_get_data(dev);
> >>>> + if (!otg) {
> >>>> + dev_err(dev, "otg: %s: device not in otg list\n",
> >>>> + __func__);
> >>>> + mutex_unlock(&otg_list_mutex);
> >>>> + return -EINVAL;
> >>>> + }
> >>>> +
> >>>> + /* prevent unregister till both host & gadget have unregistered */
> >>>> + if (otg->host || otg->gadget) {
> >>>> + dev_err(dev, "otg: %s: host/gadget still registered\n",
> >>>> + __func__);
> >>>
> >>> You need to call mutex_unlock here
> >>
> >> Indeed. good catch.
> >>>
> >>>> +
> >>>> +int usb_otg_gadget_ready(struct usb_gadget *gadget, bool ready)
> >>>> +{
> >>>
> >>> What this API is for? Why need it in this version?
> >>
> >> we moved gadget to otg registration from udc_bind_to_driver() to usb_add_gadget_udc_release().
> >> This means there is a window when gadget function driver (e.g. g_zero) is not loaded.
> >> We don't want to start the gadget controller in that window.
> >>
> >> usb_otg_gadget_ready() is used by gadget core to notify the otg core when the function driver
> >> is ready or not-ready.
> >>
> >
> > Why you need to move this from gadget's probe to udc's probe? Currently,
> > the sequence of gadget and udc's probe is random, but udc_bind_to_driver
> > is called when udc is ready.
> >
> Because we need to support -EPROBE_DEFER at udc probe.
> At udc_bind_to_driver there is no scope for -EPROBE_DEFER.
>
Why udc_bind_to_driver can't return -EPROBE_DEFER if register to OTG is
failed?
> Another issue is that we need to register with otg and have otg->caps available
> before driver->bind() is called in udc_bind_to_driver(). Else gadget function
> will not have the correct OTG descriptor.
>
You can do register before calling driver->bind.
--
Best Regards,
Peter Chen
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v9 00/14] USB OTG/dual-role framework Roger Quadros <rogerq@ti.com> - 2016-06-08 11:10 +0200
[PATCH v9 10/14] usb: otg: add hcd companion support Roger Quadros <rogerq@ti.com> - 2016-06-08 11:10 +0200
[PATCH v9 11/14] usb: otg: use dev_dbg() instead of VDBG() Roger Quadros <rogerq@ti.com> - 2016-06-08 11:10 +0200
Re: [PATCH v9 11/14] usb: otg: use dev_dbg() instead of VDBG() Joe Perches <joe@perches.com> - 2016-06-08 17:20 +0200
Re: [PATCH v9 11/14] usb: otg: use dev_dbg() instead of VDBG() Roger Quadros <rogerq@ti.com> - 2016-06-09 09:30 +0200
[PATCH v10 11/14] usb: otg: use dev_dbg() instead of VDBG() Roger Quadros <rogerq@ti.com> - 2016-06-09 10:00 +0200
Re: [PATCH v10 11/14] usb: otg: use dev_dbg() instead of VDBG() Joe Perches <joe@perches.com> - 2016-06-09 17:50 +0200
Re: [PATCH v10 11/14] usb: otg: use dev_dbg() instead of VDBG() Roger Quadros <rogerq@ti.com> - 2016-06-10 09:10 +0200
[PATCH v9 02/14] usb: otg-fsm: Prevent build warning "VDBG" redefined Roger Quadros <rogerq@ti.com> - 2016-06-08 11:10 +0200
[PATCH v9 09/14] usb: of: add an API to get OTG device from USB controller node Roger Quadros <rogerq@ti.com> - 2016-06-08 11:10 +0200
[PATCH v9 14/14] usb: host: xhci-plat: Add otg device to platform data Roger Quadros <rogerq@ti.com> - 2016-06-08 11:10 +0200
[PATCH v9 08/14] usb: otg: add OTG/dual-role core Roger Quadros <rogerq@ti.com> - 2016-06-08 11:10 +0200
Re: [PATCH v9 08/14] usb: otg: add OTG/dual-role core Peter Chen <hzpeterchen@gmail.com> - 2016-06-08 12:00 +0200
Re: [PATCH v9 08/14] usb: otg: add OTG/dual-role core Roger Quadros <rogerq@ti.com> - 2016-06-08 12:20 +0200
Re: [PATCH v9 08/14] usb: otg: add OTG/dual-role core Peter Chen <hzpeterchen@gmail.com> - 2016-06-08 14:50 +0200
Re: [PATCH v9 08/14] usb: otg: add OTG/dual-role core Roger Quadros <rogerq@ti.com> - 2016-06-09 09:30 +0200
Re: [PATCH v9 08/14] usb: otg: add OTG/dual-role core Peter Chen <hzpeterchen@gmail.com> - 2016-06-12 08:40 +0200
Re: [PATCH v9 08/14] usb: otg: add OTG/dual-role core Peter Chen <hzpeterchen@gmail.com> - 2016-06-12 13:10 +0200
[PATCH v10 08/14] usb: otg: add OTG/dual-role core Roger Quadros <rogerq@ti.com> - 2016-06-09 10:00 +0200
Re: [PATCH v10 08/14] usb: otg: add OTG/dual-role core Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-06-09 14:40 +0200
Re: [PATCH v10 08/14] usb: otg: add OTG/dual-role core Roger Quadros <rogerq@ti.com> - 2016-06-10 09:10 +0200
Re: [PATCH v10 08/14] usb: otg: add OTG/dual-role core Roger Quadros <rogerq@ti.com> - 2016-06-10 12:20 +0200
Re: [PATCH v10 08/14] usb: otg: add OTG/dual-role core Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-06-10 12:50 +0200
Re: [PATCH v10 08/14] usb: otg: add OTG/dual-role core Roger Quadros <rogerq@ti.com> - 2016-06-10 13:00 +0200
Re: [PATCH v10 08/14] usb: otg: add OTG/dual-role core Felipe Balbi <balbi@kernel.org> - 2016-06-10 13:10 +0200
[PATCH v9 13/14] usb: gadget: udc: adapt to OTG core Roger Quadros <rogerq@ti.com> - 2016-06-08 11:10 +0200
RE: [PATCH v9 13/14] usb: gadget: udc: adapt to OTG core Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> - 2016-06-09 12:50 +0200
Re: [PATCH v9 13/14] usb: gadget: udc: adapt to OTG core Roger Quadros <rogerq@ti.com> - 2016-06-10 09:10 +0200
[PATCH v9 07/14] usb: otg: get rid of CONFIG_USB_OTG_FSM in favour of CONFIG_USB_OTG Roger Quadros <rogerq@ti.com> - 2016-06-08 11:20 +0200
[PATCH v9 01/14] usb: hcd: Initialize hcd->flags to 0 Roger Quadros <rogerq@ti.com> - 2016-06-08 11:20 +0200
[PATCH v9 05/14] usb: otg-fsm: move host controller operations into usb_otg->hcd_ops Roger Quadros <rogerq@ti.com> - 2016-06-08 11:20 +0200
[PATCH v9 06/14] usb: gadget.h: Add OTG to gadget interface Roger Quadros <rogerq@ti.com> - 2016-06-08 11:20 +0200
Re: [PATCH v9 00/14] USB OTG/dual-role framework Peter Chen <hzpeterchen@gmail.com> - 2016-06-09 07:30 +0200
Re: [PATCH v9 00/14] USB OTG/dual-role framework Roger Quadros <rogerq@ti.com> - 2016-06-09 09:40 +0200
RE: [PATCH v9 00/14] USB OTG/dual-role framework Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> - 2016-06-09 12:20 +0200
csiph-web