forked from Minki/linux
blackfin RTC driver: add support for power management framework
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <bryan.wu@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> Cc: David Brownell <david-b@pacbell.net> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
5aeb776d0c
commit
813006f4bb
@ -2,7 +2,7 @@
|
|||||||
* Blackfin On-Chip Real Time Clock Driver
|
* Blackfin On-Chip Real Time Clock Driver
|
||||||
* Supports BF52[257]/BF53[123]/BF53[467]/BF54[24789]
|
* Supports BF52[257]/BF53[123]/BF53[467]/BF54[24789]
|
||||||
*
|
*
|
||||||
* Copyright 2004-2007 Analog Devices Inc.
|
* Copyright 2004-2008 Analog Devices Inc.
|
||||||
*
|
*
|
||||||
* Enter bugs at http://blackfin.uclinux.org/
|
* Enter bugs at http://blackfin.uclinux.org/
|
||||||
*
|
*
|
||||||
@ -412,6 +412,8 @@ static int __devinit bfin_rtc_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
platform_set_drvdata(pdev, rtc);
|
platform_set_drvdata(pdev, rtc);
|
||||||
|
|
||||||
|
device_init_wakeup(&pdev->dev, 1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
@ -433,25 +435,28 @@ static int __devexit bfin_rtc_remove(struct platform_device *pdev)
|
|||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM
|
||||||
static int bfin_rtc_suspend(struct platform_device *pdev, pm_message_t state)
|
static int bfin_rtc_suspend(struct platform_device *pdev, pm_message_t state)
|
||||||
{
|
{
|
||||||
#ifdef PM_WAKEUP_SIC_IWR
|
|
||||||
struct bfin_rtc *rtc = dev_get_drvdata(&pdev->dev);
|
struct bfin_rtc *rtc = dev_get_drvdata(&pdev->dev);
|
||||||
#endif
|
|
||||||
bfin_rtc_reset(&pdev->dev);
|
if (device_may_wakeup(&pdev->dev))
|
||||||
#ifdef PM_WAKEUP_SIC_IWR
|
enable_irq_wake(IRQ_RTC);
|
||||||
bfin_write_RTC_SWCNT(10);
|
else
|
||||||
bfin_rtc_int_set(rtc, RTC_ISTAT_STOPWATCH);
|
bfin_rtc_int_clear(rtc, -1);
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bfin_rtc_resume(struct platform_device *pdev)
|
static int bfin_rtc_resume(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
#ifdef PM_WAKEUP_SIC_IWR
|
if (device_may_wakeup(&pdev->dev))
|
||||||
struct bfin_rtc *rtc = dev_get_drvdata(&pdev->dev);
|
disable_irq_wake(IRQ_RTC);
|
||||||
bfin_rtc_int_clear(rtc, RTC_ISTAT_STOPWATCH);
|
else
|
||||||
#endif
|
bfin_write_RTC_ISTAT(-1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
# define bfin_rtc_suspend NULL
|
||||||
|
# define bfin_rtc_resume NULL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct platform_driver bfin_rtc_driver = {
|
static struct platform_driver bfin_rtc_driver = {
|
||||||
@ -461,10 +466,8 @@ static struct platform_driver bfin_rtc_driver = {
|
|||||||
},
|
},
|
||||||
.probe = bfin_rtc_probe,
|
.probe = bfin_rtc_probe,
|
||||||
.remove = __devexit_p(bfin_rtc_remove),
|
.remove = __devexit_p(bfin_rtc_remove),
|
||||||
#ifdef CONFIG_PM
|
|
||||||
.suspend = bfin_rtc_suspend,
|
.suspend = bfin_rtc_suspend,
|
||||||
.resume = bfin_rtc_resume,
|
.resume = bfin_rtc_resume,
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static int __init bfin_rtc_init(void)
|
static int __init bfin_rtc_init(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user