Source
79
79
}
80
80
81
81
static int max6916_set_time(struct device *dev, struct rtc_time *dt)
82
82
{
83
83
struct spi_device *spi = to_spi_device(dev);
84
84
unsigned char buf[9];
85
85
86
86
if (dt->tm_year < 100 || dt->tm_year > 199) {
87
87
dev_err(&spi->dev, "Year must be between 2000 and 2099. It's %d.\n",
88
88
dt->tm_year + 1900);
89
-
return -EINVAL;
89
+
return -EINVAL;
90
90
}
91
91
92
92
buf[0] = MAX6916_CLOCK_BURST & 0x7F;
93
93
buf[1] = bin2bcd(dt->tm_sec);
94
94
buf[2] = bin2bcd(dt->tm_min);
95
95
buf[3] = (bin2bcd(dt->tm_hour) & 0X3F);
96
96
buf[4] = bin2bcd(dt->tm_mday);
97
97
buf[5] = bin2bcd(dt->tm_mon + 1);
98
98
buf[6] = bin2bcd(dt->tm_wday + 1);
99
99
buf[7] = bin2bcd(dt->tm_year % 100);