diff options
Diffstat (limited to 'drivers/rtc')
| -rw-r--r-- | drivers/rtc/rtc-ab3100.c | 2 | ||||
| -rw-r--r-- | drivers/rtc/rtc-bfin.c | 15 | ||||
| -rw-r--r-- | drivers/rtc/rtc-ds3232.c | 2 | ||||
| -rw-r--r-- | drivers/rtc/rtc-m41t80.c | 16 | ||||
| -rw-r--r-- | drivers/rtc/rtc-nuc900.c | 2 | ||||
| -rw-r--r-- | drivers/rtc/rtc-pl031.c | 2 | ||||
| -rw-r--r-- | drivers/rtc/rtc-s3c.c | 13 |
7 files changed, 33 insertions, 19 deletions
diff --git a/drivers/rtc/rtc-ab3100.c b/drivers/rtc/rtc-ab3100.c index d26780ea254b..261a07e0fb24 100644 --- a/drivers/rtc/rtc-ab3100.c +++ b/drivers/rtc/rtc-ab3100.c | |||
| @@ -235,6 +235,7 @@ static int __init ab3100_rtc_probe(struct platform_device *pdev) | |||
| 235 | err = PTR_ERR(rtc); | 235 | err = PTR_ERR(rtc); |
| 236 | return err; | 236 | return err; |
| 237 | } | 237 | } |
| 238 | platform_set_drvdata(pdev, rtc); | ||
| 238 | 239 | ||
| 239 | return 0; | 240 | return 0; |
| 240 | } | 241 | } |
| @@ -244,6 +245,7 @@ static int __exit ab3100_rtc_remove(struct platform_device *pdev) | |||
| 244 | struct rtc_device *rtc = platform_get_drvdata(pdev); | 245 | struct rtc_device *rtc = platform_get_drvdata(pdev); |
| 245 | 246 | ||
| 246 | rtc_device_unregister(rtc); | 247 | rtc_device_unregister(rtc); |
| 248 | platform_set_drvdata(pdev, NULL); | ||
| 247 | return 0; | 249 | return 0; |
| 248 | } | 250 | } |
| 249 | 251 | ||
diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c index 72b2bcc2c224..d4fb82d85e9b 100644 --- a/drivers/rtc/rtc-bfin.c +++ b/drivers/rtc/rtc-bfin.c | |||
| @@ -426,7 +426,7 @@ static int bfin_rtc_suspend(struct platform_device *pdev, pm_message_t state) | |||
| 426 | enable_irq_wake(IRQ_RTC); | 426 | enable_irq_wake(IRQ_RTC); |
| 427 | bfin_rtc_sync_pending(&pdev->dev); | 427 | bfin_rtc_sync_pending(&pdev->dev); |
| 428 | } else | 428 | } else |
| 429 | bfin_rtc_int_clear(-1); | 429 | bfin_rtc_int_clear(0); |
| 430 | 430 | ||
| 431 | return 0; | 431 | return 0; |
| 432 | } | 432 | } |
| @@ -435,8 +435,17 @@ static int bfin_rtc_resume(struct platform_device *pdev) | |||
| 435 | { | 435 | { |
| 436 | if (device_may_wakeup(&pdev->dev)) | 436 | if (device_may_wakeup(&pdev->dev)) |
| 437 | disable_irq_wake(IRQ_RTC); | 437 | disable_irq_wake(IRQ_RTC); |
| 438 | else | 438 | |
| 439 | bfin_write_RTC_ISTAT(-1); | 439 | /* |
| 440 | * Since only some of the RTC bits are maintained externally in the | ||
| 441 | * Vbat domain, we need to wait for the RTC MMRs to be synced into | ||
| 442 | * the core after waking up. This happens every RTC 1HZ. Once that | ||
| 443 | * has happened, we can go ahead and re-enable the important write | ||
| 444 | * complete interrupt event. | ||
| 445 | */ | ||
| 446 | while (!(bfin_read_RTC_ISTAT() & RTC_ISTAT_SEC)) | ||
| 447 | continue; | ||
| 448 | bfin_rtc_int_set(RTC_ISTAT_WRITE_COMPLETE); | ||
| 440 | 449 | ||
| 441 | return 0; | 450 | return 0; |
| 442 | } | 451 | } |
diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c index 9daed8db83d3..9de8516e3531 100644 --- a/drivers/rtc/rtc-ds3232.c +++ b/drivers/rtc/rtc-ds3232.c | |||
| @@ -268,7 +268,6 @@ out_irq: | |||
| 268 | free_irq(client->irq, client); | 268 | free_irq(client->irq, client); |
| 269 | 269 | ||
| 270 | out_free: | 270 | out_free: |
| 271 | i2c_set_clientdata(client, NULL); | ||
| 272 | kfree(ds3232); | 271 | kfree(ds3232); |
| 273 | return ret; | 272 | return ret; |
| 274 | } | 273 | } |
| @@ -287,7 +286,6 @@ static int __devexit ds3232_remove(struct i2c_client *client) | |||
| 287 | } | 286 | } |
| 288 | 287 | ||
| 289 | rtc_device_unregister(ds3232->rtc); | 288 | rtc_device_unregister(ds3232->rtc); |
| 290 | i2c_set_clientdata(client, NULL); | ||
| 291 | kfree(ds3232); | 289 | kfree(ds3232); |
| 292 | return 0; | 290 | return 0; |
| 293 | } | 291 | } |
diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c index 66377f3e28b8..5a8daa358066 100644 --- a/drivers/rtc/rtc-m41t80.c +++ b/drivers/rtc/rtc-m41t80.c | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
| 21 | #include <linux/rtc.h> | 21 | #include <linux/rtc.h> |
| 22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
| 23 | #include <linux/smp_lock.h> | 23 | #include <linux/mutex.h> |
| 24 | #include <linux/string.h> | 24 | #include <linux/string.h> |
| 25 | #ifdef CONFIG_RTC_DRV_M41T80_WDT | 25 | #ifdef CONFIG_RTC_DRV_M41T80_WDT |
| 26 | #include <linux/fs.h> | 26 | #include <linux/fs.h> |
| @@ -68,6 +68,7 @@ | |||
| 68 | 68 | ||
| 69 | #define DRV_VERSION "0.05" | 69 | #define DRV_VERSION "0.05" |
| 70 | 70 | ||
| 71 | static DEFINE_MUTEX(m41t80_rtc_mutex); | ||
| 71 | static const struct i2c_device_id m41t80_id[] = { | 72 | static const struct i2c_device_id m41t80_id[] = { |
| 72 | { "m41t62", M41T80_FEATURE_SQ | M41T80_FEATURE_SQ_ALT }, | 73 | { "m41t62", M41T80_FEATURE_SQ | M41T80_FEATURE_SQ_ALT }, |
| 73 | { "m41t65", M41T80_FEATURE_HT | M41T80_FEATURE_WD }, | 74 | { "m41t65", M41T80_FEATURE_HT | M41T80_FEATURE_WD }, |
| @@ -364,7 +365,7 @@ static int m41t80_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *t) | |||
| 364 | t->time.tm_isdst = -1; | 365 | t->time.tm_isdst = -1; |
| 365 | t->enabled = !!(reg[M41T80_REG_ALARM_MON] & M41T80_ALMON_AFE); | 366 | t->enabled = !!(reg[M41T80_REG_ALARM_MON] & M41T80_ALMON_AFE); |
| 366 | t->pending = !!(reg[M41T80_REG_FLAGS] & M41T80_FLAGS_AF); | 367 | t->pending = !!(reg[M41T80_REG_FLAGS] & M41T80_FLAGS_AF); |
| 367 | return rtc_valid_tm(t); | 368 | return 0; |
| 368 | } | 369 | } |
| 369 | 370 | ||
| 370 | static struct rtc_class_ops m41t80_rtc_ops = { | 371 | static struct rtc_class_ops m41t80_rtc_ops = { |
| @@ -677,9 +678,9 @@ static long wdt_unlocked_ioctl(struct file *file, unsigned int cmd, | |||
| 677 | { | 678 | { |
| 678 | int ret; | 679 | int ret; |
| 679 | 680 | ||
| 680 | lock_kernel(); | 681 | mutex_lock(&m41t80_rtc_mutex); |
| 681 | ret = wdt_ioctl(file, cmd, arg); | 682 | ret = wdt_ioctl(file, cmd, arg); |
| 682 | unlock_kernel(); | 683 | mutex_unlock(&m41t80_rtc_mutex); |
| 683 | 684 | ||
| 684 | return ret; | 685 | return ret; |
| 685 | } | 686 | } |
| @@ -693,16 +694,16 @@ static long wdt_unlocked_ioctl(struct file *file, unsigned int cmd, | |||
| 693 | static int wdt_open(struct inode *inode, struct file *file) | 694 | static int wdt_open(struct inode *inode, struct file *file) |
| 694 | { | 695 | { |
| 695 | if (MINOR(inode->i_rdev) == WATCHDOG_MINOR) { | 696 | if (MINOR(inode->i_rdev) == WATCHDOG_MINOR) { |
| 696 | lock_kernel(); | 697 | mutex_lock(&m41t80_rtc_mutex); |
| 697 | if (test_and_set_bit(0, &wdt_is_open)) { | 698 | if (test_and_set_bit(0, &wdt_is_open)) { |
| 698 | unlock_kernel(); | 699 | mutex_unlock(&m41t80_rtc_mutex); |
| 699 | return -EBUSY; | 700 | return -EBUSY; |
| 700 | } | 701 | } |
| 701 | /* | 702 | /* |
| 702 | * Activate | 703 | * Activate |
| 703 | */ | 704 | */ |
| 704 | wdt_is_open = 1; | 705 | wdt_is_open = 1; |
| 705 | unlock_kernel(); | 706 | mutex_unlock(&m41t80_rtc_mutex); |
| 706 | return nonseekable_open(inode, file); | 707 | return nonseekable_open(inode, file); |
| 707 | } | 708 | } |
| 708 | return -ENODEV; | 709 | return -ENODEV; |
| @@ -748,6 +749,7 @@ static const struct file_operations wdt_fops = { | |||
| 748 | .write = wdt_write, | 749 | .write = wdt_write, |
| 749 | .open = wdt_open, | 750 | .open = wdt_open, |
| 750 | .release = wdt_release, | 751 | .release = wdt_release, |
| 752 | .llseek = no_llseek, | ||
| 751 | }; | 753 | }; |
| 752 | 754 | ||
| 753 | static struct miscdevice wdt_dev = { | 755 | static struct miscdevice wdt_dev = { |
diff --git a/drivers/rtc/rtc-nuc900.c b/drivers/rtc/rtc-nuc900.c index 62de66af0a68..ddb0857e15a4 100644 --- a/drivers/rtc/rtc-nuc900.c +++ b/drivers/rtc/rtc-nuc900.c | |||
| @@ -274,7 +274,7 @@ static int __devinit nuc900_rtc_probe(struct platform_device *pdev) | |||
| 274 | nuc900_rtc->rtcdev = rtc_device_register(pdev->name, &pdev->dev, | 274 | nuc900_rtc->rtcdev = rtc_device_register(pdev->name, &pdev->dev, |
| 275 | &nuc900_rtc_ops, THIS_MODULE); | 275 | &nuc900_rtc_ops, THIS_MODULE); |
| 276 | if (IS_ERR(nuc900_rtc->rtcdev)) { | 276 | if (IS_ERR(nuc900_rtc->rtcdev)) { |
| 277 | dev_err(&pdev->dev, "rtc device register faild\n"); | 277 | dev_err(&pdev->dev, "rtc device register failed\n"); |
| 278 | err = PTR_ERR(nuc900_rtc->rtcdev); | 278 | err = PTR_ERR(nuc900_rtc->rtcdev); |
| 279 | goto fail3; | 279 | goto fail3; |
| 280 | } | 280 | } |
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c index 6c418fe7f288..b7a6690e5b35 100644 --- a/drivers/rtc/rtc-pl031.c +++ b/drivers/rtc/rtc-pl031.c | |||
| @@ -403,7 +403,7 @@ static int pl031_probe(struct amba_device *adev, struct amba_id *id) | |||
| 403 | } | 403 | } |
| 404 | 404 | ||
| 405 | if (request_irq(adev->irq[0], pl031_interrupt, | 405 | if (request_irq(adev->irq[0], pl031_interrupt, |
| 406 | IRQF_DISABLED | IRQF_SHARED, "rtc-pl031", ldata)) { | 406 | IRQF_DISABLED, "rtc-pl031", ldata)) { |
| 407 | ret = -EIO; | 407 | ret = -EIO; |
| 408 | goto out_no_irq; | 408 | goto out_no_irq; |
| 409 | } | 409 | } |
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index a0d3ec89d412..f57a87f4ae96 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
| @@ -310,11 +310,6 @@ static int s3c_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
| 310 | 310 | ||
| 311 | s3c_rtc_setaie(alrm->enabled); | 311 | s3c_rtc_setaie(alrm->enabled); |
| 312 | 312 | ||
| 313 | if (alrm->enabled) | ||
| 314 | enable_irq_wake(s3c_rtc_alarmno); | ||
| 315 | else | ||
| 316 | disable_irq_wake(s3c_rtc_alarmno); | ||
| 317 | |||
| 318 | return 0; | 313 | return 0; |
| 319 | } | 314 | } |
| 320 | 315 | ||
| @@ -587,6 +582,10 @@ static int s3c_rtc_suspend(struct platform_device *pdev, pm_message_t state) | |||
| 587 | ticnt_en_save &= S3C64XX_RTCCON_TICEN; | 582 | ticnt_en_save &= S3C64XX_RTCCON_TICEN; |
| 588 | } | 583 | } |
| 589 | s3c_rtc_enable(pdev, 0); | 584 | s3c_rtc_enable(pdev, 0); |
| 585 | |||
| 586 | if (device_may_wakeup(&pdev->dev)) | ||
| 587 | enable_irq_wake(s3c_rtc_alarmno); | ||
| 588 | |||
| 590 | return 0; | 589 | return 0; |
| 591 | } | 590 | } |
| 592 | 591 | ||
| @@ -600,6 +599,10 @@ static int s3c_rtc_resume(struct platform_device *pdev) | |||
| 600 | tmp = readb(s3c_rtc_base + S3C2410_RTCCON); | 599 | tmp = readb(s3c_rtc_base + S3C2410_RTCCON); |
| 601 | writeb(tmp | ticnt_en_save, s3c_rtc_base + S3C2410_RTCCON); | 600 | writeb(tmp | ticnt_en_save, s3c_rtc_base + S3C2410_RTCCON); |
| 602 | } | 601 | } |
| 602 | |||
| 603 | if (device_may_wakeup(&pdev->dev)) | ||
| 604 | disable_irq_wake(s3c_rtc_alarmno); | ||
| 605 | |||
| 603 | return 0; | 606 | return 0; |
| 604 | } | 607 | } |
| 605 | #else | 608 | #else |
