diff options
author | Stefan Christ <s.christ@phytec.de> | 2016-07-05 07:53:17 -0400 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2016-07-21 14:06:57 -0400 |
commit | ae036af8962da5856be2ee2b5543e65014cd608f (patch) | |
tree | 74b6ff89c93196e65f7026c4e14fbf32c7fecb79 | |
parent | e89487fef537975f2c95c6c41316201c2e0869ab (diff) |
rtc: m41t80: add suspend handlers for alarm IRQ
Allow the alarm IRQ of RTC to be used as a wakeup source for the system
suspend.
Signed-off-by: Stefan Christ <s.christ@phytec.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
-rw-r--r-- | drivers/rtc/rtc-m41t80.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c index 042d6a244aad..58698d21c2c3 100644 --- a/drivers/rtc/rtc-m41t80.c +++ b/drivers/rtc/rtc-m41t80.c | |||
@@ -335,6 +335,30 @@ static struct rtc_class_ops m41t80_rtc_ops = { | |||
335 | .proc = m41t80_rtc_proc, | 335 | .proc = m41t80_rtc_proc, |
336 | }; | 336 | }; |
337 | 337 | ||
338 | #ifdef CONFIG_PM_SLEEP | ||
339 | static int m41t80_suspend(struct device *dev) | ||
340 | { | ||
341 | struct i2c_client *client = to_i2c_client(dev); | ||
342 | |||
343 | if (client->irq >= 0 && device_may_wakeup(dev)) | ||
344 | enable_irq_wake(client->irq); | ||
345 | |||
346 | return 0; | ||
347 | } | ||
348 | |||
349 | static int m41t80_resume(struct device *dev) | ||
350 | { | ||
351 | struct i2c_client *client = to_i2c_client(dev); | ||
352 | |||
353 | if (client->irq >= 0 && device_may_wakeup(dev)) | ||
354 | disable_irq_wake(client->irq); | ||
355 | |||
356 | return 0; | ||
357 | } | ||
358 | #endif | ||
359 | |||
360 | static SIMPLE_DEV_PM_OPS(m41t80_pm, m41t80_suspend, m41t80_resume); | ||
361 | |||
338 | static ssize_t flags_show(struct device *dev, | 362 | static ssize_t flags_show(struct device *dev, |
339 | struct device_attribute *attr, char *buf) | 363 | struct device_attribute *attr, char *buf) |
340 | { | 364 | { |
@@ -870,6 +894,7 @@ static int m41t80_remove(struct i2c_client *client) | |||
870 | static struct i2c_driver m41t80_driver = { | 894 | static struct i2c_driver m41t80_driver = { |
871 | .driver = { | 895 | .driver = { |
872 | .name = "rtc-m41t80", | 896 | .name = "rtc-m41t80", |
897 | .pm = &m41t80_pm, | ||
873 | }, | 898 | }, |
874 | .probe = m41t80_probe, | 899 | .probe = m41t80_probe, |
875 | .remove = m41t80_remove, | 900 | .remove = m41t80_remove, |