~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/sh/clk/core.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include <linux/module.h>
22
22
#include <linux/mutex.h>
23
23
#include <linux/list.h>
24
 
#include <linux/sysdev.h>
 
24
#include <linux/syscore_ops.h>
25
25
#include <linux/seq_file.h>
26
26
#include <linux/err.h>
27
27
#include <linux/io.h>
630
630
EXPORT_SYMBOL_GPL(clk_round_parent);
631
631
 
632
632
#ifdef CONFIG_PM
633
 
static int clks_sysdev_suspend(struct sys_device *dev, pm_message_t state)
 
633
static void clks_core_resume(void)
634
634
{
635
 
        static pm_message_t prev_state;
636
635
        struct clk *clkp;
637
636
 
638
 
        switch (state.event) {
639
 
        case PM_EVENT_ON:
640
 
                /* Resumeing from hibernation */
641
 
                if (prev_state.event != PM_EVENT_FREEZE)
642
 
                        break;
643
 
 
644
 
                list_for_each_entry(clkp, &clock_list, node) {
645
 
                        if (likely(clkp->ops)) {
646
 
                                unsigned long rate = clkp->rate;
647
 
 
648
 
                                if (likely(clkp->ops->set_parent))
649
 
                                        clkp->ops->set_parent(clkp,
650
 
                                                clkp->parent);
651
 
                                if (likely(clkp->ops->set_rate))
652
 
                                        clkp->ops->set_rate(clkp, rate);
653
 
                                else if (likely(clkp->ops->recalc))
654
 
                                        clkp->rate = clkp->ops->recalc(clkp);
655
 
                        }
 
637
        list_for_each_entry(clkp, &clock_list, node) {
 
638
                if (likely(clkp->usecount && clkp->ops)) {
 
639
                        unsigned long rate = clkp->rate;
 
640
 
 
641
                        if (likely(clkp->ops->set_parent))
 
642
                                clkp->ops->set_parent(clkp,
 
643
                                        clkp->parent);
 
644
                        if (likely(clkp->ops->set_rate))
 
645
                                clkp->ops->set_rate(clkp, rate);
 
646
                        else if (likely(clkp->ops->recalc))
 
647
                                clkp->rate = clkp->ops->recalc(clkp);
656
648
                }
657
 
                break;
658
 
        case PM_EVENT_FREEZE:
659
 
                break;
660
 
        case PM_EVENT_SUSPEND:
661
 
                break;
662
649
        }
663
 
 
664
 
        prev_state = state;
665
 
        return 0;
666
 
}
667
 
 
668
 
static int clks_sysdev_resume(struct sys_device *dev)
669
 
{
670
 
        return clks_sysdev_suspend(dev, PMSG_ON);
671
 
}
672
 
 
673
 
static struct sysdev_class clks_sysdev_class = {
674
 
        .name = "clks",
675
 
};
676
 
 
677
 
static struct sysdev_driver clks_sysdev_driver = {
678
 
        .suspend = clks_sysdev_suspend,
679
 
        .resume = clks_sysdev_resume,
680
 
};
681
 
 
682
 
static struct sys_device clks_sysdev_dev = {
683
 
        .cls = &clks_sysdev_class,
684
 
};
685
 
 
686
 
static int __init clk_sysdev_init(void)
687
 
{
688
 
        sysdev_class_register(&clks_sysdev_class);
689
 
        sysdev_driver_register(&clks_sysdev_class, &clks_sysdev_driver);
690
 
        sysdev_register(&clks_sysdev_dev);
691
 
 
692
 
        return 0;
693
 
}
694
 
subsys_initcall(clk_sysdev_init);
 
650
}
 
651
 
 
652
static struct syscore_ops clks_syscore_ops = {
 
653
        .resume = clks_core_resume,
 
654
};
 
655
 
 
656
static int __init clk_syscore_init(void)
 
657
{
 
658
        register_syscore_ops(&clks_syscore_ops);
 
659
 
 
660
        return 0;
 
661
}
 
662
subsys_initcall(clk_syscore_init);
695
663
#endif
696
664
 
697
665
/*