diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-01 11:48:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-01 11:48:25 -0500 |
commit | e56425b135a8892d1e71ad5bb605d12c10efeb32 (patch) | |
tree | 9bb899e1b6b45a125bcc21554f3673878d932035 /drivers/clocksource/sh_cmt.c | |
parent | 786f8ba2e9449a7f01ec6bc35838d0a335921061 (diff) | |
parent | 6622e670b26fbaa9c4ae7772a4d2d0abd3414b51 (diff) |
Merge branch 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
posix-timers.c: Don't export local functions
clocksource: start CMT at clocksource resume
clocksource: add suspend callback
clocksource: add argument to resume callback
ntp: Cleanup xtime references in ntp.c
ntp: Make time_esterror and time_maxerror static
Diffstat (limited to 'drivers/clocksource/sh_cmt.c')
-rw-r--r-- | drivers/clocksource/sh_cmt.c | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index 6fe4f7701188..578595c4425d 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c | |||
@@ -40,7 +40,6 @@ struct sh_cmt_priv { | |||
40 | struct platform_device *pdev; | 40 | struct platform_device *pdev; |
41 | 41 | ||
42 | unsigned long flags; | 42 | unsigned long flags; |
43 | unsigned long flags_suspend; | ||
44 | unsigned long match_value; | 43 | unsigned long match_value; |
45 | unsigned long next_match_value; | 44 | unsigned long next_match_value; |
46 | unsigned long max_match_value; | 45 | unsigned long max_match_value; |
@@ -432,6 +431,11 @@ static void sh_cmt_clocksource_disable(struct clocksource *cs) | |||
432 | sh_cmt_stop(cs_to_sh_cmt(cs), FLAG_CLOCKSOURCE); | 431 | sh_cmt_stop(cs_to_sh_cmt(cs), FLAG_CLOCKSOURCE); |
433 | } | 432 | } |
434 | 433 | ||
434 | static void sh_cmt_clocksource_resume(struct clocksource *cs) | ||
435 | { | ||
436 | sh_cmt_start(cs_to_sh_cmt(cs), FLAG_CLOCKSOURCE); | ||
437 | } | ||
438 | |||
435 | static int sh_cmt_register_clocksource(struct sh_cmt_priv *p, | 439 | static int sh_cmt_register_clocksource(struct sh_cmt_priv *p, |
436 | char *name, unsigned long rating) | 440 | char *name, unsigned long rating) |
437 | { | 441 | { |
@@ -442,6 +446,8 @@ static int sh_cmt_register_clocksource(struct sh_cmt_priv *p, | |||
442 | cs->read = sh_cmt_clocksource_read; | 446 | cs->read = sh_cmt_clocksource_read; |
443 | cs->enable = sh_cmt_clocksource_enable; | 447 | cs->enable = sh_cmt_clocksource_enable; |
444 | cs->disable = sh_cmt_clocksource_disable; | 448 | cs->disable = sh_cmt_clocksource_disable; |
449 | cs->suspend = sh_cmt_clocksource_disable; | ||
450 | cs->resume = sh_cmt_clocksource_resume; | ||
445 | cs->mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8); | 451 | cs->mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8); |
446 | cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; | 452 | cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; |
447 | pr_info("sh_cmt: %s used as clock source\n", cs->name); | 453 | pr_info("sh_cmt: %s used as clock source\n", cs->name); |
@@ -674,38 +680,11 @@ static int __devexit sh_cmt_remove(struct platform_device *pdev) | |||
674 | return -EBUSY; /* cannot unregister clockevent and clocksource */ | 680 | return -EBUSY; /* cannot unregister clockevent and clocksource */ |
675 | } | 681 | } |
676 | 682 | ||
677 | static int sh_cmt_suspend(struct device *dev) | ||
678 | { | ||
679 | struct platform_device *pdev = to_platform_device(dev); | ||
680 | struct sh_cmt_priv *p = platform_get_drvdata(pdev); | ||
681 | |||
682 | /* save flag state and stop CMT channel */ | ||
683 | p->flags_suspend = p->flags; | ||
684 | sh_cmt_stop(p, p->flags); | ||
685 | return 0; | ||
686 | } | ||
687 | |||
688 | static int sh_cmt_resume(struct device *dev) | ||
689 | { | ||
690 | struct platform_device *pdev = to_platform_device(dev); | ||
691 | struct sh_cmt_priv *p = platform_get_drvdata(pdev); | ||
692 | |||
693 | /* start CMT channel from saved state */ | ||
694 | sh_cmt_start(p, p->flags_suspend); | ||
695 | return 0; | ||
696 | } | ||
697 | |||
698 | static struct dev_pm_ops sh_cmt_dev_pm_ops = { | ||
699 | .suspend = sh_cmt_suspend, | ||
700 | .resume = sh_cmt_resume, | ||
701 | }; | ||
702 | |||
703 | static struct platform_driver sh_cmt_device_driver = { | 683 | static struct platform_driver sh_cmt_device_driver = { |
704 | .probe = sh_cmt_probe, | 684 | .probe = sh_cmt_probe, |
705 | .remove = __devexit_p(sh_cmt_remove), | 685 | .remove = __devexit_p(sh_cmt_remove), |
706 | .driver = { | 686 | .driver = { |
707 | .name = "sh_cmt", | 687 | .name = "sh_cmt", |
708 | .pm = &sh_cmt_dev_pm_ops, | ||
709 | } | 688 | } |
710 | }; | 689 | }; |
711 | 690 | ||