All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@ti.com>
To: Tony Lindgren <tony@atomide.com>
Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/6] OMAP2+: PM: SmartReflex: use put_sync_suspend for IRQ-safe disabling
Date: Thu,  4 Aug 2011 08:45:09 -0700	[thread overview]
Message-ID: <1312472710-31758-6-git-send-email-khilman@ti.com> (raw)
In-Reply-To: <1312472710-31758-1-git-send-email-khilman@ti.com>

From: Colin Cross <ccross@google.com>

omap_sr_disable_reset_volt is called with irqs off in omapx_enter_sleep,
as part of idle sequence, this eventually calls sr_disable and
pm_runtime_put_sync. pm_runtime_put_sync calls rpm_idle, which will
enable interrupts in order to call the callback. In this short interval
when interrupts are enabled, scenarios such as the following can occur:
while interrupts are enabled, the timer interrupt that is supposed to
wake the device out of idle occurs and is acked, so when the CPU finally
goes to off, the timer is already gone, missing a wakeup event.

Further, as the documentation for runtime states:"
 However, subsystems can use the pm_runtime_irq_safe() helper function
 to tell the PM core that a device's ->runtime_suspend() and ->runtime_resume()
 callbacks should be invoked in atomic context with interrupts disabled
 (->runtime_idle() is still invoked the default way)."

Hence, replace pm_runtime_put_sync with pm_runtime_put_sync_suspend
to invoke the suspend handler and shut off the fclk for SmartReflex
module instead of using the idle handler in interrupt disabled context.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Colin Cross <ccross@google.com>
[khilman@ti.com: minor Subject edits]
Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap2/smartreflex.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index dc8e86a..34c01a7 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -621,7 +621,7 @@ void sr_disable(struct voltagedomain *voltdm)
 			sr_v2_disable(sr);
 	}
 
-	pm_runtime_put_sync(&sr->pdev->dev);
+	pm_runtime_put_sync_suspend(&sr->pdev->dev);
 }
 
 /**
-- 
1.7.6


WARNING: multiple messages have this Message-ID (diff)
From: khilman@ti.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/6] OMAP2+: PM: SmartReflex: use put_sync_suspend for IRQ-safe disabling
Date: Thu,  4 Aug 2011 08:45:09 -0700	[thread overview]
Message-ID: <1312472710-31758-6-git-send-email-khilman@ti.com> (raw)
In-Reply-To: <1312472710-31758-1-git-send-email-khilman@ti.com>

From: Colin Cross <ccross@google.com>

omap_sr_disable_reset_volt is called with irqs off in omapx_enter_sleep,
as part of idle sequence, this eventually calls sr_disable and
pm_runtime_put_sync. pm_runtime_put_sync calls rpm_idle, which will
enable interrupts in order to call the callback. In this short interval
when interrupts are enabled, scenarios such as the following can occur:
while interrupts are enabled, the timer interrupt that is supposed to
wake the device out of idle occurs and is acked, so when the CPU finally
goes to off, the timer is already gone, missing a wakeup event.

Further, as the documentation for runtime states:"
 However, subsystems can use the pm_runtime_irq_safe() helper function
 to tell the PM core that a device's ->runtime_suspend() and ->runtime_resume()
 callbacks should be invoked in atomic context with interrupts disabled
 (->runtime_idle() is still invoked the default way)."

Hence, replace pm_runtime_put_sync with pm_runtime_put_sync_suspend
to invoke the suspend handler and shut off the fclk for SmartReflex
module instead of using the idle handler in interrupt disabled context.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Colin Cross <ccross@google.com>
[khilman at ti.com: minor Subject edits]
Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap2/smartreflex.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index dc8e86a..34c01a7 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -621,7 +621,7 @@ void sr_disable(struct voltagedomain *voltdm)
 			sr_v2_disable(sr);
 	}
 
-	pm_runtime_put_sync(&sr->pdev->dev);
+	pm_runtime_put_sync_suspend(&sr->pdev->dev);
 }
 
 /**
-- 
1.7.6

  parent reply	other threads:[~2011-08-04 15:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-04 15:45 [PATCH 0/6] OMAP: misc. PM-related fixes for v3.1-rc Kevin Hilman
2011-08-04 15:45 ` Kevin Hilman
2011-08-04 15:45 ` [PATCH 1/6] OMAP2+: Kconfig: don't select PM in OMAP2PLUS_TYPICAL Kevin Hilman
2011-08-04 15:45   ` Kevin Hilman
2011-08-04 15:45 ` [PATCH 2/6] OMAP3+: SR: ensure pm-runtime callbacks can be invoked with IRQs disabled Kevin Hilman
2011-08-04 15:45   ` Kevin Hilman
2011-08-04 15:45 ` [PATCH 3/6] OMAP1: enable GENERIC_IRQ_CHIP Kevin Hilman
2011-08-04 15:45   ` Kevin Hilman
2011-08-04 15:45 ` [PATCH 4/6] OMAP3: beagle: don't touch omap_device internals Kevin Hilman
2011-08-04 15:45   ` Kevin Hilman
2011-08-04 15:45 ` Kevin Hilman [this message]
2011-08-04 15:45   ` [PATCH 5/6] OMAP2+: PM: SmartReflex: use put_sync_suspend for IRQ-safe disabling Kevin Hilman
2011-08-04 15:45 ` [PATCH 6/6] OMAP: McBSP: use existing macros for converting between devices Kevin Hilman
2011-08-04 15:45   ` Kevin Hilman
2011-08-05  6:02   ` Jarkko Nikula
2011-08-05  6:02     ` Jarkko Nikula
2011-08-05 14:57     ` Kevin Hilman
2011-08-05 14:57       ` Kevin Hilman
2011-08-09 11:14 ` [PATCH 0/6] OMAP: misc. PM-related fixes for v3.1-rc Tony Lindgren
2011-08-09 11:14   ` Tony Lindgren
2011-08-10 10:39   ` Tony Lindgren
2011-08-10 10:39     ` Tony Lindgren

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=1312472710-31758-6-git-send-email-khilman@ti.com \
    --to=khilman@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.com \
    /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.