aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-12-15 17:13:26 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-12-15 17:13:26 -0500
commit7e1548a597ef7e26d5d62f8be3be6da9e101b26c (patch)
treefe6cbf4d9a3c1afdba04fb276fef0f932403727c /drivers/rtc
parent1f7f569c0ae6e619504095eabf796edd712d943d (diff)
parent2619bc327417f549f1c89d5ef9b4a4aa768f41a2 (diff)
Merge branch 'omap3-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6 into devel
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-ds1672.c6
-rw-r--r--drivers/rtc/rtc-max6900.c6
-rw-r--r--drivers/rtc/rtc-starfire.c66
-rw-r--r--drivers/rtc/rtc-twl4030.c2
4 files changed, 26 insertions, 54 deletions
diff --git a/drivers/rtc/rtc-ds1672.c b/drivers/rtc/rtc-ds1672.c
index 341d7a5b45a..4e91419e891 100644
--- a/drivers/rtc/rtc-ds1672.c
+++ b/drivers/rtc/rtc-ds1672.c
@@ -209,12 +209,18 @@ static int ds1672_probe(struct i2c_client *client,
209 return err; 209 return err;
210} 210}
211 211
212static struct i2c_device_id ds1672_id[] = {
213 { "ds1672", 0 },
214 { }
215};
216
212static struct i2c_driver ds1672_driver = { 217static struct i2c_driver ds1672_driver = {
213 .driver = { 218 .driver = {
214 .name = "rtc-ds1672", 219 .name = "rtc-ds1672",
215 }, 220 },
216 .probe = &ds1672_probe, 221 .probe = &ds1672_probe,
217 .remove = &ds1672_remove, 222 .remove = &ds1672_remove,
223 .id_table = ds1672_id,
218}; 224};
219 225
220static int __init ds1672_init(void) 226static int __init ds1672_init(void)
diff --git a/drivers/rtc/rtc-max6900.c b/drivers/rtc/rtc-max6900.c
index 80782798763..a4f6665ab3c 100644
--- a/drivers/rtc/rtc-max6900.c
+++ b/drivers/rtc/rtc-max6900.c
@@ -247,12 +247,18 @@ max6900_probe(struct i2c_client *client, const struct i2c_device_id *id)
247 return 0; 247 return 0;
248} 248}
249 249
250static struct i2c_device_id max6900_id[] = {
251 { "max6900", 0 },
252 { }
253};
254
250static struct i2c_driver max6900_driver = { 255static struct i2c_driver max6900_driver = {
251 .driver = { 256 .driver = {
252 .name = "rtc-max6900", 257 .name = "rtc-max6900",
253 }, 258 },
254 .probe = max6900_probe, 259 .probe = max6900_probe,
255 .remove = max6900_remove, 260 .remove = max6900_remove,
261 .id_table = max6900_id,
256}; 262};
257 263
258static int __init max6900_init(void) 264static int __init max6900_init(void)
diff --git a/drivers/rtc/rtc-starfire.c b/drivers/rtc/rtc-starfire.c
index 7ccb0dd700a..5be98bfd7ed 100644
--- a/drivers/rtc/rtc-starfire.c
+++ b/drivers/rtc/rtc-starfire.c
@@ -6,7 +6,6 @@
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/time.h>
10#include <linux/rtc.h> 9#include <linux/rtc.h>
11#include <linux/platform_device.h> 10#include <linux/platform_device.h>
12 11
@@ -16,11 +15,6 @@ MODULE_AUTHOR("David S. Miller <davem@davemloft.net>");
16MODULE_DESCRIPTION("Starfire RTC driver"); 15MODULE_DESCRIPTION("Starfire RTC driver");
17MODULE_LICENSE("GPL"); 16MODULE_LICENSE("GPL");
18 17
19struct starfire_rtc {
20 struct rtc_device *rtc;
21 spinlock_t lock;
22};
23
24static u32 starfire_get_time(void) 18static u32 starfire_get_time(void)
25{ 19{
26 static char obp_gettod[32]; 20 static char obp_gettod[32];
@@ -35,64 +29,31 @@ static u32 starfire_get_time(void)
35 29
36static int starfire_read_time(struct device *dev, struct rtc_time *tm) 30static int starfire_read_time(struct device *dev, struct rtc_time *tm)
37{ 31{
38 struct starfire_rtc *p = dev_get_drvdata(dev); 32 rtc_time_to_tm(starfire_get_time(), tm);
39 unsigned long flags, secs; 33 return rtc_valid_tm(tm);
40
41 spin_lock_irqsave(&p->lock, flags);
42 secs = starfire_get_time();
43 spin_unlock_irqrestore(&p->lock, flags);
44
45 rtc_time_to_tm(secs, tm);
46
47 return 0;
48}
49
50static int starfire_set_time(struct device *dev, struct rtc_time *tm)
51{
52 unsigned long secs;
53 int err;
54
55 err = rtc_tm_to_time(tm, &secs);
56 if (err)
57 return err;
58
59 /* Do nothing, time is set using the service processor
60 * console on this platform.
61 */
62 return 0;
63} 34}
64 35
65static const struct rtc_class_ops starfire_rtc_ops = { 36static const struct rtc_class_ops starfire_rtc_ops = {
66 .read_time = starfire_read_time, 37 .read_time = starfire_read_time,
67 .set_time = starfire_set_time,
68}; 38};
69 39
70static int __devinit starfire_rtc_probe(struct platform_device *pdev) 40static int __init starfire_rtc_probe(struct platform_device *pdev)
71{ 41{
72 struct starfire_rtc *p = kzalloc(sizeof(*p), GFP_KERNEL); 42 struct rtc_device *rtc = rtc_device_register("starfire", &pdev->dev,
73 43 &starfire_rtc_ops, THIS_MODULE);
74 if (!p) 44 if (IS_ERR(rtc))
75 return -ENOMEM; 45 return PTR_ERR(rtc);
76 46
77 spin_lock_init(&p->lock); 47 platform_set_drvdata(pdev, rtc);
78 48
79 p->rtc = rtc_device_register("starfire", &pdev->dev,
80 &starfire_rtc_ops, THIS_MODULE);
81 if (IS_ERR(p->rtc)) {
82 int err = PTR_ERR(p->rtc);
83 kfree(p);
84 return err;
85 }
86 platform_set_drvdata(pdev, p);
87 return 0; 49 return 0;
88} 50}
89 51
90static int __devexit starfire_rtc_remove(struct platform_device *pdev) 52static int __exit starfire_rtc_remove(struct platform_device *pdev)
91{ 53{
92 struct starfire_rtc *p = platform_get_drvdata(pdev); 54 struct rtc_device *rtc = platform_get_drvdata(pdev);
93 55
94 rtc_device_unregister(p->rtc); 56 rtc_device_unregister(rtc);
95 kfree(p);
96 57
97 return 0; 58 return 0;
98} 59}
@@ -102,13 +63,12 @@ static struct platform_driver starfire_rtc_driver = {
102 .name = "rtc-starfire", 63 .name = "rtc-starfire",
103 .owner = THIS_MODULE, 64 .owner = THIS_MODULE,
104 }, 65 },
105 .probe = starfire_rtc_probe, 66 .remove = __exit_p(starfire_rtc_remove),
106 .remove = __devexit_p(starfire_rtc_remove),
107}; 67};
108 68
109static int __init starfire_rtc_init(void) 69static int __init starfire_rtc_init(void)
110{ 70{
111 return platform_driver_register(&starfire_rtc_driver); 71 return platform_driver_probe(&starfire_rtc_driver, starfire_rtc_probe);
112} 72}
113 73
114static void __exit starfire_rtc_exit(void) 74static void __exit starfire_rtc_exit(void)
diff --git a/drivers/rtc/rtc-twl4030.c b/drivers/rtc/rtc-twl4030.c
index abe87a4d266..01d8da9afdc 100644
--- a/drivers/rtc/rtc-twl4030.c
+++ b/drivers/rtc/rtc-twl4030.c
@@ -337,7 +337,7 @@ static int twl4030_rtc_ioctl(struct device *dev, unsigned int cmd,
337} 337}
338 338
339#else 339#else
340#define omap_rtc_ioctl NULL 340#define twl4030_rtc_ioctl NULL
341#endif 341#endif
342 342
343static irqreturn_t twl4030_rtc_interrupt(int irq, void *rtc) 343static irqreturn_t twl4030_rtc_interrupt(int irq, void *rtc)