mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-19 15:39:07 +00:00
rtc: rtc-omap: convert omap_rtc_driver to dev_pm_ops
Instead of using legacy suspend/resume methods, using newer dev_pm_ops structure allows better control over power management. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
62068e2c45
commit
04ebc35973
@ -464,11 +464,10 @@ static int __exit omap_rtc_remove(struct platform_device *pdev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM_SLEEP
|
||||||
|
|
||||||
static u8 irqstat;
|
static u8 irqstat;
|
||||||
|
|
||||||
static int omap_rtc_suspend(struct platform_device *pdev, pm_message_t state)
|
static int omap_rtc_suspend(struct device *dev)
|
||||||
{
|
{
|
||||||
irqstat = rtc_read(OMAP_RTC_INTERRUPTS_REG);
|
irqstat = rtc_read(OMAP_RTC_INTERRUPTS_REG);
|
||||||
|
|
||||||
@ -476,34 +475,32 @@ static int omap_rtc_suspend(struct platform_device *pdev, pm_message_t state)
|
|||||||
* source, and in fact this enable() call is just saving a flag
|
* source, and in fact this enable() call is just saving a flag
|
||||||
* that's never used...
|
* that's never used...
|
||||||
*/
|
*/
|
||||||
if (device_may_wakeup(&pdev->dev))
|
if (device_may_wakeup(dev))
|
||||||
enable_irq_wake(omap_rtc_alarm);
|
enable_irq_wake(omap_rtc_alarm);
|
||||||
else
|
else
|
||||||
rtc_write(0, OMAP_RTC_INTERRUPTS_REG);
|
rtc_write(0, OMAP_RTC_INTERRUPTS_REG);
|
||||||
|
|
||||||
/* Disable the clock/module */
|
/* Disable the clock/module */
|
||||||
pm_runtime_put_sync(&pdev->dev);
|
pm_runtime_put_sync(dev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int omap_rtc_resume(struct platform_device *pdev)
|
static int omap_rtc_resume(struct device *dev)
|
||||||
{
|
{
|
||||||
/* Enable the clock/module so that we can access the registers */
|
/* Enable the clock/module so that we can access the registers */
|
||||||
pm_runtime_get_sync(&pdev->dev);
|
pm_runtime_get_sync(dev);
|
||||||
|
|
||||||
if (device_may_wakeup(&pdev->dev))
|
if (device_may_wakeup(dev))
|
||||||
disable_irq_wake(omap_rtc_alarm);
|
disable_irq_wake(omap_rtc_alarm);
|
||||||
else
|
else
|
||||||
rtc_write(irqstat, OMAP_RTC_INTERRUPTS_REG);
|
rtc_write(irqstat, OMAP_RTC_INTERRUPTS_REG);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
#define omap_rtc_suspend NULL
|
|
||||||
#define omap_rtc_resume NULL
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static SIMPLE_DEV_PM_OPS(omap_rtc_pm_ops, omap_rtc_suspend, omap_rtc_resume);
|
||||||
|
|
||||||
static void omap_rtc_shutdown(struct platform_device *pdev)
|
static void omap_rtc_shutdown(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
rtc_write(0, OMAP_RTC_INTERRUPTS_REG);
|
rtc_write(0, OMAP_RTC_INTERRUPTS_REG);
|
||||||
@ -512,12 +509,11 @@ static void omap_rtc_shutdown(struct platform_device *pdev)
|
|||||||
MODULE_ALIAS("platform:omap_rtc");
|
MODULE_ALIAS("platform:omap_rtc");
|
||||||
static struct platform_driver omap_rtc_driver = {
|
static struct platform_driver omap_rtc_driver = {
|
||||||
.remove = __exit_p(omap_rtc_remove),
|
.remove = __exit_p(omap_rtc_remove),
|
||||||
.suspend = omap_rtc_suspend,
|
|
||||||
.resume = omap_rtc_resume,
|
|
||||||
.shutdown = omap_rtc_shutdown,
|
.shutdown = omap_rtc_shutdown,
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = DRIVER_NAME,
|
.name = DRIVER_NAME,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
|
.pm = &omap_rtc_pm_ops,
|
||||||
.of_match_table = of_match_ptr(omap_rtc_of_match),
|
.of_match_table = of_match_ptr(omap_rtc_of_match),
|
||||||
},
|
},
|
||||||
.id_table = omap_rtc_devtype,
|
.id_table = omap_rtc_devtype,
|
||||||
|
Loading…
Reference in New Issue
Block a user