All of lore.kernel.org
 help / color / mirror / Atom feed
From: vichy <vichy.kuo@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-pm@vger.kernel.org
Subject: Re: Auto suspend not working on usb hid devices
Date: Fri, 16 Jan 2015 19:21:48 +0800	[thread overview]
Message-ID: <CAOVJa8E28LTMMUa7tjNSitYb33VZNiWH9Nob=Zt_J81fmV8TUw@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1501131029040.1520-100000@iolanthe.rowland.org>

hi alan:

2015-01-13 23:37 GMT+08:00 Alan Stern <stern@rowland.harvard.edu>:
> On Tue, 13 Jan 2015, vichy wrote:
>
>> I purposely dump runtime_usage after calling
>> pm_runtime_put_async_autosuspend(), but the value is still 2.
>> I found the value increase/decrease like below:
>
> In usb_new_device():
>> pm_runtime_get_noresume => 1
>> usb_disable_autosuspend => 2
>> usb_probe_device
>>     -> usb_autoresume_device => 3
>
> That's where you go wrong.  usb_probe_device() does this:
>
>         if (!udriver->supports_autosuspend)
>                 error = usb_autoresume_device(udev);
>
> and udriver->supports_autosuspend should be 1.  See the definition of
> usb_generic_driver at the end of generic.c.
>
>> usb_set_configuration
>>     ->usb_autoresume_device =>4
>> usb_set_configuration
>>     ->usb_autosuspend_device =>3
>> pm_runtime_put_sync_autosuspend => 2
>>
>> so even after calling pm_runtime_put_async_autosuspend() at end fo
>> usb_new_device()
>> the runtime_usage will not be back to 1
>
> It would be 1 if udriver in usb_probe_device() was equal to
> usb_generic_driver.
>
>> is there any rule for us to determine where we add those
>> usb_autoresume_device/usb_autosuspend_device in usb driver?
>
> The rule is very simple: You autoresume in places where you need the
> device to be active, and you autosuspend when you don't need the device
> to be active any more.
>
I found the usb storage interface driver also set supports_autosuspend
=1 and I found the runtime_usage =1 .
But the device doesn't go into runtime suspend, even I put control as auto.
is there any condition purposely abandon usb storage device to do so?
sincerely thanks for your help,

  reply	other threads:[~2015-01-16 11:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-11 13:23 Auto suspend not working on usb hid devices vichy
2015-01-11 15:53 ` Alan Stern
2015-01-12 10:45   ` vichy
2015-01-12 12:45     ` vichy
2015-01-12 15:18       ` Alan Stern
2015-01-13  9:35         ` vichy
2015-01-13 12:11           ` vichy
2015-01-13 15:37           ` Alan Stern
2015-01-16 11:21             ` vichy [this message]
2015-01-16 15:23               ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOVJa8E28LTMMUa7tjNSitYb33VZNiWH9Nob=Zt_J81fmV8TUw@mail.gmail.com' \
    --to=vichy.kuo@gmail.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.