summaryrefslogtreecommitdiffstats
path: root/drivers/clocksource
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2012-08-06 01:43:41 +0200
committerRafael J. Wysocki <rjw@sisk.pl>2012-09-04 01:36:02 +0200
commitcc7ad4564b1097c916834dc919678867631e7676 (patch)
tree6939a8e98b9f4fbe9612b78a75927bb5c3666094 /drivers/clocksource
parent9bb5ec8872312751f992cdac9968805fe03e81aa (diff)
downloadop-kernel-dev-cc7ad4564b1097c916834dc919678867631e7676.zip
op-kernel-dev-cc7ad4564b1097c916834dc919678867631e7676.tar.gz
sh: MTU2: Introduce clock events suspend/resume routines
Introduce suspend/resume routines for SH MTU2 clock event devices such that if those devices belong to a PM domain, the generic PM domains framework will be notified that the given domain may be turned off (during system suspend) or that it has to be turned on (during system resume). Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Magnus Damm <damm@opensource.se>
Diffstat (limited to 'drivers/clocksource')
-rw-r--r--drivers/clocksource/sh_mtu2.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c
index d9b76ca..a55bb90 100644
--- a/drivers/clocksource/sh_mtu2.c
+++ b/drivers/clocksource/sh_mtu2.c
@@ -208,6 +208,16 @@ static void sh_mtu2_clock_event_mode(enum clock_event_mode mode,
}
}
+static void sh_mtu2_clock_event_suspend(struct clock_event_device *ced)
+{
+ pm_genpd_syscore_poweroff(&ced_to_sh_mtu2(ced)->pdev->dev);
+}
+
+static void sh_mtu2_clock_event_resume(struct clock_event_device *ced)
+{
+ pm_genpd_syscore_poweron(&ced_to_sh_mtu2(ced)->pdev->dev);
+}
+
static void sh_mtu2_register_clockevent(struct sh_mtu2_priv *p,
char *name, unsigned long rating)
{
@@ -221,6 +231,8 @@ static void sh_mtu2_register_clockevent(struct sh_mtu2_priv *p,
ced->rating = rating;
ced->cpumask = cpumask_of(0);
ced->set_mode = sh_mtu2_clock_event_mode;
+ ced->suspend = sh_mtu2_clock_event_suspend;
+ ced->resume = sh_mtu2_clock_event_resume;
dev_info(&p->pdev->dev, "used for clock events\n");
clockevents_register_device(ced);
@@ -307,8 +319,12 @@ static int __devinit sh_mtu2_probe(struct platform_device *pdev)
struct sh_mtu2_priv *p = platform_get_drvdata(pdev);
int ret;
- if (!is_early_platform_device(pdev))
- pm_genpd_dev_always_on(&pdev->dev, true);
+ if (!is_early_platform_device(pdev)) {
+ struct sh_timer_config *cfg = pdev->dev.platform_data;
+
+ if (cfg->clockevent_rating)
+ pm_genpd_dev_always_on(&pdev->dev, true);
+ }
if (p) {
dev_info(&pdev->dev, "kept as earlytimer\n");
OpenPOWER on IntegriCloud