14 #include <linux/i2c.h>
15 #include <linux/rtc.h>
17 #include <linux/module.h>
20 #define EM3027_REG_ON_OFF_CTRL 0x00
21 #define EM3027_REG_IRQ_CTRL 0x01
22 #define EM3027_REG_IRQ_FLAGS 0x02
23 #define EM3027_REG_STATUS 0x03
24 #define EM3027_REG_RST_CTRL 0x04
26 #define EM3027_REG_WATCH_SEC 0x08
27 #define EM3027_REG_WATCH_MIN 0x09
28 #define EM3027_REG_WATCH_HOUR 0x0a
29 #define EM3027_REG_WATCH_DATE 0x0b
30 #define EM3027_REG_WATCH_DAY 0x0c
31 #define EM3027_REG_WATCH_MON 0x0d
32 #define EM3027_REG_WATCH_YEAR 0x0e
34 #define EM3027_REG_ALARM_SEC 0x10
35 #define EM3027_REG_ALARM_MIN 0x11
36 #define EM3027_REG_ALARM_HOUR 0x12
37 #define EM3027_REG_ALARM_DATE 0x13
38 #define EM3027_REG_ALARM_DAY 0x14
39 #define EM3027_REG_ALARM_MON 0x15
40 #define EM3027_REG_ALARM_YEAR 0x16
67 dev_err(&client->
dev,
"%s: read error\n", __func__);
82 static int em3027_set_time(
struct device *dev,
struct rtc_time *tm)
104 dev_err(&client->
dev,
"%s: write error\n", __func__);
112 .read_time = em3027_get_time,
113 .set_time = em3027_set_time,
116 static int em3027_probe(
struct i2c_client *client,
129 i2c_set_clientdata(client, rtc);
134 static int em3027_remove(
struct i2c_client *client)
136 struct rtc_device *rtc = i2c_get_clientdata(client);
151 .name =
"rtc-em3027",
153 .probe = &em3027_probe,
154 .remove = &em3027_remove,
155 .id_table = em3027_id,