11 #include <linux/module.h>
12 #include <linux/i2c.h>
13 #include <linux/rtc.h>
15 #include <linux/errno.h>
18 #define BQ32K_SECONDS 0x00
19 #define BQ32K_SECONDS_MASK 0x7F
20 #define BQ32K_STOP 0x80
22 #define BQ32K_MINUTES 0x01
23 #define BQ32K_MINUTES_MASK 0x7F
26 #define BQ32K_HOURS_MASK 0x3F
27 #define BQ32K_CENT 0x40
28 #define BQ32K_CENT_EN 0x80
71 memcpy(&buffer[1], data, len);
84 error = bq32k_read(dev, &
regs, 0,
sizeof(
regs));
100 static int bq32k_rtc_set_time(
struct device *dev,
struct rtc_time *tm)
117 return bq32k_write(dev, &
regs, 0,
sizeof(
regs));
121 .read_time = bq32k_rtc_read_time,
122 .set_time = bq32k_rtc_set_time,
125 static int bq32k_probe(
struct i2c_client *client,
139 dev_warn(dev,
"Oscillator was halted. Restarting...\n");
149 dev_warn(dev,
"Oscillator Failure. Check RTC battery.\n");
161 i2c_set_clientdata(client, rtc);
168 struct rtc_device *rtc = i2c_get_clientdata(client);
185 .probe = bq32k_probe,
187 .id_table = bq32k_id,