diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2013-02-21 19:44:35 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-21 20:22:28 -0500 |
commit | eb5eba4ef72248b976465906cfed5fca2e9d8831 (patch) | |
tree | 9bbe3909fae02a5c134f095faea8d27ed2690423 /drivers/rtc/rtc-tps65910.c | |
parent | 36d6182411b9f597f9f85ec0c4bb00909fd16d59 (diff) |
drivers/rtc/rtc-tps65910.c: enable/disable wake in suspend/resume
Making the rtc driver as wakeup capabale and leaving the wake
enable/disable decision to user space through a sysfs attribute.
In suspend, enable wake if device wakeup enabled. In resume disable wake
again.
This change is inline with the Documentation/power/devices.txt#
/sys/devices/.../power/wakeup files
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-tps65910.c')
-rw-r--r-- | drivers/rtc/rtc-tps65910.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-tps65910.c b/drivers/rtc/rtc-tps65910.c index e5fef141a0e2..932a655aa41c 100644 --- a/drivers/rtc/rtc-tps65910.c +++ b/drivers/rtc/rtc-tps65910.c | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | struct tps65910_rtc { | 28 | struct tps65910_rtc { |
29 | struct rtc_device *rtc; | 29 | struct rtc_device *rtc; |
30 | int irq; | ||
30 | /* To store the list of enabled interrupts */ | 31 | /* To store the list of enabled interrupts */ |
31 | u32 irqstat; | 32 | u32 irqstat; |
32 | }; | 33 | }; |
@@ -273,7 +274,8 @@ static int tps65910_rtc_probe(struct platform_device *pdev) | |||
273 | dev_err(&pdev->dev, "IRQ is not free.\n"); | 274 | dev_err(&pdev->dev, "IRQ is not free.\n"); |
274 | return ret; | 275 | return ret; |
275 | } | 276 | } |
276 | device_init_wakeup(&pdev->dev, 1); | 277 | tps_rtc->irq = irq; |
278 | device_set_wakeup_capable(&pdev->dev, 1); | ||
277 | 279 | ||
278 | tps_rtc->rtc = rtc_device_register(pdev->name, &pdev->dev, | 280 | tps_rtc->rtc = rtc_device_register(pdev->name, &pdev->dev, |
279 | &tps65910_rtc_ops, THIS_MODULE); | 281 | &tps65910_rtc_ops, THIS_MODULE); |
@@ -308,9 +310,13 @@ static int tps65910_rtc_remove(struct platform_device *pdev) | |||
308 | static int tps65910_rtc_suspend(struct device *dev) | 310 | static int tps65910_rtc_suspend(struct device *dev) |
309 | { | 311 | { |
310 | struct tps65910 *tps = dev_get_drvdata(dev->parent); | 312 | struct tps65910 *tps = dev_get_drvdata(dev->parent); |
313 | struct tps65910_rtc *tps_rtc = dev_get_drvdata(dev); | ||
311 | u8 alarm = TPS65910_RTC_INTERRUPTS_IT_ALARM; | 314 | u8 alarm = TPS65910_RTC_INTERRUPTS_IT_ALARM; |
312 | int ret; | 315 | int ret; |
313 | 316 | ||
317 | if (device_may_wakeup(dev)) | ||
318 | enable_irq_wake(tps_rtc->irq); | ||
319 | |||
314 | /* Store current list of enabled interrupts*/ | 320 | /* Store current list of enabled interrupts*/ |
315 | ret = regmap_read(tps->regmap, TPS65910_RTC_INTERRUPTS, | 321 | ret = regmap_read(tps->regmap, TPS65910_RTC_INTERRUPTS, |
316 | &tps->rtc->irqstat); | 322 | &tps->rtc->irqstat); |
@@ -324,6 +330,10 @@ static int tps65910_rtc_suspend(struct device *dev) | |||
324 | static int tps65910_rtc_resume(struct device *dev) | 330 | static int tps65910_rtc_resume(struct device *dev) |
325 | { | 331 | { |
326 | struct tps65910 *tps = dev_get_drvdata(dev->parent); | 332 | struct tps65910 *tps = dev_get_drvdata(dev->parent); |
333 | struct tps65910_rtc *tps_rtc = dev_get_drvdata(dev); | ||
334 | |||
335 | if (device_may_wakeup(dev)) | ||
336 | disable_irq_wake(tps_rtc->irq); | ||
327 | 337 | ||
328 | /* Restore list of enabled interrupts before suspend */ | 338 | /* Restore list of enabled interrupts before suspend */ |
329 | return regmap_write(tps->regmap, TPS65910_RTC_INTERRUPTS, | 339 | return regmap_write(tps->regmap, TPS65910_RTC_INTERRUPTS, |