rtc-x1205.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. /*
  2. * An i2c driver for the Xicor/Intersil X1205 RTC
  3. * Copyright 2004 Karen Spearel
  4. * Copyright 2005 Alessandro Zummo
  5. *
  6. * please send all reports to:
  7. * Karen Spearel <kas111 at gmail dot com>
  8. * Alessandro Zummo <a.zummo@towertech.it>
  9. *
  10. * based on a lot of other RTC drivers.
  11. *
  12. * Information and datasheet:
  13. * http://www.intersil.com/cda/deviceinfo/0,1477,X1205,00.html
  14. *
  15. * This program is free software; you can redistribute it and/or modify
  16. * it under the terms of the GNU General Public License version 2 as
  17. * published by the Free Software Foundation.
  18. */
  19. #include <linux/i2c.h>
  20. #include <linux/bcd.h>
  21. #include <linux/rtc.h>
  22. #include <linux/delay.h>
  23. #include <linux/module.h>
  24. #define DRV_VERSION "1.0.8"
  25. /* offsets into CCR area */
  26. #define CCR_SEC 0
  27. #define CCR_MIN 1
  28. #define CCR_HOUR 2
  29. #define CCR_MDAY 3
  30. #define CCR_MONTH 4
  31. #define CCR_YEAR 5
  32. #define CCR_WDAY 6
  33. #define CCR_Y2K 7
  34. #define X1205_REG_SR 0x3F /* status register */
  35. #define X1205_REG_Y2K 0x37
  36. #define X1205_REG_DW 0x36
  37. #define X1205_REG_YR 0x35
  38. #define X1205_REG_MO 0x34
  39. #define X1205_REG_DT 0x33
  40. #define X1205_REG_HR 0x32
  41. #define X1205_REG_MN 0x31
  42. #define X1205_REG_SC 0x30
  43. #define X1205_REG_DTR 0x13
  44. #define X1205_REG_ATR 0x12
  45. #define X1205_REG_INT 0x11
  46. #define X1205_REG_0 0x10
  47. #define X1205_REG_Y2K1 0x0F
  48. #define X1205_REG_DWA1 0x0E
  49. #define X1205_REG_YRA1 0x0D
  50. #define X1205_REG_MOA1 0x0C
  51. #define X1205_REG_DTA1 0x0B
  52. #define X1205_REG_HRA1 0x0A
  53. #define X1205_REG_MNA1 0x09
  54. #define X1205_REG_SCA1 0x08
  55. #define X1205_REG_Y2K0 0x07
  56. #define X1205_REG_DWA0 0x06
  57. #define X1205_REG_YRA0 0x05
  58. #define X1205_REG_MOA0 0x04
  59. #define X1205_REG_DTA0 0x03
  60. #define X1205_REG_HRA0 0x02
  61. #define X1205_REG_MNA0 0x01
  62. #define X1205_REG_SCA0 0x00
  63. #define X1205_CCR_BASE 0x30 /* Base address of CCR */
  64. #define X1205_ALM0_BASE 0x00 /* Base address of ALARM0 */
  65. #define X1205_SR_RTCF 0x01 /* Clock failure */
  66. #define X1205_SR_WEL 0x02 /* Write Enable Latch */
  67. #define X1205_SR_RWEL 0x04 /* Register Write Enable */
  68. #define X1205_SR_AL0 0x20 /* Alarm 0 match */
  69. #define X1205_DTR_DTR0 0x01
  70. #define X1205_DTR_DTR1 0x02
  71. #define X1205_DTR_DTR2 0x04
  72. #define X1205_HR_MIL 0x80 /* Set in ccr.hour for 24 hr mode */
  73. #define X1205_INT_AL0E 0x20 /* Alarm 0 enable */
  74. static struct i2c_driver x1205_driver;
  75. /*
  76. * In the routines that deal directly with the x1205 hardware, we use
  77. * rtc_time -- month 0-11, hour 0-23, yr = calendar year-epoch
  78. * Epoch is initialized as 2000. Time is set to UTC.
  79. */
  80. static int x1205_get_datetime(struct i2c_client *client, struct rtc_time *tm,
  81. unsigned char reg_base)
  82. {
  83. unsigned char dt_addr[2] = { 0, reg_base };
  84. unsigned char buf[8];
  85. int i;
  86. struct i2c_msg msgs[] = {
  87. { client->addr, 0, 2, dt_addr }, /* setup read ptr */
  88. { client->addr, I2C_M_RD, 8, buf }, /* read date */
  89. };
  90. /* read date registers */
  91. if (i2c_transfer(client->adapter, &msgs[0], 2) != 2) {
  92. dev_err(&client->dev, "%s: read error\n", __func__);
  93. return -EIO;
  94. }
  95. dev_dbg(&client->dev,
  96. "%s: raw read data - sec=%02x, min=%02x, hr=%02x, "
  97. "mday=%02x, mon=%02x, year=%02x, wday=%02x, y2k=%02x\n",
  98. __func__,
  99. buf[0], buf[1], buf[2], buf[3],
  100. buf[4], buf[5], buf[6], buf[7]);
  101. /* Mask out the enable bits if these are alarm registers */
  102. if (reg_base < X1205_CCR_BASE)
  103. for (i = 0; i <= 4; i++)
  104. buf[i] &= 0x7F;
  105. tm->tm_sec = bcd2bin(buf[CCR_SEC]);
  106. tm->tm_min = bcd2bin(buf[CCR_MIN]);
  107. tm->tm_hour = bcd2bin(buf[CCR_HOUR] & 0x3F); /* hr is 0-23 */
  108. tm->tm_mday = bcd2bin(buf[CCR_MDAY]);
  109. tm->tm_mon = bcd2bin(buf[CCR_MONTH]) - 1; /* mon is 0-11 */
  110. tm->tm_year = bcd2bin(buf[CCR_YEAR])
  111. + (bcd2bin(buf[CCR_Y2K]) * 100) - 1900;
  112. tm->tm_wday = buf[CCR_WDAY];
  113. dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, "
  114. "mday=%d, mon=%d, year=%d, wday=%d\n",
  115. __func__,
  116. tm->tm_sec, tm->tm_min, tm->tm_hour,
  117. tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday);
  118. return 0;
  119. }
  120. static int x1205_get_status(struct i2c_client *client, unsigned char *sr)
  121. {
  122. static unsigned char sr_addr[2] = { 0, X1205_REG_SR };
  123. struct i2c_msg msgs[] = {
  124. { client->addr, 0, 2, sr_addr }, /* setup read ptr */
  125. { client->addr, I2C_M_RD, 1, sr }, /* read status */
  126. };
  127. /* read status register */
  128. if (i2c_transfer(client->adapter, &msgs[0], 2) != 2) {
  129. dev_err(&client->dev, "%s: read error\n", __func__);
  130. return -EIO;
  131. }
  132. return 0;
  133. }
  134. static int x1205_set_datetime(struct i2c_client *client, struct rtc_time *tm,
  135. u8 reg_base, unsigned char alm_enable)
  136. {
  137. int i, xfer;
  138. unsigned char rdata[10] = { 0, reg_base };
  139. unsigned char *buf = rdata + 2;
  140. static const unsigned char wel[3] = { 0, X1205_REG_SR,
  141. X1205_SR_WEL };
  142. static const unsigned char rwel[3] = { 0, X1205_REG_SR,
  143. X1205_SR_WEL | X1205_SR_RWEL };
  144. static const unsigned char diswe[3] = { 0, X1205_REG_SR, 0 };
  145. dev_dbg(&client->dev,
  146. "%s: sec=%d min=%d hour=%d mday=%d mon=%d year=%d wday=%d\n",
  147. __func__, tm->tm_sec, tm->tm_min, tm->tm_hour, tm->tm_mday,
  148. tm->tm_mon, tm->tm_year, tm->tm_wday);
  149. buf[CCR_SEC] = bin2bcd(tm->tm_sec);
  150. buf[CCR_MIN] = bin2bcd(tm->tm_min);
  151. /* set hour and 24hr bit */
  152. buf[CCR_HOUR] = bin2bcd(tm->tm_hour) | X1205_HR_MIL;
  153. buf[CCR_MDAY] = bin2bcd(tm->tm_mday);
  154. /* month, 1 - 12 */
  155. buf[CCR_MONTH] = bin2bcd(tm->tm_mon + 1);
  156. /* year, since the rtc epoch*/
  157. buf[CCR_YEAR] = bin2bcd(tm->tm_year % 100);
  158. buf[CCR_WDAY] = tm->tm_wday & 0x07;
  159. buf[CCR_Y2K] = bin2bcd((tm->tm_year + 1900) / 100);
  160. /* If writing alarm registers, set compare bits on registers 0-4 */
  161. if (reg_base < X1205_CCR_BASE)
  162. for (i = 0; i <= 4; i++)
  163. buf[i] |= 0x80;
  164. /* this sequence is required to unlock the chip */
  165. if ((xfer = i2c_master_send(client, wel, 3)) != 3) {
  166. dev_err(&client->dev, "%s: wel - %d\n", __func__, xfer);
  167. return -EIO;
  168. }
  169. if ((xfer = i2c_master_send(client, rwel, 3)) != 3) {
  170. dev_err(&client->dev, "%s: rwel - %d\n", __func__, xfer);
  171. return -EIO;
  172. }
  173. xfer = i2c_master_send(client, rdata, sizeof(rdata));
  174. if (xfer != sizeof(rdata)) {
  175. dev_err(&client->dev,
  176. "%s: result=%d addr=%02x, data=%02x\n",
  177. __func__,
  178. xfer, rdata[1], rdata[2]);
  179. return -EIO;
  180. }
  181. /* If we wrote to the nonvolatile region, wait 10msec for write cycle*/
  182. if (reg_base < X1205_CCR_BASE) {
  183. unsigned char al0e[3] = { 0, X1205_REG_INT, 0 };
  184. msleep(10);
  185. /* ...and set or clear the AL0E bit in the INT register */
  186. /* Need to set RWEL again as the write has cleared it */
  187. xfer = i2c_master_send(client, rwel, 3);
  188. if (xfer != 3) {
  189. dev_err(&client->dev,
  190. "%s: aloe rwel - %d\n",
  191. __func__,
  192. xfer);
  193. return -EIO;
  194. }
  195. if (alm_enable)
  196. al0e[2] = X1205_INT_AL0E;
  197. xfer = i2c_master_send(client, al0e, 3);
  198. if (xfer != 3) {
  199. dev_err(&client->dev,
  200. "%s: al0e - %d\n",
  201. __func__,
  202. xfer);
  203. return -EIO;
  204. }
  205. /* and wait 10msec again for this write to complete */
  206. msleep(10);
  207. }
  208. /* disable further writes */
  209. if ((xfer = i2c_master_send(client, diswe, 3)) != 3) {
  210. dev_err(&client->dev, "%s: diswe - %d\n", __func__, xfer);
  211. return -EIO;
  212. }
  213. return 0;
  214. }
  215. static int x1205_fix_osc(struct i2c_client *client)
  216. {
  217. int err;
  218. struct rtc_time tm;
  219. memset(&tm, 0, sizeof(tm));
  220. err = x1205_set_datetime(client, &tm, X1205_CCR_BASE, 0);
  221. if (err < 0)
  222. dev_err(&client->dev, "unable to restart the oscillator\n");
  223. return err;
  224. }
  225. static int x1205_get_dtrim(struct i2c_client *client, int *trim)
  226. {
  227. unsigned char dtr;
  228. static unsigned char dtr_addr[2] = { 0, X1205_REG_DTR };
  229. struct i2c_msg msgs[] = {
  230. { client->addr, 0, 2, dtr_addr }, /* setup read ptr */
  231. { client->addr, I2C_M_RD, 1, &dtr }, /* read dtr */
  232. };
  233. /* read dtr register */
  234. if (i2c_transfer(client->adapter, &msgs[0], 2) != 2) {
  235. dev_err(&client->dev, "%s: read error\n", __func__);
  236. return -EIO;
  237. }
  238. dev_dbg(&client->dev, "%s: raw dtr=%x\n", __func__, dtr);
  239. *trim = 0;
  240. if (dtr & X1205_DTR_DTR0)
  241. *trim += 20;
  242. if (dtr & X1205_DTR_DTR1)
  243. *trim += 10;
  244. if (dtr & X1205_DTR_DTR2)
  245. *trim = -*trim;
  246. return 0;
  247. }
  248. static int x1205_get_atrim(struct i2c_client *client, int *trim)
  249. {
  250. s8 atr;
  251. static unsigned char atr_addr[2] = { 0, X1205_REG_ATR };
  252. struct i2c_msg msgs[] = {
  253. { client->addr, 0, 2, atr_addr }, /* setup read ptr */
  254. { client->addr, I2C_M_RD, 1, &atr }, /* read atr */
  255. };
  256. /* read atr register */
  257. if (i2c_transfer(client->adapter, &msgs[0], 2) != 2) {
  258. dev_err(&client->dev, "%s: read error\n", __func__);
  259. return -EIO;
  260. }
  261. dev_dbg(&client->dev, "%s: raw atr=%x\n", __func__, atr);
  262. /* atr is a two's complement value on 6 bits,
  263. * perform sign extension. The formula is
  264. * Catr = (atr * 0.25pF) + 11.00pF.
  265. */
  266. if (atr & 0x20)
  267. atr |= 0xC0;
  268. dev_dbg(&client->dev, "%s: raw atr=%x (%d)\n", __func__, atr, atr);
  269. *trim = (atr * 250) + 11000;
  270. dev_dbg(&client->dev, "%s: real=%d\n", __func__, *trim);
  271. return 0;
  272. }
  273. struct x1205_limit
  274. {
  275. unsigned char reg, mask, min, max;
  276. };
  277. static int x1205_validate_client(struct i2c_client *client)
  278. {
  279. int i, xfer;
  280. /* Probe array. We will read the register at the specified
  281. * address and check if the given bits are zero.
  282. */
  283. static const unsigned char probe_zero_pattern[] = {
  284. /* register, mask */
  285. X1205_REG_SR, 0x18,
  286. X1205_REG_DTR, 0xF8,
  287. X1205_REG_ATR, 0xC0,
  288. X1205_REG_INT, 0x18,
  289. X1205_REG_0, 0xFF,
  290. };
  291. static const struct x1205_limit probe_limits_pattern[] = {
  292. /* register, mask, min, max */
  293. { X1205_REG_Y2K, 0xFF, 19, 20 },
  294. { X1205_REG_DW, 0xFF, 0, 6 },
  295. { X1205_REG_YR, 0xFF, 0, 99 },
  296. { X1205_REG_MO, 0xFF, 0, 12 },
  297. { X1205_REG_DT, 0xFF, 0, 31 },
  298. { X1205_REG_HR, 0x7F, 0, 23 },
  299. { X1205_REG_MN, 0xFF, 0, 59 },
  300. { X1205_REG_SC, 0xFF, 0, 59 },
  301. { X1205_REG_Y2K1, 0xFF, 19, 20 },
  302. { X1205_REG_Y2K0, 0xFF, 19, 20 },
  303. };
  304. /* check that registers have bits a 0 where expected */
  305. for (i = 0; i < ARRAY_SIZE(probe_zero_pattern); i += 2) {
  306. unsigned char buf;
  307. unsigned char addr[2] = { 0, probe_zero_pattern[i] };
  308. struct i2c_msg msgs[2] = {
  309. { client->addr, 0, 2, addr },
  310. { client->addr, I2C_M_RD, 1, &buf },
  311. };
  312. if ((xfer = i2c_transfer(client->adapter, msgs, 2)) != 2) {
  313. dev_err(&client->dev,
  314. "%s: could not read register %x\n",
  315. __func__, probe_zero_pattern[i]);
  316. return -EIO;
  317. }
  318. if ((buf & probe_zero_pattern[i+1]) != 0) {
  319. dev_err(&client->dev,
  320. "%s: register=%02x, zero pattern=%d, value=%x\n",
  321. __func__, probe_zero_pattern[i], i, buf);
  322. return -ENODEV;
  323. }
  324. }
  325. /* check limits (only registers with bcd values) */
  326. for (i = 0; i < ARRAY_SIZE(probe_limits_pattern); i++) {
  327. unsigned char reg, value;
  328. unsigned char addr[2] = { 0, probe_limits_pattern[i].reg };
  329. struct i2c_msg msgs[2] = {
  330. { client->addr, 0, 2, addr },
  331. { client->addr, I2C_M_RD, 1, &reg },
  332. };
  333. if ((xfer = i2c_transfer(client->adapter, msgs, 2)) != 2) {
  334. dev_err(&client->dev,
  335. "%s: could not read register %x\n",
  336. __func__, probe_limits_pattern[i].reg);
  337. return -EIO;
  338. }
  339. value = bcd2bin(reg & probe_limits_pattern[i].mask);
  340. if (value > probe_limits_pattern[i].max ||
  341. value < probe_limits_pattern[i].min) {
  342. dev_dbg(&client->dev,
  343. "%s: register=%x, lim pattern=%d, value=%d\n",
  344. __func__, probe_limits_pattern[i].reg,
  345. i, value);
  346. return -ENODEV;
  347. }
  348. }
  349. return 0;
  350. }
  351. static int x1205_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
  352. {
  353. int err;
  354. unsigned char intreg, status;
  355. static unsigned char int_addr[2] = { 0, X1205_REG_INT };
  356. struct i2c_client *client = to_i2c_client(dev);
  357. struct i2c_msg msgs[] = {
  358. { client->addr, 0, 2, int_addr }, /* setup read ptr */
  359. { client->addr, I2C_M_RD, 1, &intreg }, /* read INT register */
  360. };
  361. /* read interrupt register and status register */
  362. if (i2c_transfer(client->adapter, &msgs[0], 2) != 2) {
  363. dev_err(&client->dev, "%s: read error\n", __func__);
  364. return -EIO;
  365. }
  366. err = x1205_get_status(client, &status);
  367. if (err == 0) {
  368. alrm->pending = (status & X1205_SR_AL0) ? 1 : 0;
  369. alrm->enabled = (intreg & X1205_INT_AL0E) ? 1 : 0;
  370. err = x1205_get_datetime(client, &alrm->time, X1205_ALM0_BASE);
  371. }
  372. return err;
  373. }
  374. static int x1205_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
  375. {
  376. return x1205_set_datetime(to_i2c_client(dev),
  377. &alrm->time, X1205_ALM0_BASE, alrm->enabled);
  378. }
  379. static int x1205_rtc_read_time(struct device *dev, struct rtc_time *tm)
  380. {
  381. return x1205_get_datetime(to_i2c_client(dev),
  382. tm, X1205_CCR_BASE);
  383. }
  384. static int x1205_rtc_set_time(struct device *dev, struct rtc_time *tm)
  385. {
  386. return x1205_set_datetime(to_i2c_client(dev),
  387. tm, X1205_CCR_BASE, 0);
  388. }
  389. static int x1205_rtc_proc(struct device *dev, struct seq_file *seq)
  390. {
  391. int err, dtrim, atrim;
  392. if ((err = x1205_get_dtrim(to_i2c_client(dev), &dtrim)) == 0)
  393. seq_printf(seq, "digital_trim\t: %d ppm\n", dtrim);
  394. if ((err = x1205_get_atrim(to_i2c_client(dev), &atrim)) == 0)
  395. seq_printf(seq, "analog_trim\t: %d.%02d pF\n",
  396. atrim / 1000, atrim % 1000);
  397. return 0;
  398. }
  399. static const struct rtc_class_ops x1205_rtc_ops = {
  400. .proc = x1205_rtc_proc,
  401. .read_time = x1205_rtc_read_time,
  402. .set_time = x1205_rtc_set_time,
  403. .read_alarm = x1205_rtc_read_alarm,
  404. .set_alarm = x1205_rtc_set_alarm,
  405. };
  406. static ssize_t x1205_sysfs_show_atrim(struct device *dev,
  407. struct device_attribute *attr, char *buf)
  408. {
  409. int err, atrim;
  410. err = x1205_get_atrim(to_i2c_client(dev), &atrim);
  411. if (err)
  412. return err;
  413. return sprintf(buf, "%d.%02d pF\n", atrim / 1000, atrim % 1000);
  414. }
  415. static DEVICE_ATTR(atrim, S_IRUGO, x1205_sysfs_show_atrim, NULL);
  416. static ssize_t x1205_sysfs_show_dtrim(struct device *dev,
  417. struct device_attribute *attr, char *buf)
  418. {
  419. int err, dtrim;
  420. err = x1205_get_dtrim(to_i2c_client(dev), &dtrim);
  421. if (err)
  422. return err;
  423. return sprintf(buf, "%d ppm\n", dtrim);
  424. }
  425. static DEVICE_ATTR(dtrim, S_IRUGO, x1205_sysfs_show_dtrim, NULL);
  426. static int x1205_sysfs_register(struct device *dev)
  427. {
  428. int err;
  429. err = device_create_file(dev, &dev_attr_atrim);
  430. if (err)
  431. return err;
  432. err = device_create_file(dev, &dev_attr_dtrim);
  433. if (err)
  434. device_remove_file(dev, &dev_attr_atrim);
  435. return err;
  436. }
  437. static void x1205_sysfs_unregister(struct device *dev)
  438. {
  439. device_remove_file(dev, &dev_attr_atrim);
  440. device_remove_file(dev, &dev_attr_dtrim);
  441. }
  442. static int x1205_probe(struct i2c_client *client,
  443. const struct i2c_device_id *id)
  444. {
  445. int err = 0;
  446. unsigned char sr;
  447. struct rtc_device *rtc;
  448. dev_dbg(&client->dev, "%s\n", __func__);
  449. if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
  450. return -ENODEV;
  451. if (x1205_validate_client(client) < 0)
  452. return -ENODEV;
  453. dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n");
  454. rtc = rtc_device_register(x1205_driver.driver.name, &client->dev,
  455. &x1205_rtc_ops, THIS_MODULE);
  456. if (IS_ERR(rtc))
  457. return PTR_ERR(rtc);
  458. i2c_set_clientdata(client, rtc);
  459. /* Check for power failures and eventually enable the osc */
  460. if ((err = x1205_get_status(client, &sr)) == 0) {
  461. if (sr & X1205_SR_RTCF) {
  462. dev_err(&client->dev,
  463. "power failure detected, "
  464. "please set the clock\n");
  465. udelay(50);
  466. x1205_fix_osc(client);
  467. }
  468. }
  469. else
  470. dev_err(&client->dev, "couldn't read status\n");
  471. err = x1205_sysfs_register(&client->dev);
  472. if (err)
  473. goto exit_devreg;
  474. return 0;
  475. exit_devreg:
  476. rtc_device_unregister(rtc);
  477. return err;
  478. }
  479. static int x1205_remove(struct i2c_client *client)
  480. {
  481. struct rtc_device *rtc = i2c_get_clientdata(client);
  482. rtc_device_unregister(rtc);
  483. x1205_sysfs_unregister(&client->dev);
  484. return 0;
  485. }
  486. static const struct i2c_device_id x1205_id[] = {
  487. { "x1205", 0 },
  488. { }
  489. };
  490. MODULE_DEVICE_TABLE(i2c, x1205_id);
  491. static struct i2c_driver x1205_driver = {
  492. .driver = {
  493. .name = "rtc-x1205",
  494. },
  495. .probe = x1205_probe,
  496. .remove = x1205_remove,
  497. .id_table = x1205_id,
  498. };
  499. module_i2c_driver(x1205_driver);
  500. MODULE_AUTHOR(
  501. "Karen Spearel <kas111 at gmail dot com>, "
  502. "Alessandro Zummo <a.zummo@towertech.it>");
  503. MODULE_DESCRIPTION("Xicor/Intersil X1205 RTC driver");
  504. MODULE_LICENSE("GPL");
  505. MODULE_VERSION(DRV_VERSION);