diff options
Diffstat (limited to 'drivers/rtc')
| -rw-r--r-- | drivers/rtc/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/rtc/rtc-bfin.c | 60 | ||||
| -rw-r--r-- | drivers/rtc/rtc-dev.c | 5 | ||||
| -rw-r--r-- | drivers/rtc/rtc-ds1374.c | 10 | ||||
| -rw-r--r-- | drivers/rtc/rtc-max6902.c | 2 | ||||
| -rw-r--r-- | drivers/rtc/rtc-r9701.c | 1 |
6 files changed, 38 insertions, 42 deletions
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 90ab73825401..9a9755c92fad 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
| @@ -561,7 +561,7 @@ config RTC_DRV_AT91SAM9_GPBR | |||
| 561 | 561 | ||
| 562 | config RTC_DRV_BFIN | 562 | config RTC_DRV_BFIN |
| 563 | tristate "Blackfin On-Chip RTC" | 563 | tristate "Blackfin On-Chip RTC" |
| 564 | depends on BLACKFIN | 564 | depends on BLACKFIN && !BF561 |
| 565 | help | 565 | help |
| 566 | If you say yes here you will get support for the | 566 | If you say yes here you will get support for the |
| 567 | Blackfin On-Chip Real Time Clock. | 567 | Blackfin On-Chip Real Time Clock. |
diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c index a1af4c27939b..34439ce3967e 100644 --- a/drivers/rtc/rtc-bfin.c +++ b/drivers/rtc/rtc-bfin.c | |||
| @@ -218,26 +218,6 @@ static irqreturn_t bfin_rtc_interrupt(int irq, void *dev_id) | |||
| 218 | return IRQ_NONE; | 218 | return IRQ_NONE; |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | static int bfin_rtc_open(struct device *dev) | ||
| 222 | { | ||
| 223 | int ret; | ||
| 224 | |||
| 225 | dev_dbg_stamp(dev); | ||
| 226 | |||
| 227 | ret = request_irq(IRQ_RTC, bfin_rtc_interrupt, IRQF_SHARED, to_platform_device(dev)->name, dev); | ||
| 228 | if (!ret) | ||
| 229 | bfin_rtc_reset(dev, RTC_ISTAT_WRITE_COMPLETE); | ||
| 230 | |||
| 231 | return ret; | ||
| 232 | } | ||
| 233 | |||
| 234 | static void bfin_rtc_release(struct device *dev) | ||
| 235 | { | ||
| 236 | dev_dbg_stamp(dev); | ||
| 237 | bfin_rtc_reset(dev, 0); | ||
| 238 | free_irq(IRQ_RTC, dev); | ||
| 239 | } | ||
| 240 | |||
| 241 | static void bfin_rtc_int_set(u16 rtc_int) | 221 | static void bfin_rtc_int_set(u16 rtc_int) |
| 242 | { | 222 | { |
| 243 | bfin_write_RTC_ISTAT(rtc_int); | 223 | bfin_write_RTC_ISTAT(rtc_int); |
| @@ -370,8 +350,6 @@ static int bfin_rtc_proc(struct device *dev, struct seq_file *seq) | |||
| 370 | } | 350 | } |
| 371 | 351 | ||
| 372 | static struct rtc_class_ops bfin_rtc_ops = { | 352 | static struct rtc_class_ops bfin_rtc_ops = { |
| 373 | .open = bfin_rtc_open, | ||
| 374 | .release = bfin_rtc_release, | ||
| 375 | .ioctl = bfin_rtc_ioctl, | 353 | .ioctl = bfin_rtc_ioctl, |
| 376 | .read_time = bfin_rtc_read_time, | 354 | .read_time = bfin_rtc_read_time, |
| 377 | .set_time = bfin_rtc_set_time, | 355 | .set_time = bfin_rtc_set_time, |
| @@ -383,29 +361,44 @@ static struct rtc_class_ops bfin_rtc_ops = { | |||
| 383 | static int __devinit bfin_rtc_probe(struct platform_device *pdev) | 361 | static int __devinit bfin_rtc_probe(struct platform_device *pdev) |
| 384 | { | 362 | { |
| 385 | struct bfin_rtc *rtc; | 363 | struct bfin_rtc *rtc; |
| 364 | struct device *dev = &pdev->dev; | ||
| 386 | int ret = 0; | 365 | int ret = 0; |
| 366 | unsigned long timeout; | ||
| 387 | 367 | ||
| 388 | dev_dbg_stamp(&pdev->dev); | 368 | dev_dbg_stamp(dev); |
| 389 | 369 | ||
| 370 | /* Allocate memory for our RTC struct */ | ||
| 390 | rtc = kzalloc(sizeof(*rtc), GFP_KERNEL); | 371 | rtc = kzalloc(sizeof(*rtc), GFP_KERNEL); |
| 391 | if (unlikely(!rtc)) | 372 | if (unlikely(!rtc)) |
| 392 | return -ENOMEM; | 373 | return -ENOMEM; |
| 374 | platform_set_drvdata(pdev, rtc); | ||
| 375 | device_init_wakeup(dev, 1); | ||
| 393 | 376 | ||
| 394 | rtc->rtc_dev = rtc_device_register(pdev->name, &pdev->dev, &bfin_rtc_ops, THIS_MODULE); | 377 | /* Grab the IRQ and init the hardware */ |
| 395 | if (IS_ERR(rtc)) { | 378 | ret = request_irq(IRQ_RTC, bfin_rtc_interrupt, IRQF_SHARED, pdev->name, dev); |
| 396 | ret = PTR_ERR(rtc->rtc_dev); | 379 | if (unlikely(ret)) |
| 397 | goto err; | 380 | goto err; |
| 398 | } | 381 | /* sometimes the bootloader touched things, but the write complete was not |
| 399 | 382 | * enabled, so let's just do a quick timeout here since the IRQ will not fire ... | |
| 400 | /* see comment at top of file about stopwatch/PIE */ | 383 | */ |
| 384 | timeout = jiffies + HZ; | ||
| 385 | while (bfin_read_RTC_ISTAT() & RTC_ISTAT_WRITE_PENDING) | ||
| 386 | if (time_after(jiffies, timeout)) | ||
| 387 | break; | ||
| 388 | bfin_rtc_reset(dev, RTC_ISTAT_WRITE_COMPLETE); | ||
| 401 | bfin_write_RTC_SWCNT(0); | 389 | bfin_write_RTC_SWCNT(0); |
| 402 | 390 | ||
| 403 | platform_set_drvdata(pdev, rtc); | 391 | /* Register our RTC with the RTC framework */ |
| 404 | 392 | rtc->rtc_dev = rtc_device_register(pdev->name, dev, &bfin_rtc_ops, THIS_MODULE); | |
| 405 | device_init_wakeup(&pdev->dev, 1); | 393 | if (unlikely(IS_ERR(rtc))) { |
| 394 | ret = PTR_ERR(rtc->rtc_dev); | ||
| 395 | goto err_irq; | ||
| 396 | } | ||
| 406 | 397 | ||
| 407 | return 0; | 398 | return 0; |
| 408 | 399 | ||
| 400 | err_irq: | ||
| 401 | free_irq(IRQ_RTC, dev); | ||
| 409 | err: | 402 | err: |
| 410 | kfree(rtc); | 403 | kfree(rtc); |
| 411 | return ret; | 404 | return ret; |
| @@ -414,7 +407,10 @@ static int __devinit bfin_rtc_probe(struct platform_device *pdev) | |||
| 414 | static int __devexit bfin_rtc_remove(struct platform_device *pdev) | 407 | static int __devexit bfin_rtc_remove(struct platform_device *pdev) |
| 415 | { | 408 | { |
| 416 | struct bfin_rtc *rtc = platform_get_drvdata(pdev); | 409 | struct bfin_rtc *rtc = platform_get_drvdata(pdev); |
| 410 | struct device *dev = &pdev->dev; | ||
| 417 | 411 | ||
| 412 | bfin_rtc_reset(dev, 0); | ||
| 413 | free_irq(IRQ_RTC, dev); | ||
| 418 | rtc_device_unregister(rtc->rtc_dev); | 414 | rtc_device_unregister(rtc->rtc_dev); |
| 419 | platform_set_drvdata(pdev, NULL); | 415 | platform_set_drvdata(pdev, NULL); |
| 420 | kfree(rtc); | 416 | kfree(rtc); |
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index 35dcc06eb3e2..f118252f3a9f 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c | |||
| @@ -403,11 +403,14 @@ static long rtc_dev_ioctl(struct file *file, | |||
| 403 | 403 | ||
| 404 | #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL | 404 | #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL |
| 405 | case RTC_UIE_OFF: | 405 | case RTC_UIE_OFF: |
| 406 | mutex_unlock(&rtc->ops_lock); | ||
| 406 | clear_uie(rtc); | 407 | clear_uie(rtc); |
| 407 | break; | 408 | return 0; |
| 408 | 409 | ||
| 409 | case RTC_UIE_ON: | 410 | case RTC_UIE_ON: |
| 411 | mutex_unlock(&rtc->ops_lock); | ||
| 410 | err = set_uie(rtc); | 412 | err = set_uie(rtc); |
| 413 | return err; | ||
| 411 | #endif | 414 | #endif |
| 412 | default: | 415 | default: |
| 413 | err = -ENOTTY; | 416 | err = -ENOTTY; |
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c index 640acd20fdde..a150418fba76 100644 --- a/drivers/rtc/rtc-ds1374.c +++ b/drivers/rtc/rtc-ds1374.c | |||
| @@ -173,7 +173,7 @@ static int ds1374_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) | |||
| 173 | int cr, sr; | 173 | int cr, sr; |
| 174 | int ret = 0; | 174 | int ret = 0; |
| 175 | 175 | ||
| 176 | if (client->irq < 0) | 176 | if (client->irq <= 0) |
| 177 | return -EINVAL; | 177 | return -EINVAL; |
| 178 | 178 | ||
| 179 | mutex_lock(&ds1374->mutex); | 179 | mutex_lock(&ds1374->mutex); |
| @@ -212,7 +212,7 @@ static int ds1374_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) | |||
| 212 | int cr; | 212 | int cr; |
| 213 | int ret = 0; | 213 | int ret = 0; |
| 214 | 214 | ||
| 215 | if (client->irq < 0) | 215 | if (client->irq <= 0) |
| 216 | return -EINVAL; | 216 | return -EINVAL; |
| 217 | 217 | ||
| 218 | ret = ds1374_read_time(dev, &now); | 218 | ret = ds1374_read_time(dev, &now); |
| @@ -381,7 +381,7 @@ static int ds1374_probe(struct i2c_client *client, | |||
| 381 | if (ret) | 381 | if (ret) |
| 382 | goto out_free; | 382 | goto out_free; |
| 383 | 383 | ||
| 384 | if (client->irq >= 0) { | 384 | if (client->irq > 0) { |
| 385 | ret = request_irq(client->irq, ds1374_irq, 0, | 385 | ret = request_irq(client->irq, ds1374_irq, 0, |
| 386 | "ds1374", client); | 386 | "ds1374", client); |
| 387 | if (ret) { | 387 | if (ret) { |
| @@ -401,7 +401,7 @@ static int ds1374_probe(struct i2c_client *client, | |||
| 401 | return 0; | 401 | return 0; |
| 402 | 402 | ||
| 403 | out_irq: | 403 | out_irq: |
| 404 | if (client->irq >= 0) | 404 | if (client->irq > 0) |
| 405 | free_irq(client->irq, client); | 405 | free_irq(client->irq, client); |
| 406 | 406 | ||
| 407 | out_free: | 407 | out_free: |
| @@ -414,7 +414,7 @@ static int __devexit ds1374_remove(struct i2c_client *client) | |||
| 414 | { | 414 | { |
| 415 | struct ds1374 *ds1374 = i2c_get_clientdata(client); | 415 | struct ds1374 *ds1374 = i2c_get_clientdata(client); |
| 416 | 416 | ||
| 417 | if (client->irq >= 0) { | 417 | if (client->irq > 0) { |
| 418 | mutex_lock(&ds1374->mutex); | 418 | mutex_lock(&ds1374->mutex); |
| 419 | ds1374->exiting = 1; | 419 | ds1374->exiting = 1; |
| 420 | mutex_unlock(&ds1374->mutex); | 420 | mutex_unlock(&ds1374->mutex); |
diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c index 12f0310ae89c..78b2551fb19d 100644 --- a/drivers/rtc/rtc-max6902.c +++ b/drivers/rtc/rtc-max6902.c | |||
| @@ -20,8 +20,6 @@ | |||
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
| 23 | #include <linux/version.h> | ||
| 24 | |||
| 25 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
| 26 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
| 27 | #include <linux/init.h> | 25 | #include <linux/init.h> |
diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c index b35f9bfa2af4..395985b339c9 100644 --- a/drivers/rtc/rtc-r9701.c +++ b/drivers/rtc/rtc-r9701.c | |||
| @@ -14,7 +14,6 @@ | |||
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
| 17 | #include <linux/version.h> | ||
| 18 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
| 19 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
| 20 | #include <linux/device.h> | 19 | #include <linux/device.h> |
