sh: CMT suspend/resume
This patch updates the SuperH CMT driver with suspend and resume callbacks for the suspend-to-ram case. This patch stops the CMT channel at suspend time to avoid unwanted wake up events. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
@@ -40,6 +40,7 @@ struct sh_cmt_priv {
|
|||||||
struct platform_device *pdev;
|
struct platform_device *pdev;
|
||||||
|
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
unsigned long flags_suspend;
|
||||||
unsigned long match_value;
|
unsigned long match_value;
|
||||||
unsigned long next_match_value;
|
unsigned long next_match_value;
|
||||||
unsigned long max_match_value;
|
unsigned long max_match_value;
|
||||||
@@ -667,11 +668,38 @@ static int __devexit sh_cmt_remove(struct platform_device *pdev)
|
|||||||
return -EBUSY; /* cannot unregister clockevent and clocksource */
|
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 = {
|
static struct platform_driver sh_cmt_device_driver = {
|
||||||
.probe = sh_cmt_probe,
|
.probe = sh_cmt_probe,
|
||||||
.remove = __devexit_p(sh_cmt_remove),
|
.remove = __devexit_p(sh_cmt_remove),
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "sh_cmt",
|
.name = "sh_cmt",
|
||||||
|
.pm = &sh_cmt_dev_pm_ops,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user