From: Dave Gerlach <d-gerlach@ti.com>
To: Tony Lindgren <tony@atomide.com>,
Santosh Shilimkar <ssantosh@kernel.org>,
Russell King <linux@armlinux.org.uk>
Cc: <linux-arm-kernel@lists.infradead.org>,
<linux-omap@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Dave Gerlach <d-gerlach@ti.com>, Keerthy J <j-keerthy@ti.com>
Subject: [PATCH 2/8] ARM: OMAP2+: timer: Add suspend-resume callbacks for clkevent device
Date: Tue, 28 Mar 2017 20:57:55 -0500 [thread overview]
Message-ID: <20170329015801.22240-3-d-gerlach@ti.com> (raw)
In-Reply-To: <20170329015801.22240-1-d-gerlach@ti.com>
OMAP timer code registers two timers - one as clocksource
and one as clockevent. Since AM33XX has only one usable timer
in the WKUP domain one of the timers needs suspend-resume
support to restore the configuration to pre-suspend state.
commit adc78e6b9946 ("timekeeping: Add suspend and resume
of clock event devices") introduced .suspend and .resume
callbacks for clock event devices. Leverage these
callbacks to have AM33XX clockevent timer behave properly
across system suspend. Extend the use of the .suspend and
.resume callbacks used by am335x clockevent to am437x as well.
Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
---
arch/arm/mach-omap2/timer.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 07dd692c4737..70670dfd7135 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -68,6 +68,9 @@
static struct omap_dm_timer clkev;
static struct clock_event_device clockevent_gpt;
+/* Clockevent hwmod for am335x and am437x suspend */
+static struct omap_hwmod *clockevent_gpt_hwmod;
+
#ifdef CONFIG_SOC_HAS_REALTIME_COUNTER
static unsigned long arch_timer_freq;
@@ -125,6 +128,23 @@ static int omap2_gp_timer_set_periodic(struct clock_event_device *evt)
return 0;
}
+static void omap_clkevt_idle(struct clock_event_device *unused)
+{
+ if (!clockevent_gpt_hwmod)
+ return;
+
+ omap_hwmod_idle(clockevent_gpt_hwmod);
+}
+
+static void omap_clkevt_unidle(struct clock_event_device *unused)
+{
+ if (!clockevent_gpt_hwmod)
+ return;
+
+ omap_hwmod_enable(clockevent_gpt_hwmod);
+ __omap_dm_timer_int_enable(&clkev, OMAP_TIMER_INT_OVERFLOW);
+}
+
static struct clock_event_device clockevent_gpt = {
.features = CLOCK_EVT_FEAT_PERIODIC |
CLOCK_EVT_FEAT_ONESHOT,
@@ -358,6 +378,14 @@ static void __init omap2_gp_clockevent_init(int gptimer_id,
3, /* Timer internal resynch latency */
0xffffffff);
+ if (soc_is_am33xx() || soc_is_am43xx()) {
+ clockevent_gpt.suspend = omap_clkevt_idle;
+ clockevent_gpt.resume = omap_clkevt_unidle;
+
+ clockevent_gpt_hwmod =
+ omap_hwmod_lookup(clockevent_gpt.name);
+ }
+
pr_info("OMAP clockevent source: %s at %lu Hz\n", clockevent_gpt.name,
clkev.rate);
}
--
2.11.0
next prev parent reply other threads:[~2017-03-29 1:59 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-29 1:57 [PATCH 0/8] ARM: OMAP2+: AM33XX/AM43XX: Add suspend-resume support Dave Gerlach
2017-03-29 1:57 ` [PATCH 1/8] ARM: OMAP: Wakeupgen: Add context save/restore for AM43XX Dave Gerlach
2017-03-29 1:57 ` Dave Gerlach [this message]
2017-03-29 1:57 ` [PATCH 3/8] ARM: OMAP2+: pm: Remove __init from omap_pm_clkdms_setup Dave Gerlach
2017-03-29 1:57 ` [PATCH 4/8] ARM: OMAP2+: Introduce low-level suspend code for AM33XX Dave Gerlach
2017-03-29 1:57 ` [PATCH 5/8] ARM: OMAP2+: Introduce low-level suspend code for AM43XX Dave Gerlach
2017-03-29 1:57 ` [PATCH 6/8] ARM: OMAP2+: pm33xx-core: Add platform code needed for PM Dave Gerlach
2017-04-04 16:19 ` Tony Lindgren
2017-03-29 1:58 ` [PATCH 7/8] soc: ti: Add pm33xx driver for basic suspend support Dave Gerlach
2017-03-29 1:58 ` [PATCH 8/8] ARM: OMAP2+: Create dummy platform_device for pm33xx Dave Gerlach
2017-03-29 17:13 ` [PATCH 0/8] ARM: OMAP2+: AM33XX/AM43XX: Add suspend-resume support Tony Lindgren
2017-03-29 18:50 ` Dave Gerlach
2017-05-16 15:47 ` Tony Lindgren
2017-05-16 15:49 ` Dave Gerlach
2017-05-18 14:19 ` Dave Gerlach
2017-05-18 14:59 ` 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=20170329015801.22240-3-d-gerlach@ti.com \
--to=d-gerlach@ti.com \
--cc=j-keerthy@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=ssantosh@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®