linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Magnus Damm <magnus.damm@gmail.com>
To: Kevin Hilman <khilman@ti.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	Alan Stern <stern@rowland.harvard.edu>,
	Linux-pm mailing list <linux-pm@lists.linux-foundation.org>,
	linux-omap@vger.kernel.org, Paul Walmsley <paul@pwsan.com>
Subject: Re: [linux-pm] calling runtime PM from system PM methods
Date: Thu, 9 Jun 2011 14:29:30 +0900	[thread overview]
Message-ID: <BANLkTimFJdRAipL0Gq_K=RYKcWmDNpds+w@mail.gmail.com> (raw)
In-Reply-To: <87hb80546c.fsf@ti.com>

Hi Kevin,

On Thu, Jun 9, 2011 at 7:50 AM, Kevin Hilman <khilman@ti.com> wrote:
> "Rafael J. Wysocki" <rjw@sisk.pl> writes:
>
> [...]
>
>> you need to separate the system suspend handling from runtime PM.
>
> /me risks getting yelled at again and jumps back in ;)

=)

>> Each of them requires a different approach, because the goal is really
>> different in both cases (basically, runtime PM triggers when the
>> device is _known_ to be idle, while system suspend may trigger while
>> it's actually being used).
>
> OK, but from the driver's perspective, the goals do not seem all that
> different to me:
>
> Runtime suspend
> 1. activity
> 2. activity finishes
> 3. device is _known_ to be idle
> 4. trigger device low-power transition
>
> system suspend [echo mem > /sys/power/state]
> 1. activity
> 2. prevent future activity, halt/wait for current activity
> 3. device is _known_ to be idle
> 4. trigger device low-power transition
>
> The only difference is step 2.  In runtime suspend, the activity
> finishes on its own, in system suspend, the activity is forcibly
> stopped.  In either case, after that point the device is known to be
> idle, and proceeding from there is identical.  IOW, based on the above,
> another way of looking at system PM is forcing idle so that runtime PM
> can happen.

I agree with the view that system wide suspend is similar to force
idle in the case of a non-wakeup device. If you flip that around then
from a device driver perspective, system wide suspend on a device
which is a wakeup source looks like forcing enable.

This is how I see the system wide suspend including wakeup support:

1. activity
(In case of an ethernet device for instance, the network may be up or down)
2. save current state
3. prevent future activity, halt/wait for current activity
4. device is _known_ to be idle
5. if wakeup is enabled, force enable regardless of state in step 1 above
6. trigger device low-power transition (if possible)

For system wide resume:

1. wake up from low-power state (if needed)
2. if wakeup was enabled, force idle - similar to suspend step 3 above
3. device is _known_ to be idle
4. restore state saved in suspend step 2 above
5. activity
(Also, make sure no interrupts are lost)

The two roles for each wakeup-capable driver, and switching between
those adds quite a bit of complexity. The absolute best part is the
interrupt leakage between the wakeup state and the real state. Almost
impossible to get right. =)

/ magnus
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-06-09  5:29 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 [this message]
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
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='BANLkTimFJdRAipL0Gq_K=RYKcWmDNpds+w@mail.gmail.com' \
    --to=magnus.damm@gmail.com \
    --cc=khilman@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --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).