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


Groups > linux.kernel > #1460202

Re: [PATCH] usb: core: Add runtime resume checking

From Peter Chen <hzpeterchen@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] usb: core: Add runtime resume checking
Date 2016-08-11 09:10 +0200
Message-ID <s4ShP-8tK-1@gated-at.bofh.it> (permalink)
References <s4GgH-79-67@gated-at.bofh.it> <s4GA4-f8-129@gated-at.bofh.it> <s4OHf-5JF-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Aug 11, 2016 at 11:08:52AM +0800, Baolin Wang wrote:
> Hi Alan,
> 
> On 10 August 2016 at 22:25, Alan Stern <stern@rowland.harvard.edu> wrote:
> > On Wed, 10 Aug 2016, Baolin Wang wrote:
> >
> >> >> >> For example: No slave attached----> usb interface runtime suspend
> >> >> >> ----> usb device runtime suspend -----> xhci suspend -----> power off
> >> >> >> usb controller. After that if the system wants to enter suspend state,
> >> >> >> then it also will issue usb_dev_suspend(), then the
> >> >> >> pm_runtime_resume() function (issued in choose_wakeup() function) will
> >> >> >> return -ESHUTDOWN due to xhci has been suspend and hardware is not
> >> >> >> accessible.
> >> >> >
> >> >> > Why the controller does not be resumed when the root hub has issued
> >> >> > runtime resume?
> >> >>
> >> >> Because now there is no slave attached, we will not power on usb
> >> >> controller and resume xhci.
> >> >>
> >> >
> >> > I don't know why you set policy like this. Even the controller is
> >> > resumed, it will still be suspended by system suspend. What's more,
> >> > if you disallow it, how can you change your wakeup setting?
> >> > Eg, at runtime suspend, we enable wakeup by default. But for system
> >> > sleep, we disable wakeup by default.
> >> >
> >> > At runtime, if there is no device on the port, even we resumes the
> >> > controller and roohub, it still will be suspended soon.
> >>
> >> For saving power, if there is no slave attached, why we need to power
> >> on usb controller and resume xhci? Especially for mobile device.
> >
> > You need to power-on the USB controller in order to change the wakeup
> > setting.
> 
> pm_runtime_resume() function issued in choose_wakeup() can just resume
> usb device, which can not power-on the USB controller and resume xHCI.
> Cause the user won't know you need to power-on usb controller now,
> then how to power-on the USB controller when changing wakeup setting?
> 
> >
> >> Moreover the usb device runtime suspend/resume is separate with xhci
> >> suspend/resume, when xhci entered suspend state, only slave attaching
> >> can resume xhci.
> >
> > That's right.  Suppose the user wants the system to stay asleep when a
> > slave attaches.  But when you suspended the xHCI controller, it was set
> > to wake up when a new slave attaches.  So when a slave is attached, the
> > controller will wake up the system.  That's bad.
> >
> > If the wakeup setting needs to be changed when the system suspend
> > begins, then you have to power-on the controller to make that change.
> >
> > Given a choice between using a little power or behaving incorrectly,
> > you should choose to use the power.
> 
> OK. But that is a real problem. It will pm_runtime_resume() falied
> (issued in choose_wakeup()), cause usb controller has powered-off and
> xHCI controller has suspended and we have no method to notify the user
> to power-on USB controller. Any good suggestion to solve this, Alan
> and Peter? Thanks.
> 

Maybe you can show us the call stack why pm_runtime_resume has failed
at your environment. 

-- 

Best Regards,
Peter Chen

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


Thread

[PATCH] usb: core: Add runtime resume checking Baolin Wang <baolin.wang@linaro.org> - 2016-08-09 11:40 +0200
  Re: [PATCH] usb: core: Add runtime resume checking Greg KH <gregkh@linuxfoundation.org> - 2016-08-09 12:30 +0200
    Re: [PATCH] usb: core: Add runtime resume checking Baolin Wang <baolin.wang@linaro.org> - 2016-08-10 04:40 +0200
      Re: [PATCH] usb: core: Add runtime resume checking Baolin Wang <baolin.wang@linaro.org> - 2016-08-10 20:20 +0200
        Re: [PATCH] usb: core: Add runtime resume checking Alan Stern <stern@rowland.harvard.edu> - 2016-08-10 20:40 +0200
          Re: [PATCH] usb: core: Add runtime resume checking Baolin Wang <baolin.wang@linaro.org> - 2016-08-11 05:20 +0200
            Re: [PATCH] usb: core: Add runtime resume checking Peter Chen <hzpeterchen@gmail.com> - 2016-08-11 09:10 +0200
              Re: [PATCH] usb: core: Add runtime resume checking Baolin Wang <baolin.wang@linaro.org> - 2016-08-11 10:10 +0200
                Re: [PATCH] usb: core: Add runtime resume checking Peter Chen <hzpeterchen@gmail.com> - 2016-08-11 10:30 +0200
                Re: [PATCH] usb: core: Add runtime resume checking Baolin Wang <baolin.wang@linaro.org> - 2016-08-11 10:50 +0200
                Re: [PATCH] usb: core: Add runtime resume checking Peter Chen <hzpeterchen@gmail.com> - 2016-08-11 11:00 +0200
                Re: [PATCH] usb: core: Add runtime resume checking Baolin Wang <baolin.wang@linaro.org> - 2016-08-11 11:10 +0200
      Re: [PATCH] usb: core: Add runtime resume checking Peter Chen <hzpeterchen@gmail.com> - 2016-08-10 20:20 +0200
      Re: [PATCH] usb: core: Add runtime resume checking Peter Chen <hzpeterchen@gmail.com> - 2016-08-10 21:30 +0200
        Re: [PATCH] usb: core: Add runtime resume checking Baolin Wang <baolin.wang@linaro.org> - 2016-08-10 22:20 +0200
      Re: [PATCH] usb: core: Add runtime resume checking Baolin Wang <baolin.wang@linaro.org> - 2016-08-10 21:30 +0200

csiph-web