From: Kevin Hilman <khilman@ti.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Alan Stern <stern@rowland.harvard.edu>,
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: Mon, 06 Jun 2011 15:25:48 -0700 [thread overview]
Message-ID: <87zkluwqab.fsf@ti.com> (raw)
In-Reply-To: <201106062029.36389.rjw@sisk.pl> (Rafael J. Wysocki's message of "Mon, 6 Jun 2011 20:29:36 +0200")
"Rafael J. Wysocki" <rjw@sisk.pl> writes:
[..]
> While it is tempting to try to get away with only two PM callbacks per
> driver instead of four (or even more), it generally is not doable, simply
> because driver callbacks are not executed directly by the core.
>
> The only way to address the problem of code duplication between .suspend()
> and .runtime_suspend() callbacks (and analogously for resume) I see at the
> moment is to make those callbacks execute common routines.
Makes sense if the "common routines" are in the driver. The problem
arises when the common routines are not actually in the driver, but are
instead at the subsystem (or in this case, device power domain) level.
Considering the OMAP I2C driver, it doesn't have (or need) runtime PM
callbacks. It does runtime PM get/put per-xfer, and has no context to
save/restore, so it needs no runtime PM callbacks, or no special PM code
other than runtime PM get/put calls. The device power domain level code
is managing the device clocks, power states, etc..
So what the system suspend needs to do is something like:
1. block any new xfers from starting
2. wait for any outstanding xfers
3. if device is already runtime suspended
- nothing to do
4. trigger idle transition (at device power domain level)
If runtime PM has not been disabled from userspace, it should always end
at step 3, since the last xfer will always trigger a runtime suspend.
However, if runtime PM has been disabled from
userspace/pm_runtime_forbid(), we need some way to do step 4. It's this
last 'trigger' step that I'm trying to figure out how a clean way of
implementing, particularily for drivers with no runtime PM callbacks.
Unless I'm missing something else, if runtime PM was not prevented via
userspace/pm_runtime_forbid(), we would not need this last 'trigger'
step. That's why a solution where any pending runtime PM transitions
would be allowed during system PM is the ideal solution (to me.) It
avoids having to call runtime PM methods from system PM all together.
The current OMAP I2C driver in mainline does this extra "trigger" step
by directly calling the subsystem (bus) callbacks. (It's also missing
the first two steps, which is a known bug and will be fixed once I
figure out the rest of this problem.)
However, now that we have device power domains, I was planning to extend
that to call device power domain callbacks first if they exist. Since
that was starting to duplicate callback precedence assumptions in the
runtime PM core, I was thinking about ways to avoid that by simply using
runtime PM directly, that's what got me to start this thread in the
first place.
So, I see 2 ways forward
1. Having some per-device option/flag that would allow pending runtime
PM transitions to happen during system PM, thus removing the need
for step 4 above.
2. Decide the "right" way to trigger device power domain (or subsytem)
transitions from the driver. Directly calling the subsystem
callbacks from the driver? Any other options?
I have a rather strong preference for the first one, but am realizing
that I may be in the minority. So what is the recommended solution for
2?
Kevin
P.S. I'm glad you got to discuss this with Paul & Magnus at LinuxCon
Japan. I wish I could've been there too. Hope your return trip went
well and your internet is back working soon.
next prev parent reply other threads:[~2011-06-06 22:25 UTC|newest]
Thread overview: 117+ 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 17:10 ` [linux-pm] " Kevin Hilman
2011-06-02 18:38 ` Alan Stern
2011-06-02 18:38 ` Alan Stern
2011-06-06 18:29 ` Rafael J. Wysocki
2011-06-06 18:29 ` [linux-pm] " Rafael J. Wysocki
2011-06-06 19:16 ` Alan Stern
2011-06-06 19:16 ` Alan Stern
2011-06-06 22:25 ` Kevin Hilman [this message]
2011-06-07 13:55 ` [linux-pm] " Alan Stern
2011-06-07 13:55 ` Alan Stern
2011-06-07 21:32 ` Rafael J. Wysocki
2011-06-07 21:32 ` [linux-pm] " Rafael J. Wysocki
2011-06-07 22:34 ` Kevin Hilman
2011-06-07 22:34 ` [linux-pm] " Kevin Hilman
2011-06-08 22:50 ` Kevin Hilman
2011-06-08 22:50 ` [linux-pm] " Kevin Hilman
2011-06-09 5:29 ` Magnus Damm
2011-06-09 5:29 ` [linux-pm] " Magnus Damm
2011-06-09 13:56 ` Alan Stern
2011-06-09 13:56 ` [linux-pm] " Alan Stern
2011-06-10 14:36 ` Mark Brown
2011-06-10 14:36 ` [linux-pm] " Mark Brown
2011-06-10 14:51 ` Alan Stern
2011-06-10 15:21 ` Mark Brown
2011-06-10 15:21 ` [linux-pm] " 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-10 21:27 ` [linux-pm] " Alan Stern
2011-06-11 11:42 ` Mark Brown
2011-06-11 11:42 ` [linux-pm] " Mark Brown
2011-06-11 20:56 ` Rafael J. Wysocki
2011-06-13 12:22 ` [linux-pm] " Mark Brown
2011-06-13 12:22 ` Mark Brown
2011-06-10 20:27 ` Rafael J. Wysocki
2011-06-10 18:42 ` Mark Brown
2011-06-10 18:38 ` Rafael J. Wysocki
2011-06-10 17:31 ` Mark Brown
2011-06-10 17:17 ` Alan Stern
2011-06-10 15:57 ` Mark Brown
2011-06-10 15:45 ` Alan Stern
2011-06-10 14:51 ` Alan Stern
2011-06-10 18:49 ` Rafael J. Wysocki
2011-06-10 18:49 ` [linux-pm] " Rafael J. Wysocki
2011-06-10 18:54 ` Mark Brown
2011-06-10 18:54 ` [linux-pm] " Mark Brown
2011-06-10 20:45 ` Rafael J. Wysocki
2011-06-10 20:45 ` [linux-pm] " Rafael J. Wysocki
2011-06-10 23:52 ` Kevin Hilman
2011-06-10 23:52 ` [linux-pm] " Kevin Hilman
2011-06-11 16:42 ` Alan Stern
2011-06-11 16:42 ` [linux-pm] " 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-12 18:27 ` Rafael J. Wysocki
2011-06-12 15:59 ` Alan Stern
2011-06-15 21:54 ` [linux-pm] " Kevin Hilman
2011-06-16 0:01 ` Rafael J. Wysocki
2011-06-16 0:01 ` [linux-pm] " 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-16 22:48 ` [linux-pm] " Rafael J. Wysocki
2011-06-17 19:47 ` Rafael J. Wysocki
2011-06-17 19:47 ` [linux-pm] " Rafael J. Wysocki
2011-06-17 20:04 ` Alan Stern
2011-06-17 20:04 ` [linux-pm] " 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 15:31 ` [linux-pm] " Alan Stern
2011-06-18 21:01 ` Rafael J. Wysocki
2011-06-18 21:01 ` [linux-pm] " Rafael J. Wysocki
2011-06-18 23:57 ` Rafael J. Wysocki
2011-06-18 23:57 ` [linux-pm] " Rafael J. Wysocki
2011-06-19 1:42 ` Alan Stern
2011-06-19 1:42 ` Alan Stern
2011-06-19 14:04 ` Rafael J. Wysocki
2011-06-19 14:04 ` [linux-pm] " Rafael J. Wysocki
2011-06-19 15:01 ` Alan Stern
2011-06-19 15:01 ` [linux-pm] " Alan Stern
2011-06-19 15:01 ` Alan Stern
2011-06-19 19:36 ` Rafael J. Wysocki
2011-06-19 19:36 ` [linux-pm] " Rafael J. Wysocki
2011-06-20 14:39 ` Alan Stern
2011-06-20 14:39 ` [linux-pm] " Alan Stern
2011-06-20 14:39 ` Alan Stern
2011-06-20 19:53 ` Rafael J. Wysocki
2011-06-20 19:53 ` [linux-pm] " Rafael J. Wysocki
2011-06-19 1:42 ` Alan Stern
2011-06-18 11:08 ` Rafael J. Wysocki
2011-06-17 21:29 ` Rafael J. Wysocki
2011-06-16 14:27 ` Alan Stern
2011-06-16 22:30 ` [linux-pm] " Rafael J. Wysocki
2011-06-16 22:30 ` Rafael J. Wysocki
2011-06-16 1:17 ` Kevin Hilman
2011-06-15 21:54 ` Kevin Hilman
2011-06-11 22:46 ` Rafael J. Wysocki
2011-06-10 23:14 ` Kevin Hilman
2011-06-10 23:14 ` [linux-pm] " Kevin Hilman
2011-06-11 16:27 ` Alan Stern
2011-06-11 16:27 ` Alan Stern
2011-06-11 23:13 ` [linux-pm] " Rafael J. Wysocki
2011-06-11 23:13 ` Rafael J. Wysocki
2011-06-06 22:25 ` Kevin Hilman
2011-06-02 14:18 ` Alan Stern
2011-06-06 18:01 ` 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=87zkluwqab.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 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.