diff options
author | Ben Dooks <ben-linux@fluff.org> | 2008-11-03 09:49:01 -0500 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2008-11-03 09:49:01 -0500 |
commit | e856359685143a2f65876e7db4e4aa0ef5dce7f0 (patch) | |
tree | bbcafe7f23975979f7a2bc6fd1404908d5fd7bd1 /drivers/rtc | |
parent | e3bd9ec5d8bfc90f9e1bd995677829e57a404061 (diff) | |
parent | 45beca08dd8b6d6a65c5ffd730af2eac7a2c7a03 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into s3c-moves2
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-dev.c | 3 | ||||
-rw-r--r-- | drivers/rtc/rtc-ds3234.c | 4 | ||||
-rw-r--r-- | drivers/rtc/rtc-m48t59.c | 34 | ||||
-rw-r--r-- | drivers/rtc/rtc-s3c.c | 8 |
4 files changed, 37 insertions, 12 deletions
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index 079e9ed907e0..ecdea44ae4e5 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c | |||
@@ -446,9 +446,6 @@ static int rtc_dev_release(struct inode *inode, struct file *file) | |||
446 | if (rtc->ops->release) | 446 | if (rtc->ops->release) |
447 | rtc->ops->release(rtc->dev.parent); | 447 | rtc->ops->release(rtc->dev.parent); |
448 | 448 | ||
449 | if (file->f_flags & FASYNC) | ||
450 | rtc_dev_fasync(-1, file, 0); | ||
451 | |||
452 | clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags); | 449 | clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags); |
453 | return 0; | 450 | return 0; |
454 | } | 451 | } |
diff --git a/drivers/rtc/rtc-ds3234.c b/drivers/rtc/rtc-ds3234.c index 37d131d03f33..45e5b106af73 100644 --- a/drivers/rtc/rtc-ds3234.c +++ b/drivers/rtc/rtc-ds3234.c | |||
@@ -189,7 +189,7 @@ static const struct rtc_class_ops ds3234_rtc_ops = { | |||
189 | .set_time = ds3234_set_time, | 189 | .set_time = ds3234_set_time, |
190 | }; | 190 | }; |
191 | 191 | ||
192 | static int ds3234_probe(struct spi_device *spi) | 192 | static int __devinit ds3234_probe(struct spi_device *spi) |
193 | { | 193 | { |
194 | struct rtc_device *rtc; | 194 | struct rtc_device *rtc; |
195 | unsigned char tmp; | 195 | unsigned char tmp; |
@@ -249,7 +249,7 @@ static int ds3234_probe(struct spi_device *spi) | |||
249 | return 0; | 249 | return 0; |
250 | } | 250 | } |
251 | 251 | ||
252 | static int __exit ds3234_remove(struct spi_device *spi) | 252 | static int __devexit ds3234_remove(struct spi_device *spi) |
253 | { | 253 | { |
254 | struct ds3234 *chip = platform_get_drvdata(spi); | 254 | struct ds3234 *chip = platform_get_drvdata(spi); |
255 | struct rtc_device *rtc = chip->rtc; | 255 | struct rtc_device *rtc = chip->rtc; |
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c index 04b63dab6932..43afb7ab5289 100644 --- a/drivers/rtc/rtc-m48t59.c +++ b/drivers/rtc/rtc-m48t59.c | |||
@@ -87,6 +87,10 @@ static int m48t59_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
87 | dev_dbg(dev, "Century bit is enabled\n"); | 87 | dev_dbg(dev, "Century bit is enabled\n"); |
88 | tm->tm_year += 100; /* one century */ | 88 | tm->tm_year += 100; /* one century */ |
89 | } | 89 | } |
90 | #ifdef CONFIG_SPARC | ||
91 | /* Sun SPARC machines count years since 1968 */ | ||
92 | tm->tm_year += 68; | ||
93 | #endif | ||
90 | 94 | ||
91 | tm->tm_wday = bcd2bin(val & 0x07); | 95 | tm->tm_wday = bcd2bin(val & 0x07); |
92 | tm->tm_hour = bcd2bin(M48T59_READ(M48T59_HOUR) & 0x3F); | 96 | tm->tm_hour = bcd2bin(M48T59_READ(M48T59_HOUR) & 0x3F); |
@@ -110,11 +114,20 @@ static int m48t59_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
110 | struct m48t59_private *m48t59 = platform_get_drvdata(pdev); | 114 | struct m48t59_private *m48t59 = platform_get_drvdata(pdev); |
111 | unsigned long flags; | 115 | unsigned long flags; |
112 | u8 val = 0; | 116 | u8 val = 0; |
117 | int year = tm->tm_year; | ||
118 | |||
119 | #ifdef CONFIG_SPARC | ||
120 | /* Sun SPARC machines count years since 1968 */ | ||
121 | year -= 68; | ||
122 | #endif | ||
113 | 123 | ||
114 | dev_dbg(dev, "RTC set time %04d-%02d-%02d %02d/%02d/%02d\n", | 124 | dev_dbg(dev, "RTC set time %04d-%02d-%02d %02d/%02d/%02d\n", |
115 | tm->tm_year + 1900, tm->tm_mon, tm->tm_mday, | 125 | year + 1900, tm->tm_mon, tm->tm_mday, |
116 | tm->tm_hour, tm->tm_min, tm->tm_sec); | 126 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
117 | 127 | ||
128 | if (year < 0) | ||
129 | return -EINVAL; | ||
130 | |||
118 | spin_lock_irqsave(&m48t59->lock, flags); | 131 | spin_lock_irqsave(&m48t59->lock, flags); |
119 | /* Issue the WRITE command */ | 132 | /* Issue the WRITE command */ |
120 | M48T59_SET_BITS(M48T59_CNTL_WRITE, M48T59_CNTL); | 133 | M48T59_SET_BITS(M48T59_CNTL_WRITE, M48T59_CNTL); |
@@ -125,9 +138,9 @@ static int m48t59_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
125 | M48T59_WRITE((bin2bcd(tm->tm_mday) & 0x3F), M48T59_MDAY); | 138 | M48T59_WRITE((bin2bcd(tm->tm_mday) & 0x3F), M48T59_MDAY); |
126 | /* tm_mon is 0-11 */ | 139 | /* tm_mon is 0-11 */ |
127 | M48T59_WRITE((bin2bcd(tm->tm_mon + 1) & 0x1F), M48T59_MONTH); | 140 | M48T59_WRITE((bin2bcd(tm->tm_mon + 1) & 0x1F), M48T59_MONTH); |
128 | M48T59_WRITE(bin2bcd(tm->tm_year % 100), M48T59_YEAR); | 141 | M48T59_WRITE(bin2bcd(year % 100), M48T59_YEAR); |
129 | 142 | ||
130 | if (pdata->type == M48T59RTC_TYPE_M48T59 && (tm->tm_year / 100)) | 143 | if (pdata->type == M48T59RTC_TYPE_M48T59 && (year / 100)) |
131 | val = (M48T59_WDAY_CEB | M48T59_WDAY_CB); | 144 | val = (M48T59_WDAY_CEB | M48T59_WDAY_CB); |
132 | val |= (bin2bcd(tm->tm_wday) & 0x07); | 145 | val |= (bin2bcd(tm->tm_wday) & 0x07); |
133 | M48T59_WRITE(val, M48T59_WDAY); | 146 | M48T59_WRITE(val, M48T59_WDAY); |
@@ -159,6 +172,10 @@ static int m48t59_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
159 | M48T59_SET_BITS(M48T59_CNTL_READ, M48T59_CNTL); | 172 | M48T59_SET_BITS(M48T59_CNTL_READ, M48T59_CNTL); |
160 | 173 | ||
161 | tm->tm_year = bcd2bin(M48T59_READ(M48T59_YEAR)); | 174 | tm->tm_year = bcd2bin(M48T59_READ(M48T59_YEAR)); |
175 | #ifdef CONFIG_SPARC | ||
176 | /* Sun SPARC machines count years since 1968 */ | ||
177 | tm->tm_year += 68; | ||
178 | #endif | ||
162 | /* tm_mon is 0-11 */ | 179 | /* tm_mon is 0-11 */ |
163 | tm->tm_mon = bcd2bin(M48T59_READ(M48T59_MONTH)) - 1; | 180 | tm->tm_mon = bcd2bin(M48T59_READ(M48T59_MONTH)) - 1; |
164 | 181 | ||
@@ -192,11 +209,20 @@ static int m48t59_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
192 | struct rtc_time *tm = &alrm->time; | 209 | struct rtc_time *tm = &alrm->time; |
193 | u8 mday, hour, min, sec; | 210 | u8 mday, hour, min, sec; |
194 | unsigned long flags; | 211 | unsigned long flags; |
212 | int year = tm->tm_year; | ||
213 | |||
214 | #ifdef CONFIG_SPARC | ||
215 | /* Sun SPARC machines count years since 1968 */ | ||
216 | year -= 68; | ||
217 | #endif | ||
195 | 218 | ||
196 | /* If no irq, we don't support ALARM */ | 219 | /* If no irq, we don't support ALARM */ |
197 | if (m48t59->irq == NO_IRQ) | 220 | if (m48t59->irq == NO_IRQ) |
198 | return -EIO; | 221 | return -EIO; |
199 | 222 | ||
223 | if (year < 0) | ||
224 | return -EINVAL; | ||
225 | |||
200 | /* | 226 | /* |
201 | * 0xff means "always match" | 227 | * 0xff means "always match" |
202 | */ | 228 | */ |
@@ -228,7 +254,7 @@ static int m48t59_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
228 | spin_unlock_irqrestore(&m48t59->lock, flags); | 254 | spin_unlock_irqrestore(&m48t59->lock, flags); |
229 | 255 | ||
230 | dev_dbg(dev, "RTC set alarm time %04d-%02d-%02d %02d/%02d/%02d\n", | 256 | dev_dbg(dev, "RTC set alarm time %04d-%02d-%02d %02d/%02d/%02d\n", |
231 | tm->tm_year + 1900, tm->tm_mon, tm->tm_mday, | 257 | year + 1900, tm->tm_mon, tm->tm_mday, |
232 | tm->tm_hour, tm->tm_min, tm->tm_sec); | 258 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
233 | return 0; | 259 | return 0; |
234 | } | 260 | } |
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 0273ebc4cf36..7a568beba3f0 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -455,6 +455,8 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) | |||
455 | 455 | ||
456 | s3c_rtc_setfreq(&pdev->dev, 1); | 456 | s3c_rtc_setfreq(&pdev->dev, 1); |
457 | 457 | ||
458 | device_init_wakeup(&pdev->dev, 1); | ||
459 | |||
458 | /* register RTC and exit */ | 460 | /* register RTC and exit */ |
459 | 461 | ||
460 | rtc = rtc_device_register("s3c", &pdev->dev, &s3c_rtcops, | 462 | rtc = rtc_device_register("s3c", &pdev->dev, &s3c_rtcops, |
@@ -507,7 +509,7 @@ static int s3c_rtc_resume(struct platform_device *pdev) | |||
507 | #define s3c_rtc_resume NULL | 509 | #define s3c_rtc_resume NULL |
508 | #endif | 510 | #endif |
509 | 511 | ||
510 | static struct platform_driver s3c2410_rtcdrv = { | 512 | static struct platform_driver s3c2410_rtc_driver = { |
511 | .probe = s3c_rtc_probe, | 513 | .probe = s3c_rtc_probe, |
512 | .remove = __devexit_p(s3c_rtc_remove), | 514 | .remove = __devexit_p(s3c_rtc_remove), |
513 | .suspend = s3c_rtc_suspend, | 515 | .suspend = s3c_rtc_suspend, |
@@ -523,12 +525,12 @@ static char __initdata banner[] = "S3C24XX RTC, (c) 2004,2006 Simtec Electronics | |||
523 | static int __init s3c_rtc_init(void) | 525 | static int __init s3c_rtc_init(void) |
524 | { | 526 | { |
525 | printk(banner); | 527 | printk(banner); |
526 | return platform_driver_register(&s3c2410_rtcdrv); | 528 | return platform_driver_register(&s3c2410_rtc_driver); |
527 | } | 529 | } |
528 | 530 | ||
529 | static void __exit s3c_rtc_exit(void) | 531 | static void __exit s3c_rtc_exit(void) |
530 | { | 532 | { |
531 | platform_driver_unregister(&s3c2410_rtcdrv); | 533 | platform_driver_unregister(&s3c2410_rtc_driver); |
532 | } | 534 | } |
533 | 535 | ||
534 | module_init(s3c_rtc_init); | 536 | module_init(s3c_rtc_init); |