linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@ti.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	Linux-pm mailing list <linux-pm@lists.linux-foundation.org>,
	linux-omap@vger.kernel.org, Magnus Damm <magnus.damm@gmail.com>,
	Paul Walmsley <paul@pwsan.com>
Subject: Re: [linux-pm] calling runtime PM from system PM methods
Date: Fri, 10 Jun 2011 16:52:33 -0700	[thread overview]
Message-ID: <87ipsdnt1a.fsf@ti.com> (raw)
In-Reply-To: Pine.LNX.4.44L0.1106090945490.2081-100000@iolanthe.rowland.org

Alan Stern <stern@rowland.harvard.edu> writes:

[...]

>> More specifically, what should be the approach in system suspend when a
>> device is already runtime suspended?  If you treat runtime and system PM
>> as completely independent, you would have to runtime resume the device
>> so that it can then be immediately system suspended.
>
> Assuming the wakeup setting is correct, and assuming you use the same 
> power level for runtime suspend and system suspend, then nothing needs 
> to be done.
>
> If the wakeup setting is not correct, it has to be changed.  That 
> often implies going back to full power in order to change the 
> wakeup setting, then going to low power again.

OK, but how should this be implemented?  

If the device is runtime suspended at system suspend time, it implies
that somwhere in the system suspend path, the device has to be powered
on and enabled (a.k.a. runtime resumed.)

>From a driver writer's perspective, doing a pm_runtime_get_sync() would
be the obvious choice, but that causes nesting of ->runtime_resume
callbacks within ->suspend callbacks which is apparently forbidden (or
rather strongly recommended against :)

Now, assuming the driver's suspend can't do a pm_runtime_get()...

In order to power on & enable the device, the driver has to essentially
duplicate everything that would be done by a runtime resume.

The problem comes because this work is shared between the driver and the
subsystem.  IOW, it's the driver's ->suspend() callback that decides
whether or not the device needs to be powered-on/enabled (e.g. to
enable/disable wakeups), but it might be the subsystem that actually has
does the magic_device_set_full_power(), magic_device_enable().

So once the driver's ->suspend() realizes it needs to power on & enable
the device, it has no way to tell the subsystem to do so, wait for it to
happen, and then enable/disable its wakeups.

Maybe I'm being really dense, really blind, or really stubborn (or all
three), but it seems to be that using runtime PM calls to implement
these things would be the most obvious and the most readable.

Kevin

  parent reply	other threads:[~2011-06-10 23:52 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-02  0:05 calling runtime PM from system PM methods Kevin Hilman
2011-06-02 14:18 ` [linux-pm] " Alan Stern
2011-06-02 17:10   ` Kevin Hilman
2011-06-02 18:38     ` Alan Stern
2011-06-06 18:29     ` Rafael J. Wysocki
2011-06-06 19:16       ` Alan Stern
2011-06-06 22:25       ` Kevin Hilman
2011-06-07 13:55         ` Alan Stern
2011-06-07 21:32         ` Rafael J. Wysocki
2011-06-07 22:34           ` Kevin Hilman
2011-06-08 22:50           ` Kevin Hilman
2011-06-09  5:29             ` Magnus Damm
2011-06-09 13:56             ` Alan Stern
2011-06-10 14:36               ` Mark Brown
2011-06-10 14:51                 ` Alan Stern
2011-06-10 15:21                   ` Mark Brown
2011-06-10 15:45                     ` Alan Stern
2011-06-10 15:57                       ` Mark Brown
2011-06-10 17:17                         ` Alan Stern
2011-06-10 17:31                           ` Mark Brown
2011-06-10 18:38                             ` Rafael J. Wysocki
2011-06-10 18:42                               ` Mark Brown
2011-06-10 20:27                                 ` Rafael J. Wysocki
2011-06-10 21:27                                   ` Alan Stern
2011-06-11 11:42                                   ` Mark Brown
2011-06-11 20:56                                     ` Rafael J. Wysocki
2011-06-13 12:22                                       ` [linux-pm] " Mark Brown
2011-06-10 18:49                 ` Rafael J. Wysocki
2011-06-10 18:54                   ` Mark Brown
2011-06-10 20:45                     ` Rafael J. Wysocki
2011-06-10 23:52               ` Kevin Hilman [this message]
2011-06-11 16:42                 ` Alan Stern
2011-06-11 22:46                   ` Rafael J. Wysocki
2011-06-12 15:59                     ` Alan Stern
2011-06-12 18:27                       ` Rafael J. Wysocki
2011-06-15 21:54                     ` Kevin Hilman
2011-06-16  0:01                       ` Rafael J. Wysocki
2011-06-16  1:17                         ` Kevin Hilman
2011-06-16 14:27                           ` Alan Stern
2011-06-16 22:48                             ` Rafael J. Wysocki
2011-06-17 19:47                               ` Rafael J. Wysocki
2011-06-17 20:04                                 ` Alan Stern
2011-06-17 21:29                                   ` Rafael J. Wysocki
2011-06-18 11:08                                     ` Rafael J. Wysocki
2011-06-18 15:31                                       ` Alan Stern
2011-06-18 21:01                                         ` Rafael J. Wysocki
2011-06-18 23:57                                           ` Rafael J. Wysocki
2011-06-19  1:42                                             ` Alan Stern
2011-06-19 14:04                                               ` Rafael J. Wysocki
2011-06-19 15:01                                                 ` Alan Stern
2011-06-19 19:36                                                   ` Rafael J. Wysocki
2011-06-20 14:39                                                     ` Alan Stern
2011-06-20 19:53                                                       ` Rafael J. Wysocki
2011-06-16 22:30                           ` Rafael J. Wysocki
2011-06-10 23:14           ` Kevin Hilman
2011-06-11 16:27             ` Alan Stern
2011-06-11 23:13             ` Rafael J. Wysocki
2011-06-06 18:01 ` Rafael J. Wysocki

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=87ipsdnt1a.fsf@ti.com \
    --to=khilman@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=magnus.damm@gmail.com \
    --cc=paul@pwsan.com \
    --cc=rjw@sisk.pl \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).