Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Real time clock driver for DA9052 |
| 3 | * |
| 4 | * Copyright(c) 2012 Dialog Semiconductor Ltd. |
| 5 | * |
| 6 | * Author: Dajun Dajun Chen <dajun.chen@diasemi.com> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | */ |
| 14 | |
| 15 | #include <linux/module.h> |
| 16 | #include <linux/platform_device.h> |
| 17 | #include <linux/rtc.h> |
Sachin Kamat | 11f54d0 | 2013-07-03 15:07:48 -0700 | [diff] [blame] | 18 | #include <linux/err.h> |
Adam Ward | 03cc162 | 2015-04-16 12:45:26 -0700 | [diff] [blame] | 19 | #include <linux/delay.h> |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 20 | |
| 21 | #include <linux/mfd/da9052/da9052.h> |
| 22 | #include <linux/mfd/da9052/reg.h> |
| 23 | |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 24 | #define rtc_err(rtc, fmt, ...) \ |
| 25 | dev_err(rtc->da9052->dev, "%s: " fmt, __func__, ##__VA_ARGS__) |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 26 | |
Adam Ward | 03cc162 | 2015-04-16 12:45:26 -0700 | [diff] [blame] | 27 | #define DA9052_GET_TIME_RETRIES 5 |
| 28 | |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 29 | struct da9052_rtc { |
| 30 | struct rtc_device *rtc; |
| 31 | struct da9052 *da9052; |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 32 | }; |
| 33 | |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 34 | static int da9052_rtc_enable_alarm(struct da9052_rtc *rtc, bool enable) |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 35 | { |
| 36 | int ret; |
| 37 | if (enable) { |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 38 | ret = da9052_reg_update(rtc->da9052, DA9052_ALARM_Y_REG, |
| 39 | DA9052_ALARM_Y_ALARM_ON|DA9052_ALARM_Y_TICK_ON, |
| 40 | DA9052_ALARM_Y_ALARM_ON); |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 41 | if (ret != 0) |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 42 | rtc_err(rtc, "Failed to enable ALM: %d\n", ret); |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 43 | } else { |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 44 | ret = da9052_reg_update(rtc->da9052, DA9052_ALARM_Y_REG, |
| 45 | DA9052_ALARM_Y_ALARM_ON|DA9052_ALARM_Y_TICK_ON, 0); |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 46 | if (ret != 0) |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 47 | rtc_err(rtc, "Write error: %d\n", ret); |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 48 | } |
| 49 | return ret; |
| 50 | } |
| 51 | |
| 52 | static irqreturn_t da9052_rtc_irq(int irq, void *data) |
| 53 | { |
| 54 | struct da9052_rtc *rtc = data; |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 55 | |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 56 | rtc_update_irq(rtc->rtc, 1, RTC_IRQF | RTC_AF); |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 57 | |
| 58 | return IRQ_HANDLED; |
| 59 | } |
| 60 | |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 61 | static int da9052_read_alarm(struct da9052_rtc *rtc, struct rtc_time *rtc_tm) |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 62 | { |
| 63 | int ret; |
Adam Ward | 03cc162 | 2015-04-16 12:45:26 -0700 | [diff] [blame] | 64 | uint8_t v[2][5]; |
| 65 | int idx = 1; |
| 66 | int timeout = DA9052_GET_TIME_RETRIES; |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 67 | |
Adam Ward | 03cc162 | 2015-04-16 12:45:26 -0700 | [diff] [blame] | 68 | ret = da9052_group_read(rtc->da9052, DA9052_ALARM_MI_REG, 5, &v[0][0]); |
| 69 | if (ret) { |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 70 | rtc_err(rtc, "Failed to group read ALM: %d\n", ret); |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 71 | return ret; |
| 72 | } |
| 73 | |
Adam Ward | 03cc162 | 2015-04-16 12:45:26 -0700 | [diff] [blame] | 74 | do { |
| 75 | ret = da9052_group_read(rtc->da9052, |
| 76 | DA9052_ALARM_MI_REG, 5, &v[idx][0]); |
| 77 | if (ret) { |
| 78 | rtc_err(rtc, "Failed to group read ALM: %d\n", ret); |
| 79 | return ret; |
| 80 | } |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 81 | |
Adam Ward | 03cc162 | 2015-04-16 12:45:26 -0700 | [diff] [blame] | 82 | if (memcmp(&v[0][0], &v[1][0], 5) == 0) { |
| 83 | rtc_tm->tm_year = (v[0][4] & DA9052_RTC_YEAR) + 100; |
| 84 | rtc_tm->tm_mon = (v[0][3] & DA9052_RTC_MONTH) - 1; |
| 85 | rtc_tm->tm_mday = v[0][2] & DA9052_RTC_DAY; |
| 86 | rtc_tm->tm_hour = v[0][1] & DA9052_RTC_HOUR; |
| 87 | rtc_tm->tm_min = v[0][0] & DA9052_RTC_MIN; |
Uwe Kleine-König | d2c9270 | 2016-07-11 10:05:27 +0200 | [diff] [blame] | 88 | rtc_tm->tm_sec = 0; |
Adam Ward | 03cc162 | 2015-04-16 12:45:26 -0700 | [diff] [blame] | 89 | |
| 90 | ret = rtc_valid_tm(rtc_tm); |
| 91 | return ret; |
| 92 | } |
| 93 | |
| 94 | idx = (1-idx); |
| 95 | msleep(20); |
| 96 | |
| 97 | } while (timeout--); |
| 98 | |
| 99 | rtc_err(rtc, "Timed out reading alarm time\n"); |
| 100 | |
| 101 | return -EIO; |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 102 | } |
| 103 | |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 104 | static int da9052_set_alarm(struct da9052_rtc *rtc, struct rtc_time *rtc_tm) |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 105 | { |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 106 | struct da9052 *da9052 = rtc->da9052; |
| 107 | unsigned long alm_time; |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 108 | int ret; |
| 109 | uint8_t v[3]; |
| 110 | |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 111 | ret = rtc_tm_to_time(rtc_tm, &alm_time); |
| 112 | if (ret != 0) |
| 113 | return ret; |
| 114 | |
| 115 | if (rtc_tm->tm_sec > 0) { |
| 116 | alm_time += 60 - rtc_tm->tm_sec; |
| 117 | rtc_time_to_tm(alm_time, rtc_tm); |
| 118 | } |
| 119 | BUG_ON(rtc_tm->tm_sec); /* it will cause repeated irqs if not zero */ |
| 120 | |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 121 | rtc_tm->tm_year -= 100; |
| 122 | rtc_tm->tm_mon += 1; |
| 123 | |
| 124 | ret = da9052_reg_update(da9052, DA9052_ALARM_MI_REG, |
| 125 | DA9052_RTC_MIN, rtc_tm->tm_min); |
| 126 | if (ret != 0) { |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 127 | rtc_err(rtc, "Failed to write ALRM MIN: %d\n", ret); |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 128 | return ret; |
| 129 | } |
| 130 | |
| 131 | v[0] = rtc_tm->tm_hour; |
| 132 | v[1] = rtc_tm->tm_mday; |
| 133 | v[2] = rtc_tm->tm_mon; |
| 134 | |
| 135 | ret = da9052_group_write(da9052, DA9052_ALARM_H_REG, 3, v); |
| 136 | if (ret < 0) |
| 137 | return ret; |
| 138 | |
| 139 | ret = da9052_reg_update(da9052, DA9052_ALARM_Y_REG, |
| 140 | DA9052_RTC_YEAR, rtc_tm->tm_year); |
| 141 | if (ret != 0) |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 142 | rtc_err(rtc, "Failed to write ALRM YEAR: %d\n", ret); |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 143 | |
| 144 | return ret; |
| 145 | } |
| 146 | |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 147 | static int da9052_rtc_get_alarm_status(struct da9052_rtc *rtc) |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 148 | { |
| 149 | int ret; |
| 150 | |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 151 | ret = da9052_reg_read(rtc->da9052, DA9052_ALARM_Y_REG); |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 152 | if (ret < 0) { |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 153 | rtc_err(rtc, "Failed to read ALM: %d\n", ret); |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 154 | return ret; |
| 155 | } |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 156 | |
| 157 | return !!(ret&DA9052_ALARM_Y_ALARM_ON); |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 158 | } |
| 159 | |
| 160 | static int da9052_rtc_read_time(struct device *dev, struct rtc_time *rtc_tm) |
| 161 | { |
| 162 | struct da9052_rtc *rtc = dev_get_drvdata(dev); |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 163 | int ret; |
Adam Ward | 03cc162 | 2015-04-16 12:45:26 -0700 | [diff] [blame] | 164 | uint8_t v[2][6]; |
| 165 | int idx = 1; |
| 166 | int timeout = DA9052_GET_TIME_RETRIES; |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 167 | |
Adam Ward | 03cc162 | 2015-04-16 12:45:26 -0700 | [diff] [blame] | 168 | ret = da9052_group_read(rtc->da9052, DA9052_COUNT_S_REG, 6, &v[0][0]); |
| 169 | if (ret) { |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 170 | rtc_err(rtc, "Failed to read RTC time : %d\n", ret); |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 171 | return ret; |
| 172 | } |
| 173 | |
Adam Ward | 03cc162 | 2015-04-16 12:45:26 -0700 | [diff] [blame] | 174 | do { |
| 175 | ret = da9052_group_read(rtc->da9052, |
| 176 | DA9052_COUNT_S_REG, 6, &v[idx][0]); |
| 177 | if (ret) { |
| 178 | rtc_err(rtc, "Failed to read RTC time : %d\n", ret); |
| 179 | return ret; |
| 180 | } |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 181 | |
Adam Ward | 03cc162 | 2015-04-16 12:45:26 -0700 | [diff] [blame] | 182 | if (memcmp(&v[0][0], &v[1][0], 6) == 0) { |
| 183 | rtc_tm->tm_year = (v[0][5] & DA9052_RTC_YEAR) + 100; |
| 184 | rtc_tm->tm_mon = (v[0][4] & DA9052_RTC_MONTH) - 1; |
| 185 | rtc_tm->tm_mday = v[0][3] & DA9052_RTC_DAY; |
| 186 | rtc_tm->tm_hour = v[0][2] & DA9052_RTC_HOUR; |
| 187 | rtc_tm->tm_min = v[0][1] & DA9052_RTC_MIN; |
| 188 | rtc_tm->tm_sec = v[0][0] & DA9052_RTC_SEC; |
| 189 | |
| 190 | ret = rtc_valid_tm(rtc_tm); |
| 191 | return ret; |
| 192 | } |
| 193 | |
| 194 | idx = (1-idx); |
| 195 | msleep(20); |
| 196 | |
| 197 | } while (timeout--); |
| 198 | |
| 199 | rtc_err(rtc, "Timed out reading time\n"); |
| 200 | |
| 201 | return -EIO; |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 202 | } |
| 203 | |
| 204 | static int da9052_rtc_set_time(struct device *dev, struct rtc_time *tm) |
| 205 | { |
| 206 | struct da9052_rtc *rtc; |
| 207 | uint8_t v[6]; |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 208 | int ret; |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 209 | |
Adam Ward | ae824c4 | 2015-04-16 12:45:29 -0700 | [diff] [blame] | 210 | /* DA9052 only has 6 bits for year - to represent 2000-2063 */ |
| 211 | if ((tm->tm_year < 100) || (tm->tm_year > 163)) |
| 212 | return -EINVAL; |
| 213 | |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 214 | rtc = dev_get_drvdata(dev); |
| 215 | |
| 216 | v[0] = tm->tm_sec; |
| 217 | v[1] = tm->tm_min; |
| 218 | v[2] = tm->tm_hour; |
| 219 | v[3] = tm->tm_mday; |
| 220 | v[4] = tm->tm_mon + 1; |
| 221 | v[5] = tm->tm_year - 100; |
| 222 | |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 223 | ret = da9052_group_write(rtc->da9052, DA9052_COUNT_S_REG, 6, v); |
| 224 | if (ret < 0) |
| 225 | rtc_err(rtc, "failed to set RTC time: %d\n", ret); |
| 226 | return ret; |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 227 | } |
| 228 | |
| 229 | static int da9052_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) |
| 230 | { |
| 231 | int ret; |
| 232 | struct rtc_time *tm = &alrm->time; |
| 233 | struct da9052_rtc *rtc = dev_get_drvdata(dev); |
| 234 | |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 235 | ret = da9052_read_alarm(rtc, tm); |
| 236 | if (ret < 0) { |
| 237 | rtc_err(rtc, "failed to read RTC alarm: %d\n", ret); |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 238 | return ret; |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 239 | } |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 240 | |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 241 | alrm->enabled = da9052_rtc_get_alarm_status(rtc); |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 242 | return 0; |
| 243 | } |
| 244 | |
| 245 | static int da9052_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) |
| 246 | { |
| 247 | int ret; |
| 248 | struct rtc_time *tm = &alrm->time; |
| 249 | struct da9052_rtc *rtc = dev_get_drvdata(dev); |
| 250 | |
Adam Ward | ae824c4 | 2015-04-16 12:45:29 -0700 | [diff] [blame] | 251 | /* DA9052 only has 6 bits for year - to represent 2000-2063 */ |
| 252 | if ((tm->tm_year < 100) || (tm->tm_year > 163)) |
| 253 | return -EINVAL; |
| 254 | |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 255 | ret = da9052_rtc_enable_alarm(rtc, 0); |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 256 | if (ret < 0) |
| 257 | return ret; |
| 258 | |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 259 | ret = da9052_set_alarm(rtc, tm); |
| 260 | if (ret < 0) |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 261 | return ret; |
| 262 | |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 263 | ret = da9052_rtc_enable_alarm(rtc, 1); |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 264 | return ret; |
| 265 | } |
| 266 | |
| 267 | static int da9052_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) |
| 268 | { |
| 269 | struct da9052_rtc *rtc = dev_get_drvdata(dev); |
| 270 | |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 271 | return da9052_rtc_enable_alarm(rtc, enabled); |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 272 | } |
| 273 | |
| 274 | static const struct rtc_class_ops da9052_rtc_ops = { |
| 275 | .read_time = da9052_rtc_read_time, |
| 276 | .set_time = da9052_rtc_set_time, |
| 277 | .read_alarm = da9052_rtc_read_alarm, |
| 278 | .set_alarm = da9052_rtc_set_alarm, |
| 279 | .alarm_irq_enable = da9052_rtc_alarm_irq_enable, |
| 280 | }; |
| 281 | |
Greg Kroah-Hartman | 5a167f4 | 2012-12-21 13:09:38 -0800 | [diff] [blame] | 282 | static int da9052_rtc_probe(struct platform_device *pdev) |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 283 | { |
| 284 | struct da9052_rtc *rtc; |
| 285 | int ret; |
| 286 | |
| 287 | rtc = devm_kzalloc(&pdev->dev, sizeof(struct da9052_rtc), GFP_KERNEL); |
| 288 | if (!rtc) |
| 289 | return -ENOMEM; |
| 290 | |
| 291 | rtc->da9052 = dev_get_drvdata(pdev->dev.parent); |
| 292 | platform_set_drvdata(pdev, rtc); |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 293 | |
| 294 | ret = da9052_reg_write(rtc->da9052, DA9052_BBAT_CONT_REG, 0xFE); |
| 295 | if (ret < 0) { |
| 296 | rtc_err(rtc, |
| 297 | "Failed to setup RTC battery charging: %d\n", ret); |
| 298 | return ret; |
| 299 | } |
| 300 | |
| 301 | ret = da9052_reg_update(rtc->da9052, DA9052_ALARM_Y_REG, |
| 302 | DA9052_ALARM_Y_TICK_ON, 0); |
| 303 | if (ret != 0) |
| 304 | rtc_err(rtc, "Failed to disable TICKS: %d\n", ret); |
| 305 | |
Steve Twiss | 6406d96 | 2016-04-14 12:04:54 +0100 | [diff] [blame] | 306 | device_init_wakeup(&pdev->dev, true); |
| 307 | rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, |
| 308 | &da9052_rtc_ops, THIS_MODULE); |
| 309 | |
| 310 | if (IS_ERR(rtc->rtc)) |
| 311 | return PTR_ERR(rtc->rtc); |
| 312 | |
Anthony Olech | c2c0eed | 2014-04-03 14:49:52 -0700 | [diff] [blame] | 313 | ret = da9052_request_irq(rtc->da9052, DA9052_IRQ_ALARM, "ALM", |
Ashish Jangam | 925e8ea | 2013-03-22 15:04:44 -0700 | [diff] [blame] | 314 | da9052_rtc_irq, rtc); |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 315 | if (ret != 0) { |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 316 | rtc_err(rtc, "irq registration failed: %d\n", ret); |
Devendra Naga | 007def0 | 2012-07-30 14:41:54 -0700 | [diff] [blame] | 317 | return ret; |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 318 | } |
| 319 | |
Steve Twiss | 6406d96 | 2016-04-14 12:04:54 +0100 | [diff] [blame] | 320 | return 0; |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 321 | } |
| 322 | |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 323 | static struct platform_driver da9052_rtc_driver = { |
| 324 | .probe = da9052_rtc_probe, |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 325 | .driver = { |
| 326 | .name = "da9052-rtc", |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 327 | }, |
| 328 | }; |
| 329 | |
| 330 | module_platform_driver(da9052_rtc_driver); |
| 331 | |
Anthony Olech | 7c994c0 | 2014-06-06 14:35:54 -0700 | [diff] [blame] | 332 | MODULE_AUTHOR("Anthony Olech <Anthony.Olech@diasemi.com>"); |
Ashish Jangam | fef931f | 2012-03-23 15:02:36 -0700 | [diff] [blame] | 333 | MODULE_DESCRIPTION("RTC driver for Dialog DA9052 PMIC"); |
| 334 | MODULE_LICENSE("GPL"); |
| 335 | MODULE_ALIAS("platform:da9052-rtc"); |