aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-twl.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 20:12:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 20:12:13 -0400
commit7f0ef0267e20d62d45d527911a993b1e998f4968 (patch)
treede51abc7da5903f59d83e23937f22420164c9477 /drivers/rtc/rtc-twl.c
parent862f0012549110d6f2586bf54b52ed4540cbff3a (diff)
parent9307c29524502c21f0e8a6d96d850b2f5bc0bd9a (diff)
Merge branch 'akpm' (updates from Andrew Morton)
Merge first patch-bomb from Andrew Morton: - various misc bits - I'm been patchmonkeying ocfs2 for a while, as Joel and Mark have been distracted. There has been quite a bit of activity. - About half the MM queue - Some backlight bits - Various lib/ updates - checkpatch updates - zillions more little rtc patches - ptrace - signals - exec - procfs - rapidio - nbd - aoe - pps - memstick - tools/testing/selftests updates * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (445 commits) tools/testing/selftests: don't assume the x bit is set on scripts selftests: add .gitignore for kcmp selftests: fix clean target in kcmp Makefile selftests: add .gitignore for vm selftests: add hugetlbfstest self-test: fix make clean selftests: exit 1 on failure kernel/resource.c: remove the unneeded assignment in function __find_resource aio: fix wrong comment in aio_complete() drivers/w1/slaves/w1_ds2408.c: add magic sequence to disable P0 test mode drivers/memstick/host/r592.c: convert to module_pci_driver drivers/memstick/host/jmb38x_ms: convert to module_pci_driver pps-gpio: add device-tree binding and support drivers/pps/clients/pps-gpio.c: convert to module_platform_driver drivers/pps/clients/pps-gpio.c: convert to devm_* helpers drivers/parport/share.c: use kzalloc Documentation/accounting/getdelays.c: avoid strncpy in accounting tool aoe: update internal version number to v83 aoe: update copyright date aoe: perform I/O completions in parallel ...
Diffstat (limited to 'drivers/rtc/rtc-twl.c')
-rw-r--r--drivers/rtc/rtc-twl.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index b2eab34f38d9..02faf3c4e0d5 100644
--- a/drivers/rtc/rtc-twl.c
+++ b/drivers/rtc/rtc-twl.c
@@ -213,12 +213,24 @@ static int mask_rtc_irq_bit(unsigned char bit)
213 213
214static int twl_rtc_alarm_irq_enable(struct device *dev, unsigned enabled) 214static int twl_rtc_alarm_irq_enable(struct device *dev, unsigned enabled)
215{ 215{
216 struct platform_device *pdev = to_platform_device(dev);
217 int irq = platform_get_irq(pdev, 0);
218 static bool twl_rtc_wake_enabled;
216 int ret; 219 int ret;
217 220
218 if (enabled) 221 if (enabled) {
219 ret = set_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_ALARM_M); 222 ret = set_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
220 else 223 if (device_can_wakeup(dev) && !twl_rtc_wake_enabled) {
224 enable_irq_wake(irq);
225 twl_rtc_wake_enabled = true;
226 }
227 } else {
221 ret = mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_ALARM_M); 228 ret = mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
229 if (twl_rtc_wake_enabled) {
230 disable_irq_wake(irq);
231 twl_rtc_wake_enabled = false;
232 }
233 }
222 234
223 return ret; 235 return ret;
224} 236}
@@ -469,6 +481,12 @@ static int twl_rtc_probe(struct platform_device *pdev)
469 if (irq <= 0) 481 if (irq <= 0)
470 goto out1; 482 goto out1;
471 483
484 /* Initialize the register map */
485 if (twl_class_is_4030())
486 rtc_reg_map = (u8 *)twl4030_rtc_reg_map;
487 else
488 rtc_reg_map = (u8 *)twl6030_rtc_reg_map;
489
472 ret = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG); 490 ret = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
473 if (ret < 0) 491 if (ret < 0)
474 goto out1; 492 goto out1;
@@ -556,7 +574,6 @@ static int twl_rtc_remove(struct platform_device *pdev)
556 free_irq(irq, rtc); 574 free_irq(irq, rtc);
557 575
558 rtc_device_unregister(rtc); 576 rtc_device_unregister(rtc);
559 platform_set_drvdata(pdev, NULL);
560 return 0; 577 return 0;
561} 578}
562 579
@@ -609,22 +626,7 @@ static struct platform_driver twl4030rtc_driver = {
609 }, 626 },
610}; 627};
611 628
612static int __init twl_rtc_init(void) 629module_platform_driver(twl4030rtc_driver);
613{
614 if (twl_class_is_4030())
615 rtc_reg_map = (u8 *) twl4030_rtc_reg_map;
616 else
617 rtc_reg_map = (u8 *) twl6030_rtc_reg_map;
618
619 return platform_driver_register(&twl4030rtc_driver);
620}
621module_init(twl_rtc_init);
622
623static void __exit twl_rtc_exit(void)
624{
625 platform_driver_unregister(&twl4030rtc_driver);
626}
627module_exit(twl_rtc_exit);
628 630
629MODULE_AUTHOR("Texas Instruments, MontaVista Software"); 631MODULE_AUTHOR("Texas Instruments, MontaVista Software");
630MODULE_LICENSE("GPL"); 632MODULE_LICENSE("GPL");