Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1402895

Re: [PATCH] dwc3: gadget: Defer starting the gadget device until gadget is power on

From Baolin Wang <baolin.wang@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH] dwc3: gadget: Defer starting the gadget device until gadget is power on
Date 2016-05-18 13:10 +0200
Message-ID <rA7wt-1ja-19@gated-at.bofh.it> (permalink)
References (10 earlier) <rzKJz-3sb-3@gated-at.bofh.it> <rA6qK-mg-23@gated-at.bofh.it> <rA6K5-JL-3@gated-at.bofh.it> <rA6K6-JL-21@gated-at.bofh.it> <rA6TM-Pd-41@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

On 18 May 2016 at 18:22, Felipe Balbi <balbi@kernel.org> wrote:
>
> Hi,
>
> Baolin Wang <baolin.wang@linaro.org> writes:
>>>> @@ -1485,16 +1490,11 @@ static int dwc3_gadget_run_stop(struct dwc3
>>>> *dwc, int is_on, int suspend)
>>>>  {
>>>>         u32                     reg;
>>>>         u32                     timeout = 500, i;
>>>>
>>>> +       if (pm_runtime_suspended(dwc->dev))
>>>> +               return 0;
>>>>
>>>> (2)
>>>> @@ -1748,15 +1754,25 @@ static int dwc3_gadget_start(struct usb_gadget *g,
>>>>          * even though host mode might be active. Don't actually perform
>>>>          * device-specific initialization until device mode is activated.
>>>>          */
>>>>
>>>> +       if (pm_runtime_suspended(dwc->dev)) {
>>>> +               spin_unlock_irqrestore(&dwc->lock, flags);
>>>> +               return 0;
>>>> +       }
>>>>
>>>> +       ret = __dwc3_gadget_start(dwc);
>>>> +       if (ret)
>>>> +               goto err1;
>>>>
>>>> So I think the dwc3 core can enter suspend mode before gadget function
>>>> is ready to call the 'usb_gadget_udc_start()' and
>>>> 'usb_udc_connect_control()', then if the dwc3 core has entered
>>>> suspended mode, we need to return success when starting the gadget,
>>>> and leave the gadget starting action from gadget resume. What do you
>>>> think about that? Thanks.
>>>
>>> Well, if this makes it work properly. Then, yeah; looks okay to me. I'll
>>> add this to the patch introducing runtime PM.
>>
>> OK.
>
> I've updated the branch with slightly modified version of your
> changes. Can you test again just to make sure it still works ?
>
> Basically, here's what I did:
>
> on dwc3_gadget_start:
>
> -       __dwc3_gadget_start(dwc);
> +       if (pm_runtime_active(dwc->dev))
> +               __dwc3_gadget_start(dwc);
> +

Great.

>
> on run_stop, I kept the same thing.
>
> you just need to replace "usb: dwc3: implement runtime PM" with the new
> version from my branch.

Yeah, it can work well on my platform with your new patch.

>
> cheers
>
> --
> balbi



-- 
Baolin.wang
Best Regards

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] dwc3: gadget: Defer starting the gadget device until gadget is power on Baolin Wang <baolin.wang@linaro.org> - 2016-05-13 12:30 +0200
  Re: [PATCH] dwc3: gadget: Defer starting the gadget device until gadget is power on Felipe Balbi <balbi@kernel.org> - 2016-05-13 12:50 +0200
    Re: [PATCH] dwc3: gadget: Defer starting the gadget device until  gadget is power on Baolin Wang <baolin.wang@linaro.org> - 2016-05-13 13:40 +0200
      Re: [PATCH] dwc3: gadget: Defer starting the gadget device until gadget is power on Felipe Balbi <balbi@kernel.org> - 2016-05-13 14:20 +0200
        Re: [PATCH] dwc3: gadget: Defer starting the gadget device until  gadget is power on Baolin Wang <baolin.wang@linaro.org> - 2016-05-13 14:40 +0200
          Re: [PATCH] dwc3: gadget: Defer starting the gadget device until gadget is power on Felipe Balbi <balbi@kernel.org> - 2016-05-13 14:50 +0200
            Re: [PATCH] dwc3: gadget: Defer starting the gadget device until  gadget is power on Baolin Wang <baolin.wang@linaro.org> - 2016-05-16 04:10 +0200
            Re: [PATCH] dwc3: gadget: Defer starting the gadget device until  gadget is power on Baolin Wang <baolin.wang@linaro.org> - 2016-05-17 10:00 +0200
              Re: [PATCH] dwc3: gadget: Defer starting the gadget device until gadget is power on Felipe Balbi <balbi@kernel.org> - 2016-05-17 10:10 +0200
                Re: [PATCH] dwc3: gadget: Defer starting the gadget device until  gadget is power on Baolin Wang <baolin.wang@linaro.org> - 2016-05-17 10:50 +0200
                Re: [PATCH] dwc3: gadget: Defer starting the gadget device until gadget is power on Felipe Balbi <balbi@kernel.org> - 2016-05-17 11:30 +0200
                Re: [PATCH] dwc3: gadget: Defer starting the gadget device until  gadget is power on Baolin Wang <baolin.wang@linaro.org> - 2016-05-17 12:50 +0200
                Re: [PATCH] dwc3: gadget: Defer starting the gadget device until  gadget is power on Baolin Wang <baolin.wang@linaro.org> - 2016-05-18 12:00 +0200
                Re: [PATCH] dwc3: gadget: Defer starting the gadget device until gadget is power on Felipe Balbi <balbi@kernel.org> - 2016-05-18 12:20 +0200
                Re: [PATCH] dwc3: gadget: Defer starting the gadget device until  gadget is power on Baolin Wang <baolin.wang@linaro.org> - 2016-05-18 12:20 +0200
                Re: [PATCH] dwc3: gadget: Defer starting the gadget device until gadget is power on Felipe Balbi <balbi@kernel.org> - 2016-05-18 12:30 +0200
                Re: [PATCH] dwc3: gadget: Defer starting the gadget device until  gadget is power on Baolin Wang <baolin.wang@linaro.org> - 2016-05-18 13:10 +0200
                Re: [PATCH] dwc3: gadget: Defer starting the gadget device until  gadget is power on Baolin Wang <baolin.wang@linaro.org> - 2016-05-18 13:30 +0200
                Re: [PATCH] dwc3: gadget: Defer starting the gadget device until gadget is power on Felipe Balbi <balbi@kernel.org> - 2016-05-18 13:30 +0200

csiph-web