public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sylwester Nawrocki <s.nawrocki@samsung.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Partha Basak <p-basak2@ti.com>,
	Linux-pm mailing list <linux-pm@lists.linux-foundation.org>
Subject: Re: [PATCH ver. 2] PM: add synchronous runtime interface for interrupt	handlers
Date: Mon, 11 Apr 2011 17:47:40 +0200	[thread overview]
Message-ID: <4DA3229C.8070808@samsung.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1011191044400.1344-100000__32659.8797612407$1290181721$gmane$org@iolanthe.rowland.org>

Hello,

On 11/19/2010 04:45 PM, Alan Stern wrote:
> This patch (as1431b) makes the synchronous runtime-PM interface
> suitable for use in interrupt handlers.  Subsystems can call the new
> pm_runtime_irq_safe() function to tell the PM core that a device's
> runtime-PM callbacks should be invoked with interrupts disabled
> (runtime_suspend and runtime_resume callbacks will be invoked with the
> spinlock held as well).  This permits the pm_runtime_get_sync() and
> pm_runtime_put_sync() routines to be called from within interrupt
> handlers.
> 
> When a device is declared irq-safe in this way, the PM core increments
> the parent's usage count, so the parent will never be runtime
> suspended.  This prevents difficult situations in which an irq-safe
> device can't resume because it is forced to wait for its non-irq-safe
> parent.
> 
> Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
> 
> ---
...
>  
> +  void pm_runtime_irq_safe(struct device *dev);
> +    - set the power.irq_safe flag for the device, causing the runtime-PM
> +      callbacks to be invoked with interrupts disabled
> +
>    void pm_runtime_mark_last_busy(struct device *dev);
>      - set the power.last_busy field to the current time
>  
> @@ -438,6 +454,16 @@ pm_runtime_suspended()
>  pm_runtime_mark_last_busy()
>  pm_runtime_autosuspend_expiration()
>  
> +If pm_runtime_irq_safe() has been called for a device then the following helper
> +functions may also be called in interrupt context:

I was wondering what is the proper usage of this API. From a point of view of
a driver, does it mean that in runtime_resume/runtime_suspend helpers any
blocking calls cannot be used, so the device driver is prepared for situations
when some other subsystem invokes pm_runtime_irq_safe() on its device?

Or is pm_runtime_irq_safe() intended to be called only by the device driver
in such case?

I'd like to use blocking calls for a voltage regulator control within
the runtime PM helpers in the driver but I'm not sure whether this wouldn't
violate the API.

Thanks,
Sylwester

> +
> +pm_runtime_idle()
> +pm_runtime_suspend()
> +pm_runtime_autosuspend()
> +pm_runtime_resume()
> +pm_runtime_get_sync()
> +pm_runtime_put_sync()
> +
>  5. Run-time PM Initialization, Device Probing and Removal
>  
>  Initially, the run-time PM is disabled for all devices, which means that the
> 
-- 
Sylwester Nawrocki
Samsung Poland R&D Center

  reply	other threads:[~2011-04-11 15:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201010062347.18232.rjw@sisk.pl>
2010-10-07 15:26 ` [PATCH] PM: add synchronous runtime interface for interrupt handlers Alan Stern
2010-11-19 15:45 ` [PATCH ver. 2] " Alan Stern
2011-04-11 15:47   ` Sylwester Nawrocki [this message]
2011-04-11 16:08     ` Alan Stern
2011-04-11 17:20       ` Sylwester Nawrocki
2011-04-11 18:37         ` Alan Stern
     [not found] <Pine.LNX.4.44L0.1011191044400.1344-100000@iolanthe.rowland.org>
2010-11-20 12:56 ` Rafael J. Wysocki
     [not found] <201011201356.11782.rjw@sisk.pl>
2010-11-20 16:59 ` Alan Stern
     [not found] <Pine.LNX.4.44L0.1011201152210.5871-100000@netrider.rowland.org>
2010-11-20 19:41 ` Alan Stern
2010-11-21 23:41 ` Rafael J. Wysocki
     [not found] <Pine.LNX.4.44L0.1011201437450.8483-100000@netrider.rowland.org>
2010-11-21 23:45 ` Rafael J. Wysocki
     [not found] <201011220041.06440.rjw@sisk.pl>
2010-11-22 15:38 ` Alan Stern
     [not found] <Pine.LNX.4.44L0.1011221027120.1758-100000@iolanthe.rowland.org>
2010-11-22 23:01 ` Rafael J. Wysocki
     [not found] <201011230001.20241.rjw@sisk.pl>
2010-11-23  3:19 ` Alan Stern
     [not found] <Pine.LNX.4.44L0.1011222204440.26293-100000@netrider.rowland.org>
2010-11-23 22:51 ` Rafael J. Wysocki
     [not found] ` <201011232351.11340.rjw@sisk.pl>
2010-11-24  0:11   ` Kevin Hilman
2010-11-24 14:56   ` Alan Stern
     [not found] <87mxozd1ho.fsf@deeprootsystems.com>
2010-11-24 16:43 ` Alan Stern
     [not found] <Pine.LNX.4.44L0.1011241141010.1513-100000@iolanthe.rowland.org>
2010-11-24 18:03 ` Kevin Hilman
     [not found] <Pine.LNX.4.44L0.1011240950220.1513-100000@iolanthe.rowland.org>
2010-11-24 20:33 ` 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=4DA3229C.8070808@samsung.com \
    --to=s.nawrocki@samsung.com \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=p-basak2@ti.com \
    --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