Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Real Time Clock driver for Freescale MC13XXX PMIC |
| 3 | * |
| 4 | * (C) 2009 Sascha Hauer, Pengutronix |
| 5 | * (C) 2009 Uwe Kleine-Koenig, Pengutronix |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/mfd/mc13xxx.h> |
| 13 | #include <linux/platform_device.h> |
| 14 | #include <linux/kernel.h> |
| 15 | #include <linux/module.h> |
| 16 | #include <linux/slab.h> |
| 17 | #include <linux/rtc.h> |
| 18 | |
| 19 | #define DRIVER_NAME "mc13xxx-rtc" |
| 20 | |
| 21 | #define MC13XXX_RTCTOD 20 |
| 22 | #define MC13XXX_RTCTODA 21 |
| 23 | #define MC13XXX_RTCDAY 22 |
| 24 | #define MC13XXX_RTCDAYA 23 |
| 25 | |
Alexander Shiyan | 6a2b342 | 2014-04-03 14:50:01 -0700 | [diff] [blame^] | 26 | #define SEC_PER_DAY (24 * 60 * 60) |
| 27 | |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 28 | struct mc13xxx_rtc { |
| 29 | struct rtc_device *rtc; |
| 30 | struct mc13xxx *mc13xxx; |
| 31 | int valid; |
| 32 | }; |
| 33 | |
| 34 | static int mc13xxx_rtc_irq_enable_unlocked(struct device *dev, |
| 35 | unsigned int enabled, int irq) |
| 36 | { |
| 37 | struct mc13xxx_rtc *priv = dev_get_drvdata(dev); |
| 38 | int (*func)(struct mc13xxx *mc13xxx, int irq); |
| 39 | |
| 40 | if (!priv->valid) |
| 41 | return -ENODATA; |
| 42 | |
| 43 | func = enabled ? mc13xxx_irq_unmask : mc13xxx_irq_mask; |
| 44 | return func(priv->mc13xxx, irq); |
| 45 | } |
| 46 | |
Alexander Shiyan | 2fb004a | 2014-04-03 14:49:58 -0700 | [diff] [blame] | 47 | static int mc13xxx_rtc_alarm_irq_enable(struct device *dev, |
| 48 | unsigned int enabled) |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 49 | { |
| 50 | struct mc13xxx_rtc *priv = dev_get_drvdata(dev); |
| 51 | int ret; |
| 52 | |
| 53 | mc13xxx_lock(priv->mc13xxx); |
| 54 | |
Alexander Shiyan | 2fb004a | 2014-04-03 14:49:58 -0700 | [diff] [blame] | 55 | ret = mc13xxx_rtc_irq_enable_unlocked(dev, enabled, MC13XXX_IRQ_TODA); |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 56 | |
| 57 | mc13xxx_unlock(priv->mc13xxx); |
| 58 | |
| 59 | return ret; |
| 60 | } |
| 61 | |
| 62 | static int mc13xxx_rtc_read_time(struct device *dev, struct rtc_time *tm) |
| 63 | { |
| 64 | struct mc13xxx_rtc *priv = dev_get_drvdata(dev); |
| 65 | unsigned int seconds, days1, days2; |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 66 | |
Alexander Shiyan | 12de362 | 2014-04-03 14:50:00 -0700 | [diff] [blame] | 67 | if (!priv->valid) |
| 68 | return -ENODATA; |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 69 | |
Alexander Shiyan | 6a2b342 | 2014-04-03 14:50:01 -0700 | [diff] [blame^] | 70 | do { |
| 71 | int ret; |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 72 | |
Alexander Shiyan | 6a2b342 | 2014-04-03 14:50:01 -0700 | [diff] [blame^] | 73 | ret = mc13xxx_reg_read(priv->mc13xxx, MC13XXX_RTCDAY, &days1); |
| 74 | if (ret) |
| 75 | return ret; |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 76 | |
Alexander Shiyan | 6a2b342 | 2014-04-03 14:50:01 -0700 | [diff] [blame^] | 77 | ret = mc13xxx_reg_read(priv->mc13xxx, MC13XXX_RTCTOD, &seconds); |
| 78 | if (ret) |
| 79 | return ret; |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 80 | |
Alexander Shiyan | 6a2b342 | 2014-04-03 14:50:01 -0700 | [diff] [blame^] | 81 | ret = mc13xxx_reg_read(priv->mc13xxx, MC13XXX_RTCDAY, &days2); |
| 82 | if (ret) |
| 83 | return ret; |
| 84 | } while (days1 != days2); |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 85 | |
Alexander Shiyan | 6a2b342 | 2014-04-03 14:50:01 -0700 | [diff] [blame^] | 86 | rtc_time_to_tm(days1 * SEC_PER_DAY + seconds, tm); |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 87 | |
| 88 | return rtc_valid_tm(tm); |
| 89 | } |
| 90 | |
| 91 | static int mc13xxx_rtc_set_mmss(struct device *dev, unsigned long secs) |
| 92 | { |
| 93 | struct mc13xxx_rtc *priv = dev_get_drvdata(dev); |
| 94 | unsigned int seconds, days; |
| 95 | unsigned int alarmseconds; |
| 96 | int ret; |
| 97 | |
Alexander Shiyan | 6a2b342 | 2014-04-03 14:50:01 -0700 | [diff] [blame^] | 98 | seconds = secs % SEC_PER_DAY; |
| 99 | days = secs / SEC_PER_DAY; |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 100 | |
| 101 | mc13xxx_lock(priv->mc13xxx); |
| 102 | |
| 103 | /* |
| 104 | * temporarily invalidate alarm to prevent triggering it when the day is |
| 105 | * already updated while the time isn't yet. |
| 106 | */ |
| 107 | ret = mc13xxx_reg_read(priv->mc13xxx, MC13XXX_RTCTODA, &alarmseconds); |
| 108 | if (unlikely(ret)) |
| 109 | goto out; |
| 110 | |
Alexander Shiyan | 6a2b342 | 2014-04-03 14:50:01 -0700 | [diff] [blame^] | 111 | if (alarmseconds < SEC_PER_DAY) { |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 112 | ret = mc13xxx_reg_write(priv->mc13xxx, |
| 113 | MC13XXX_RTCTODA, 0x1ffff); |
| 114 | if (unlikely(ret)) |
| 115 | goto out; |
| 116 | } |
| 117 | |
| 118 | /* |
| 119 | * write seconds=0 to prevent a day switch between writing days |
| 120 | * and seconds below |
| 121 | */ |
| 122 | ret = mc13xxx_reg_write(priv->mc13xxx, MC13XXX_RTCTOD, 0); |
| 123 | if (unlikely(ret)) |
| 124 | goto out; |
| 125 | |
| 126 | ret = mc13xxx_reg_write(priv->mc13xxx, MC13XXX_RTCDAY, days); |
| 127 | if (unlikely(ret)) |
| 128 | goto out; |
| 129 | |
| 130 | ret = mc13xxx_reg_write(priv->mc13xxx, MC13XXX_RTCTOD, seconds); |
| 131 | if (unlikely(ret)) |
| 132 | goto out; |
| 133 | |
| 134 | /* restore alarm */ |
Alexander Shiyan | 6a2b342 | 2014-04-03 14:50:01 -0700 | [diff] [blame^] | 135 | if (alarmseconds < SEC_PER_DAY) { |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 136 | ret = mc13xxx_reg_write(priv->mc13xxx, |
| 137 | MC13XXX_RTCTODA, alarmseconds); |
| 138 | if (unlikely(ret)) |
| 139 | goto out; |
| 140 | } |
| 141 | |
Alexander Shiyan | 12de362 | 2014-04-03 14:50:00 -0700 | [diff] [blame] | 142 | if (!priv->valid) { |
| 143 | ret = mc13xxx_irq_ack(priv->mc13xxx, MC13XXX_IRQ_RTCRST); |
| 144 | if (unlikely(ret)) |
| 145 | goto out; |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 146 | |
Alexander Shiyan | 12de362 | 2014-04-03 14:50:00 -0700 | [diff] [blame] | 147 | ret = mc13xxx_irq_unmask(priv->mc13xxx, MC13XXX_IRQ_RTCRST); |
| 148 | } |
| 149 | |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 150 | out: |
| 151 | priv->valid = !ret; |
| 152 | |
| 153 | mc13xxx_unlock(priv->mc13xxx); |
| 154 | |
| 155 | return ret; |
| 156 | } |
| 157 | |
| 158 | static int mc13xxx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) |
| 159 | { |
| 160 | struct mc13xxx_rtc *priv = dev_get_drvdata(dev); |
| 161 | unsigned seconds, days; |
| 162 | unsigned long s1970; |
| 163 | int enabled, pending; |
| 164 | int ret; |
| 165 | |
| 166 | mc13xxx_lock(priv->mc13xxx); |
| 167 | |
| 168 | ret = mc13xxx_reg_read(priv->mc13xxx, MC13XXX_RTCTODA, &seconds); |
| 169 | if (unlikely(ret)) |
| 170 | goto out; |
Alexander Shiyan | 6a2b342 | 2014-04-03 14:50:01 -0700 | [diff] [blame^] | 171 | if (seconds >= SEC_PER_DAY) { |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 172 | ret = -ENODATA; |
| 173 | goto out; |
| 174 | } |
| 175 | |
| 176 | ret = mc13xxx_reg_read(priv->mc13xxx, MC13XXX_RTCDAY, &days); |
| 177 | if (unlikely(ret)) |
| 178 | goto out; |
| 179 | |
| 180 | ret = mc13xxx_irq_status(priv->mc13xxx, MC13XXX_IRQ_TODA, |
| 181 | &enabled, &pending); |
| 182 | |
| 183 | out: |
| 184 | mc13xxx_unlock(priv->mc13xxx); |
| 185 | |
| 186 | if (ret) |
| 187 | return ret; |
| 188 | |
| 189 | alarm->enabled = enabled; |
| 190 | alarm->pending = pending; |
| 191 | |
Alexander Shiyan | 6a2b342 | 2014-04-03 14:50:01 -0700 | [diff] [blame^] | 192 | s1970 = days * SEC_PER_DAY + seconds; |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 193 | |
| 194 | rtc_time_to_tm(s1970, &alarm->time); |
| 195 | dev_dbg(dev, "%s: %lu\n", __func__, s1970); |
| 196 | |
| 197 | return 0; |
| 198 | } |
| 199 | |
| 200 | static int mc13xxx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) |
| 201 | { |
| 202 | struct mc13xxx_rtc *priv = dev_get_drvdata(dev); |
| 203 | unsigned long s1970; |
| 204 | unsigned seconds, days; |
| 205 | int ret; |
| 206 | |
| 207 | mc13xxx_lock(priv->mc13xxx); |
| 208 | |
| 209 | /* disable alarm to prevent false triggering */ |
| 210 | ret = mc13xxx_reg_write(priv->mc13xxx, MC13XXX_RTCTODA, 0x1ffff); |
| 211 | if (unlikely(ret)) |
| 212 | goto out; |
| 213 | |
| 214 | ret = mc13xxx_irq_ack(priv->mc13xxx, MC13XXX_IRQ_TODA); |
| 215 | if (unlikely(ret)) |
| 216 | goto out; |
| 217 | |
| 218 | ret = rtc_tm_to_time(&alarm->time, &s1970); |
| 219 | if (unlikely(ret)) |
| 220 | goto out; |
| 221 | |
| 222 | dev_dbg(dev, "%s: o%2.s %lu\n", __func__, alarm->enabled ? "n" : "ff", |
| 223 | s1970); |
| 224 | |
| 225 | ret = mc13xxx_rtc_irq_enable_unlocked(dev, alarm->enabled, |
| 226 | MC13XXX_IRQ_TODA); |
| 227 | if (unlikely(ret)) |
| 228 | goto out; |
| 229 | |
Alexander Shiyan | 6a2b342 | 2014-04-03 14:50:01 -0700 | [diff] [blame^] | 230 | seconds = s1970 % SEC_PER_DAY; |
| 231 | days = s1970 / SEC_PER_DAY; |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 232 | |
| 233 | ret = mc13xxx_reg_write(priv->mc13xxx, MC13XXX_RTCDAYA, days); |
| 234 | if (unlikely(ret)) |
| 235 | goto out; |
| 236 | |
| 237 | ret = mc13xxx_reg_write(priv->mc13xxx, MC13XXX_RTCTODA, seconds); |
| 238 | |
| 239 | out: |
| 240 | mc13xxx_unlock(priv->mc13xxx); |
| 241 | |
| 242 | return ret; |
| 243 | } |
| 244 | |
| 245 | static irqreturn_t mc13xxx_rtc_alarm_handler(int irq, void *dev) |
| 246 | { |
| 247 | struct mc13xxx_rtc *priv = dev; |
| 248 | struct mc13xxx *mc13xxx = priv->mc13xxx; |
| 249 | |
| 250 | dev_dbg(&priv->rtc->dev, "Alarm\n"); |
| 251 | |
| 252 | rtc_update_irq(priv->rtc, 1, RTC_IRQF | RTC_AF); |
| 253 | |
| 254 | mc13xxx_irq_ack(mc13xxx, irq); |
| 255 | |
| 256 | return IRQ_HANDLED; |
| 257 | } |
| 258 | |
| 259 | static irqreturn_t mc13xxx_rtc_update_handler(int irq, void *dev) |
| 260 | { |
| 261 | struct mc13xxx_rtc *priv = dev; |
| 262 | struct mc13xxx *mc13xxx = priv->mc13xxx; |
| 263 | |
| 264 | dev_dbg(&priv->rtc->dev, "1HZ\n"); |
| 265 | |
| 266 | rtc_update_irq(priv->rtc, 1, RTC_IRQF | RTC_UF); |
| 267 | |
| 268 | mc13xxx_irq_ack(mc13xxx, irq); |
| 269 | |
| 270 | return IRQ_HANDLED; |
| 271 | } |
| 272 | |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 273 | static const struct rtc_class_ops mc13xxx_rtc_ops = { |
| 274 | .read_time = mc13xxx_rtc_read_time, |
| 275 | .set_mmss = mc13xxx_rtc_set_mmss, |
| 276 | .read_alarm = mc13xxx_rtc_read_alarm, |
| 277 | .set_alarm = mc13xxx_rtc_set_alarm, |
| 278 | .alarm_irq_enable = mc13xxx_rtc_alarm_irq_enable, |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 279 | }; |
| 280 | |
| 281 | static irqreturn_t mc13xxx_rtc_reset_handler(int irq, void *dev) |
| 282 | { |
| 283 | struct mc13xxx_rtc *priv = dev; |
| 284 | struct mc13xxx *mc13xxx = priv->mc13xxx; |
| 285 | |
Alexander Shiyan | 12de362 | 2014-04-03 14:50:00 -0700 | [diff] [blame] | 286 | dev_warn(&priv->rtc->dev, "Contents of the RTC are no longer valid\n"); |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 287 | priv->valid = 0; |
| 288 | |
| 289 | mc13xxx_irq_mask(mc13xxx, irq); |
| 290 | |
| 291 | return IRQ_HANDLED; |
| 292 | } |
| 293 | |
Uwe Kleine-König | db5cf8d | 2011-11-02 13:37:56 -0700 | [diff] [blame] | 294 | static int __init mc13xxx_rtc_probe(struct platform_device *pdev) |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 295 | { |
| 296 | int ret; |
| 297 | struct mc13xxx_rtc *priv; |
| 298 | struct mc13xxx *mc13xxx; |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 299 | |
Jingoo Han | a379fd2 | 2013-04-29 16:20:44 -0700 | [diff] [blame] | 300 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 301 | if (!priv) |
| 302 | return -ENOMEM; |
| 303 | |
| 304 | mc13xxx = dev_get_drvdata(pdev->dev.parent); |
| 305 | priv->mc13xxx = mc13xxx; |
Alexander Shiyan | 12de362 | 2014-04-03 14:50:00 -0700 | [diff] [blame] | 306 | priv->valid = 1; |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 307 | |
| 308 | platform_set_drvdata(pdev, priv); |
| 309 | |
Alexander Shiyan | 589e501 | 2014-04-03 14:49:57 -0700 | [diff] [blame] | 310 | priv->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, |
| 311 | &mc13xxx_rtc_ops, THIS_MODULE); |
| 312 | if (IS_ERR(priv->rtc)) |
| 313 | return PTR_ERR(priv->rtc); |
| 314 | |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 315 | mc13xxx_lock(mc13xxx); |
| 316 | |
Alexander Shiyan | 12de362 | 2014-04-03 14:50:00 -0700 | [diff] [blame] | 317 | mc13xxx_irq_ack(mc13xxx, MC13XXX_IRQ_RTCRST); |
| 318 | |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 319 | ret = mc13xxx_irq_request(mc13xxx, MC13XXX_IRQ_RTCRST, |
| 320 | mc13xxx_rtc_reset_handler, DRIVER_NAME, priv); |
| 321 | if (ret) |
| 322 | goto err_reset_irq_request; |
| 323 | |
Alexander Shiyan | fb1bd9a | 2014-04-03 14:49:59 -0700 | [diff] [blame] | 324 | ret = mc13xxx_irq_request(mc13xxx, MC13XXX_IRQ_1HZ, |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 325 | mc13xxx_rtc_update_handler, DRIVER_NAME, priv); |
| 326 | if (ret) |
Alexander Shiyan | 589e501 | 2014-04-03 14:49:57 -0700 | [diff] [blame] | 327 | goto err_reset_irq_status; |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 328 | |
| 329 | ret = mc13xxx_irq_request_nounmask(mc13xxx, MC13XXX_IRQ_TODA, |
| 330 | mc13xxx_rtc_alarm_handler, DRIVER_NAME, priv); |
Alexander Shiyan | 589e501 | 2014-04-03 14:49:57 -0700 | [diff] [blame] | 331 | if (!ret) |
| 332 | goto err_reset_irq_request; |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 333 | |
Alexander Shiyan | 589e501 | 2014-04-03 14:49:57 -0700 | [diff] [blame] | 334 | mc13xxx_irq_free(mc13xxx, MC13XXX_IRQ_1HZ, priv); |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 335 | |
| 336 | err_reset_irq_status: |
Alexander Shiyan | 589e501 | 2014-04-03 14:49:57 -0700 | [diff] [blame] | 337 | mc13xxx_irq_free(mc13xxx, MC13XXX_IRQ_RTCRST, priv); |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 338 | |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 339 | err_reset_irq_request: |
Alexander Shiyan | 589e501 | 2014-04-03 14:49:57 -0700 | [diff] [blame] | 340 | mc13xxx_unlock(mc13xxx); |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 341 | |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 342 | return ret; |
| 343 | } |
| 344 | |
Alexander Shiyan | 77bf2ea | 2014-04-03 14:49:56 -0700 | [diff] [blame] | 345 | static int mc13xxx_rtc_remove(struct platform_device *pdev) |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 346 | { |
| 347 | struct mc13xxx_rtc *priv = platform_get_drvdata(pdev); |
| 348 | |
| 349 | mc13xxx_lock(priv->mc13xxx); |
| 350 | |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 351 | mc13xxx_irq_free(priv->mc13xxx, MC13XXX_IRQ_TODA, priv); |
| 352 | mc13xxx_irq_free(priv->mc13xxx, MC13XXX_IRQ_1HZ, priv); |
| 353 | mc13xxx_irq_free(priv->mc13xxx, MC13XXX_IRQ_RTCRST, priv); |
| 354 | |
| 355 | mc13xxx_unlock(priv->mc13xxx); |
| 356 | |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 357 | return 0; |
| 358 | } |
| 359 | |
Axel Lin | a46481d | 2012-01-10 15:10:52 -0800 | [diff] [blame] | 360 | static const struct platform_device_id mc13xxx_rtc_idtable[] = { |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 361 | { |
| 362 | .name = "mc13783-rtc", |
| 363 | }, { |
| 364 | .name = "mc13892-rtc", |
Uwe Kleine-König | 19a1ac5 | 2012-07-30 14:41:52 -0700 | [diff] [blame] | 365 | }, { |
| 366 | .name = "mc34708-rtc", |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 367 | }, |
Uwe Kleine-König | 0f636fc | 2012-07-30 14:41:50 -0700 | [diff] [blame] | 368 | { /* sentinel */ } |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 369 | }; |
Uwe Kleine-König | 0f636fc | 2012-07-30 14:41:50 -0700 | [diff] [blame] | 370 | MODULE_DEVICE_TABLE(platform, mc13xxx_rtc_idtable); |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 371 | |
| 372 | static struct platform_driver mc13xxx_rtc_driver = { |
| 373 | .id_table = mc13xxx_rtc_idtable, |
Alexander Shiyan | 77bf2ea | 2014-04-03 14:49:56 -0700 | [diff] [blame] | 374 | .remove = mc13xxx_rtc_remove, |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 375 | .driver = { |
| 376 | .name = DRIVER_NAME, |
| 377 | .owner = THIS_MODULE, |
| 378 | }, |
| 379 | }; |
| 380 | |
Jingoo Han | 09fb7ad | 2013-04-29 16:18:43 -0700 | [diff] [blame] | 381 | module_platform_driver_probe(mc13xxx_rtc_driver, &mc13xxx_rtc_probe); |
Uwe Kleine-König | 1c97872 | 2010-10-28 12:30:53 +0200 | [diff] [blame] | 382 | |
| 383 | MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>"); |
| 384 | MODULE_DESCRIPTION("RTC driver for Freescale MC13XXX PMIC"); |
| 385 | MODULE_LICENSE("GPL v2"); |