aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/rtc/rtc-ds1374.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c
index d834a63ec4b0..e6e71deb188f 100644
--- a/drivers/rtc/rtc-ds1374.c
+++ b/drivers/rtc/rtc-ds1374.c
@@ -25,6 +25,7 @@
25#include <linux/bcd.h> 25#include <linux/bcd.h>
26#include <linux/workqueue.h> 26#include <linux/workqueue.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/pm.h>
28 29
29#define DS1374_REG_TOD0 0x00 /* Time of Day */ 30#define DS1374_REG_TOD0 0x00 /* Time of Day */
30#define DS1374_REG_TOD1 0x01 31#define DS1374_REG_TOD1 0x01
@@ -409,32 +410,38 @@ static int __devexit ds1374_remove(struct i2c_client *client)
409} 410}
410 411
411#ifdef CONFIG_PM 412#ifdef CONFIG_PM
412static int ds1374_suspend(struct i2c_client *client, pm_message_t state) 413static int ds1374_suspend(struct device *dev)
413{ 414{
415 struct i2c_client *client = to_i2c_client(dev);
416
414 if (client->irq >= 0 && device_may_wakeup(&client->dev)) 417 if (client->irq >= 0 && device_may_wakeup(&client->dev))
415 enable_irq_wake(client->irq); 418 enable_irq_wake(client->irq);
416 return 0; 419 return 0;
417} 420}
418 421
419static int ds1374_resume(struct i2c_client *client) 422static int ds1374_resume(struct device *dev)
420{ 423{
424 struct i2c_client *client = to_i2c_client(dev);
425
421 if (client->irq >= 0 && device_may_wakeup(&client->dev)) 426 if (client->irq >= 0 && device_may_wakeup(&client->dev))
422 disable_irq_wake(client->irq); 427 disable_irq_wake(client->irq);
423 return 0; 428 return 0;
424} 429}
430
431static SIMPLE_DEV_PM_OPS(ds1374_pm, ds1374_suspend, ds1374_resume);
432
433#define DS1374_PM (&ds1374_pm)
425#else 434#else
426#define ds1374_suspend NULL 435#define DS1374_PM NULL
427#define ds1374_resume NULL
428#endif 436#endif
429 437
430static struct i2c_driver ds1374_driver = { 438static struct i2c_driver ds1374_driver = {
431 .driver = { 439 .driver = {
432 .name = "rtc-ds1374", 440 .name = "rtc-ds1374",
433 .owner = THIS_MODULE, 441 .owner = THIS_MODULE,
442 .pm = DS1374_PM,
434 }, 443 },
435 .probe = ds1374_probe, 444 .probe = ds1374_probe,
436 .suspend = ds1374_suspend,
437 .resume = ds1374_resume,
438 .remove = __devexit_p(ds1374_remove), 445 .remove = __devexit_p(ds1374_remove),
439 .id_table = ds1374_id, 446 .id_table = ds1374_id,
440}; 447};