Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 156853
b: refs/heads/master
c: f643173
h: refs/heads/master
i:
  156851: 088ccdf
v: v3
  • Loading branch information
Magnus Damm authored and Paul Mundt committed Aug 15, 2009
1 parent cd9c9b3 commit 3039a58
Show file tree
Hide file tree
Showing 2 changed files with 29 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: 21bc1f024d0d4ea43fc0f2a43504e759261c7b18
refs/heads/master: f6431732f128a241b149c0aa85dfec852455ebf9
28 changes: 28 additions & 0 deletions trunk/drivers/clocksource/sh_cmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ struct sh_cmt_priv {
struct platform_device *pdev;

unsigned long flags;
unsigned long flags_suspend;
unsigned long match_value;
unsigned long next_match_value;
unsigned long max_match_value;
Expand Down Expand Up @@ -667,11 +668,38 @@ static int __devexit sh_cmt_remove(struct platform_device *pdev)
return -EBUSY; /* cannot unregister clockevent and clocksource */
}

static int sh_cmt_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct sh_cmt_priv *p = platform_get_drvdata(pdev);

/* save flag state and stop CMT channel */
p->flags_suspend = p->flags;
sh_cmt_stop(p, p->flags);
return 0;
}

static int sh_cmt_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct sh_cmt_priv *p = platform_get_drvdata(pdev);

/* start CMT channel from saved state */
sh_cmt_start(p, p->flags_suspend);
return 0;
}

static struct dev_pm_ops sh_cmt_dev_pm_ops = {
.suspend = sh_cmt_suspend,
.resume = sh_cmt_resume,
};

static struct platform_driver sh_cmt_device_driver = {
.probe = sh_cmt_probe,
.remove = __devexit_p(sh_cmt_remove),
.driver = {
.name = "sh_cmt",
.pm = &sh_cmt_dev_pm_ops,
}
};

Expand Down

0 comments on commit 3039a58

Please sign in to comment.