2 * Intersil ISL1208 rtc class driver
4 * Copyright 2005,2006 Hebert Valerio Riedel <hvr@gnu.org>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
13 #include <linux/bcd.h>
14 #include <linux/i2c.h>
15 #include <linux/module.h>
16 #include <linux/of_irq.h>
17 #include <linux/rtc.h>
21 #define ISL1208_REG_SC 0x00
22 #define ISL1208_REG_MN 0x01
23 #define ISL1208_REG_HR 0x02
24 #define ISL1208_REG_HR_MIL (1<<7) /* 24h/12h mode */
25 #define ISL1208_REG_HR_PM (1<<5) /* PM/AM bit in 12h mode */
26 #define ISL1208_REG_DT 0x03
27 #define ISL1208_REG_MO 0x04
28 #define ISL1208_REG_YR 0x05
29 #define ISL1208_REG_DW 0x06
30 #define ISL1208_RTC_SECTION_LEN 7
32 /* control/status section */
33 #define ISL1208_REG_SR 0x07
34 #define ISL1208_REG_SR_ARST (1<<7) /* auto reset */
35 #define ISL1208_REG_SR_XTOSCB (1<<6) /* crystal oscillator */
36 #define ISL1208_REG_SR_WRTC (1<<4) /* write rtc */
37 #define ISL1208_REG_SR_EVT (1<<3) /* event */
38 #define ISL1208_REG_SR_ALM (1<<2) /* alarm */
39 #define ISL1208_REG_SR_BAT (1<<1) /* battery */
40 #define ISL1208_REG_SR_RTCF (1<<0) /* rtc fail */
41 #define ISL1208_REG_INT 0x08
42 #define ISL1208_REG_INT_ALME (1<<6) /* alarm enable */
43 #define ISL1208_REG_INT_IM (1<<7) /* interrupt/alarm mode */
44 #define ISL1219_REG_EV 0x09
45 #define ISL1219_REG_EV_EVEN (1<<4) /* event detection enable */
46 #define ISL1219_REG_EV_EVIENB (1<<7) /* event in pull-up disable */
47 #define ISL1208_REG_ATR 0x0a
48 #define ISL1208_REG_DTR 0x0b
51 #define ISL1208_REG_SCA 0x0c
52 #define ISL1208_REG_MNA 0x0d
53 #define ISL1208_REG_HRA 0x0e
54 #define ISL1208_REG_DTA 0x0f
55 #define ISL1208_REG_MOA 0x10
56 #define ISL1208_REG_DWA 0x11
57 #define ISL1208_ALARM_SECTION_LEN 6
60 #define ISL1208_REG_USR1 0x12
61 #define ISL1208_REG_USR2 0x13
62 #define ISL1208_USR_SECTION_LEN 2
65 #define ISL1219_REG_SCT 0x14
66 #define ISL1219_REG_MNT 0x15
67 #define ISL1219_REG_HRT 0x16
68 #define ISL1219_REG_DTT 0x17
69 #define ISL1219_REG_MOT 0x18
70 #define ISL1219_REG_YRT 0x19
71 #define ISL1219_EVT_SECTION_LEN 6
73 static struct i2c_driver isl1208_driver;
75 /* ISL1208 various variants */
84 isl1208_i2c_read_regs(struct i2c_client *client, u8 reg, u8 buf[],
89 WARN_ON(reg > ISL1219_REG_YRT);
90 WARN_ON(reg + len > ISL1219_REG_YRT + 1);
92 ret = i2c_smbus_read_i2c_block_data(client, reg, len, buf);
93 return (ret < 0) ? ret : 0;
98 isl1208_i2c_set_regs(struct i2c_client *client, u8 reg, u8 const buf[],
103 WARN_ON(reg > ISL1219_REG_YRT);
104 WARN_ON(reg + len > ISL1219_REG_YRT + 1);
106 ret = i2c_smbus_write_i2c_block_data(client, reg, len, buf);
107 return (ret < 0) ? ret : 0;
110 /* simple check to see whether we have a isl1208 */
112 isl1208_i2c_validate_client(struct i2c_client *client)
114 u8 regs[ISL1208_RTC_SECTION_LEN] = { 0, };
115 u8 zero_mask[ISL1208_RTC_SECTION_LEN] = {
116 0x80, 0x80, 0x40, 0xc0, 0xe0, 0x00, 0xf8
121 ret = isl1208_i2c_read_regs(client, 0, regs, ISL1208_RTC_SECTION_LEN);
125 for (i = 0; i < ISL1208_RTC_SECTION_LEN; ++i) {
126 if (regs[i] & zero_mask[i]) /* check if bits are cleared */
134 isl1208_i2c_get_sr(struct i2c_client *client)
136 return i2c_smbus_read_byte_data(client, ISL1208_REG_SR);
140 isl1208_i2c_get_atr(struct i2c_client *client)
142 int atr = i2c_smbus_read_byte_data(client, ISL1208_REG_ATR);
146 /* The 6bit value in the ATR register controls the load
147 * capacitance C_load * in steps of 0.25pF
149 * bit (1<<5) of the ATR register is inverted
151 * C_load(ATR=0x20) = 4.50pF
152 * C_load(ATR=0x00) = 12.50pF
153 * C_load(ATR=0x1f) = 20.25pF
157 atr &= 0x3f; /* mask out lsb */
158 atr ^= 1 << 5; /* invert 6th bit */
159 atr += 2 * 9; /* add offset of 4.5pF; unit[atr] = 0.25pF */
165 isl1208_i2c_get_dtr(struct i2c_client *client)
167 int dtr = i2c_smbus_read_byte_data(client, ISL1208_REG_DTR);
171 /* dtr encodes adjustments of {-60,-40,-20,0,20,40,60} ppm */
172 dtr = ((dtr & 0x3) * 20) * (dtr & (1 << 2) ? -1 : 1);
178 isl1208_i2c_get_usr(struct i2c_client *client)
180 u8 buf[ISL1208_USR_SECTION_LEN] = { 0, };
183 ret = isl1208_i2c_read_regs(client, ISL1208_REG_USR1, buf,
184 ISL1208_USR_SECTION_LEN);
188 return (buf[1] << 8) | buf[0];
192 isl1208_i2c_set_usr(struct i2c_client *client, u16 usr)
194 u8 buf[ISL1208_USR_SECTION_LEN];
197 buf[1] = (usr >> 8) & 0xff;
199 return isl1208_i2c_set_regs(client, ISL1208_REG_USR1, buf,
200 ISL1208_USR_SECTION_LEN);
204 isl1208_rtc_toggle_alarm(struct i2c_client *client, int enable)
206 int icr = i2c_smbus_read_byte_data(client, ISL1208_REG_INT);
209 dev_err(&client->dev, "%s: reading INT failed\n", __func__);
214 icr |= ISL1208_REG_INT_ALME | ISL1208_REG_INT_IM;
216 icr &= ~(ISL1208_REG_INT_ALME | ISL1208_REG_INT_IM);
218 icr = i2c_smbus_write_byte_data(client, ISL1208_REG_INT, icr);
220 dev_err(&client->dev, "%s: writing INT failed\n", __func__);
228 isl1208_rtc_proc(struct device *dev, struct seq_file *seq)
230 struct i2c_client *const client = to_i2c_client(dev);
231 int sr, dtr, atr, usr;
233 sr = isl1208_i2c_get_sr(client);
235 dev_err(&client->dev, "%s: reading SR failed\n", __func__);
239 seq_printf(seq, "status_reg\t:%s%s%s%s%s%s (0x%.2x)\n",
240 (sr & ISL1208_REG_SR_RTCF) ? " RTCF" : "",
241 (sr & ISL1208_REG_SR_BAT) ? " BAT" : "",
242 (sr & ISL1208_REG_SR_ALM) ? " ALM" : "",
243 (sr & ISL1208_REG_SR_WRTC) ? " WRTC" : "",
244 (sr & ISL1208_REG_SR_XTOSCB) ? " XTOSCB" : "",
245 (sr & ISL1208_REG_SR_ARST) ? " ARST" : "", sr);
247 seq_printf(seq, "batt_status\t: %s\n",
248 (sr & ISL1208_REG_SR_RTCF) ? "bad" : "okay");
250 dtr = isl1208_i2c_get_dtr(client);
252 seq_printf(seq, "digital_trim\t: %d ppm\n", dtr);
254 atr = isl1208_i2c_get_atr(client);
256 seq_printf(seq, "analog_trim\t: %d.%.2d pF\n",
257 atr >> 2, (atr & 0x3) * 25);
259 usr = isl1208_i2c_get_usr(client);
261 seq_printf(seq, "user_data\t: 0x%.4x\n", usr);
267 isl1208_i2c_read_time(struct i2c_client *client, struct rtc_time *tm)
270 u8 regs[ISL1208_RTC_SECTION_LEN] = { 0, };
272 sr = isl1208_i2c_get_sr(client);
274 dev_err(&client->dev, "%s: reading SR failed\n", __func__);
278 sr = isl1208_i2c_read_regs(client, 0, regs, ISL1208_RTC_SECTION_LEN);
280 dev_err(&client->dev, "%s: reading RTC section failed\n",
285 tm->tm_sec = bcd2bin(regs[ISL1208_REG_SC]);
286 tm->tm_min = bcd2bin(regs[ISL1208_REG_MN]);
288 /* HR field has a more complex interpretation */
290 const u8 _hr = regs[ISL1208_REG_HR];
291 if (_hr & ISL1208_REG_HR_MIL) /* 24h format */
292 tm->tm_hour = bcd2bin(_hr & 0x3f);
295 tm->tm_hour = bcd2bin(_hr & 0x1f);
296 if (_hr & ISL1208_REG_HR_PM) /* PM flag set */
301 tm->tm_mday = bcd2bin(regs[ISL1208_REG_DT]);
302 tm->tm_mon = bcd2bin(regs[ISL1208_REG_MO]) - 1; /* rtc starts at 1 */
303 tm->tm_year = bcd2bin(regs[ISL1208_REG_YR]) + 100;
304 tm->tm_wday = bcd2bin(regs[ISL1208_REG_DW]);
310 isl1208_i2c_read_alarm(struct i2c_client *client, struct rtc_wkalrm *alarm)
312 struct rtc_time *const tm = &alarm->time;
313 u8 regs[ISL1208_ALARM_SECTION_LEN] = { 0, };
314 int icr, yr, sr = isl1208_i2c_get_sr(client);
317 dev_err(&client->dev, "%s: reading SR failed\n", __func__);
321 sr = isl1208_i2c_read_regs(client, ISL1208_REG_SCA, regs,
322 ISL1208_ALARM_SECTION_LEN);
324 dev_err(&client->dev, "%s: reading alarm section failed\n",
329 /* MSB of each alarm register is an enable bit */
330 tm->tm_sec = bcd2bin(regs[ISL1208_REG_SCA - ISL1208_REG_SCA] & 0x7f);
331 tm->tm_min = bcd2bin(regs[ISL1208_REG_MNA - ISL1208_REG_SCA] & 0x7f);
332 tm->tm_hour = bcd2bin(regs[ISL1208_REG_HRA - ISL1208_REG_SCA] & 0x3f);
333 tm->tm_mday = bcd2bin(regs[ISL1208_REG_DTA - ISL1208_REG_SCA] & 0x3f);
335 bcd2bin(regs[ISL1208_REG_MOA - ISL1208_REG_SCA] & 0x1f) - 1;
336 tm->tm_wday = bcd2bin(regs[ISL1208_REG_DWA - ISL1208_REG_SCA] & 0x03);
338 /* The alarm doesn't store the year so get it from the rtc section */
339 yr = i2c_smbus_read_byte_data(client, ISL1208_REG_YR);
341 dev_err(&client->dev, "%s: reading RTC YR failed\n", __func__);
344 tm->tm_year = bcd2bin(yr) + 100;
346 icr = i2c_smbus_read_byte_data(client, ISL1208_REG_INT);
348 dev_err(&client->dev, "%s: reading INT failed\n", __func__);
351 alarm->enabled = !!(icr & ISL1208_REG_INT_ALME);
357 isl1208_i2c_set_alarm(struct i2c_client *client, struct rtc_wkalrm *alarm)
359 struct rtc_time *alarm_tm = &alarm->time;
360 u8 regs[ISL1208_ALARM_SECTION_LEN] = { 0, };
361 const int offs = ISL1208_REG_SCA;
362 struct rtc_time rtc_tm;
365 err = isl1208_i2c_read_time(client, &rtc_tm);
369 /* If the alarm time is before the current time disable the alarm */
370 if (!alarm->enabled || rtc_tm_sub(alarm_tm, &rtc_tm) <= 0)
375 /* Program the alarm and enable it for each setting */
376 regs[ISL1208_REG_SCA - offs] = bin2bcd(alarm_tm->tm_sec) | enable;
377 regs[ISL1208_REG_MNA - offs] = bin2bcd(alarm_tm->tm_min) | enable;
378 regs[ISL1208_REG_HRA - offs] = bin2bcd(alarm_tm->tm_hour) |
379 ISL1208_REG_HR_MIL | enable;
381 regs[ISL1208_REG_DTA - offs] = bin2bcd(alarm_tm->tm_mday) | enable;
382 regs[ISL1208_REG_MOA - offs] = bin2bcd(alarm_tm->tm_mon + 1) | enable;
383 regs[ISL1208_REG_DWA - offs] = bin2bcd(alarm_tm->tm_wday & 7) | enable;
385 /* write ALARM registers */
386 err = isl1208_i2c_set_regs(client, offs, regs,
387 ISL1208_ALARM_SECTION_LEN);
389 dev_err(&client->dev, "%s: writing ALARM section failed\n",
394 err = isl1208_rtc_toggle_alarm(client, enable);
402 isl1208_rtc_read_time(struct device *dev, struct rtc_time *tm)
404 return isl1208_i2c_read_time(to_i2c_client(dev), tm);
408 isl1208_i2c_set_time(struct i2c_client *client, struct rtc_time const *tm)
411 u8 regs[ISL1208_RTC_SECTION_LEN] = { 0, };
413 /* The clock has an 8 bit wide bcd-coded register (they never learn)
414 * for the year. tm_year is an offset from 1900 and we are interested
415 * in the 2000-2099 range, so any value less than 100 is invalid.
417 if (tm->tm_year < 100)
420 regs[ISL1208_REG_SC] = bin2bcd(tm->tm_sec);
421 regs[ISL1208_REG_MN] = bin2bcd(tm->tm_min);
422 regs[ISL1208_REG_HR] = bin2bcd(tm->tm_hour) | ISL1208_REG_HR_MIL;
424 regs[ISL1208_REG_DT] = bin2bcd(tm->tm_mday);
425 regs[ISL1208_REG_MO] = bin2bcd(tm->tm_mon + 1);
426 regs[ISL1208_REG_YR] = bin2bcd(tm->tm_year - 100);
428 regs[ISL1208_REG_DW] = bin2bcd(tm->tm_wday & 7);
430 sr = isl1208_i2c_get_sr(client);
432 dev_err(&client->dev, "%s: reading SR failed\n", __func__);
437 sr = i2c_smbus_write_byte_data(client, ISL1208_REG_SR,
438 sr | ISL1208_REG_SR_WRTC);
440 dev_err(&client->dev, "%s: writing SR failed\n", __func__);
444 /* write RTC registers */
445 sr = isl1208_i2c_set_regs(client, 0, regs, ISL1208_RTC_SECTION_LEN);
447 dev_err(&client->dev, "%s: writing RTC section failed\n",
452 /* clear WRTC again */
453 sr = isl1208_i2c_get_sr(client);
455 dev_err(&client->dev, "%s: reading SR failed\n", __func__);
458 sr = i2c_smbus_write_byte_data(client, ISL1208_REG_SR,
459 sr & ~ISL1208_REG_SR_WRTC);
461 dev_err(&client->dev, "%s: writing SR failed\n", __func__);
470 isl1208_rtc_set_time(struct device *dev, struct rtc_time *tm)
472 return isl1208_i2c_set_time(to_i2c_client(dev), tm);
476 isl1208_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
478 return isl1208_i2c_read_alarm(to_i2c_client(dev), alarm);
482 isl1208_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
484 return isl1208_i2c_set_alarm(to_i2c_client(dev), alarm);
487 static ssize_t timestamp0_store(struct device *dev,
488 struct device_attribute *attr,
489 const char *buf, size_t count)
491 struct i2c_client *client = to_i2c_client(dev->parent);
494 sr = isl1208_i2c_get_sr(client);
496 dev_err(dev, "%s: reading SR failed\n", __func__);
500 sr &= ~ISL1208_REG_SR_EVT;
502 sr = i2c_smbus_write_byte_data(client, ISL1208_REG_SR, sr);
504 dev_err(dev, "%s: writing SR failed\n",
510 static ssize_t timestamp0_show(struct device *dev,
511 struct device_attribute *attr, char *buf)
513 struct i2c_client *client = to_i2c_client(dev->parent);
514 u8 regs[ISL1219_EVT_SECTION_LEN] = { 0, };
518 sr = isl1208_i2c_get_sr(client);
520 dev_err(dev, "%s: reading SR failed\n", __func__);
524 if (!(sr & ISL1208_REG_SR_EVT))
527 sr = isl1208_i2c_read_regs(client, ISL1219_REG_SCT, regs,
528 ISL1219_EVT_SECTION_LEN);
530 dev_err(dev, "%s: reading event section failed\n",
535 /* MSB of each alarm register is an enable bit */
536 tm.tm_sec = bcd2bin(regs[ISL1219_REG_SCT - ISL1219_REG_SCT] & 0x7f);
537 tm.tm_min = bcd2bin(regs[ISL1219_REG_MNT - ISL1219_REG_SCT] & 0x7f);
538 tm.tm_hour = bcd2bin(regs[ISL1219_REG_HRT - ISL1219_REG_SCT] & 0x3f);
539 tm.tm_mday = bcd2bin(regs[ISL1219_REG_DTT - ISL1219_REG_SCT] & 0x3f);
541 bcd2bin(regs[ISL1219_REG_MOT - ISL1219_REG_SCT] & 0x1f) - 1;
542 tm.tm_year = bcd2bin(regs[ISL1219_REG_YRT - ISL1219_REG_SCT]) + 100;
544 sr = rtc_valid_tm(&tm);
548 return sprintf(buf, "%llu\n",
549 (unsigned long long)rtc_tm_to_time64(&tm));
552 static DEVICE_ATTR_RW(timestamp0);
555 isl1208_rtc_interrupt(int irq, void *data)
557 unsigned long timeout = jiffies + msecs_to_jiffies(1000);
558 struct i2c_client *client = data;
559 struct rtc_device *rtc = i2c_get_clientdata(client);
560 int handled = 0, sr, err;
563 * I2C reads get NAK'ed if we read straight away after an interrupt?
564 * Using a mdelay/msleep didn't seem to help either, so we work around
565 * this by continually trying to read the register for a short time.
568 sr = isl1208_i2c_get_sr(client);
572 if (time_after(jiffies, timeout)) {
573 dev_err(&client->dev, "%s: reading SR failed\n",
579 if (sr & ISL1208_REG_SR_ALM) {
580 dev_dbg(&client->dev, "alarm!\n");
582 rtc_update_irq(rtc, 1, RTC_IRQF | RTC_AF);
584 /* Clear the alarm */
585 sr &= ~ISL1208_REG_SR_ALM;
586 sr = i2c_smbus_write_byte_data(client, ISL1208_REG_SR, sr);
588 dev_err(&client->dev, "%s: writing SR failed\n",
593 /* Disable the alarm */
594 err = isl1208_rtc_toggle_alarm(client, 0);
599 if (sr & ISL1208_REG_SR_EVT) {
600 sysfs_notify(&rtc->dev.kobj, NULL,
601 dev_attr_timestamp0.attr.name);
602 dev_warn(&client->dev, "event detected");
606 return handled ? IRQ_HANDLED : IRQ_NONE;
609 static const struct rtc_class_ops isl1208_rtc_ops = {
610 .proc = isl1208_rtc_proc,
611 .read_time = isl1208_rtc_read_time,
612 .set_time = isl1208_rtc_set_time,
613 .read_alarm = isl1208_rtc_read_alarm,
614 .set_alarm = isl1208_rtc_set_alarm,
617 /* sysfs interface */
620 isl1208_sysfs_show_atrim(struct device *dev,
621 struct device_attribute *attr, char *buf)
623 int atr = isl1208_i2c_get_atr(to_i2c_client(dev->parent));
627 return sprintf(buf, "%d.%.2d pF\n", atr >> 2, (atr & 0x3) * 25);
630 static DEVICE_ATTR(atrim, S_IRUGO, isl1208_sysfs_show_atrim, NULL);
633 isl1208_sysfs_show_dtrim(struct device *dev,
634 struct device_attribute *attr, char *buf)
636 int dtr = isl1208_i2c_get_dtr(to_i2c_client(dev->parent));
640 return sprintf(buf, "%d ppm\n", dtr);
643 static DEVICE_ATTR(dtrim, S_IRUGO, isl1208_sysfs_show_dtrim, NULL);
646 isl1208_sysfs_show_usr(struct device *dev,
647 struct device_attribute *attr, char *buf)
649 int usr = isl1208_i2c_get_usr(to_i2c_client(dev->parent));
653 return sprintf(buf, "0x%.4x\n", usr);
657 isl1208_sysfs_store_usr(struct device *dev,
658 struct device_attribute *attr,
659 const char *buf, size_t count)
663 if (buf[0] == '0' && (buf[1] == 'x' || buf[1] == 'X')) {
664 if (sscanf(buf, "%x", &usr) != 1)
667 if (sscanf(buf, "%d", &usr) != 1)
671 if (usr < 0 || usr > 0xffff)
674 if (isl1208_i2c_set_usr(to_i2c_client(dev->parent), usr))
680 static DEVICE_ATTR(usr, S_IRUGO | S_IWUSR, isl1208_sysfs_show_usr,
681 isl1208_sysfs_store_usr);
683 static struct attribute *isl1208_rtc_attrs[] = {
684 &dev_attr_atrim.attr,
685 &dev_attr_dtrim.attr,
690 static const struct attribute_group isl1208_rtc_sysfs_files = {
691 .attrs = isl1208_rtc_attrs,
694 static struct attribute *isl1219_rtc_attrs[] = {
695 &dev_attr_timestamp0.attr,
699 static const struct attribute_group isl1219_rtc_sysfs_files = {
700 .attrs = isl1219_rtc_attrs,
703 static int isl1208_setup_irq(struct i2c_client *client, int irq)
705 int rc = devm_request_threaded_irq(&client->dev, irq, NULL,
706 isl1208_rtc_interrupt,
707 IRQF_SHARED | IRQF_ONESHOT,
708 isl1208_driver.driver.name,
711 device_init_wakeup(&client->dev, 1);
712 enable_irq_wake(irq);
714 dev_err(&client->dev,
715 "Unable to request irq %d, no alarm support\n",
722 isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id)
725 struct rtc_device *rtc;
728 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
731 if (isl1208_i2c_validate_client(client) < 0)
734 rtc = devm_rtc_allocate_device(&client->dev);
738 rtc->ops = &isl1208_rtc_ops;
740 i2c_set_clientdata(client, rtc);
742 rc = isl1208_i2c_get_sr(client);
744 dev_err(&client->dev, "reading status failed\n");
748 if (rc & ISL1208_REG_SR_RTCF)
749 dev_warn(&client->dev, "rtc power failure detected, "
750 "please set clock.\n");
752 if (id->driver_data == TYPE_ISL1219) {
753 struct device_node *np = client->dev.of_node;
756 rc = i2c_smbus_read_byte_data(client, ISL1219_REG_EV);
758 dev_err(&client->dev, "failed to read EV reg\n");
761 rc |= ISL1219_REG_EV_EVEN;
762 if (!of_property_read_u32(np, "isil,ev-evienb", &evienb)) {
764 rc |= ISL1219_REG_EV_EVIENB;
766 rc &= ~ISL1219_REG_EV_EVIENB;
768 rc = i2c_smbus_write_byte_data(client, ISL1219_REG_EV, rc);
770 dev_err(&client->dev, "could not enable tamper detection\n");
773 rc = rtc_add_group(rtc, &isl1219_rtc_sysfs_files);
776 evdet_irq = of_irq_get_byname(np, "evdet");
779 rc = rtc_add_group(rtc, &isl1208_rtc_sysfs_files);
784 rc = isl1208_setup_irq(client, client->irq);
788 if (evdet_irq > 0 && evdet_irq != client->irq)
789 rc = isl1208_setup_irq(client, evdet_irq);
793 return rtc_register_device(rtc);
796 static const struct i2c_device_id isl1208_id[] = {
797 { "isl1208", TYPE_ISL1208 },
798 { "isl1218", TYPE_ISL1218 },
799 { "isl1219", TYPE_ISL1219 },
802 MODULE_DEVICE_TABLE(i2c, isl1208_id);
804 static const struct of_device_id isl1208_of_match[] = {
805 { .compatible = "isil,isl1208" },
806 { .compatible = "isil,isl1218" },
807 { .compatible = "isil,isl1219" },
810 MODULE_DEVICE_TABLE(of, isl1208_of_match);
812 static struct i2c_driver isl1208_driver = {
814 .name = "rtc-isl1208",
815 .of_match_table = of_match_ptr(isl1208_of_match),
817 .probe = isl1208_probe,
818 .id_table = isl1208_id,
821 module_i2c_driver(isl1208_driver);
823 MODULE_AUTHOR("Herbert Valerio Riedel <hvr@gnu.org>");
824 MODULE_DESCRIPTION("Intersil ISL1208 RTC driver");
825 MODULE_LICENSE("GPL");