17 #include <linux/module.h>
19 #include <linux/rtc.h>
22 #include <linux/slab.h>
24 #define DS1390_REG_100THS 0x00
25 #define DS1390_REG_SECONDS 0x01
26 #define DS1390_REG_MINUTES 0x02
27 #define DS1390_REG_HOURS 0x03
28 #define DS1390_REG_DAY 0x04
29 #define DS1390_REG_DATE 0x05
30 #define DS1390_REG_MONTH_CENT 0x06
31 #define DS1390_REG_YEAR 0x07
33 #define DS1390_REG_ALARM_100THS 0x08
34 #define DS1390_REG_ALARM_SECONDS 0x09
35 #define DS1390_REG_ALARM_MINUTES 0x0A
36 #define DS1390_REG_ALARM_HOURS 0x0B
37 #define DS1390_REG_ALARM_DAY_DATE 0x0C
39 #define DS1390_REG_CONTROL 0x0D
40 #define DS1390_REG_STATUS 0x0E
41 #define DS1390_REG_TRICKLE 0x0F
99 static int ds1390_set_time(
struct device *dev,
struct rtc_time *dt)
112 ((dt->
tm_year > 99) ? 0x80 : 0x00);
120 .read_time = ds1390_read_time,
121 .set_time = ds1390_set_time,
136 dev_err(&spi->
dev,
"unable to allocate device memory\n");
143 dev_err(&spi->
dev,
"unable to read device\n");
150 if (IS_ERR(chip->
rtc)) {
151 dev_err(&spi->
dev,
"unable to register device\n");
152 res = PTR_ERR(chip->
rtc);
161 struct ds1390 *chip = spi_get_drvdata(spi);
171 .name =
"rtc-ds1390",
174 .probe = ds1390_probe,