diff options
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-ab3100.c | 41 | ||||
-rw-r--r-- | drivers/rtc/rtc-ds1374.c | 2 | ||||
-rw-r--r-- | drivers/rtc/rtc-mpc5121.c | 14 | ||||
-rw-r--r-- | drivers/rtc/rtc-rx8025.c | 2 | ||||
-rw-r--r-- | drivers/rtc/rtc-s35390a.c | 2 | ||||
-rw-r--r-- | drivers/rtc/rtc-s3c.c | 9 |
6 files changed, 30 insertions, 40 deletions
diff --git a/drivers/rtc/rtc-ab3100.c b/drivers/rtc/rtc-ab3100.c index 4704aac2b5af..d26780ea254b 100644 --- a/drivers/rtc/rtc-ab3100.c +++ b/drivers/rtc/rtc-ab3100.c | |||
@@ -9,7 +9,7 @@ | |||
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <linux/platform_device.h> | 10 | #include <linux/platform_device.h> |
11 | #include <linux/rtc.h> | 11 | #include <linux/rtc.h> |
12 | #include <linux/mfd/ab3100.h> | 12 | #include <linux/mfd/abx500.h> |
13 | 13 | ||
14 | /* Clock rate in Hz */ | 14 | /* Clock rate in Hz */ |
15 | #define AB3100_RTC_CLOCK_RATE 32768 | 15 | #define AB3100_RTC_CLOCK_RATE 32768 |
@@ -45,7 +45,6 @@ | |||
45 | */ | 45 | */ |
46 | static int ab3100_rtc_set_mmss(struct device *dev, unsigned long secs) | 46 | static int ab3100_rtc_set_mmss(struct device *dev, unsigned long secs) |
47 | { | 47 | { |
48 | struct ab3100 *ab3100_data = dev_get_drvdata(dev); | ||
49 | u8 regs[] = {AB3100_TI0, AB3100_TI1, AB3100_TI2, | 48 | u8 regs[] = {AB3100_TI0, AB3100_TI1, AB3100_TI2, |
50 | AB3100_TI3, AB3100_TI4, AB3100_TI5}; | 49 | AB3100_TI3, AB3100_TI4, AB3100_TI5}; |
51 | unsigned char buf[6]; | 50 | unsigned char buf[6]; |
@@ -61,27 +60,26 @@ static int ab3100_rtc_set_mmss(struct device *dev, unsigned long secs) | |||
61 | buf[5] = (fat_time >> 40) & 0xFF; | 60 | buf[5] = (fat_time >> 40) & 0xFF; |
62 | 61 | ||
63 | for (i = 0; i < 6; i++) { | 62 | for (i = 0; i < 6; i++) { |
64 | err = ab3100_set_register_interruptible(ab3100_data, | 63 | err = abx500_set_register_interruptible(dev, 0, |
65 | regs[i], buf[i]); | 64 | regs[i], buf[i]); |
66 | if (err) | 65 | if (err) |
67 | return err; | 66 | return err; |
68 | } | 67 | } |
69 | 68 | ||
70 | /* Set the flag to mark that the clock is now set */ | 69 | /* Set the flag to mark that the clock is now set */ |
71 | return ab3100_mask_and_set_register_interruptible(ab3100_data, | 70 | return abx500_mask_and_set_register_interruptible(dev, 0, |
72 | AB3100_RTC, | 71 | AB3100_RTC, |
73 | 0xFE, 0x01); | 72 | 0x01, 0x01); |
74 | 73 | ||
75 | } | 74 | } |
76 | 75 | ||
77 | static int ab3100_rtc_read_time(struct device *dev, struct rtc_time *tm) | 76 | static int ab3100_rtc_read_time(struct device *dev, struct rtc_time *tm) |
78 | { | 77 | { |
79 | struct ab3100 *ab3100_data = dev_get_drvdata(dev); | ||
80 | unsigned long time; | 78 | unsigned long time; |
81 | u8 rtcval; | 79 | u8 rtcval; |
82 | int err; | 80 | int err; |
83 | 81 | ||
84 | err = ab3100_get_register_interruptible(ab3100_data, | 82 | err = abx500_get_register_interruptible(dev, 0, |
85 | AB3100_RTC, &rtcval); | 83 | AB3100_RTC, &rtcval); |
86 | if (err) | 84 | if (err) |
87 | return err; | 85 | return err; |
@@ -94,7 +92,7 @@ static int ab3100_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
94 | u8 buf[6]; | 92 | u8 buf[6]; |
95 | 93 | ||
96 | /* Read out time registers */ | 94 | /* Read out time registers */ |
97 | err = ab3100_get_register_page_interruptible(ab3100_data, | 95 | err = abx500_get_register_page_interruptible(dev, 0, |
98 | AB3100_TI0, | 96 | AB3100_TI0, |
99 | buf, 6); | 97 | buf, 6); |
100 | if (err != 0) | 98 | if (err != 0) |
@@ -114,7 +112,6 @@ static int ab3100_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
114 | 112 | ||
115 | static int ab3100_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) | 113 | static int ab3100_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) |
116 | { | 114 | { |
117 | struct ab3100 *ab3100_data = dev_get_drvdata(dev); | ||
118 | unsigned long time; | 115 | unsigned long time; |
119 | u64 fat_time; | 116 | u64 fat_time; |
120 | u8 buf[6]; | 117 | u8 buf[6]; |
@@ -122,7 +119,7 @@ static int ab3100_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) | |||
122 | int err; | 119 | int err; |
123 | 120 | ||
124 | /* Figure out if alarm is enabled or not */ | 121 | /* Figure out if alarm is enabled or not */ |
125 | err = ab3100_get_register_interruptible(ab3100_data, | 122 | err = abx500_get_register_interruptible(dev, 0, |
126 | AB3100_RTC, &rtcval); | 123 | AB3100_RTC, &rtcval); |
127 | if (err) | 124 | if (err) |
128 | return err; | 125 | return err; |
@@ -133,7 +130,7 @@ static int ab3100_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) | |||
133 | /* No idea how this could be represented */ | 130 | /* No idea how this could be represented */ |
134 | alarm->pending = 0; | 131 | alarm->pending = 0; |
135 | /* Read out alarm registers, only 4 bytes */ | 132 | /* Read out alarm registers, only 4 bytes */ |
136 | err = ab3100_get_register_page_interruptible(ab3100_data, | 133 | err = abx500_get_register_page_interruptible(dev, 0, |
137 | AB3100_AL0, buf, 4); | 134 | AB3100_AL0, buf, 4); |
138 | if (err) | 135 | if (err) |
139 | return err; | 136 | return err; |
@@ -148,7 +145,6 @@ static int ab3100_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) | |||
148 | 145 | ||
149 | static int ab3100_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) | 146 | static int ab3100_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) |
150 | { | 147 | { |
151 | struct ab3100 *ab3100_data = dev_get_drvdata(dev); | ||
152 | u8 regs[] = {AB3100_AL0, AB3100_AL1, AB3100_AL2, AB3100_AL3}; | 148 | u8 regs[] = {AB3100_AL0, AB3100_AL1, AB3100_AL2, AB3100_AL3}; |
153 | unsigned char buf[4]; | 149 | unsigned char buf[4]; |
154 | unsigned long secs; | 150 | unsigned long secs; |
@@ -165,21 +161,19 @@ static int ab3100_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) | |||
165 | 161 | ||
166 | /* Set the alarm */ | 162 | /* Set the alarm */ |
167 | for (i = 0; i < 4; i++) { | 163 | for (i = 0; i < 4; i++) { |
168 | err = ab3100_set_register_interruptible(ab3100_data, | 164 | err = abx500_set_register_interruptible(dev, 0, |
169 | regs[i], buf[i]); | 165 | regs[i], buf[i]); |
170 | if (err) | 166 | if (err) |
171 | return err; | 167 | return err; |
172 | } | 168 | } |
173 | /* Then enable the alarm */ | 169 | /* Then enable the alarm */ |
174 | return ab3100_mask_and_set_register_interruptible(ab3100_data, | 170 | return abx500_mask_and_set_register_interruptible(dev, 0, |
175 | AB3100_RTC, ~(1 << 2), | 171 | AB3100_RTC, (1 << 2), |
176 | alarm->enabled << 2); | 172 | alarm->enabled << 2); |
177 | } | 173 | } |
178 | 174 | ||
179 | static int ab3100_rtc_irq_enable(struct device *dev, unsigned int enabled) | 175 | static int ab3100_rtc_irq_enable(struct device *dev, unsigned int enabled) |
180 | { | 176 | { |
181 | struct ab3100 *ab3100_data = dev_get_drvdata(dev); | ||
182 | |||
183 | /* | 177 | /* |
184 | * It's not possible to enable/disable the alarm IRQ for this RTC. | 178 | * It's not possible to enable/disable the alarm IRQ for this RTC. |
185 | * It does not actually trigger any IRQ: instead its only function is | 179 | * It does not actually trigger any IRQ: instead its only function is |
@@ -188,12 +182,12 @@ static int ab3100_rtc_irq_enable(struct device *dev, unsigned int enabled) | |||
188 | * and need to be handled there instead. | 182 | * and need to be handled there instead. |
189 | */ | 183 | */ |
190 | if (enabled) | 184 | if (enabled) |
191 | return ab3100_mask_and_set_register_interruptible(ab3100_data, | 185 | return abx500_mask_and_set_register_interruptible(dev, 0, |
192 | AB3100_RTC, ~(1 << 2), | 186 | AB3100_RTC, (1 << 2), |
193 | 1 << 2); | 187 | 1 << 2); |
194 | else | 188 | else |
195 | return ab3100_mask_and_set_register_interruptible(ab3100_data, | 189 | return abx500_mask_and_set_register_interruptible(dev, 0, |
196 | AB3100_RTC, ~(1 << 2), | 190 | AB3100_RTC, (1 << 2), |
197 | 0); | 191 | 0); |
198 | } | 192 | } |
199 | 193 | ||
@@ -210,10 +204,9 @@ static int __init ab3100_rtc_probe(struct platform_device *pdev) | |||
210 | int err; | 204 | int err; |
211 | u8 regval; | 205 | u8 regval; |
212 | struct rtc_device *rtc; | 206 | struct rtc_device *rtc; |
213 | struct ab3100 *ab3100_data = platform_get_drvdata(pdev); | ||
214 | 207 | ||
215 | /* The first RTC register needs special treatment */ | 208 | /* The first RTC register needs special treatment */ |
216 | err = ab3100_get_register_interruptible(ab3100_data, | 209 | err = abx500_get_register_interruptible(&pdev->dev, 0, |
217 | AB3100_RTC, ®val); | 210 | AB3100_RTC, ®val); |
218 | if (err) { | 211 | if (err) { |
219 | dev_err(&pdev->dev, "unable to read RTC register\n"); | 212 | dev_err(&pdev->dev, "unable to read RTC register\n"); |
@@ -231,7 +224,7 @@ static int __init ab3100_rtc_probe(struct platform_device *pdev) | |||
231 | * This bit remains until RTC power is lost. | 224 | * This bit remains until RTC power is lost. |
232 | */ | 225 | */ |
233 | regval = 1 | RTC_SETTING; | 226 | regval = 1 | RTC_SETTING; |
234 | err = ab3100_set_register_interruptible(ab3100_data, | 227 | err = abx500_set_register_interruptible(&pdev->dev, 0, |
235 | AB3100_RTC, regval); | 228 | AB3100_RTC, regval); |
236 | /* Ignore any error on this write */ | 229 | /* Ignore any error on this write */ |
237 | } | 230 | } |
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c index 61945734ad00..1f0007fd4431 100644 --- a/drivers/rtc/rtc-ds1374.c +++ b/drivers/rtc/rtc-ds1374.c | |||
@@ -403,7 +403,6 @@ out_irq: | |||
403 | free_irq(client->irq, client); | 403 | free_irq(client->irq, client); |
404 | 404 | ||
405 | out_free: | 405 | out_free: |
406 | i2c_set_clientdata(client, NULL); | ||
407 | kfree(ds1374); | 406 | kfree(ds1374); |
408 | return ret; | 407 | return ret; |
409 | } | 408 | } |
@@ -422,7 +421,6 @@ static int __devexit ds1374_remove(struct i2c_client *client) | |||
422 | } | 421 | } |
423 | 422 | ||
424 | rtc_device_unregister(ds1374->rtc); | 423 | rtc_device_unregister(ds1374->rtc); |
425 | i2c_set_clientdata(client, NULL); | ||
426 | kfree(ds1374); | 424 | kfree(ds1374); |
427 | return 0; | 425 | return 0; |
428 | } | 426 | } |
diff --git a/drivers/rtc/rtc-mpc5121.c b/drivers/rtc/rtc-mpc5121.c index f0dbf9cb8f9c..db5d8c416d26 100644 --- a/drivers/rtc/rtc-mpc5121.c +++ b/drivers/rtc/rtc-mpc5121.c | |||
@@ -279,7 +279,7 @@ static int __devinit mpc5121_rtc_probe(struct of_device *op, | |||
279 | if (!rtc) | 279 | if (!rtc) |
280 | return -ENOMEM; | 280 | return -ENOMEM; |
281 | 281 | ||
282 | rtc->regs = of_iomap(op->node, 0); | 282 | rtc->regs = of_iomap(op->dev.of_node, 0); |
283 | if (!rtc->regs) { | 283 | if (!rtc->regs) { |
284 | dev_err(&op->dev, "%s: couldn't map io space\n", __func__); | 284 | dev_err(&op->dev, "%s: couldn't map io space\n", __func__); |
285 | err = -ENOSYS; | 285 | err = -ENOSYS; |
@@ -290,7 +290,7 @@ static int __devinit mpc5121_rtc_probe(struct of_device *op, | |||
290 | 290 | ||
291 | dev_set_drvdata(&op->dev, rtc); | 291 | dev_set_drvdata(&op->dev, rtc); |
292 | 292 | ||
293 | rtc->irq = irq_of_parse_and_map(op->node, 1); | 293 | rtc->irq = irq_of_parse_and_map(op->dev.of_node, 1); |
294 | err = request_irq(rtc->irq, mpc5121_rtc_handler, IRQF_DISABLED, | 294 | err = request_irq(rtc->irq, mpc5121_rtc_handler, IRQF_DISABLED, |
295 | "mpc5121-rtc", &op->dev); | 295 | "mpc5121-rtc", &op->dev); |
296 | if (err) { | 296 | if (err) { |
@@ -299,7 +299,7 @@ static int __devinit mpc5121_rtc_probe(struct of_device *op, | |||
299 | goto out_dispose; | 299 | goto out_dispose; |
300 | } | 300 | } |
301 | 301 | ||
302 | rtc->irq_periodic = irq_of_parse_and_map(op->node, 0); | 302 | rtc->irq_periodic = irq_of_parse_and_map(op->dev.of_node, 0); |
303 | err = request_irq(rtc->irq_periodic, mpc5121_rtc_handler_upd, | 303 | err = request_irq(rtc->irq_periodic, mpc5121_rtc_handler_upd, |
304 | IRQF_DISABLED, "mpc5121-rtc_upd", &op->dev); | 304 | IRQF_DISABLED, "mpc5121-rtc_upd", &op->dev); |
305 | if (err) { | 305 | if (err) { |
@@ -365,9 +365,11 @@ static struct of_device_id mpc5121_rtc_match[] __devinitdata = { | |||
365 | }; | 365 | }; |
366 | 366 | ||
367 | static struct of_platform_driver mpc5121_rtc_driver = { | 367 | static struct of_platform_driver mpc5121_rtc_driver = { |
368 | .owner = THIS_MODULE, | 368 | .driver = { |
369 | .name = "mpc5121-rtc", | 369 | .name = "mpc5121-rtc", |
370 | .match_table = mpc5121_rtc_match, | 370 | .owner = THIS_MODULE, |
371 | .of_match_table = mpc5121_rtc_match, | ||
372 | }, | ||
371 | .probe = mpc5121_rtc_probe, | 373 | .probe = mpc5121_rtc_probe, |
372 | .remove = __devexit_p(mpc5121_rtc_remove), | 374 | .remove = __devexit_p(mpc5121_rtc_remove), |
373 | }; | 375 | }; |
diff --git a/drivers/rtc/rtc-rx8025.c b/drivers/rtc/rtc-rx8025.c index b65c82f792d9..789f62f9b47d 100644 --- a/drivers/rtc/rtc-rx8025.c +++ b/drivers/rtc/rtc-rx8025.c | |||
@@ -632,7 +632,6 @@ errout_reg: | |||
632 | rtc_device_unregister(rx8025->rtc); | 632 | rtc_device_unregister(rx8025->rtc); |
633 | 633 | ||
634 | errout_free: | 634 | errout_free: |
635 | i2c_set_clientdata(client, NULL); | ||
636 | kfree(rx8025); | 635 | kfree(rx8025); |
637 | 636 | ||
638 | errout: | 637 | errout: |
@@ -656,7 +655,6 @@ static int __devexit rx8025_remove(struct i2c_client *client) | |||
656 | 655 | ||
657 | rx8025_sysfs_unregister(&client->dev); | 656 | rx8025_sysfs_unregister(&client->dev); |
658 | rtc_device_unregister(rx8025->rtc); | 657 | rtc_device_unregister(rx8025->rtc); |
659 | i2c_set_clientdata(client, NULL); | ||
660 | kfree(rx8025); | 658 | kfree(rx8025); |
661 | return 0; | 659 | return 0; |
662 | } | 660 | } |
diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c index def4d396d0b0..f789e002c9b0 100644 --- a/drivers/rtc/rtc-s35390a.c +++ b/drivers/rtc/rtc-s35390a.c | |||
@@ -275,7 +275,6 @@ exit_dummy: | |||
275 | if (s35390a->client[i]) | 275 | if (s35390a->client[i]) |
276 | i2c_unregister_device(s35390a->client[i]); | 276 | i2c_unregister_device(s35390a->client[i]); |
277 | kfree(s35390a); | 277 | kfree(s35390a); |
278 | i2c_set_clientdata(client, NULL); | ||
279 | 278 | ||
280 | exit: | 279 | exit: |
281 | return err; | 280 | return err; |
@@ -292,7 +291,6 @@ static int s35390a_remove(struct i2c_client *client) | |||
292 | 291 | ||
293 | rtc_device_unregister(s35390a->rtc); | 292 | rtc_device_unregister(s35390a->rtc); |
294 | kfree(s35390a); | 293 | kfree(s35390a); |
295 | i2c_set_clientdata(client, NULL); | ||
296 | 294 | ||
297 | return 0; | 295 | return 0; |
298 | } | 296 | } |
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index e5972b2c17b7..70b68d35f969 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -495,8 +495,6 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) | |||
495 | pr_debug("s3c2410_rtc: RTCCON=%02x\n", | 495 | pr_debug("s3c2410_rtc: RTCCON=%02x\n", |
496 | readb(s3c_rtc_base + S3C2410_RTCCON)); | 496 | readb(s3c_rtc_base + S3C2410_RTCCON)); |
497 | 497 | ||
498 | s3c_rtc_setfreq(&pdev->dev, 1); | ||
499 | |||
500 | device_init_wakeup(&pdev->dev, 1); | 498 | device_init_wakeup(&pdev->dev, 1); |
501 | 499 | ||
502 | /* register RTC and exit */ | 500 | /* register RTC and exit */ |
@@ -510,14 +508,17 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) | |||
510 | goto err_nortc; | 508 | goto err_nortc; |
511 | } | 509 | } |
512 | 510 | ||
511 | s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data; | ||
512 | |||
513 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) | 513 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) |
514 | rtc->max_user_freq = 32768; | 514 | rtc->max_user_freq = 32768; |
515 | else | 515 | else |
516 | rtc->max_user_freq = 128; | 516 | rtc->max_user_freq = 128; |
517 | 517 | ||
518 | s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data; | ||
519 | |||
520 | platform_set_drvdata(pdev, rtc); | 518 | platform_set_drvdata(pdev, rtc); |
519 | |||
520 | s3c_rtc_setfreq(&pdev->dev, 1); | ||
521 | |||
521 | return 0; | 522 | return 0; |
522 | 523 | ||
523 | err_nortc: | 524 | err_nortc: |