Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 133321
b: refs/heads/master
c: 4a55026
h: refs/heads/master
i:
  133319: 497e256
v: v3
  • Loading branch information
Francesco VIRLINZI authored and Paul Mundt committed Mar 11, 2009
1 parent 7ff3073 commit 8c84d09
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d680c76eccd9222031ee30dcee5fdedba2467610
refs/heads/master: 4a55026fd7a08074676e87932578ff9e327e82a3
64 changes: 64 additions & 0 deletions trunk/arch/sh/kernel/cpu/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include <linux/mutex.h>
#include <linux/list.h>
#include <linux/kref.h>
#include <linux/kobject.h>
#include <linux/sysdev.h>
#include <linux/seq_file.h>
#include <linux/err.h>
#include <linux/platform_device.h>
Expand Down Expand Up @@ -358,6 +360,68 @@ static int show_clocks(char *buf, char **start, off_t off,
return p - buf;
}

#ifdef CONFIG_PM
static int clks_sysdev_suspend(struct sys_device *dev, pm_message_t state)
{
static pm_message_t prev_state;
struct clk *clkp;

switch (state.event) {
case PM_EVENT_ON:
/* Resumeing from hibernation */
if (prev_state.event == PM_EVENT_FREEZE) {
list_for_each_entry(clkp, &clock_list, node)
if (likely(clkp->ops)) {
if (likely(clkp->ops->set_parent))
clkp->ops->set_parent(clkp,
clkp->parent);
if (likely(clkp->ops->set_rate))
clkp->ops->set_rate(clkp,
clkp->rate, NO_CHANGE);
else if (likely(clkp->ops->recalc))
clkp->ops->recalc(clkp);
}
}
break;
case PM_EVENT_FREEZE:
break;
case PM_EVENT_SUSPEND:
break;
}

prev_state = state;
return 0;
}

static int clks_sysdev_resume(struct sys_device *dev)
{
return clks_sysdev_suspend(dev, PMSG_ON);
}

static struct sysdev_class clks_sysdev_class = {
.name = "clks",
};

static struct sysdev_driver clks_sysdev_driver = {
.suspend = clks_sysdev_suspend,
.resume = clks_sysdev_resume,
};

static struct sys_device clks_sysdev_dev = {
.cls = &clks_sysdev_class,
};

static int __init clk_sysdev_init(void)
{
sysdev_class_register(&clks_sysdev_class);
sysdev_driver_register(&clks_sysdev_class, &clks_sysdev_driver);
sysdev_register(&clks_sysdev_dev);

return 0;
}
subsys_initcall(clk_sysdev_init);
#endif

int __init clk_init(void)
{
int i, ret = 0;
Expand Down

0 comments on commit 8c84d09

Please sign in to comment.