diff options
Diffstat (limited to 'drivers/clocksource')
-rw-r--r-- | drivers/clocksource/sh_mtu2.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c index d9b76ca64a61..a55bb905812e 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, | |||
208 | } | 208 | } |
209 | } | 209 | } |
210 | 210 | ||
211 | static void sh_mtu2_clock_event_suspend(struct clock_event_device *ced) | ||
212 | { | ||
213 | pm_genpd_syscore_poweroff(&ced_to_sh_mtu2(ced)->pdev->dev); | ||
214 | } | ||
215 | |||
216 | static void sh_mtu2_clock_event_resume(struct clock_event_device *ced) | ||
217 | { | ||
218 | pm_genpd_syscore_poweron(&ced_to_sh_mtu2(ced)->pdev->dev); | ||
219 | } | ||
220 | |||
211 | static void sh_mtu2_register_clockevent(struct sh_mtu2_priv *p, | 221 | static void sh_mtu2_register_clockevent(struct sh_mtu2_priv *p, |
212 | char *name, unsigned long rating) | 222 | char *name, unsigned long rating) |
213 | { | 223 | { |
@@ -221,6 +231,8 @@ static void sh_mtu2_register_clockevent(struct sh_mtu2_priv *p, | |||
221 | ced->rating = rating; | 231 | ced->rating = rating; |
222 | ced->cpumask = cpumask_of(0); | 232 | ced->cpumask = cpumask_of(0); |
223 | ced->set_mode = sh_mtu2_clock_event_mode; | 233 | ced->set_mode = sh_mtu2_clock_event_mode; |
234 | ced->suspend = sh_mtu2_clock_event_suspend; | ||
235 | ced->resume = sh_mtu2_clock_event_resume; | ||
224 | 236 | ||
225 | dev_info(&p->pdev->dev, "used for clock events\n"); | 237 | dev_info(&p->pdev->dev, "used for clock events\n"); |
226 | clockevents_register_device(ced); | 238 | clockevents_register_device(ced); |
@@ -307,8 +319,12 @@ static int __devinit sh_mtu2_probe(struct platform_device *pdev) | |||
307 | struct sh_mtu2_priv *p = platform_get_drvdata(pdev); | 319 | struct sh_mtu2_priv *p = platform_get_drvdata(pdev); |
308 | int ret; | 320 | int ret; |
309 | 321 | ||
310 | if (!is_early_platform_device(pdev)) | 322 | if (!is_early_platform_device(pdev)) { |
311 | pm_genpd_dev_always_on(&pdev->dev, true); | 323 | struct sh_timer_config *cfg = pdev->dev.platform_data; |
324 | |||
325 | if (cfg->clockevent_rating) | ||
326 | pm_genpd_dev_always_on(&pdev->dev, true); | ||
327 | } | ||
312 | 328 | ||
313 | if (p) { | 329 | if (p) { |
314 | dev_info(&pdev->dev, "kept as earlytimer\n"); | 330 | dev_info(&pdev->dev, "kept as earlytimer\n"); |