Lines Matching +full:start +full:- +full:year

1 // SPDX-License-Identifier: GPL-2.0-only
55 .addr = client->addr, in isl12022_read_regs()
61 .addr = client->addr, in isl12022_read_regs()
71 ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); in isl12022_read_regs()
73 dev_err(&client->dev, "%s: read error, ret=%d\n", in isl12022_read_regs()
75 return -EIO; in isl12022_read_regs()
90 dev_err(&client->dev, in isl12022_write_reg()
93 return -EIO; in isl12022_write_reg()
102 * rtc_time -- month 0-11, hour 0-23, yr = calendar year-epoch.
115 dev_warn(&client->dev, in isl12022_rtc_read_time()
121 dev_dbg(&client->dev, in isl12022_rtc_read_time()
123 "mday=%02x, mon=%02x, year=%02x, wday=%02x, " in isl12022_rtc_read_time()
136 tm->tm_sec = bcd2bin(buf[ISL12022_REG_SC] & 0x7F); in isl12022_rtc_read_time()
137 tm->tm_min = bcd2bin(buf[ISL12022_REG_MN] & 0x7F); in isl12022_rtc_read_time()
138 tm->tm_hour = bcd2bin(buf[ISL12022_REG_HR] & 0x3F); in isl12022_rtc_read_time()
139 tm->tm_mday = bcd2bin(buf[ISL12022_REG_DT] & 0x3F); in isl12022_rtc_read_time()
140 tm->tm_wday = buf[ISL12022_REG_DW] & 0x07; in isl12022_rtc_read_time()
141 tm->tm_mon = bcd2bin(buf[ISL12022_REG_MO] & 0x1F) - 1; in isl12022_rtc_read_time()
142 tm->tm_year = bcd2bin(buf[ISL12022_REG_YR]) + 100; in isl12022_rtc_read_time()
144 dev_dbg(&client->dev, "%s: secs=%d, mins=%d, hours=%d, " in isl12022_rtc_read_time()
145 "mday=%d, mon=%d, year=%d, wday=%d\n", in isl12022_rtc_read_time()
147 tm->tm_sec, tm->tm_min, tm->tm_hour, in isl12022_rtc_read_time()
148 tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); in isl12022_rtc_read_time()
161 dev_dbg(&client->dev, "%s: secs=%d, mins=%d, hours=%d, " in isl12022_rtc_set_time()
162 "mday=%d, mon=%d, year=%d, wday=%d\n", in isl12022_rtc_set_time()
164 tm->tm_sec, tm->tm_min, tm->tm_hour, in isl12022_rtc_set_time()
165 tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); in isl12022_rtc_set_time()
167 if (!isl12022->write_enabled) { in isl12022_rtc_set_time()
176 dev_info(&client->dev, in isl12022_rtc_set_time()
186 /* Write to any RTC register to start RTC, we use the in isl12022_rtc_set_time()
201 isl12022->write_enabled = true; in isl12022_rtc_set_time()
205 buf[ISL12022_REG_SC] = bin2bcd(tm->tm_sec); in isl12022_rtc_set_time()
206 buf[ISL12022_REG_MN] = bin2bcd(tm->tm_min); in isl12022_rtc_set_time()
207 buf[ISL12022_REG_HR] = bin2bcd(tm->tm_hour) | ISL12022_HR_MIL; in isl12022_rtc_set_time()
209 buf[ISL12022_REG_DT] = bin2bcd(tm->tm_mday); in isl12022_rtc_set_time()
211 /* month, 1 - 12 */ in isl12022_rtc_set_time()
212 buf[ISL12022_REG_MO] = bin2bcd(tm->tm_mon + 1); in isl12022_rtc_set_time()
214 /* year and century */ in isl12022_rtc_set_time()
215 buf[ISL12022_REG_YR] = bin2bcd(tm->tm_year % 100); in isl12022_rtc_set_time()
217 buf[ISL12022_REG_DW] = tm->tm_wday & 0x07; in isl12022_rtc_set_time()
224 return -EIO; in isl12022_rtc_set_time()
240 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) in isl12022_probe()
241 return -ENODEV; in isl12022_probe()
243 isl12022 = devm_kzalloc(&client->dev, sizeof(struct isl12022), in isl12022_probe()
246 return -ENOMEM; in isl12022_probe()
250 isl12022->rtc = devm_rtc_device_register(&client->dev, in isl12022_probe()
253 return PTR_ERR_OR_ZERO(isl12022->rtc); in isl12022_probe()
273 .name = "rtc-isl12022",