630
630
EXPORT_SYMBOL_GPL(clk_round_parent);
633
static int clks_sysdev_suspend(struct sys_device *dev, pm_message_t state)
633
static void clks_core_resume(void)
635
static pm_message_t prev_state;
636
635
struct clk *clkp;
638
switch (state.event) {
640
/* Resumeing from hibernation */
641
if (prev_state.event != PM_EVENT_FREEZE)
644
list_for_each_entry(clkp, &clock_list, node) {
645
if (likely(clkp->ops)) {
646
unsigned long rate = clkp->rate;
648
if (likely(clkp->ops->set_parent))
649
clkp->ops->set_parent(clkp,
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);
637
list_for_each_entry(clkp, &clock_list, node) {
638
if (likely(clkp->usecount && clkp->ops)) {
639
unsigned long rate = clkp->rate;
641
if (likely(clkp->ops->set_parent))
642
clkp->ops->set_parent(clkp,
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);
658
case PM_EVENT_FREEZE:
660
case PM_EVENT_SUSPEND:
668
static int clks_sysdev_resume(struct sys_device *dev)
670
return clks_sysdev_suspend(dev, PMSG_ON);
673
static struct sysdev_class clks_sysdev_class = {
677
static struct sysdev_driver clks_sysdev_driver = {
678
.suspend = clks_sysdev_suspend,
679
.resume = clks_sysdev_resume,
682
static struct sys_device clks_sysdev_dev = {
683
.cls = &clks_sysdev_class,
686
static int __init clk_sysdev_init(void)
688
sysdev_class_register(&clks_sysdev_class);
689
sysdev_driver_register(&clks_sysdev_class, &clks_sysdev_driver);
690
sysdev_register(&clks_sysdev_dev);
694
subsys_initcall(clk_sysdev_init);
652
static struct syscore_ops clks_syscore_ops = {
653
.resume = clks_core_resume,
656
static int __init clk_syscore_init(void)
658
register_syscore_ops(&clks_syscore_ops);
662
subsys_initcall(clk_syscore_init);