diff options
Diffstat (limited to 'drivers/rtc')
47 files changed, 382 insertions, 524 deletions
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 53eb4e55b289..3a125b835546 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
| @@ -498,9 +498,9 @@ config RTC_DRV_CMOS | |||
| 498 | will be called rtc-cmos. | 498 | will be called rtc-cmos. |
| 499 | 499 | ||
| 500 | config RTC_DRV_VRTC | 500 | config RTC_DRV_VRTC |
| 501 | tristate "Virtual RTC for Moorestown platforms" | 501 | tristate "Virtual RTC for Intel MID platforms" |
| 502 | depends on X86_MRST | 502 | depends on X86_INTEL_MID |
| 503 | default y if X86_MRST | 503 | default y if X86_INTEL_MID |
| 504 | 504 | ||
| 505 | help | 505 | help |
| 506 | Say "yes" here to get direct support for the real time clock | 506 | Say "yes" here to get direct support for the real time clock |
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index e8326f26fa2f..dc4c2748bbc3 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c | |||
| @@ -63,7 +63,7 @@ static int rtc_suspend(struct device *dev, pm_message_t mesg) | |||
| 63 | */ | 63 | */ |
| 64 | delta = timespec_sub(old_system, old_rtc); | 64 | delta = timespec_sub(old_system, old_rtc); |
| 65 | delta_delta = timespec_sub(delta, old_delta); | 65 | delta_delta = timespec_sub(delta, old_delta); |
| 66 | if (abs(delta_delta.tv_sec) >= 2) { | 66 | if (delta_delta.tv_sec < -2 || delta_delta.tv_sec >= 2) { |
| 67 | /* | 67 | /* |
| 68 | * if delta_delta is too large, assume time correction | 68 | * if delta_delta is too large, assume time correction |
| 69 | * has occured and set old_delta to the current delta. | 69 | * has occured and set old_delta to the current delta. |
| @@ -97,9 +97,8 @@ static int rtc_resume(struct device *dev) | |||
| 97 | rtc_tm_to_time(&tm, &new_rtc.tv_sec); | 97 | rtc_tm_to_time(&tm, &new_rtc.tv_sec); |
| 98 | new_rtc.tv_nsec = 0; | 98 | new_rtc.tv_nsec = 0; |
| 99 | 99 | ||
| 100 | if (new_rtc.tv_sec <= old_rtc.tv_sec) { | 100 | if (new_rtc.tv_sec < old_rtc.tv_sec) { |
| 101 | if (new_rtc.tv_sec < old_rtc.tv_sec) | 101 | pr_debug("%s: time travel!\n", dev_name(&rtc->dev)); |
| 102 | pr_debug("%s: time travel!\n", dev_name(&rtc->dev)); | ||
| 103 | return 0; | 102 | return 0; |
| 104 | } | 103 | } |
| 105 | 104 | ||
| @@ -116,7 +115,8 @@ static int rtc_resume(struct device *dev) | |||
| 116 | sleep_time = timespec_sub(sleep_time, | 115 | sleep_time = timespec_sub(sleep_time, |
| 117 | timespec_sub(new_system, old_system)); | 116 | timespec_sub(new_system, old_system)); |
| 118 | 117 | ||
| 119 | timekeeping_inject_sleeptime(&sleep_time); | 118 | if (sleep_time.tv_sec >= 0) |
| 119 | timekeeping_inject_sleeptime(&sleep_time); | ||
| 120 | return 0; | 120 | return 0; |
| 121 | } | 121 | } |
| 122 | 122 | ||
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 8e286259a007..8a1c031391d6 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c | |||
| @@ -228,11 +228,11 @@ int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) | |||
| 228 | alarm->time.tm_hour = now.tm_hour; | 228 | alarm->time.tm_hour = now.tm_hour; |
| 229 | 229 | ||
| 230 | /* For simplicity, only support date rollover for now */ | 230 | /* For simplicity, only support date rollover for now */ |
| 231 | if (alarm->time.tm_mday == -1) { | 231 | if (alarm->time.tm_mday < 1 || alarm->time.tm_mday > 31) { |
| 232 | alarm->time.tm_mday = now.tm_mday; | 232 | alarm->time.tm_mday = now.tm_mday; |
| 233 | missing = day; | 233 | missing = day; |
| 234 | } | 234 | } |
| 235 | if (alarm->time.tm_mon == -1) { | 235 | if ((unsigned)alarm->time.tm_mon >= 12) { |
| 236 | alarm->time.tm_mon = now.tm_mon; | 236 | alarm->time.tm_mon = now.tm_mon; |
| 237 | if (missing == none) | 237 | if (missing == none) |
| 238 | missing = month; | 238 | missing = month; |
diff --git a/drivers/rtc/rtc-88pm860x.c b/drivers/rtc/rtc-88pm860x.c index 64b847b7f970..f04761e6622d 100644 --- a/drivers/rtc/rtc-88pm860x.c +++ b/drivers/rtc/rtc-88pm860x.c | |||
| @@ -410,17 +410,7 @@ static struct platform_driver pm860x_rtc_driver = { | |||
| 410 | .remove = __devexit_p(pm860x_rtc_remove), | 410 | .remove = __devexit_p(pm860x_rtc_remove), |
| 411 | }; | 411 | }; |
| 412 | 412 | ||
| 413 | static int __init pm860x_rtc_init(void) | 413 | module_platform_driver(pm860x_rtc_driver); |
| 414 | { | ||
| 415 | return platform_driver_register(&pm860x_rtc_driver); | ||
| 416 | } | ||
| 417 | module_init(pm860x_rtc_init); | ||
| 418 | |||
| 419 | static void __exit pm860x_rtc_exit(void) | ||
| 420 | { | ||
| 421 | platform_driver_unregister(&pm860x_rtc_driver); | ||
| 422 | } | ||
| 423 | module_exit(pm860x_rtc_exit); | ||
| 424 | 414 | ||
| 425 | MODULE_DESCRIPTION("Marvell 88PM860x RTC driver"); | 415 | MODULE_DESCRIPTION("Marvell 88PM860x RTC driver"); |
| 426 | MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); | 416 | MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); |
diff --git a/drivers/rtc/rtc-ab8500.c b/drivers/rtc/rtc-ab8500.c index e346705aae92..4bcf9ca2818a 100644 --- a/drivers/rtc/rtc-ab8500.c +++ b/drivers/rtc/rtc-ab8500.c | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
| 16 | #include <linux/rtc.h> | 16 | #include <linux/rtc.h> |
| 17 | #include <linux/mfd/abx500.h> | 17 | #include <linux/mfd/abx500.h> |
| 18 | #include <linux/mfd/ab8500.h> | 18 | #include <linux/mfd/abx500/ab8500.h> |
| 19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
| 20 | 20 | ||
| 21 | #define AB8500_RTC_SOFF_STAT_REG 0x00 | 21 | #define AB8500_RTC_SOFF_STAT_REG 0x00 |
| @@ -90,7 +90,7 @@ static int ab8500_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
| 90 | 90 | ||
| 91 | /* Early AB8500 chips will not clear the rtc read request bit */ | 91 | /* Early AB8500 chips will not clear the rtc read request bit */ |
| 92 | if (abx500_get_chip_id(dev) == 0) { | 92 | if (abx500_get_chip_id(dev) == 0) { |
| 93 | msleep(1); | 93 | usleep_range(1000, 1000); |
| 94 | } else { | 94 | } else { |
| 95 | /* Wait for some cycles after enabling the rtc read in ab8500 */ | 95 | /* Wait for some cycles after enabling the rtc read in ab8500 */ |
| 96 | while (time_before(jiffies, timeout)) { | 96 | while (time_before(jiffies, timeout)) { |
| @@ -102,7 +102,7 @@ static int ab8500_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
| 102 | if (!(value & RTC_READ_REQUEST)) | 102 | if (!(value & RTC_READ_REQUEST)) |
| 103 | break; | 103 | break; |
| 104 | 104 | ||
| 105 | msleep(1); | 105 | usleep_range(1000, 5000); |
| 106 | } | 106 | } |
| 107 | } | 107 | } |
| 108 | 108 | ||
| @@ -258,6 +258,109 @@ static int ab8500_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) | |||
| 258 | return ab8500_rtc_irq_enable(dev, alarm->enabled); | 258 | return ab8500_rtc_irq_enable(dev, alarm->enabled); |
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | |||
| 262 | static int ab8500_rtc_set_calibration(struct device *dev, int calibration) | ||
| 263 | { | ||
| 264 | int retval; | ||
| 265 | u8 rtccal = 0; | ||
| 266 | |||
| 267 | /* | ||
| 268 | * Check that the calibration value (which is in units of 0.5 | ||
| 269 | * parts-per-million) is in the AB8500's range for RtcCalibration | ||
| 270 | * register. -128 (0x80) is not permitted because the AB8500 uses | ||
| 271 | * a sign-bit rather than two's complement, so 0x80 is just another | ||
| 272 | * representation of zero. | ||
| 273 | */ | ||
| 274 | if ((calibration < -127) || (calibration > 127)) { | ||
| 275 | dev_err(dev, "RtcCalibration value outside permitted range\n"); | ||
| 276 | return -EINVAL; | ||
| 277 | } | ||
| 278 | |||
| 279 | /* | ||
| 280 | * The AB8500 uses sign (in bit7) and magnitude (in bits0-7) | ||
| 281 | * so need to convert to this sort of representation before writing | ||
| 282 | * into RtcCalibration register... | ||
| 283 | */ | ||
| 284 | if (calibration >= 0) | ||
| 285 | rtccal = 0x7F & calibration; | ||
| 286 | else | ||
| 287 | rtccal = ~(calibration - 1) | 0x80; | ||
| 288 | |||
| 289 | retval = abx500_set_register_interruptible(dev, AB8500_RTC, | ||
| 290 | AB8500_RTC_CALIB_REG, rtccal); | ||
| 291 | |||
| 292 | return retval; | ||
| 293 | } | ||
| 294 | |||
| 295 | static int ab8500_rtc_get_calibration(struct device *dev, int *calibration) | ||
| 296 | { | ||
| 297 | int retval; | ||
| 298 | u8 rtccal = 0; | ||
| 299 | |||
| 300 | retval = abx500_get_register_interruptible(dev, AB8500_RTC, | ||
| 301 | AB8500_RTC_CALIB_REG, &rtccal); | ||
| 302 | if (retval >= 0) { | ||
| 303 | /* | ||
| 304 | * The AB8500 uses sign (in bit7) and magnitude (in bits0-7) | ||
| 305 | * so need to convert value from RtcCalibration register into | ||
| 306 | * a two's complement signed value... | ||
| 307 | */ | ||
| 308 | if (rtccal & 0x80) | ||
| 309 | *calibration = 0 - (rtccal & 0x7F); | ||
| 310 | else | ||
| 311 | *calibration = 0x7F & rtccal; | ||
| 312 | } | ||
| 313 | |||
| 314 | return retval; | ||
| 315 | } | ||
| 316 | |||
| 317 | static ssize_t ab8500_sysfs_store_rtc_calibration(struct device *dev, | ||
| 318 | struct device_attribute *attr, | ||
| 319 | const char *buf, size_t count) | ||
| 320 | { | ||
| 321 | int retval; | ||
| 322 | int calibration = 0; | ||
| 323 | |||
| 324 | if (sscanf(buf, " %i ", &calibration) != 1) { | ||
| 325 | dev_err(dev, "Failed to store RTC calibration attribute\n"); | ||
| 326 | return -EINVAL; | ||
| 327 | } | ||
| 328 | |||
| 329 | retval = ab8500_rtc_set_calibration(dev, calibration); | ||
| 330 | |||
| 331 | return retval ? retval : count; | ||
| 332 | } | ||
| 333 | |||
| 334 | static ssize_t ab8500_sysfs_show_rtc_calibration(struct device *dev, | ||
| 335 | struct device_attribute *attr, char *buf) | ||
| 336 | { | ||
| 337 | int retval = 0; | ||
| 338 | int calibration = 0; | ||
| 339 | |||
| 340 | retval = ab8500_rtc_get_calibration(dev, &calibration); | ||
| 341 | if (retval < 0) { | ||
| 342 | dev_err(dev, "Failed to read RTC calibration attribute\n"); | ||
| 343 | sprintf(buf, "0\n"); | ||
| 344 | return retval; | ||
| 345 | } | ||
| 346 | |||
| 347 | return sprintf(buf, "%d\n", calibration); | ||
| 348 | } | ||
| 349 | |||
| 350 | static DEVICE_ATTR(rtc_calibration, S_IRUGO | S_IWUSR, | ||
| 351 | ab8500_sysfs_show_rtc_calibration, | ||
| 352 | ab8500_sysfs_store_rtc_calibration); | ||
| 353 | |||
| 354 | static int ab8500_sysfs_rtc_register(struct device *dev) | ||
| 355 | { | ||
| 356 | return device_create_file(dev, &dev_attr_rtc_calibration); | ||
| 357 | } | ||
| 358 | |||
| 359 | static void ab8500_sysfs_rtc_unregister(struct device *dev) | ||
| 360 | { | ||
| 361 | device_remove_file(dev, &dev_attr_rtc_calibration); | ||
| 362 | } | ||
| 363 | |||
| 261 | static irqreturn_t rtc_alarm_handler(int irq, void *data) | 364 | static irqreturn_t rtc_alarm_handler(int irq, void *data) |
| 262 | { | 365 | { |
| 263 | struct rtc_device *rtc = data; | 366 | struct rtc_device *rtc = data; |
| @@ -295,7 +398,7 @@ static int __devinit ab8500_rtc_probe(struct platform_device *pdev) | |||
| 295 | return err; | 398 | return err; |
| 296 | 399 | ||
| 297 | /* Wait for reset by the PorRtc */ | 400 | /* Wait for reset by the PorRtc */ |
| 298 | msleep(1); | 401 | usleep_range(1000, 5000); |
| 299 | 402 | ||
| 300 | err = abx500_get_register_interruptible(&pdev->dev, AB8500_RTC, | 403 | err = abx500_get_register_interruptible(&pdev->dev, AB8500_RTC, |
| 301 | AB8500_RTC_STAT_REG, &rtc_ctrl); | 404 | AB8500_RTC_STAT_REG, &rtc_ctrl); |
| @@ -308,6 +411,8 @@ static int __devinit ab8500_rtc_probe(struct platform_device *pdev) | |||
| 308 | return -ENODEV; | 411 | return -ENODEV; |
| 309 | } | 412 | } |
| 310 | 413 | ||
| 414 | device_init_wakeup(&pdev->dev, true); | ||
| 415 | |||
| 311 | rtc = rtc_device_register("ab8500-rtc", &pdev->dev, &ab8500_rtc_ops, | 416 | rtc = rtc_device_register("ab8500-rtc", &pdev->dev, &ab8500_rtc_ops, |
| 312 | THIS_MODULE); | 417 | THIS_MODULE); |
| 313 | if (IS_ERR(rtc)) { | 418 | if (IS_ERR(rtc)) { |
| @@ -316,8 +421,8 @@ static int __devinit ab8500_rtc_probe(struct platform_device *pdev) | |||
| 316 | return err; | 421 | return err; |
| 317 | } | 422 | } |
| 318 | 423 | ||
| 319 | err = request_threaded_irq(irq, NULL, rtc_alarm_handler, 0, | 424 | err = request_threaded_irq(irq, NULL, rtc_alarm_handler, |
| 320 | "ab8500-rtc", rtc); | 425 | IRQF_NO_SUSPEND, "ab8500-rtc", rtc); |
| 321 | if (err < 0) { | 426 | if (err < 0) { |
| 322 | rtc_device_unregister(rtc); | 427 | rtc_device_unregister(rtc); |
| 323 | return err; | 428 | return err; |
| @@ -325,6 +430,13 @@ static int __devinit ab8500_rtc_probe(struct platform_device *pdev) | |||
| 325 | 430 | ||
| 326 | platform_set_drvdata(pdev, rtc); | 431 | platform_set_drvdata(pdev, rtc); |
| 327 | 432 | ||
| 433 | |||
| 434 | err = ab8500_sysfs_rtc_register(&pdev->dev); | ||
| 435 | if (err) { | ||
| 436 | dev_err(&pdev->dev, "sysfs RTC failed to register\n"); | ||
| 437 | return err; | ||
| 438 | } | ||
| 439 | |||
| 328 | return 0; | 440 | return 0; |
| 329 | } | 441 | } |
| 330 | 442 | ||
| @@ -333,6 +445,8 @@ static int __devexit ab8500_rtc_remove(struct platform_device *pdev) | |||
| 333 | struct rtc_device *rtc = platform_get_drvdata(pdev); | 445 | struct rtc_device *rtc = platform_get_drvdata(pdev); |
| 334 | int irq = platform_get_irq_byname(pdev, "ALARM"); | 446 | int irq = platform_get_irq_byname(pdev, "ALARM"); |
| 335 | 447 | ||
| 448 | ab8500_sysfs_rtc_unregister(&pdev->dev); | ||
| 449 | |||
| 336 | free_irq(irq, rtc); | 450 | free_irq(irq, rtc); |
| 337 | rtc_device_unregister(rtc); | 451 | rtc_device_unregister(rtc); |
| 338 | platform_set_drvdata(pdev, NULL); | 452 | platform_set_drvdata(pdev, NULL); |
| @@ -349,18 +463,8 @@ static struct platform_driver ab8500_rtc_driver = { | |||
| 349 | .remove = __devexit_p(ab8500_rtc_remove), | 463 | .remove = __devexit_p(ab8500_rtc_remove), |
| 350 | }; | 464 | }; |
| 351 | 465 | ||
| 352 | static int __init ab8500_rtc_init(void) | 466 | module_platform_driver(ab8500_rtc_driver); |
| 353 | { | ||
| 354 | return platform_driver_register(&ab8500_rtc_driver); | ||
| 355 | } | ||
| 356 | |||
| 357 | static void __exit ab8500_rtc_exit(void) | ||
| 358 | { | ||
| 359 | platform_driver_unregister(&ab8500_rtc_driver); | ||
| 360 | } | ||
| 361 | 467 | ||
| 362 | module_init(ab8500_rtc_init); | ||
| 363 | module_exit(ab8500_rtc_exit); | ||
| 364 | MODULE_AUTHOR("Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>"); | 468 | MODULE_AUTHOR("Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>"); |
| 365 | MODULE_DESCRIPTION("AB8500 RTC Driver"); | 469 | MODULE_DESCRIPTION("AB8500 RTC Driver"); |
| 366 | MODULE_LICENSE("GPL v2"); | 470 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c index e39b77a4609a..dc474bc6522d 100644 --- a/drivers/rtc/rtc-at91rm9200.c +++ b/drivers/rtc/rtc-at91rm9200.c | |||
| @@ -32,11 +32,17 @@ | |||
| 32 | 32 | ||
| 33 | #include <mach/at91_rtc.h> | 33 | #include <mach/at91_rtc.h> |
| 34 | 34 | ||
| 35 | #define at91_rtc_read(field) \ | ||
| 36 | __raw_readl(at91_rtc_regs + field) | ||
| 37 | #define at91_rtc_write(field, val) \ | ||
| 38 | __raw_writel((val), at91_rtc_regs + field) | ||
| 35 | 39 | ||
| 36 | #define AT91_RTC_EPOCH 1900UL /* just like arch/arm/common/rtctime.c */ | 40 | #define AT91_RTC_EPOCH 1900UL /* just like arch/arm/common/rtctime.c */ |
| 37 | 41 | ||
| 38 | static DECLARE_COMPLETION(at91_rtc_updated); | 42 | static DECLARE_COMPLETION(at91_rtc_updated); |
| 39 | static unsigned int at91_alarm_year = AT91_RTC_EPOCH; | 43 | static unsigned int at91_alarm_year = AT91_RTC_EPOCH; |
| 44 | static void __iomem *at91_rtc_regs; | ||
| 45 | static int irq; | ||
| 40 | 46 | ||
| 41 | /* | 47 | /* |
| 42 | * Decode time/date into rtc_time structure | 48 | * Decode time/date into rtc_time structure |
| @@ -48,10 +54,10 @@ static void at91_rtc_decodetime(unsigned int timereg, unsigned int calreg, | |||
| 48 | 54 | ||
| 49 | /* must read twice in case it changes */ | 55 | /* must read twice in case it changes */ |
| 50 | do { | 56 | do { |
| 51 | time = at91_sys_read(timereg); | 57 | time = at91_rtc_read(timereg); |
| 52 | date = at91_sys_read(calreg); | 58 | date = at91_rtc_read(calreg); |
| 53 | } while ((time != at91_sys_read(timereg)) || | 59 | } while ((time != at91_rtc_read(timereg)) || |
| 54 | (date != at91_sys_read(calreg))); | 60 | (date != at91_rtc_read(calreg))); |
| 55 | 61 | ||
| 56 | tm->tm_sec = bcd2bin((time & AT91_RTC_SEC) >> 0); | 62 | tm->tm_sec = bcd2bin((time & AT91_RTC_SEC) >> 0); |
| 57 | tm->tm_min = bcd2bin((time & AT91_RTC_MIN) >> 8); | 63 | tm->tm_min = bcd2bin((time & AT91_RTC_MIN) >> 8); |
| @@ -98,19 +104,19 @@ static int at91_rtc_settime(struct device *dev, struct rtc_time *tm) | |||
| 98 | tm->tm_hour, tm->tm_min, tm->tm_sec); | 104 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
| 99 | 105 | ||
| 100 | /* Stop Time/Calendar from counting */ | 106 | /* Stop Time/Calendar from counting */ |
| 101 | cr = at91_sys_read(AT91_RTC_CR); | 107 | cr = at91_rtc_read(AT91_RTC_CR); |
| 102 | at91_sys_write(AT91_RTC_CR, cr | AT91_RTC_UPDCAL | AT91_RTC_UPDTIM); | 108 | at91_rtc_write(AT91_RTC_CR, cr | AT91_RTC_UPDCAL | AT91_RTC_UPDTIM); |
| 103 | 109 | ||
| 104 | at91_sys_write(AT91_RTC_IER, AT91_RTC_ACKUPD); | 110 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ACKUPD); |
| 105 | wait_for_completion(&at91_rtc_updated); /* wait for ACKUPD interrupt */ | 111 | wait_for_completion(&at91_rtc_updated); /* wait for ACKUPD interrupt */ |
| 106 | at91_sys_write(AT91_RTC_IDR, AT91_RTC_ACKUPD); | 112 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD); |
| 107 | 113 | ||
| 108 | at91_sys_write(AT91_RTC_TIMR, | 114 | at91_rtc_write(AT91_RTC_TIMR, |
| 109 | bin2bcd(tm->tm_sec) << 0 | 115 | bin2bcd(tm->tm_sec) << 0 |
| 110 | | bin2bcd(tm->tm_min) << 8 | 116 | | bin2bcd(tm->tm_min) << 8 |
| 111 | | bin2bcd(tm->tm_hour) << 16); | 117 | | bin2bcd(tm->tm_hour) << 16); |
| 112 | 118 | ||
| 113 | at91_sys_write(AT91_RTC_CALR, | 119 | at91_rtc_write(AT91_RTC_CALR, |
| 114 | bin2bcd((tm->tm_year + 1900) / 100) /* century */ | 120 | bin2bcd((tm->tm_year + 1900) / 100) /* century */ |
| 115 | | bin2bcd(tm->tm_year % 100) << 8 /* year */ | 121 | | bin2bcd(tm->tm_year % 100) << 8 /* year */ |
| 116 | | bin2bcd(tm->tm_mon + 1) << 16 /* tm_mon starts at zero */ | 122 | | bin2bcd(tm->tm_mon + 1) << 16 /* tm_mon starts at zero */ |
| @@ -118,8 +124,8 @@ static int at91_rtc_settime(struct device *dev, struct rtc_time *tm) | |||
| 118 | | bin2bcd(tm->tm_mday) << 24); | 124 | | bin2bcd(tm->tm_mday) << 24); |
| 119 | 125 | ||
| 120 | /* Restart Time/Calendar */ | 126 | /* Restart Time/Calendar */ |
| 121 | cr = at91_sys_read(AT91_RTC_CR); | 127 | cr = at91_rtc_read(AT91_RTC_CR); |
| 122 | at91_sys_write(AT91_RTC_CR, cr & ~(AT91_RTC_UPDCAL | AT91_RTC_UPDTIM)); | 128 | at91_rtc_write(AT91_RTC_CR, cr & ~(AT91_RTC_UPDCAL | AT91_RTC_UPDTIM)); |
| 123 | 129 | ||
| 124 | return 0; | 130 | return 0; |
| 125 | } | 131 | } |
| @@ -135,7 +141,7 @@ static int at91_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
| 135 | tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year); | 141 | tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year); |
| 136 | tm->tm_year = at91_alarm_year - 1900; | 142 | tm->tm_year = at91_alarm_year - 1900; |
| 137 | 143 | ||
| 138 | alrm->enabled = (at91_sys_read(AT91_RTC_IMR) & AT91_RTC_ALARM) | 144 | alrm->enabled = (at91_rtc_read(AT91_RTC_IMR) & AT91_RTC_ALARM) |
| 139 | ? 1 : 0; | 145 | ? 1 : 0; |
| 140 | 146 | ||
| 141 | pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, | 147 | pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, |
| @@ -160,20 +166,20 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
| 160 | tm.tm_min = alrm->time.tm_min; | 166 | tm.tm_min = alrm->time.tm_min; |
| 161 | tm.tm_sec = alrm->time.tm_sec; | 167 | tm.tm_sec = alrm->time.tm_sec; |
| 162 | 168 | ||
| 163 | at91_sys_write(AT91_RTC_IDR, AT91_RTC_ALARM); | 169 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); |
| 164 | at91_sys_write(AT91_RTC_TIMALR, | 170 | at91_rtc_write(AT91_RTC_TIMALR, |
| 165 | bin2bcd(tm.tm_sec) << 0 | 171 | bin2bcd(tm.tm_sec) << 0 |
| 166 | | bin2bcd(tm.tm_min) << 8 | 172 | | bin2bcd(tm.tm_min) << 8 |
| 167 | | bin2bcd(tm.tm_hour) << 16 | 173 | | bin2bcd(tm.tm_hour) << 16 |
| 168 | | AT91_RTC_HOUREN | AT91_RTC_MINEN | AT91_RTC_SECEN); | 174 | | AT91_RTC_HOUREN | AT91_RTC_MINEN | AT91_RTC_SECEN); |
| 169 | at91_sys_write(AT91_RTC_CALALR, | 175 | at91_rtc_write(AT91_RTC_CALALR, |
| 170 | bin2bcd(tm.tm_mon + 1) << 16 /* tm_mon starts at zero */ | 176 | bin2bcd(tm.tm_mon + 1) << 16 /* tm_mon starts at zero */ |
| 171 | | bin2bcd(tm.tm_mday) << 24 | 177 | | bin2bcd(tm.tm_mday) << 24 |
| 172 | | AT91_RTC_DATEEN | AT91_RTC_MTHEN); | 178 | | AT91_RTC_DATEEN | AT91_RTC_MTHEN); |
| 173 | 179 | ||
| 174 | if (alrm->enabled) { | 180 | if (alrm->enabled) { |
| 175 | at91_sys_write(AT91_RTC_SCCR, AT91_RTC_ALARM); | 181 | at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); |
| 176 | at91_sys_write(AT91_RTC_IER, AT91_RTC_ALARM); | 182 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); |
| 177 | } | 183 | } |
| 178 | 184 | ||
| 179 | pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, | 185 | pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, |
| @@ -188,10 +194,10 @@ static int at91_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | |||
| 188 | pr_debug("%s(): cmd=%08x\n", __func__, enabled); | 194 | pr_debug("%s(): cmd=%08x\n", __func__, enabled); |
| 189 | 195 | ||
| 190 | if (enabled) { | 196 | if (enabled) { |
| 191 | at91_sys_write(AT91_RTC_SCCR, AT91_RTC_ALARM); | 197 | at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); |
| 192 | at91_sys_write(AT91_RTC_IER, AT91_RTC_ALARM); | 198 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); |
| 193 | } else | 199 | } else |
| 194 | at91_sys_write(AT91_RTC_IDR, AT91_RTC_ALARM); | 200 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); |
| 195 | 201 | ||
| 196 | return 0; | 202 | return 0; |
| 197 | } | 203 | } |
| @@ -200,7 +206,7 @@ static int at91_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | |||
| 200 | */ | 206 | */ |
| 201 | static int at91_rtc_proc(struct device *dev, struct seq_file *seq) | 207 | static int at91_rtc_proc(struct device *dev, struct seq_file *seq) |
| 202 | { | 208 | { |
| 203 | unsigned long imr = at91_sys_read(AT91_RTC_IMR); | 209 | unsigned long imr = at91_rtc_read(AT91_RTC_IMR); |
| 204 | 210 | ||
| 205 | seq_printf(seq, "update_IRQ\t: %s\n", | 211 | seq_printf(seq, "update_IRQ\t: %s\n", |
| 206 | (imr & AT91_RTC_ACKUPD) ? "yes" : "no"); | 212 | (imr & AT91_RTC_ACKUPD) ? "yes" : "no"); |
| @@ -220,7 +226,7 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *dev_id) | |||
| 220 | unsigned int rtsr; | 226 | unsigned int rtsr; |
| 221 | unsigned long events = 0; | 227 | unsigned long events = 0; |
| 222 | 228 | ||
| 223 | rtsr = at91_sys_read(AT91_RTC_SR) & at91_sys_read(AT91_RTC_IMR); | 229 | rtsr = at91_rtc_read(AT91_RTC_SR) & at91_rtc_read(AT91_RTC_IMR); |
| 224 | if (rtsr) { /* this interrupt is shared! Is it ours? */ | 230 | if (rtsr) { /* this interrupt is shared! Is it ours? */ |
| 225 | if (rtsr & AT91_RTC_ALARM) | 231 | if (rtsr & AT91_RTC_ALARM) |
| 226 | events |= (RTC_AF | RTC_IRQF); | 232 | events |= (RTC_AF | RTC_IRQF); |
| @@ -229,7 +235,7 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *dev_id) | |||
| 229 | if (rtsr & AT91_RTC_ACKUPD) | 235 | if (rtsr & AT91_RTC_ACKUPD) |
| 230 | complete(&at91_rtc_updated); | 236 | complete(&at91_rtc_updated); |
| 231 | 237 | ||
| 232 | at91_sys_write(AT91_RTC_SCCR, rtsr); /* clear status reg */ | 238 | at91_rtc_write(AT91_RTC_SCCR, rtsr); /* clear status reg */ |
| 233 | 239 | ||
| 234 | rtc_update_irq(rtc, 1, events); | 240 | rtc_update_irq(rtc, 1, events); |
| 235 | 241 | ||
| @@ -256,22 +262,41 @@ static const struct rtc_class_ops at91_rtc_ops = { | |||
| 256 | static int __init at91_rtc_probe(struct platform_device *pdev) | 262 | static int __init at91_rtc_probe(struct platform_device *pdev) |
| 257 | { | 263 | { |
| 258 | struct rtc_device *rtc; | 264 | struct rtc_device *rtc; |
| 259 | int ret; | 265 | struct resource *regs; |
| 266 | int ret = 0; | ||
| 260 | 267 | ||
| 261 | at91_sys_write(AT91_RTC_CR, 0); | 268 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 262 | at91_sys_write(AT91_RTC_MR, 0); /* 24 hour mode */ | 269 | if (!regs) { |
| 270 | dev_err(&pdev->dev, "no mmio resource defined\n"); | ||
| 271 | return -ENXIO; | ||
| 272 | } | ||
| 273 | |||
| 274 | irq = platform_get_irq(pdev, 0); | ||
| 275 | if (irq < 0) { | ||
| 276 | dev_err(&pdev->dev, "no irq resource defined\n"); | ||
| 277 | return -ENXIO; | ||
| 278 | } | ||
| 279 | |||
| 280 | at91_rtc_regs = ioremap(regs->start, resource_size(regs)); | ||
| 281 | if (!at91_rtc_regs) { | ||
| 282 | dev_err(&pdev->dev, "failed to map registers, aborting.\n"); | ||
| 283 | return -ENOMEM; | ||
| 284 | } | ||
| 285 | |||
| 286 | at91_rtc_write(AT91_RTC_CR, 0); | ||
| 287 | at91_rtc_write(AT91_RTC_MR, 0); /* 24 hour mode */ | ||
| 263 | 288 | ||
| 264 | /* Disable all interrupts */ | 289 | /* Disable all interrupts */ |
| 265 | at91_sys_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | | 290 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | |
| 266 | AT91_RTC_SECEV | AT91_RTC_TIMEV | | 291 | AT91_RTC_SECEV | AT91_RTC_TIMEV | |
| 267 | AT91_RTC_CALEV); | 292 | AT91_RTC_CALEV); |
| 268 | 293 | ||
| 269 | ret = request_irq(AT91_ID_SYS, at91_rtc_interrupt, | 294 | ret = request_irq(irq, at91_rtc_interrupt, |
| 270 | IRQF_SHARED, | 295 | IRQF_SHARED, |
| 271 | "at91_rtc", pdev); | 296 | "at91_rtc", pdev); |
| 272 | if (ret) { | 297 | if (ret) { |
| 273 | printk(KERN_ERR "at91_rtc: IRQ %d already in use.\n", | 298 | printk(KERN_ERR "at91_rtc: IRQ %d already in use.\n", |
| 274 | AT91_ID_SYS); | 299 | irq); |
| 275 | return ret; | 300 | return ret; |
| 276 | } | 301 | } |
| 277 | 302 | ||
| @@ -284,7 +309,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev) | |||
| 284 | rtc = rtc_device_register(pdev->name, &pdev->dev, | 309 | rtc = rtc_device_register(pdev->name, &pdev->dev, |
| 285 | &at91_rtc_ops, THIS_MODULE); | 310 | &at91_rtc_ops, THIS_MODULE); |
| 286 | if (IS_ERR(rtc)) { | 311 | if (IS_ERR(rtc)) { |
| 287 | free_irq(AT91_ID_SYS, pdev); | 312 | free_irq(irq, pdev); |
| 288 | return PTR_ERR(rtc); | 313 | return PTR_ERR(rtc); |
| 289 | } | 314 | } |
| 290 | platform_set_drvdata(pdev, rtc); | 315 | platform_set_drvdata(pdev, rtc); |
| @@ -301,10 +326,10 @@ static int __exit at91_rtc_remove(struct platform_device *pdev) | |||
| 301 | struct rtc_device *rtc = platform_get_drvdata(pdev); | 326 | struct rtc_device *rtc = platform_get_drvdata(pdev); |
| 302 | 327 | ||
| 303 | /* Disable all interrupts */ | 328 | /* Disable all interrupts */ |
| 304 | at91_sys_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | | 329 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | |
| 305 | AT91_RTC_SECEV | AT91_RTC_TIMEV | | 330 | AT91_RTC_SECEV | AT91_RTC_TIMEV | |
| 306 | AT91_RTC_CALEV); | 331 | AT91_RTC_CALEV); |
| 307 | free_irq(AT91_ID_SYS, pdev); | 332 | free_irq(irq, pdev); |
| 308 | 333 | ||
| 309 | rtc_device_unregister(rtc); | 334 | rtc_device_unregister(rtc); |
| 310 | platform_set_drvdata(pdev, NULL); | 335 | platform_set_drvdata(pdev, NULL); |
| @@ -323,13 +348,13 @@ static int at91_rtc_suspend(struct device *dev) | |||
| 323 | /* this IRQ is shared with DBGU and other hardware which isn't | 348 | /* this IRQ is shared with DBGU and other hardware which isn't |
| 324 | * necessarily doing PM like we are... | 349 | * necessarily doing PM like we are... |
| 325 | */ | 350 | */ |
| 326 | at91_rtc_imr = at91_sys_read(AT91_RTC_IMR) | 351 | at91_rtc_imr = at91_rtc_read(AT91_RTC_IMR) |
| 327 | & (AT91_RTC_ALARM|AT91_RTC_SECEV); | 352 | & (AT91_RTC_ALARM|AT91_RTC_SECEV); |
| 328 | if (at91_rtc_imr) { | 353 | if (at91_rtc_imr) { |
| 329 | if (device_may_wakeup(dev)) | 354 | if (device_may_wakeup(dev)) |
| 330 | enable_irq_wake(AT91_ID_SYS); | 355 | enable_irq_wake(irq); |
| 331 | else | 356 | else |
| 332 | at91_sys_write(AT91_RTC_IDR, at91_rtc_imr); | 357 | at91_rtc_write(AT91_RTC_IDR, at91_rtc_imr); |
| 333 | } | 358 | } |
| 334 | return 0; | 359 | return 0; |
| 335 | } | 360 | } |
| @@ -338,9 +363,9 @@ static int at91_rtc_resume(struct device *dev) | |||
| 338 | { | 363 | { |
| 339 | if (at91_rtc_imr) { | 364 | if (at91_rtc_imr) { |
| 340 | if (device_may_wakeup(dev)) | 365 | if (device_may_wakeup(dev)) |
| 341 | disable_irq_wake(AT91_ID_SYS); | 366 | disable_irq_wake(irq); |
| 342 | else | 367 | else |
| 343 | at91_sys_write(AT91_RTC_IER, at91_rtc_imr); | 368 | at91_rtc_write(AT91_RTC_IER, at91_rtc_imr); |
| 344 | } | 369 | } |
| 345 | return 0; | 370 | return 0; |
| 346 | } | 371 | } |
diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c index 90d866272c8e..abfc1a0c07d9 100644 --- a/drivers/rtc/rtc-bfin.c +++ b/drivers/rtc/rtc-bfin.c | |||
| @@ -456,18 +456,7 @@ static struct platform_driver bfin_rtc_driver = { | |||
| 456 | .resume = bfin_rtc_resume, | 456 | .resume = bfin_rtc_resume, |
| 457 | }; | 457 | }; |
| 458 | 458 | ||
| 459 | static int __init bfin_rtc_init(void) | 459 | module_platform_driver(bfin_rtc_driver); |
| 460 | { | ||
| 461 | return platform_driver_register(&bfin_rtc_driver); | ||
| 462 | } | ||
| 463 | |||
| 464 | static void __exit bfin_rtc_exit(void) | ||
| 465 | { | ||
| 466 | platform_driver_unregister(&bfin_rtc_driver); | ||
| 467 | } | ||
| 468 | |||
| 469 | module_init(bfin_rtc_init); | ||
| 470 | module_exit(bfin_rtc_exit); | ||
| 471 | 460 | ||
| 472 | MODULE_DESCRIPTION("Blackfin On-Chip Real Time Clock Driver"); | 461 | MODULE_DESCRIPTION("Blackfin On-Chip Real Time Clock Driver"); |
| 473 | MODULE_AUTHOR("Mike Frysinger <vapier@gentoo.org>"); | 462 | MODULE_AUTHOR("Mike Frysinger <vapier@gentoo.org>"); |
diff --git a/drivers/rtc/rtc-bq4802.c b/drivers/rtc/rtc-bq4802.c index 128270ce355d..bf612ef22941 100644 --- a/drivers/rtc/rtc-bq4802.c +++ b/drivers/rtc/rtc-bq4802.c | |||
| @@ -218,15 +218,4 @@ static struct platform_driver bq4802_driver = { | |||
| 218 | .remove = __devexit_p(bq4802_remove), | 218 | .remove = __devexit_p(bq4802_remove), |
| 219 | }; | 219 | }; |
| 220 | 220 | ||
| 221 | static int __init bq4802_init(void) | 221 | module_platform_driver(bq4802_driver); |
| 222 | { | ||
| 223 | return platform_driver_register(&bq4802_driver); | ||
| 224 | } | ||
| 225 | |||
| 226 | static void __exit bq4802_exit(void) | ||
| 227 | { | ||
| 228 | platform_driver_unregister(&bq4802_driver); | ||
| 229 | } | ||
| 230 | |||
| 231 | module_init(bq4802_init); | ||
| 232 | module_exit(bq4802_exit); | ||
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index 05beb6c1ca79..d7782aa09943 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c | |||
| @@ -164,7 +164,7 @@ static inline unsigned char cmos_read_bank2(unsigned char addr) | |||
| 164 | static inline void cmos_write_bank2(unsigned char val, unsigned char addr) | 164 | static inline void cmos_write_bank2(unsigned char val, unsigned char addr) |
| 165 | { | 165 | { |
| 166 | outb(addr, RTC_PORT(2)); | 166 | outb(addr, RTC_PORT(2)); |
| 167 | outb(val, RTC_PORT(2)); | 167 | outb(val, RTC_PORT(3)); |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | #else | 170 | #else |
diff --git a/drivers/rtc/rtc-dm355evm.c b/drivers/rtc/rtc-dm355evm.c index 2322c43af201..d4457afcba89 100644 --- a/drivers/rtc/rtc-dm355evm.c +++ b/drivers/rtc/rtc-dm355evm.c | |||
| @@ -161,16 +161,6 @@ static struct platform_driver rtc_dm355evm_driver = { | |||
| 161 | }, | 161 | }, |
| 162 | }; | 162 | }; |
| 163 | 163 | ||
| 164 | static int __init dm355evm_rtc_init(void) | 164 | module_platform_driver(rtc_dm355evm_driver); |
| 165 | { | ||
| 166 | return platform_driver_register(&rtc_dm355evm_driver); | ||
| 167 | } | ||
| 168 | module_init(dm355evm_rtc_init); | ||
| 169 | |||
| 170 | static void __exit dm355evm_rtc_exit(void) | ||
| 171 | { | ||
| 172 | platform_driver_unregister(&rtc_dm355evm_driver); | ||
| 173 | } | ||
| 174 | module_exit(dm355evm_rtc_exit); | ||
| 175 | 165 | ||
| 176 | MODULE_LICENSE("GPL"); | 166 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/rtc/rtc-ds1286.c b/drivers/rtc/rtc-ds1286.c index 68e6caf25496..990c3ff489bf 100644 --- a/drivers/rtc/rtc-ds1286.c +++ b/drivers/rtc/rtc-ds1286.c | |||
| @@ -396,21 +396,10 @@ static struct platform_driver ds1286_platform_driver = { | |||
| 396 | .remove = __devexit_p(ds1286_remove), | 396 | .remove = __devexit_p(ds1286_remove), |
| 397 | }; | 397 | }; |
| 398 | 398 | ||
| 399 | static int __init ds1286_init(void) | 399 | module_platform_driver(ds1286_platform_driver); |
| 400 | { | ||
| 401 | return platform_driver_register(&ds1286_platform_driver); | ||
| 402 | } | ||
| 403 | |||
| 404 | static void __exit ds1286_exit(void) | ||
| 405 | { | ||
| 406 | platform_driver_unregister(&ds1286_platform_driver); | ||
| 407 | } | ||
| 408 | 400 | ||
| 409 | MODULE_AUTHOR("Thomas Bogendoerfer <tsbogend@alpha.franken.de>"); | 401 | MODULE_AUTHOR("Thomas Bogendoerfer <tsbogend@alpha.franken.de>"); |
| 410 | MODULE_DESCRIPTION("DS1286 RTC driver"); | 402 | MODULE_DESCRIPTION("DS1286 RTC driver"); |
| 411 | MODULE_LICENSE("GPL"); | 403 | MODULE_LICENSE("GPL"); |
| 412 | MODULE_VERSION(DRV_VERSION); | 404 | MODULE_VERSION(DRV_VERSION); |
| 413 | MODULE_ALIAS("platform:rtc-ds1286"); | 405 | MODULE_ALIAS("platform:rtc-ds1286"); |
| 414 | |||
| 415 | module_init(ds1286_init); | ||
| 416 | module_exit(ds1286_exit); | ||
diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c index 586c244a05d8..761f36bc83a9 100644 --- a/drivers/rtc/rtc-ds1511.c +++ b/drivers/rtc/rtc-ds1511.c | |||
| @@ -580,20 +580,7 @@ static struct platform_driver ds1511_rtc_driver = { | |||
| 580 | }, | 580 | }, |
| 581 | }; | 581 | }; |
| 582 | 582 | ||
| 583 | static int __init | 583 | module_platform_driver(ds1511_rtc_driver); |
| 584 | ds1511_rtc_init(void) | ||
| 585 | { | ||
| 586 | return platform_driver_register(&ds1511_rtc_driver); | ||
| 587 | } | ||
| 588 | |||
| 589 | static void __exit | ||
| 590 | ds1511_rtc_exit(void) | ||
| 591 | { | ||
| 592 | platform_driver_unregister(&ds1511_rtc_driver); | ||
| 593 | } | ||
| 594 | |||
| 595 | module_init(ds1511_rtc_init); | ||
| 596 | module_exit(ds1511_rtc_exit); | ||
| 597 | 584 | ||
| 598 | MODULE_AUTHOR("Andrew Sharp <andy.sharp@lsi.com>"); | 585 | MODULE_AUTHOR("Andrew Sharp <andy.sharp@lsi.com>"); |
| 599 | MODULE_DESCRIPTION("Dallas DS1511 RTC driver"); | 586 | MODULE_DESCRIPTION("Dallas DS1511 RTC driver"); |
diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c index 1350029044e6..6f0a1b530f2e 100644 --- a/drivers/rtc/rtc-ds1553.c +++ b/drivers/rtc/rtc-ds1553.c | |||
| @@ -361,18 +361,7 @@ static struct platform_driver ds1553_rtc_driver = { | |||
| 361 | }, | 361 | }, |
| 362 | }; | 362 | }; |
| 363 | 363 | ||
| 364 | static __init int ds1553_init(void) | 364 | module_platform_driver(ds1553_rtc_driver); |
| 365 | { | ||
| 366 | return platform_driver_register(&ds1553_rtc_driver); | ||
| 367 | } | ||
| 368 | |||
| 369 | static __exit void ds1553_exit(void) | ||
| 370 | { | ||
| 371 | platform_driver_unregister(&ds1553_rtc_driver); | ||
| 372 | } | ||
| 373 | |||
| 374 | module_init(ds1553_init); | ||
| 375 | module_exit(ds1553_exit); | ||
| 376 | 365 | ||
| 377 | MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>"); | 366 | MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>"); |
| 378 | MODULE_DESCRIPTION("Dallas DS1553 RTC driver"); | 367 | MODULE_DESCRIPTION("Dallas DS1553 RTC driver"); |
diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c index e3e0f92b60f0..76112667c507 100644 --- a/drivers/rtc/rtc-ds1742.c +++ b/drivers/rtc/rtc-ds1742.c | |||
| @@ -240,18 +240,7 @@ static struct platform_driver ds1742_rtc_driver = { | |||
| 240 | }, | 240 | }, |
| 241 | }; | 241 | }; |
| 242 | 242 | ||
| 243 | static __init int ds1742_init(void) | 243 | module_platform_driver(ds1742_rtc_driver); |
| 244 | { | ||
| 245 | return platform_driver_register(&ds1742_rtc_driver); | ||
| 246 | } | ||
| 247 | |||
| 248 | static __exit void ds1742_exit(void) | ||
| 249 | { | ||
| 250 | platform_driver_unregister(&ds1742_rtc_driver); | ||
| 251 | } | ||
| 252 | |||
| 253 | module_init(ds1742_init); | ||
| 254 | module_exit(ds1742_exit); | ||
| 255 | 244 | ||
| 256 | MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>"); | 245 | MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>"); |
| 257 | MODULE_DESCRIPTION("Dallas DS1742 RTC driver"); | 246 | MODULE_DESCRIPTION("Dallas DS1742 RTC driver"); |
diff --git a/drivers/rtc/rtc-jz4740.c b/drivers/rtc/rtc-jz4740.c index b6473631d182..05ab227eeff7 100644 --- a/drivers/rtc/rtc-jz4740.c +++ b/drivers/rtc/rtc-jz4740.c | |||
| @@ -345,7 +345,7 @@ static const struct dev_pm_ops jz4740_pm_ops = { | |||
| 345 | #define JZ4740_RTC_PM_OPS NULL | 345 | #define JZ4740_RTC_PM_OPS NULL |
| 346 | #endif /* CONFIG_PM */ | 346 | #endif /* CONFIG_PM */ |
| 347 | 347 | ||
| 348 | struct platform_driver jz4740_rtc_driver = { | 348 | static struct platform_driver jz4740_rtc_driver = { |
| 349 | .probe = jz4740_rtc_probe, | 349 | .probe = jz4740_rtc_probe, |
| 350 | .remove = __devexit_p(jz4740_rtc_remove), | 350 | .remove = __devexit_p(jz4740_rtc_remove), |
| 351 | .driver = { | 351 | .driver = { |
| @@ -355,17 +355,7 @@ struct platform_driver jz4740_rtc_driver = { | |||
| 355 | }, | 355 | }, |
| 356 | }; | 356 | }; |
| 357 | 357 | ||
| 358 | static int __init jz4740_rtc_init(void) | 358 | module_platform_driver(jz4740_rtc_driver); |
| 359 | { | ||
| 360 | return platform_driver_register(&jz4740_rtc_driver); | ||
| 361 | } | ||
| 362 | module_init(jz4740_rtc_init); | ||
| 363 | |||
| 364 | static void __exit jz4740_rtc_exit(void) | ||
| 365 | { | ||
| 366 | platform_driver_unregister(&jz4740_rtc_driver); | ||
| 367 | } | ||
| 368 | module_exit(jz4740_rtc_exit); | ||
| 369 | 359 | ||
| 370 | MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); | 360 | MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); |
| 371 | MODULE_LICENSE("GPL"); | 361 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/rtc/rtc-lpc32xx.c b/drivers/rtc/rtc-lpc32xx.c index ae16250c762f..ecc1713b2b4f 100644 --- a/drivers/rtc/rtc-lpc32xx.c +++ b/drivers/rtc/rtc-lpc32xx.c | |||
| @@ -396,17 +396,7 @@ static struct platform_driver lpc32xx_rtc_driver = { | |||
| 396 | }, | 396 | }, |
| 397 | }; | 397 | }; |
| 398 | 398 | ||
| 399 | static int __init lpc32xx_rtc_init(void) | 399 | module_platform_driver(lpc32xx_rtc_driver); |
| 400 | { | ||
| 401 | return platform_driver_register(&lpc32xx_rtc_driver); | ||
| 402 | } | ||
| 403 | module_init(lpc32xx_rtc_init); | ||
| 404 | |||
| 405 | static void __exit lpc32xx_rtc_exit(void) | ||
| 406 | { | ||
| 407 | platform_driver_unregister(&lpc32xx_rtc_driver); | ||
| 408 | } | ||
| 409 | module_exit(lpc32xx_rtc_exit); | ||
| 410 | 400 | ||
| 411 | MODULE_AUTHOR("Kevin Wells <wellsk40@gmail.com"); | 401 | MODULE_AUTHOR("Kevin Wells <wellsk40@gmail.com"); |
| 412 | MODULE_DESCRIPTION("RTC driver for the LPC32xx SoC"); | 402 | MODULE_DESCRIPTION("RTC driver for the LPC32xx SoC"); |
diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c index eda128fc1d38..64aedd8cc095 100644 --- a/drivers/rtc/rtc-m41t80.c +++ b/drivers/rtc/rtc-m41t80.c | |||
| @@ -357,10 +357,19 @@ static int m41t80_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *t) | |||
| 357 | static struct rtc_class_ops m41t80_rtc_ops = { | 357 | static struct rtc_class_ops m41t80_rtc_ops = { |
| 358 | .read_time = m41t80_rtc_read_time, | 358 | .read_time = m41t80_rtc_read_time, |
| 359 | .set_time = m41t80_rtc_set_time, | 359 | .set_time = m41t80_rtc_set_time, |
| 360 | /* | ||
| 361 | * XXX - m41t80 alarm functionality is reported broken. | ||
| 362 | * until it is fixed, don't register alarm functions. | ||
| 363 | * | ||
| 360 | .read_alarm = m41t80_rtc_read_alarm, | 364 | .read_alarm = m41t80_rtc_read_alarm, |
| 361 | .set_alarm = m41t80_rtc_set_alarm, | 365 | .set_alarm = m41t80_rtc_set_alarm, |
| 366 | */ | ||
| 362 | .proc = m41t80_rtc_proc, | 367 | .proc = m41t80_rtc_proc, |
| 368 | /* | ||
| 369 | * See above comment on broken alarm | ||
| 370 | * | ||
| 363 | .alarm_irq_enable = m41t80_rtc_alarm_irq_enable, | 371 | .alarm_irq_enable = m41t80_rtc_alarm_irq_enable, |
| 372 | */ | ||
| 364 | }; | 373 | }; |
| 365 | 374 | ||
| 366 | #if defined(CONFIG_RTC_INTF_SYSFS) || defined(CONFIG_RTC_INTF_SYSFS_MODULE) | 375 | #if defined(CONFIG_RTC_INTF_SYSFS) || defined(CONFIG_RTC_INTF_SYSFS_MODULE) |
diff --git a/drivers/rtc/rtc-m41t93.c b/drivers/rtc/rtc-m41t93.c index 7317d3b9a3d5..ef71132ff205 100644 --- a/drivers/rtc/rtc-m41t93.c +++ b/drivers/rtc/rtc-m41t93.c | |||
| @@ -200,7 +200,6 @@ static int __devexit m41t93_remove(struct spi_device *spi) | |||
| 200 | static struct spi_driver m41t93_driver = { | 200 | static struct spi_driver m41t93_driver = { |
| 201 | .driver = { | 201 | .driver = { |
| 202 | .name = "rtc-m41t93", | 202 | .name = "rtc-m41t93", |
| 203 | .bus = &spi_bus_type, | ||
| 204 | .owner = THIS_MODULE, | 203 | .owner = THIS_MODULE, |
| 205 | }, | 204 | }, |
| 206 | .probe = m41t93_probe, | 205 | .probe = m41t93_probe, |
diff --git a/drivers/rtc/rtc-m41t94.c b/drivers/rtc/rtc-m41t94.c index e259ed76ae85..2a4721f61797 100644 --- a/drivers/rtc/rtc-m41t94.c +++ b/drivers/rtc/rtc-m41t94.c | |||
| @@ -147,7 +147,6 @@ static int __devexit m41t94_remove(struct spi_device *spi) | |||
| 147 | static struct spi_driver m41t94_driver = { | 147 | static struct spi_driver m41t94_driver = { |
| 148 | .driver = { | 148 | .driver = { |
| 149 | .name = "rtc-m41t94", | 149 | .name = "rtc-m41t94", |
| 150 | .bus = &spi_bus_type, | ||
| 151 | .owner = THIS_MODULE, | 150 | .owner = THIS_MODULE, |
| 152 | }, | 151 | }, |
| 153 | .probe = m41t94_probe, | 152 | .probe = m41t94_probe, |
diff --git a/drivers/rtc/rtc-m48t35.c b/drivers/rtc/rtc-m48t35.c index 8e2a24e33ed6..f9e3b3583733 100644 --- a/drivers/rtc/rtc-m48t35.c +++ b/drivers/rtc/rtc-m48t35.c | |||
| @@ -216,21 +216,10 @@ static struct platform_driver m48t35_platform_driver = { | |||
| 216 | .remove = __devexit_p(m48t35_remove), | 216 | .remove = __devexit_p(m48t35_remove), |
| 217 | }; | 217 | }; |
| 218 | 218 | ||
| 219 | static int __init m48t35_init(void) | 219 | module_platform_driver(m48t35_platform_driver); |
| 220 | { | ||
| 221 | return platform_driver_register(&m48t35_platform_driver); | ||
| 222 | } | ||
| 223 | |||
| 224 | static void __exit m48t35_exit(void) | ||
| 225 | { | ||
| 226 | platform_driver_unregister(&m48t35_platform_driver); | ||
| 227 | } | ||
| 228 | 220 | ||
| 229 | MODULE_AUTHOR("Thomas Bogendoerfer <tsbogend@alpha.franken.de>"); | 221 | MODULE_AUTHOR("Thomas Bogendoerfer <tsbogend@alpha.franken.de>"); |
| 230 | MODULE_DESCRIPTION("M48T35 RTC driver"); | 222 | MODULE_DESCRIPTION("M48T35 RTC driver"); |
| 231 | MODULE_LICENSE("GPL"); | 223 | MODULE_LICENSE("GPL"); |
| 232 | MODULE_VERSION(DRV_VERSION); | 224 | MODULE_VERSION(DRV_VERSION); |
| 233 | MODULE_ALIAS("platform:rtc-m48t35"); | 225 | MODULE_ALIAS("platform:rtc-m48t35"); |
| 234 | |||
| 235 | module_init(m48t35_init); | ||
| 236 | module_exit(m48t35_exit); | ||
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c index 28365388fb6c..30ebfec9fd2b 100644 --- a/drivers/rtc/rtc-m48t59.c +++ b/drivers/rtc/rtc-m48t59.c | |||
| @@ -530,18 +530,7 @@ static struct platform_driver m48t59_rtc_driver = { | |||
| 530 | .remove = __devexit_p(m48t59_rtc_remove), | 530 | .remove = __devexit_p(m48t59_rtc_remove), |
| 531 | }; | 531 | }; |
| 532 | 532 | ||
| 533 | static int __init m48t59_rtc_init(void) | 533 | module_platform_driver(m48t59_rtc_driver); |
| 534 | { | ||
| 535 | return platform_driver_register(&m48t59_rtc_driver); | ||
| 536 | } | ||
| 537 | |||
| 538 | static void __exit m48t59_rtc_exit(void) | ||
| 539 | { | ||
| 540 | platform_driver_unregister(&m48t59_rtc_driver); | ||
| 541 | } | ||
| 542 | |||
| 543 | module_init(m48t59_rtc_init); | ||
| 544 | module_exit(m48t59_rtc_exit); | ||
| 545 | 534 | ||
| 546 | MODULE_AUTHOR("Mark Zhan <rongkai.zhan@windriver.com>"); | 535 | MODULE_AUTHOR("Mark Zhan <rongkai.zhan@windriver.com>"); |
| 547 | MODULE_DESCRIPTION("M48T59/M48T02/M48T08 RTC driver"); | 536 | MODULE_DESCRIPTION("M48T59/M48T02/M48T08 RTC driver"); |
diff --git a/drivers/rtc/rtc-m48t86.c b/drivers/rtc/rtc-m48t86.c index f981287d582b..863fb3363aa6 100644 --- a/drivers/rtc/rtc-m48t86.c +++ b/drivers/rtc/rtc-m48t86.c | |||
| @@ -185,21 +185,10 @@ static struct platform_driver m48t86_rtc_platform_driver = { | |||
| 185 | .remove = __devexit_p(m48t86_rtc_remove), | 185 | .remove = __devexit_p(m48t86_rtc_remove), |
| 186 | }; | 186 | }; |
| 187 | 187 | ||
| 188 | static int __init m48t86_rtc_init(void) | 188 | module_platform_driver(m48t86_rtc_platform_driver); |
| 189 | { | ||
| 190 | return platform_driver_register(&m48t86_rtc_platform_driver); | ||
| 191 | } | ||
| 192 | |||
| 193 | static void __exit m48t86_rtc_exit(void) | ||
| 194 | { | ||
| 195 | platform_driver_unregister(&m48t86_rtc_platform_driver); | ||
| 196 | } | ||
| 197 | 189 | ||
| 198 | MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); | 190 | MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); |
| 199 | MODULE_DESCRIPTION("M48T86 RTC driver"); | 191 | MODULE_DESCRIPTION("M48T86 RTC driver"); |
| 200 | MODULE_LICENSE("GPL"); | 192 | MODULE_LICENSE("GPL"); |
| 201 | MODULE_VERSION(DRV_VERSION); | 193 | MODULE_VERSION(DRV_VERSION); |
| 202 | MODULE_ALIAS("platform:rtc-m48t86"); | 194 | MODULE_ALIAS("platform:rtc-m48t86"); |
| 203 | |||
| 204 | module_init(m48t86_rtc_init); | ||
| 205 | module_exit(m48t86_rtc_exit); | ||
diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c index 0ec3f588a255..1f6b3cc58e8a 100644 --- a/drivers/rtc/rtc-max6902.c +++ b/drivers/rtc/rtc-max6902.c | |||
| @@ -154,7 +154,6 @@ static int __devexit max6902_remove(struct spi_device *spi) | |||
| 154 | static struct spi_driver max6902_driver = { | 154 | static struct spi_driver max6902_driver = { |
| 155 | .driver = { | 155 | .driver = { |
| 156 | .name = "rtc-max6902", | 156 | .name = "rtc-max6902", |
| 157 | .bus = &spi_bus_type, | ||
| 158 | .owner = THIS_MODULE, | 157 | .owner = THIS_MODULE, |
| 159 | }, | 158 | }, |
| 160 | .probe = max6902_probe, | 159 | .probe = max6902_probe, |
diff --git a/drivers/rtc/rtc-max8925.c b/drivers/rtc/rtc-max8925.c index 3bc046f427e0..2d71943bc436 100644 --- a/drivers/rtc/rtc-max8925.c +++ b/drivers/rtc/rtc-max8925.c | |||
| @@ -261,6 +261,8 @@ static int __devinit max8925_rtc_probe(struct platform_device *pdev) | |||
| 261 | /* XXX - isn't this redundant? */ | 261 | /* XXX - isn't this redundant? */ |
| 262 | platform_set_drvdata(pdev, info); | 262 | platform_set_drvdata(pdev, info); |
| 263 | 263 | ||
| 264 | device_init_wakeup(&pdev->dev, 1); | ||
| 265 | |||
| 264 | info->rtc_dev = rtc_device_register("max8925-rtc", &pdev->dev, | 266 | info->rtc_dev = rtc_device_register("max8925-rtc", &pdev->dev, |
| 265 | &max8925_rtc_ops, THIS_MODULE); | 267 | &max8925_rtc_ops, THIS_MODULE); |
| 266 | ret = PTR_ERR(info->rtc_dev); | 268 | ret = PTR_ERR(info->rtc_dev); |
| @@ -290,26 +292,40 @@ static int __devexit max8925_rtc_remove(struct platform_device *pdev) | |||
| 290 | return 0; | 292 | return 0; |
| 291 | } | 293 | } |
| 292 | 294 | ||
| 295 | #ifdef CONFIG_PM_SLEEP | ||
| 296 | static int max8925_rtc_suspend(struct device *dev) | ||
| 297 | { | ||
| 298 | struct platform_device *pdev = to_platform_device(dev); | ||
| 299 | struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); | ||
| 300 | |||
| 301 | if (device_may_wakeup(dev)) | ||
| 302 | chip->wakeup_flag |= 1 << MAX8925_IRQ_RTC_ALARM0; | ||
| 303 | return 0; | ||
| 304 | } | ||
| 305 | static int max8925_rtc_resume(struct device *dev) | ||
| 306 | { | ||
| 307 | struct platform_device *pdev = to_platform_device(dev); | ||
| 308 | struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); | ||
| 309 | |||
| 310 | if (device_may_wakeup(dev)) | ||
| 311 | chip->wakeup_flag &= ~(1 << MAX8925_IRQ_RTC_ALARM0); | ||
| 312 | return 0; | ||
| 313 | } | ||
| 314 | #endif | ||
| 315 | |||
| 316 | static SIMPLE_DEV_PM_OPS(max8925_rtc_pm_ops, max8925_rtc_suspend, max8925_rtc_resume); | ||
| 317 | |||
| 293 | static struct platform_driver max8925_rtc_driver = { | 318 | static struct platform_driver max8925_rtc_driver = { |
| 294 | .driver = { | 319 | .driver = { |
| 295 | .name = "max8925-rtc", | 320 | .name = "max8925-rtc", |
| 296 | .owner = THIS_MODULE, | 321 | .owner = THIS_MODULE, |
| 322 | .pm = &max8925_rtc_pm_ops, | ||
| 297 | }, | 323 | }, |
| 298 | .probe = max8925_rtc_probe, | 324 | .probe = max8925_rtc_probe, |
| 299 | .remove = __devexit_p(max8925_rtc_remove), | 325 | .remove = __devexit_p(max8925_rtc_remove), |
| 300 | }; | 326 | }; |
| 301 | 327 | ||
| 302 | static int __init max8925_rtc_init(void) | 328 | module_platform_driver(max8925_rtc_driver); |
| 303 | { | ||
| 304 | return platform_driver_register(&max8925_rtc_driver); | ||
| 305 | } | ||
| 306 | module_init(max8925_rtc_init); | ||
| 307 | |||
| 308 | static void __exit max8925_rtc_exit(void) | ||
| 309 | { | ||
| 310 | platform_driver_unregister(&max8925_rtc_driver); | ||
| 311 | } | ||
| 312 | module_exit(max8925_rtc_exit); | ||
| 313 | 329 | ||
| 314 | MODULE_DESCRIPTION("Maxim MAX8925 RTC driver"); | 330 | MODULE_DESCRIPTION("Maxim MAX8925 RTC driver"); |
| 315 | MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); | 331 | MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); |
diff --git a/drivers/rtc/rtc-max8998.c b/drivers/rtc/rtc-max8998.c index 2e48aa604273..7196f438c089 100644 --- a/drivers/rtc/rtc-max8998.c +++ b/drivers/rtc/rtc-max8998.c | |||
| @@ -327,17 +327,7 @@ static struct platform_driver max8998_rtc_driver = { | |||
| 327 | .id_table = max8998_rtc_id, | 327 | .id_table = max8998_rtc_id, |
| 328 | }; | 328 | }; |
| 329 | 329 | ||
| 330 | static int __init max8998_rtc_init(void) | 330 | module_platform_driver(max8998_rtc_driver); |
| 331 | { | ||
| 332 | return platform_driver_register(&max8998_rtc_driver); | ||
| 333 | } | ||
| 334 | module_init(max8998_rtc_init); | ||
| 335 | |||
| 336 | static void __exit max8998_rtc_exit(void) | ||
| 337 | { | ||
| 338 | platform_driver_unregister(&max8998_rtc_driver); | ||
| 339 | } | ||
| 340 | module_exit(max8998_rtc_exit); | ||
| 341 | 331 | ||
| 342 | MODULE_AUTHOR("Minkyu Kang <mk7.kang@samsung.com>"); | 332 | MODULE_AUTHOR("Minkyu Kang <mk7.kang@samsung.com>"); |
| 343 | MODULE_AUTHOR("Joonyoung Shim <jy0922.shim@samsung.com>"); | 333 | MODULE_AUTHOR("Joonyoung Shim <jy0922.shim@samsung.com>"); |
diff --git a/drivers/rtc/rtc-mc13xxx.c b/drivers/rtc/rtc-mc13xxx.c index 9d0c3b478d55..546f6850bffb 100644 --- a/drivers/rtc/rtc-mc13xxx.c +++ b/drivers/rtc/rtc-mc13xxx.c | |||
| @@ -399,7 +399,7 @@ static int __exit mc13xxx_rtc_remove(struct platform_device *pdev) | |||
| 399 | return 0; | 399 | return 0; |
| 400 | } | 400 | } |
| 401 | 401 | ||
| 402 | const struct platform_device_id mc13xxx_rtc_idtable[] = { | 402 | static const struct platform_device_id mc13xxx_rtc_idtable[] = { |
| 403 | { | 403 | { |
| 404 | .name = "mc13783-rtc", | 404 | .name = "mc13783-rtc", |
| 405 | }, { | 405 | }, { |
diff --git a/drivers/rtc/rtc-mpc5121.c b/drivers/rtc/rtc-mpc5121.c index da60915818b6..9d3caccfc250 100644 --- a/drivers/rtc/rtc-mpc5121.c +++ b/drivers/rtc/rtc-mpc5121.c | |||
| @@ -418,17 +418,7 @@ static struct platform_driver mpc5121_rtc_driver = { | |||
| 418 | .remove = __devexit_p(mpc5121_rtc_remove), | 418 | .remove = __devexit_p(mpc5121_rtc_remove), |
| 419 | }; | 419 | }; |
| 420 | 420 | ||
| 421 | static int __init mpc5121_rtc_init(void) | 421 | module_platform_driver(mpc5121_rtc_driver); |
| 422 | { | ||
| 423 | return platform_driver_register(&mpc5121_rtc_driver); | ||
| 424 | } | ||
| 425 | module_init(mpc5121_rtc_init); | ||
| 426 | |||
| 427 | static void __exit mpc5121_rtc_exit(void) | ||
| 428 | { | ||
| 429 | platform_driver_unregister(&mpc5121_rtc_driver); | ||
| 430 | } | ||
| 431 | module_exit(mpc5121_rtc_exit); | ||
| 432 | 422 | ||
| 433 | MODULE_LICENSE("GPL"); | 423 | MODULE_LICENSE("GPL"); |
| 434 | MODULE_AUTHOR("John Rigby <jcrigby@gmail.com>"); | 424 | MODULE_AUTHOR("John Rigby <jcrigby@gmail.com>"); |
diff --git a/drivers/rtc/rtc-mrst.c b/drivers/rtc/rtc-mrst.c index d33544802a2e..6cd6c7235344 100644 --- a/drivers/rtc/rtc-mrst.c +++ b/drivers/rtc/rtc-mrst.c | |||
| @@ -76,12 +76,15 @@ static inline unsigned char vrtc_is_updating(void) | |||
| 76 | /* | 76 | /* |
| 77 | * rtc_time's year contains the increment over 1900, but vRTC's YEAR | 77 | * rtc_time's year contains the increment over 1900, but vRTC's YEAR |
| 78 | * register can't be programmed to value larger than 0x64, so vRTC | 78 | * register can't be programmed to value larger than 0x64, so vRTC |
| 79 | * driver chose to use 1960 (1970 is UNIX time start point) as the base, | 79 | * driver chose to use 1972 (1970 is UNIX time start point) as the base, |
| 80 | * and does the translation at read/write time. | 80 | * and does the translation at read/write time. |
| 81 | * | 81 | * |
| 82 | * Why not just use 1970 as the offset? it's because using 1960 will | 82 | * Why not just use 1970 as the offset? it's because using 1972 will |
| 83 | * make it consistent in leap year setting for both vrtc and low-level | 83 | * make it consistent in leap year setting for both vrtc and low-level |
| 84 | * physical rtc devices. | 84 | * physical rtc devices. Then why not use 1960 as the offset? If we use |
| 85 | * 1960, for a device's first use, its YEAR register is 0 and the system | ||
| 86 | * year will be parsed as 1960 which is not a valid UNIX time and will | ||
| 87 | * cause many applications to fail mysteriously. | ||
| 85 | */ | 88 | */ |
| 86 | static int mrst_read_time(struct device *dev, struct rtc_time *time) | 89 | static int mrst_read_time(struct device *dev, struct rtc_time *time) |
| 87 | { | 90 | { |
| @@ -99,10 +102,10 @@ static int mrst_read_time(struct device *dev, struct rtc_time *time) | |||
| 99 | time->tm_year = vrtc_cmos_read(RTC_YEAR); | 102 | time->tm_year = vrtc_cmos_read(RTC_YEAR); |
| 100 | spin_unlock_irqrestore(&rtc_lock, flags); | 103 | spin_unlock_irqrestore(&rtc_lock, flags); |
| 101 | 104 | ||
| 102 | /* Adjust for the 1960/1900 */ | 105 | /* Adjust for the 1972/1900 */ |
| 103 | time->tm_year += 60; | 106 | time->tm_year += 72; |
| 104 | time->tm_mon--; | 107 | time->tm_mon--; |
| 105 | return RTC_24H; | 108 | return rtc_valid_tm(time); |
| 106 | } | 109 | } |
| 107 | 110 | ||
| 108 | static int mrst_set_time(struct device *dev, struct rtc_time *time) | 111 | static int mrst_set_time(struct device *dev, struct rtc_time *time) |
| @@ -119,9 +122,9 @@ static int mrst_set_time(struct device *dev, struct rtc_time *time) | |||
| 119 | min = time->tm_min; | 122 | min = time->tm_min; |
| 120 | sec = time->tm_sec; | 123 | sec = time->tm_sec; |
| 121 | 124 | ||
| 122 | if (yrs < 70 || yrs > 138) | 125 | if (yrs < 72 || yrs > 138) |
| 123 | return -EINVAL; | 126 | return -EINVAL; |
| 124 | yrs -= 60; | 127 | yrs -= 72; |
| 125 | 128 | ||
| 126 | spin_lock_irqsave(&rtc_lock, flags); | 129 | spin_lock_irqsave(&rtc_lock, flags); |
| 127 | 130 | ||
| @@ -534,18 +537,7 @@ static struct platform_driver vrtc_mrst_platform_driver = { | |||
| 534 | } | 537 | } |
| 535 | }; | 538 | }; |
| 536 | 539 | ||
| 537 | static int __init vrtc_mrst_init(void) | 540 | module_platform_driver(vrtc_mrst_platform_driver); |
| 538 | { | ||
| 539 | return platform_driver_register(&vrtc_mrst_platform_driver); | ||
| 540 | } | ||
| 541 | |||
| 542 | static void __exit vrtc_mrst_exit(void) | ||
| 543 | { | ||
| 544 | platform_driver_unregister(&vrtc_mrst_platform_driver); | ||
| 545 | } | ||
| 546 | |||
| 547 | module_init(vrtc_mrst_init); | ||
| 548 | module_exit(vrtc_mrst_exit); | ||
| 549 | 541 | ||
| 550 | MODULE_AUTHOR("Jacob Pan; Feng Tang"); | 542 | MODULE_AUTHOR("Jacob Pan; Feng Tang"); |
| 551 | MODULE_DESCRIPTION("Driver for Moorestown virtual RTC"); | 543 | MODULE_DESCRIPTION("Driver for Moorestown virtual RTC"); |
diff --git a/drivers/rtc/rtc-mxc.c b/drivers/rtc/rtc-mxc.c index 39e41fbdf08b..5e1d64ee5228 100644 --- a/drivers/rtc/rtc-mxc.c +++ b/drivers/rtc/rtc-mxc.c | |||
| @@ -155,7 +155,6 @@ static int rtc_update_alarm(struct device *dev, struct rtc_time *alrm) | |||
| 155 | { | 155 | { |
| 156 | struct rtc_time alarm_tm, now_tm; | 156 | struct rtc_time alarm_tm, now_tm; |
| 157 | unsigned long now, time; | 157 | unsigned long now, time; |
| 158 | int ret; | ||
| 159 | struct platform_device *pdev = to_platform_device(dev); | 158 | struct platform_device *pdev = to_platform_device(dev); |
| 160 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); | 159 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); |
| 161 | void __iomem *ioaddr = pdata->ioaddr; | 160 | void __iomem *ioaddr = pdata->ioaddr; |
| @@ -168,21 +167,33 @@ static int rtc_update_alarm(struct device *dev, struct rtc_time *alrm) | |||
| 168 | alarm_tm.tm_hour = alrm->tm_hour; | 167 | alarm_tm.tm_hour = alrm->tm_hour; |
| 169 | alarm_tm.tm_min = alrm->tm_min; | 168 | alarm_tm.tm_min = alrm->tm_min; |
| 170 | alarm_tm.tm_sec = alrm->tm_sec; | 169 | alarm_tm.tm_sec = alrm->tm_sec; |
| 171 | rtc_tm_to_time(&now_tm, &now); | ||
| 172 | rtc_tm_to_time(&alarm_tm, &time); | 170 | rtc_tm_to_time(&alarm_tm, &time); |
| 173 | 171 | ||
| 174 | if (time < now) { | ||
| 175 | time += 60 * 60 * 24; | ||
| 176 | rtc_time_to_tm(time, &alarm_tm); | ||
| 177 | } | ||
| 178 | |||
| 179 | ret = rtc_tm_to_time(&alarm_tm, &time); | ||
| 180 | |||
| 181 | /* clear all the interrupt status bits */ | 172 | /* clear all the interrupt status bits */ |
| 182 | writew(readw(ioaddr + RTC_RTCISR), ioaddr + RTC_RTCISR); | 173 | writew(readw(ioaddr + RTC_RTCISR), ioaddr + RTC_RTCISR); |
| 183 | set_alarm_or_time(dev, MXC_RTC_ALARM, time); | 174 | set_alarm_or_time(dev, MXC_RTC_ALARM, time); |
| 184 | 175 | ||
| 185 | return ret; | 176 | return 0; |
| 177 | } | ||
| 178 | |||
| 179 | static void mxc_rtc_irq_enable(struct device *dev, unsigned int bit, | ||
| 180 | unsigned int enabled) | ||
| 181 | { | ||
| 182 | struct platform_device *pdev = to_platform_device(dev); | ||
| 183 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); | ||
| 184 | void __iomem *ioaddr = pdata->ioaddr; | ||
| 185 | u32 reg; | ||
| 186 | |||
| 187 | spin_lock_irq(&pdata->rtc->irq_lock); | ||
| 188 | reg = readw(ioaddr + RTC_RTCIENR); | ||
| 189 | |||
| 190 | if (enabled) | ||
| 191 | reg |= bit; | ||
| 192 | else | ||
| 193 | reg &= ~bit; | ||
| 194 | |||
| 195 | writew(reg, ioaddr + RTC_RTCIENR); | ||
| 196 | spin_unlock_irq(&pdata->rtc->irq_lock); | ||
| 186 | } | 197 | } |
| 187 | 198 | ||
| 188 | /* This function is the RTC interrupt service routine. */ | 199 | /* This function is the RTC interrupt service routine. */ |
| @@ -199,13 +210,12 @@ static irqreturn_t mxc_rtc_interrupt(int irq, void *dev_id) | |||
| 199 | /* clear interrupt sources */ | 210 | /* clear interrupt sources */ |
| 200 | writew(status, ioaddr + RTC_RTCISR); | 211 | writew(status, ioaddr + RTC_RTCISR); |
| 201 | 212 | ||
| 202 | /* clear alarm interrupt if it has occurred */ | ||
| 203 | if (status & RTC_ALM_BIT) | ||
| 204 | status &= ~RTC_ALM_BIT; | ||
| 205 | |||
| 206 | /* update irq data & counter */ | 213 | /* update irq data & counter */ |
| 207 | if (status & RTC_ALM_BIT) | 214 | if (status & RTC_ALM_BIT) { |
| 208 | events |= (RTC_AF | RTC_IRQF); | 215 | events |= (RTC_AF | RTC_IRQF); |
| 216 | /* RTC alarm should be one-shot */ | ||
| 217 | mxc_rtc_irq_enable(&pdev->dev, RTC_ALM_BIT, 0); | ||
| 218 | } | ||
| 209 | 219 | ||
| 210 | if (status & RTC_1HZ_BIT) | 220 | if (status & RTC_1HZ_BIT) |
| 211 | events |= (RTC_UF | RTC_IRQF); | 221 | events |= (RTC_UF | RTC_IRQF); |
| @@ -213,9 +223,6 @@ static irqreturn_t mxc_rtc_interrupt(int irq, void *dev_id) | |||
| 213 | if (status & PIT_ALL_ON) | 223 | if (status & PIT_ALL_ON) |
| 214 | events |= (RTC_PF | RTC_IRQF); | 224 | events |= (RTC_PF | RTC_IRQF); |
| 215 | 225 | ||
| 216 | if ((status & RTC_ALM_BIT) && rtc_valid_tm(&pdata->g_rtc_alarm)) | ||
| 217 | rtc_update_alarm(&pdev->dev, &pdata->g_rtc_alarm); | ||
| 218 | |||
| 219 | rtc_update_irq(pdata->rtc, 1, events); | 226 | rtc_update_irq(pdata->rtc, 1, events); |
| 220 | spin_unlock_irq(&pdata->rtc->irq_lock); | 227 | spin_unlock_irq(&pdata->rtc->irq_lock); |
| 221 | 228 | ||
| @@ -242,26 +249,6 @@ static void mxc_rtc_release(struct device *dev) | |||
| 242 | spin_unlock_irq(&pdata->rtc->irq_lock); | 249 | spin_unlock_irq(&pdata->rtc->irq_lock); |
| 243 | } | 250 | } |
| 244 | 251 | ||
| 245 | static void mxc_rtc_irq_enable(struct device *dev, unsigned int bit, | ||
| 246 | unsigned int enabled) | ||
| 247 | { | ||
| 248 | struct platform_device *pdev = to_platform_device(dev); | ||
| 249 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); | ||
| 250 | void __iomem *ioaddr = pdata->ioaddr; | ||
| 251 | u32 reg; | ||
| 252 | |||
| 253 | spin_lock_irq(&pdata->rtc->irq_lock); | ||
| 254 | reg = readw(ioaddr + RTC_RTCIENR); | ||
| 255 | |||
| 256 | if (enabled) | ||
| 257 | reg |= bit; | ||
| 258 | else | ||
| 259 | reg &= ~bit; | ||
| 260 | |||
| 261 | writew(reg, ioaddr + RTC_RTCIENR); | ||
| 262 | spin_unlock_irq(&pdata->rtc->irq_lock); | ||
| 263 | } | ||
| 264 | |||
| 265 | static int mxc_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | 252 | static int mxc_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) |
| 266 | { | 253 | { |
| 267 | mxc_rtc_irq_enable(dev, RTC_ALM_BIT, enabled); | 254 | mxc_rtc_irq_enable(dev, RTC_ALM_BIT, enabled); |
| @@ -290,6 +277,17 @@ static int mxc_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
| 290 | */ | 277 | */ |
| 291 | static int mxc_rtc_set_mmss(struct device *dev, unsigned long time) | 278 | static int mxc_rtc_set_mmss(struct device *dev, unsigned long time) |
| 292 | { | 279 | { |
| 280 | /* | ||
| 281 | * TTC_DAYR register is 9-bit in MX1 SoC, save time and day of year only | ||
| 282 | */ | ||
| 283 | if (cpu_is_mx1()) { | ||
| 284 | struct rtc_time tm; | ||
| 285 | |||
| 286 | rtc_time_to_tm(time, &tm); | ||
| 287 | tm.tm_year = 70; | ||
| 288 | rtc_tm_to_time(&tm, &time); | ||
| 289 | } | ||
| 290 | |||
| 293 | /* Avoid roll-over from reading the different registers */ | 291 | /* Avoid roll-over from reading the different registers */ |
| 294 | do { | 292 | do { |
| 295 | set_alarm_or_time(dev, MXC_RTC_TIME, time); | 293 | set_alarm_or_time(dev, MXC_RTC_TIME, time); |
| @@ -324,21 +322,7 @@ static int mxc_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
| 324 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); | 322 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); |
| 325 | int ret; | 323 | int ret; |
| 326 | 324 | ||
| 327 | if (rtc_valid_tm(&alrm->time)) { | 325 | ret = rtc_update_alarm(dev, &alrm->time); |
| 328 | if (alrm->time.tm_sec > 59 || | ||
| 329 | alrm->time.tm_hour > 23 || | ||
| 330 | alrm->time.tm_min > 59) | ||
| 331 | return -EINVAL; | ||
| 332 | |||
| 333 | ret = rtc_update_alarm(dev, &alrm->time); | ||
| 334 | } else { | ||
| 335 | ret = rtc_valid_tm(&alrm->time); | ||
| 336 | if (ret) | ||
| 337 | return ret; | ||
| 338 | |||
| 339 | ret = rtc_update_alarm(dev, &alrm->time); | ||
| 340 | } | ||
| 341 | |||
| 342 | if (ret) | 326 | if (ret) |
| 343 | return ret; | 327 | return ret; |
| 344 | 328 | ||
| @@ -424,6 +408,9 @@ static int __init mxc_rtc_probe(struct platform_device *pdev) | |||
| 424 | pdata->irq = -1; | 408 | pdata->irq = -1; |
| 425 | } | 409 | } |
| 426 | 410 | ||
| 411 | if (pdata->irq >=0) | ||
| 412 | device_init_wakeup(&pdev->dev, 1); | ||
| 413 | |||
| 427 | rtc = rtc_device_register(pdev->name, &pdev->dev, &mxc_rtc_ops, | 414 | rtc = rtc_device_register(pdev->name, &pdev->dev, &mxc_rtc_ops, |
| 428 | THIS_MODULE); | 415 | THIS_MODULE); |
| 429 | if (IS_ERR(rtc)) { | 416 | if (IS_ERR(rtc)) { |
| @@ -459,9 +446,39 @@ static int __exit mxc_rtc_remove(struct platform_device *pdev) | |||
| 459 | return 0; | 446 | return 0; |
| 460 | } | 447 | } |
| 461 | 448 | ||
| 449 | #ifdef CONFIG_PM | ||
| 450 | static int mxc_rtc_suspend(struct device *dev) | ||
| 451 | { | ||
| 452 | struct rtc_plat_data *pdata = dev_get_drvdata(dev); | ||
| 453 | |||
| 454 | if (device_may_wakeup(dev)) | ||
| 455 | enable_irq_wake(pdata->irq); | ||
| 456 | |||
| 457 | return 0; | ||
| 458 | } | ||
| 459 | |||
| 460 | static int mxc_rtc_resume(struct device *dev) | ||
| 461 | { | ||
| 462 | struct rtc_plat_data *pdata = dev_get_drvdata(dev); | ||
| 463 | |||
| 464 | if (device_may_wakeup(dev)) | ||
| 465 | disable_irq_wake(pdata->irq); | ||
| 466 | |||
| 467 | return 0; | ||
| 468 | } | ||
| 469 | |||
| 470 | static struct dev_pm_ops mxc_rtc_pm_ops = { | ||
| 471 | .suspend = mxc_rtc_suspend, | ||
| 472 | .resume = mxc_rtc_resume, | ||
| 473 | }; | ||
| 474 | #endif | ||
| 475 | |||
| 462 | static struct platform_driver mxc_rtc_driver = { | 476 | static struct platform_driver mxc_rtc_driver = { |
| 463 | .driver = { | 477 | .driver = { |
| 464 | .name = "mxc_rtc", | 478 | .name = "mxc_rtc", |
| 479 | #ifdef CONFIG_PM | ||
| 480 | .pm = &mxc_rtc_pm_ops, | ||
| 481 | #endif | ||
| 465 | .owner = THIS_MODULE, | 482 | .owner = THIS_MODULE, |
| 466 | }, | 483 | }, |
| 467 | .remove = __exit_p(mxc_rtc_remove), | 484 | .remove = __exit_p(mxc_rtc_remove), |
diff --git a/drivers/rtc/rtc-pcf2123.c b/drivers/rtc/rtc-pcf2123.c index 2ee3bbf7e5ea..b46c4004d8fe 100644 --- a/drivers/rtc/rtc-pcf2123.c +++ b/drivers/rtc/rtc-pcf2123.c | |||
| @@ -340,7 +340,6 @@ static int __devexit pcf2123_remove(struct spi_device *spi) | |||
| 340 | static struct spi_driver pcf2123_driver = { | 340 | static struct spi_driver pcf2123_driver = { |
| 341 | .driver = { | 341 | .driver = { |
| 342 | .name = "rtc-pcf2123", | 342 | .name = "rtc-pcf2123", |
| 343 | .bus = &spi_bus_type, | ||
| 344 | .owner = THIS_MODULE, | 343 | .owner = THIS_MODULE, |
| 345 | }, | 344 | }, |
| 346 | .probe = pcf2123_probe, | 345 | .probe = pcf2123_probe, |
diff --git a/drivers/rtc/rtc-pcf50633.c b/drivers/rtc/rtc-pcf50633.c index 0c423892923c..a20202f9ee57 100644 --- a/drivers/rtc/rtc-pcf50633.c +++ b/drivers/rtc/rtc-pcf50633.c | |||
| @@ -294,17 +294,7 @@ static struct platform_driver pcf50633_rtc_driver = { | |||
| 294 | .remove = __devexit_p(pcf50633_rtc_remove), | 294 | .remove = __devexit_p(pcf50633_rtc_remove), |
| 295 | }; | 295 | }; |
| 296 | 296 | ||
| 297 | static int __init pcf50633_rtc_init(void) | 297 | module_platform_driver(pcf50633_rtc_driver); |
| 298 | { | ||
| 299 | return platform_driver_register(&pcf50633_rtc_driver); | ||
| 300 | } | ||
| 301 | module_init(pcf50633_rtc_init); | ||
| 302 | |||
| 303 | static void __exit pcf50633_rtc_exit(void) | ||
| 304 | { | ||
| 305 | platform_driver_unregister(&pcf50633_rtc_driver); | ||
| 306 | } | ||
| 307 | module_exit(pcf50633_rtc_exit); | ||
| 308 | 298 | ||
| 309 | MODULE_DESCRIPTION("PCF50633 RTC driver"); | 299 | MODULE_DESCRIPTION("PCF50633 RTC driver"); |
| 310 | MODULE_AUTHOR("Balaji Rao <balajirrao@openmoko.org>"); | 300 | MODULE_AUTHOR("Balaji Rao <balajirrao@openmoko.org>"); |
diff --git a/drivers/rtc/rtc-pl030.c b/drivers/rtc/rtc-pl030.c index 1d28d4451dae..02111fee077e 100644 --- a/drivers/rtc/rtc-pl030.c +++ b/drivers/rtc/rtc-pl030.c | |||
| @@ -174,6 +174,8 @@ static struct amba_id pl030_ids[] = { | |||
| 174 | { 0, 0 }, | 174 | { 0, 0 }, |
| 175 | }; | 175 | }; |
| 176 | 176 | ||
| 177 | MODULE_DEVICE_TABLE(amba, pl030_ids); | ||
| 178 | |||
| 177 | static struct amba_driver pl030_driver = { | 179 | static struct amba_driver pl030_driver = { |
| 178 | .drv = { | 180 | .drv = { |
| 179 | .name = "rtc-pl030", | 181 | .name = "rtc-pl030", |
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c index ff1b84bd9bb5..a952c8de1dd7 100644 --- a/drivers/rtc/rtc-pl031.c +++ b/drivers/rtc/rtc-pl031.c | |||
| @@ -420,6 +420,8 @@ static struct amba_id pl031_ids[] = { | |||
| 420 | {0, 0}, | 420 | {0, 0}, |
| 421 | }; | 421 | }; |
| 422 | 422 | ||
| 423 | MODULE_DEVICE_TABLE(amba, pl031_ids); | ||
| 424 | |||
| 423 | static struct amba_driver pl031_driver = { | 425 | static struct amba_driver pl031_driver = { |
| 424 | .drv = { | 426 | .drv = { |
| 425 | .name = "rtc-pl031", | 427 | .name = "rtc-pl031", |
diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c index d420e9d877e8..9f1d6bcbdf6c 100644 --- a/drivers/rtc/rtc-pm8xxx.c +++ b/drivers/rtc/rtc-pm8xxx.c | |||
| @@ -532,17 +532,7 @@ static struct platform_driver pm8xxx_rtc_driver = { | |||
| 532 | }, | 532 | }, |
| 533 | }; | 533 | }; |
| 534 | 534 | ||
| 535 | static int __init pm8xxx_rtc_init(void) | 535 | module_platform_driver(pm8xxx_rtc_driver); |
| 536 | { | ||
| 537 | return platform_driver_register(&pm8xxx_rtc_driver); | ||
| 538 | } | ||
| 539 | module_init(pm8xxx_rtc_init); | ||
| 540 | |||
| 541 | static void __exit pm8xxx_rtc_exit(void) | ||
| 542 | { | ||
| 543 | platform_driver_unregister(&pm8xxx_rtc_driver); | ||
| 544 | } | ||
| 545 | module_exit(pm8xxx_rtc_exit); | ||
| 546 | 536 | ||
| 547 | MODULE_ALIAS("platform:rtc-pm8xxx"); | 537 | MODULE_ALIAS("platform:rtc-pm8xxx"); |
| 548 | MODULE_DESCRIPTION("PMIC8xxx RTC driver"); | 538 | MODULE_DESCRIPTION("PMIC8xxx RTC driver"); |
diff --git a/drivers/rtc/rtc-puv3.c b/drivers/rtc/rtc-puv3.c index b3eba3cddd42..ab0acaeb2371 100644 --- a/drivers/rtc/rtc-puv3.c +++ b/drivers/rtc/rtc-puv3.c | |||
| @@ -164,7 +164,7 @@ static int puv3_rtc_open(struct device *dev) | |||
| 164 | int ret; | 164 | int ret; |
| 165 | 165 | ||
| 166 | ret = request_irq(puv3_rtc_alarmno, puv3_rtc_alarmirq, | 166 | ret = request_irq(puv3_rtc_alarmno, puv3_rtc_alarmirq, |
| 167 | IRQF_DISABLED, "pkunity-rtc alarm", rtc_dev); | 167 | 0, "pkunity-rtc alarm", rtc_dev); |
| 168 | 168 | ||
| 169 | if (ret) { | 169 | if (ret) { |
| 170 | dev_err(dev, "IRQ%d error %d\n", puv3_rtc_alarmno, ret); | 170 | dev_err(dev, "IRQ%d error %d\n", puv3_rtc_alarmno, ret); |
| @@ -172,7 +172,7 @@ static int puv3_rtc_open(struct device *dev) | |||
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | ret = request_irq(puv3_rtc_tickno, puv3_rtc_tickirq, | 174 | ret = request_irq(puv3_rtc_tickno, puv3_rtc_tickirq, |
| 175 | IRQF_DISABLED, "pkunity-rtc tick", rtc_dev); | 175 | 0, "pkunity-rtc tick", rtc_dev); |
| 176 | 176 | ||
| 177 | if (ret) { | 177 | if (ret) { |
| 178 | dev_err(dev, "IRQ%d error %d\n", puv3_rtc_tickno, ret); | 178 | dev_err(dev, "IRQ%d error %d\n", puv3_rtc_tickno, ret); |
| @@ -220,7 +220,7 @@ static void puv3_rtc_enable(struct platform_device *pdev, int en) | |||
| 220 | } | 220 | } |
| 221 | } | 221 | } |
| 222 | 222 | ||
| 223 | static int puv3_rtc_remove(struct platform_device *dev) | 223 | static int __devexit puv3_rtc_remove(struct platform_device *dev) |
| 224 | { | 224 | { |
| 225 | struct rtc_device *rtc = platform_get_drvdata(dev); | 225 | struct rtc_device *rtc = platform_get_drvdata(dev); |
| 226 | 226 | ||
| @@ -236,7 +236,7 @@ static int puv3_rtc_remove(struct platform_device *dev) | |||
| 236 | return 0; | 236 | return 0; |
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | static int puv3_rtc_probe(struct platform_device *pdev) | 239 | static int __devinit puv3_rtc_probe(struct platform_device *pdev) |
| 240 | { | 240 | { |
| 241 | struct rtc_device *rtc; | 241 | struct rtc_device *rtc; |
| 242 | struct resource *res; | 242 | struct resource *res; |
| @@ -326,7 +326,7 @@ static int puv3_rtc_resume(struct platform_device *pdev) | |||
| 326 | #define puv3_rtc_resume NULL | 326 | #define puv3_rtc_resume NULL |
| 327 | #endif | 327 | #endif |
| 328 | 328 | ||
| 329 | static struct platform_driver puv3_rtcdrv = { | 329 | static struct platform_driver puv3_rtc_driver = { |
| 330 | .probe = puv3_rtc_probe, | 330 | .probe = puv3_rtc_probe, |
| 331 | .remove = __devexit_p(puv3_rtc_remove), | 331 | .remove = __devexit_p(puv3_rtc_remove), |
| 332 | .suspend = puv3_rtc_suspend, | 332 | .suspend = puv3_rtc_suspend, |
| @@ -337,21 +337,7 @@ static struct platform_driver puv3_rtcdrv = { | |||
| 337 | } | 337 | } |
| 338 | }; | 338 | }; |
| 339 | 339 | ||
| 340 | static char __initdata banner[] = "PKUnity-v3 RTC, (c) 2009 PKUnity Co.\n"; | 340 | module_platform_driver(puv3_rtc_driver); |
| 341 | |||
| 342 | static int __init puv3_rtc_init(void) | ||
| 343 | { | ||
| 344 | printk(banner); | ||
| 345 | return platform_driver_register(&puv3_rtcdrv); | ||
| 346 | } | ||
| 347 | |||
| 348 | static void __exit puv3_rtc_exit(void) | ||
| 349 | { | ||
| 350 | platform_driver_unregister(&puv3_rtcdrv); | ||
| 351 | } | ||
| 352 | |||
| 353 | module_init(puv3_rtc_init); | ||
| 354 | module_exit(puv3_rtc_exit); | ||
| 355 | 341 | ||
| 356 | MODULE_DESCRIPTION("RTC Driver for the PKUnity v3 chip"); | 342 | MODULE_DESCRIPTION("RTC Driver for the PKUnity v3 chip"); |
| 357 | MODULE_AUTHOR("Hu Dongliang"); | 343 | MODULE_AUTHOR("Hu Dongliang"); |
diff --git a/drivers/rtc/rtc-rs5c348.c b/drivers/rtc/rtc-rs5c348.c index 971bc8e08da6..ce2ca8523ddd 100644 --- a/drivers/rtc/rtc-rs5c348.c +++ b/drivers/rtc/rtc-rs5c348.c | |||
| @@ -229,7 +229,6 @@ static int __devexit rs5c348_remove(struct spi_device *spi) | |||
| 229 | static struct spi_driver rs5c348_driver = { | 229 | static struct spi_driver rs5c348_driver = { |
| 230 | .driver = { | 230 | .driver = { |
| 231 | .name = "rtc-rs5c348", | 231 | .name = "rtc-rs5c348", |
| 232 | .bus = &spi_bus_type, | ||
| 233 | .owner = THIS_MODULE, | 232 | .owner = THIS_MODULE, |
| 234 | }, | 233 | }, |
| 235 | .probe = rs5c348_probe, | 234 | .probe = rs5c348_probe, |
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 7639ab906f02..aef40bd2957b 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <linux/clk.h> | 25 | #include <linux/clk.h> |
| 26 | #include <linux/log2.h> | 26 | #include <linux/log2.h> |
| 27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
| 28 | #include <linux/of.h> | ||
| 28 | 29 | ||
| 29 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
| 30 | #include <asm/uaccess.h> | 31 | #include <asm/uaccess.h> |
| @@ -202,7 +203,6 @@ static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm) | |||
| 202 | void __iomem *base = s3c_rtc_base; | 203 | void __iomem *base = s3c_rtc_base; |
| 203 | int year = tm->tm_year - 100; | 204 | int year = tm->tm_year - 100; |
| 204 | 205 | ||
| 205 | clk_enable(rtc_clk); | ||
| 206 | pr_debug("set time %04d.%02d.%02d %02d:%02d:%02d\n", | 206 | pr_debug("set time %04d.%02d.%02d %02d:%02d:%02d\n", |
| 207 | 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday, | 207 | 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday, |
| 208 | tm->tm_hour, tm->tm_min, tm->tm_sec); | 208 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
| @@ -214,6 +214,7 @@ static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm) | |||
| 214 | return -EINVAL; | 214 | return -EINVAL; |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | clk_enable(rtc_clk); | ||
| 217 | writeb(bin2bcd(tm->tm_sec), base + S3C2410_RTCSEC); | 218 | writeb(bin2bcd(tm->tm_sec), base + S3C2410_RTCSEC); |
| 218 | writeb(bin2bcd(tm->tm_min), base + S3C2410_RTCMIN); | 219 | writeb(bin2bcd(tm->tm_min), base + S3C2410_RTCMIN); |
| 219 | writeb(bin2bcd(tm->tm_hour), base + S3C2410_RTCHOUR); | 220 | writeb(bin2bcd(tm->tm_hour), base + S3C2410_RTCHOUR); |
| @@ -507,7 +508,13 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) | |||
| 507 | goto err_nortc; | 508 | goto err_nortc; |
| 508 | } | 509 | } |
| 509 | 510 | ||
| 510 | s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data; | 511 | #ifdef CONFIG_OF |
| 512 | if (pdev->dev.of_node) | ||
| 513 | s3c_rtc_cpu_type = of_device_is_compatible(pdev->dev.of_node, | ||
| 514 | "samsung,s3c6410-rtc") ? TYPE_S3C64XX : TYPE_S3C2410; | ||
| 515 | else | ||
| 516 | #endif | ||
| 517 | s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data; | ||
| 511 | 518 | ||
| 512 | /* Check RTC Time */ | 519 | /* Check RTC Time */ |
| 513 | 520 | ||
| @@ -629,6 +636,17 @@ static int s3c_rtc_resume(struct platform_device *pdev) | |||
| 629 | #define s3c_rtc_resume NULL | 636 | #define s3c_rtc_resume NULL |
| 630 | #endif | 637 | #endif |
| 631 | 638 | ||
| 639 | #ifdef CONFIG_OF | ||
| 640 | static const struct of_device_id s3c_rtc_dt_match[] = { | ||
| 641 | { .compatible = "samsung,s3c2410-rtc" }, | ||
| 642 | { .compatible = "samsung,s3c6410-rtc" }, | ||
| 643 | {}, | ||
| 644 | }; | ||
| 645 | MODULE_DEVICE_TABLE(of, s3c_rtc_dt_match); | ||
| 646 | #else | ||
| 647 | #define s3c_rtc_dt_match NULL | ||
| 648 | #endif | ||
| 649 | |||
| 632 | static struct platform_device_id s3c_rtc_driver_ids[] = { | 650 | static struct platform_device_id s3c_rtc_driver_ids[] = { |
| 633 | { | 651 | { |
| 634 | .name = "s3c2410-rtc", | 652 | .name = "s3c2410-rtc", |
| @@ -651,24 +669,11 @@ static struct platform_driver s3c_rtc_driver = { | |||
| 651 | .driver = { | 669 | .driver = { |
| 652 | .name = "s3c-rtc", | 670 | .name = "s3c-rtc", |
| 653 | .owner = THIS_MODULE, | 671 | .owner = THIS_MODULE, |
| 672 | .of_match_table = s3c_rtc_dt_match, | ||
| 654 | }, | 673 | }, |
| 655 | }; | 674 | }; |
| 656 | 675 | ||
| 657 | static char __initdata banner[] = "S3C24XX RTC, (c) 2004,2006 Simtec Electronics\n"; | 676 | module_platform_driver(s3c_rtc_driver); |
| 658 | |||
| 659 | static int __init s3c_rtc_init(void) | ||
| 660 | { | ||
| 661 | printk(banner); | ||
| 662 | return platform_driver_register(&s3c_rtc_driver); | ||
| 663 | } | ||
| 664 | |||
| 665 | static void __exit s3c_rtc_exit(void) | ||
| 666 | { | ||
| 667 | platform_driver_unregister(&s3c_rtc_driver); | ||
| 668 | } | ||
| 669 | |||
| 670 | module_init(s3c_rtc_init); | ||
| 671 | module_exit(s3c_rtc_exit); | ||
| 672 | 677 | ||
| 673 | MODULE_DESCRIPTION("Samsung S3C RTC Driver"); | 678 | MODULE_DESCRIPTION("Samsung S3C RTC Driver"); |
| 674 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); | 679 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); |
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c index 0b40bb88a884..cb9a585312cc 100644 --- a/drivers/rtc/rtc-sa1100.c +++ b/drivers/rtc/rtc-sa1100.c | |||
| @@ -36,7 +36,6 @@ | |||
| 36 | 36 | ||
| 37 | #ifdef CONFIG_ARCH_PXA | 37 | #ifdef CONFIG_ARCH_PXA |
| 38 | #include <mach/regs-rtc.h> | 38 | #include <mach/regs-rtc.h> |
| 39 | #include <mach/regs-ost.h> | ||
| 40 | #endif | 39 | #endif |
| 41 | 40 | ||
| 42 | #define RTC_DEF_DIVIDER (32768 - 1) | 41 | #define RTC_DEF_DIVIDER (32768 - 1) |
| @@ -188,8 +187,6 @@ static void sa1100_rtc_release(struct device *dev) | |||
| 188 | { | 187 | { |
| 189 | spin_lock_irq(&sa1100_rtc_lock); | 188 | spin_lock_irq(&sa1100_rtc_lock); |
| 190 | RTSR = 0; | 189 | RTSR = 0; |
| 191 | OIER &= ~OIER_E1; | ||
| 192 | OSSR = OSSR_M1; | ||
| 193 | spin_unlock_irq(&sa1100_rtc_lock); | 190 | spin_unlock_irq(&sa1100_rtc_lock); |
| 194 | 191 | ||
| 195 | free_irq(IRQ_RTCAlrm, dev); | 192 | free_irq(IRQ_RTCAlrm, dev); |
| @@ -369,18 +366,7 @@ static struct platform_driver sa1100_rtc_driver = { | |||
| 369 | }, | 366 | }, |
| 370 | }; | 367 | }; |
| 371 | 368 | ||
| 372 | static int __init sa1100_rtc_init(void) | 369 | module_platform_driver(sa1100_rtc_driver); |
| 373 | { | ||
| 374 | return platform_driver_register(&sa1100_rtc_driver); | ||
| 375 | } | ||
| 376 | |||
| 377 | static void __exit sa1100_rtc_exit(void) | ||
| 378 | { | ||
| 379 | platform_driver_unregister(&sa1100_rtc_driver); | ||
| 380 | } | ||
| 381 | |||
| 382 | module_init(sa1100_rtc_init); | ||
| 383 | module_exit(sa1100_rtc_exit); | ||
| 384 | 370 | ||
| 385 | MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); | 371 | MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); |
| 386 | MODULE_DESCRIPTION("SA11x0/PXA2xx Realtime Clock Driver (RTC)"); | 372 | MODULE_DESCRIPTION("SA11x0/PXA2xx Realtime Clock Driver (RTC)"); |
diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c index 893bac2bb21b..19a28a671a8e 100644 --- a/drivers/rtc/rtc-spear.c +++ b/drivers/rtc/rtc-spear.c | |||
| @@ -516,17 +516,7 @@ static struct platform_driver spear_rtc_driver = { | |||
| 516 | }, | 516 | }, |
| 517 | }; | 517 | }; |
| 518 | 518 | ||
| 519 | static int __init rtc_init(void) | 519 | module_platform_driver(spear_rtc_driver); |
| 520 | { | ||
| 521 | return platform_driver_register(&spear_rtc_driver); | ||
| 522 | } | ||
| 523 | module_init(rtc_init); | ||
| 524 | |||
| 525 | static void __exit rtc_exit(void) | ||
| 526 | { | ||
| 527 | platform_driver_unregister(&spear_rtc_driver); | ||
| 528 | } | ||
| 529 | module_exit(rtc_exit); | ||
| 530 | 520 | ||
| 531 | MODULE_ALIAS("platform:rtc-spear"); | 521 | MODULE_ALIAS("platform:rtc-spear"); |
| 532 | MODULE_AUTHOR("Rajeev Kumar <rajeev-dlh.kumar@st.com>"); | 522 | MODULE_AUTHOR("Rajeev Kumar <rajeev-dlh.kumar@st.com>"); |
diff --git a/drivers/rtc/rtc-stk17ta8.c b/drivers/rtc/rtc-stk17ta8.c index ed3e9b599031..7621116bd20d 100644 --- a/drivers/rtc/rtc-stk17ta8.c +++ b/drivers/rtc/rtc-stk17ta8.c | |||
| @@ -370,18 +370,7 @@ static struct platform_driver stk17ta8_rtc_driver = { | |||
| 370 | }, | 370 | }, |
| 371 | }; | 371 | }; |
| 372 | 372 | ||
| 373 | static __init int stk17ta8_init(void) | 373 | module_platform_driver(stk17ta8_rtc_driver); |
| 374 | { | ||
| 375 | return platform_driver_register(&stk17ta8_rtc_driver); | ||
| 376 | } | ||
| 377 | |||
| 378 | static __exit void stk17ta8_exit(void) | ||
| 379 | { | ||
| 380 | platform_driver_unregister(&stk17ta8_rtc_driver); | ||
| 381 | } | ||
| 382 | |||
| 383 | module_init(stk17ta8_init); | ||
| 384 | module_exit(stk17ta8_exit); | ||
| 385 | 374 | ||
| 386 | MODULE_AUTHOR("Thomas Hommel <thomas.hommel@ge.com>"); | 375 | MODULE_AUTHOR("Thomas Hommel <thomas.hommel@ge.com>"); |
| 387 | MODULE_DESCRIPTION("Simtek STK17TA8 RTC driver"); | 376 | MODULE_DESCRIPTION("Simtek STK17TA8 RTC driver"); |
diff --git a/drivers/rtc/rtc-stmp3xxx.c b/drivers/rtc/rtc-stmp3xxx.c index 7315068daa59..10287865e330 100644 --- a/drivers/rtc/rtc-stmp3xxx.c +++ b/drivers/rtc/rtc-stmp3xxx.c | |||
| @@ -276,18 +276,7 @@ static struct platform_driver stmp3xxx_rtcdrv = { | |||
| 276 | }, | 276 | }, |
| 277 | }; | 277 | }; |
| 278 | 278 | ||
| 279 | static int __init stmp3xxx_rtc_init(void) | 279 | module_platform_driver(stmp3xxx_rtcdrv); |
| 280 | { | ||
| 281 | return platform_driver_register(&stmp3xxx_rtcdrv); | ||
| 282 | } | ||
| 283 | |||
| 284 | static void __exit stmp3xxx_rtc_exit(void) | ||
| 285 | { | ||
| 286 | platform_driver_unregister(&stmp3xxx_rtcdrv); | ||
| 287 | } | ||
| 288 | |||
| 289 | module_init(stmp3xxx_rtc_init); | ||
| 290 | module_exit(stmp3xxx_rtc_exit); | ||
| 291 | 280 | ||
| 292 | MODULE_DESCRIPTION("STMP3xxx RTC Driver"); | 281 | MODULE_DESCRIPTION("STMP3xxx RTC Driver"); |
| 293 | MODULE_AUTHOR("dmitry pervushin <dpervushin@embeddedalley.com> and " | 282 | MODULE_AUTHOR("dmitry pervushin <dpervushin@embeddedalley.com> and " |
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index 20687d55e7a7..d43b4f6eb4e4 100644 --- a/drivers/rtc/rtc-twl.c +++ b/drivers/rtc/rtc-twl.c | |||
| @@ -550,6 +550,11 @@ static int twl_rtc_resume(struct platform_device *pdev) | |||
| 550 | #define twl_rtc_resume NULL | 550 | #define twl_rtc_resume NULL |
| 551 | #endif | 551 | #endif |
| 552 | 552 | ||
| 553 | static const struct of_device_id twl_rtc_of_match[] = { | ||
| 554 | {.compatible = "ti,twl4030-rtc", }, | ||
| 555 | { }, | ||
| 556 | }; | ||
| 557 | MODULE_DEVICE_TABLE(of, twl_rtc_of_match); | ||
| 553 | MODULE_ALIAS("platform:twl_rtc"); | 558 | MODULE_ALIAS("platform:twl_rtc"); |
| 554 | 559 | ||
| 555 | static struct platform_driver twl4030rtc_driver = { | 560 | static struct platform_driver twl4030rtc_driver = { |
| @@ -559,8 +564,9 @@ static struct platform_driver twl4030rtc_driver = { | |||
| 559 | .suspend = twl_rtc_suspend, | 564 | .suspend = twl_rtc_suspend, |
| 560 | .resume = twl_rtc_resume, | 565 | .resume = twl_rtc_resume, |
| 561 | .driver = { | 566 | .driver = { |
| 562 | .owner = THIS_MODULE, | 567 | .owner = THIS_MODULE, |
| 563 | .name = "twl_rtc", | 568 | .name = "twl_rtc", |
| 569 | .of_match_table = twl_rtc_of_match, | ||
| 564 | }, | 570 | }, |
| 565 | }; | 571 | }; |
| 566 | 572 | ||
diff --git a/drivers/rtc/rtc-v3020.c b/drivers/rtc/rtc-v3020.c index f71c3ce18036..bca5d677bc85 100644 --- a/drivers/rtc/rtc-v3020.c +++ b/drivers/rtc/rtc-v3020.c | |||
| @@ -393,18 +393,7 @@ static struct platform_driver rtc_device_driver = { | |||
| 393 | }, | 393 | }, |
| 394 | }; | 394 | }; |
| 395 | 395 | ||
| 396 | static __init int v3020_init(void) | 396 | module_platform_driver(rtc_device_driver); |
| 397 | { | ||
| 398 | return platform_driver_register(&rtc_device_driver); | ||
| 399 | } | ||
| 400 | |||
| 401 | static __exit void v3020_exit(void) | ||
| 402 | { | ||
| 403 | platform_driver_unregister(&rtc_device_driver); | ||
| 404 | } | ||
| 405 | |||
| 406 | module_init(v3020_init); | ||
| 407 | module_exit(v3020_exit); | ||
| 408 | 397 | ||
| 409 | MODULE_DESCRIPTION("V3020 RTC"); | 398 | MODULE_DESCRIPTION("V3020 RTC"); |
| 410 | MODULE_AUTHOR("Raphael Assenat"); | 399 | MODULE_AUTHOR("Raphael Assenat"); |
diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c index c5698cda366a..fcbfdda2993b 100644 --- a/drivers/rtc/rtc-vr41xx.c +++ b/drivers/rtc/rtc-vr41xx.c | |||
| @@ -405,15 +405,4 @@ static struct platform_driver rtc_platform_driver = { | |||
| 405 | }, | 405 | }, |
| 406 | }; | 406 | }; |
| 407 | 407 | ||
| 408 | static int __init vr41xx_rtc_init(void) | 408 | module_platform_driver(rtc_platform_driver); |
| 409 | { | ||
| 410 | return platform_driver_register(&rtc_platform_driver); | ||
| 411 | } | ||
| 412 | |||
| 413 | static void __exit vr41xx_rtc_exit(void) | ||
| 414 | { | ||
| 415 | platform_driver_unregister(&rtc_platform_driver); | ||
| 416 | } | ||
| 417 | |||
| 418 | module_init(vr41xx_rtc_init); | ||
| 419 | module_exit(vr41xx_rtc_exit); | ||
diff --git a/drivers/rtc/rtc-vt8500.c b/drivers/rtc/rtc-vt8500.c index f93f412423c6..9e94fb147c26 100644 --- a/drivers/rtc/rtc-vt8500.c +++ b/drivers/rtc/rtc-vt8500.c | |||
| @@ -311,17 +311,7 @@ static struct platform_driver vt8500_rtc_driver = { | |||
| 311 | }, | 311 | }, |
| 312 | }; | 312 | }; |
| 313 | 313 | ||
| 314 | static int __init vt8500_rtc_init(void) | 314 | module_platform_driver(vt8500_rtc_driver); |
| 315 | { | ||
| 316 | return platform_driver_register(&vt8500_rtc_driver); | ||
| 317 | } | ||
| 318 | module_init(vt8500_rtc_init); | ||
| 319 | |||
| 320 | static void __exit vt8500_rtc_exit(void) | ||
| 321 | { | ||
| 322 | platform_driver_unregister(&vt8500_rtc_driver); | ||
| 323 | } | ||
| 324 | module_exit(vt8500_rtc_exit); | ||
| 325 | 315 | ||
| 326 | MODULE_AUTHOR("Alexey Charkov <alchark@gmail.com>"); | 316 | MODULE_AUTHOR("Alexey Charkov <alchark@gmail.com>"); |
| 327 | MODULE_DESCRIPTION("VIA VT8500 SoC Realtime Clock Driver (RTC)"); | 317 | MODULE_DESCRIPTION("VIA VT8500 SoC Realtime Clock Driver (RTC)"); |
diff --git a/drivers/rtc/rtc-wm831x.c b/drivers/rtc/rtc-wm831x.c index bdc909bd56da..3b6e6a67e765 100644 --- a/drivers/rtc/rtc-wm831x.c +++ b/drivers/rtc/rtc-wm831x.c | |||
| @@ -324,15 +324,6 @@ static irqreturn_t wm831x_alm_irq(int irq, void *data) | |||
| 324 | return IRQ_HANDLED; | 324 | return IRQ_HANDLED; |
| 325 | } | 325 | } |
| 326 | 326 | ||
| 327 | static irqreturn_t wm831x_per_irq(int irq, void *data) | ||
| 328 | { | ||
| 329 | struct wm831x_rtc *wm831x_rtc = data; | ||
| 330 | |||
| 331 | rtc_update_irq(wm831x_rtc->rtc, 1, RTC_IRQF | RTC_UF); | ||
| 332 | |||
| 333 | return IRQ_HANDLED; | ||
| 334 | } | ||
| 335 | |||
| 336 | static const struct rtc_class_ops wm831x_rtc_ops = { | 327 | static const struct rtc_class_ops wm831x_rtc_ops = { |
| 337 | .read_time = wm831x_rtc_readtime, | 328 | .read_time = wm831x_rtc_readtime, |
| 338 | .set_mmss = wm831x_rtc_set_mmss, | 329 | .set_mmss = wm831x_rtc_set_mmss, |
| @@ -405,11 +396,10 @@ static int wm831x_rtc_probe(struct platform_device *pdev) | |||
| 405 | { | 396 | { |
| 406 | struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); | 397 | struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); |
| 407 | struct wm831x_rtc *wm831x_rtc; | 398 | struct wm831x_rtc *wm831x_rtc; |
| 408 | int per_irq = platform_get_irq_byname(pdev, "PER"); | ||
| 409 | int alm_irq = platform_get_irq_byname(pdev, "ALM"); | 399 | int alm_irq = platform_get_irq_byname(pdev, "ALM"); |
| 410 | int ret = 0; | 400 | int ret = 0; |
| 411 | 401 | ||
| 412 | wm831x_rtc = kzalloc(sizeof(*wm831x_rtc), GFP_KERNEL); | 402 | wm831x_rtc = devm_kzalloc(&pdev->dev, sizeof(*wm831x_rtc), GFP_KERNEL); |
| 413 | if (wm831x_rtc == NULL) | 403 | if (wm831x_rtc == NULL) |
| 414 | return -ENOMEM; | 404 | return -ENOMEM; |
| 415 | 405 | ||
| @@ -433,14 +423,6 @@ static int wm831x_rtc_probe(struct platform_device *pdev) | |||
| 433 | goto err; | 423 | goto err; |
| 434 | } | 424 | } |
| 435 | 425 | ||
| 436 | ret = request_threaded_irq(per_irq, NULL, wm831x_per_irq, | ||
| 437 | IRQF_TRIGGER_RISING, "RTC period", | ||
| 438 | wm831x_rtc); | ||
| 439 | if (ret != 0) { | ||
| 440 | dev_err(&pdev->dev, "Failed to request periodic IRQ %d: %d\n", | ||
| 441 | per_irq, ret); | ||
| 442 | } | ||
| 443 | |||
| 444 | ret = request_threaded_irq(alm_irq, NULL, wm831x_alm_irq, | 426 | ret = request_threaded_irq(alm_irq, NULL, wm831x_alm_irq, |
| 445 | IRQF_TRIGGER_RISING, "RTC alarm", | 427 | IRQF_TRIGGER_RISING, "RTC alarm", |
| 446 | wm831x_rtc); | 428 | wm831x_rtc); |
| @@ -452,20 +434,16 @@ static int wm831x_rtc_probe(struct platform_device *pdev) | |||
| 452 | return 0; | 434 | return 0; |
| 453 | 435 | ||
| 454 | err: | 436 | err: |
| 455 | kfree(wm831x_rtc); | ||
| 456 | return ret; | 437 | return ret; |
| 457 | } | 438 | } |
| 458 | 439 | ||
| 459 | static int __devexit wm831x_rtc_remove(struct platform_device *pdev) | 440 | static int __devexit wm831x_rtc_remove(struct platform_device *pdev) |
| 460 | { | 441 | { |
| 461 | struct wm831x_rtc *wm831x_rtc = platform_get_drvdata(pdev); | 442 | struct wm831x_rtc *wm831x_rtc = platform_get_drvdata(pdev); |
| 462 | int per_irq = platform_get_irq_byname(pdev, "PER"); | ||
| 463 | int alm_irq = platform_get_irq_byname(pdev, "ALM"); | 443 | int alm_irq = platform_get_irq_byname(pdev, "ALM"); |
| 464 | 444 | ||
| 465 | free_irq(alm_irq, wm831x_rtc); | 445 | free_irq(alm_irq, wm831x_rtc); |
| 466 | free_irq(per_irq, wm831x_rtc); | ||
| 467 | rtc_device_unregister(wm831x_rtc->rtc); | 446 | rtc_device_unregister(wm831x_rtc->rtc); |
| 468 | kfree(wm831x_rtc); | ||
| 469 | 447 | ||
| 470 | return 0; | 448 | return 0; |
| 471 | } | 449 | } |
| @@ -490,17 +468,7 @@ static struct platform_driver wm831x_rtc_driver = { | |||
| 490 | }, | 468 | }, |
| 491 | }; | 469 | }; |
| 492 | 470 | ||
| 493 | static int __init wm831x_rtc_init(void) | 471 | module_platform_driver(wm831x_rtc_driver); |
| 494 | { | ||
| 495 | return platform_driver_register(&wm831x_rtc_driver); | ||
| 496 | } | ||
| 497 | module_init(wm831x_rtc_init); | ||
| 498 | |||
| 499 | static void __exit wm831x_rtc_exit(void) | ||
| 500 | { | ||
| 501 | platform_driver_unregister(&wm831x_rtc_driver); | ||
| 502 | } | ||
| 503 | module_exit(wm831x_rtc_exit); | ||
| 504 | 472 | ||
| 505 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); | 473 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); |
| 506 | MODULE_DESCRIPTION("RTC driver for the WM831x series PMICs"); | 474 | MODULE_DESCRIPTION("RTC driver for the WM831x series PMICs"); |
diff --git a/drivers/rtc/rtc-wm8350.c b/drivers/rtc/rtc-wm8350.c index 66421426e404..c2e52d15abb2 100644 --- a/drivers/rtc/rtc-wm8350.c +++ b/drivers/rtc/rtc-wm8350.c | |||
| @@ -486,17 +486,7 @@ static struct platform_driver wm8350_rtc_driver = { | |||
| 486 | }, | 486 | }, |
| 487 | }; | 487 | }; |
| 488 | 488 | ||
| 489 | static int __init wm8350_rtc_init(void) | 489 | module_platform_driver(wm8350_rtc_driver); |
| 490 | { | ||
| 491 | return platform_driver_register(&wm8350_rtc_driver); | ||
| 492 | } | ||
| 493 | module_init(wm8350_rtc_init); | ||
| 494 | |||
| 495 | static void __exit wm8350_rtc_exit(void) | ||
| 496 | { | ||
| 497 | platform_driver_unregister(&wm8350_rtc_driver); | ||
| 498 | } | ||
| 499 | module_exit(wm8350_rtc_exit); | ||
| 500 | 490 | ||
| 501 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); | 491 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); |
| 502 | MODULE_DESCRIPTION("RTC driver for the WM8350"); | 492 | MODULE_DESCRIPTION("RTC driver for the WM8350"); |
