Lines Matching +full:- +full:hours

1 // SPDX-License-Identifier: GPL-2.0-only
2 /* drivers/rtc/rtc-rx4581.c
7 * drivers/rtc/rtc-max6902.c
15 * drivers/rtc/rtc-rx8581.c
22 * Based on: rtc-pcf8563.c (An I2C driver for the Philips PCF8563 RTC)
23 * Copyright 2005-06 Tower Technologies
92 * rtc_time -- month 0-11, hour 0-23, yr = calendar year-epoch.
102 * time and date then re-read the "update flag". If the update flag in rx4581_get_datetime()
109 return -EIO; in rx4581_get_datetime()
120 return -EIO; in rx4581_get_datetime()
129 return -EIO; in rx4581_get_datetime()
136 return -EIO; in rx4581_get_datetime()
150 tm->tm_sec = bcd2bin(date[RX4581_REG_SC] & 0x7F); in rx4581_get_datetime()
151 tm->tm_min = bcd2bin(date[RX4581_REG_MN] & 0x7F); in rx4581_get_datetime()
152 tm->tm_hour = bcd2bin(date[RX4581_REG_HR] & 0x3F); /* rtc hr 0-23 */ in rx4581_get_datetime()
153 tm->tm_wday = ilog2(date[RX4581_REG_DW] & 0x7F); in rx4581_get_datetime()
154 tm->tm_mday = bcd2bin(date[RX4581_REG_DM] & 0x3F); in rx4581_get_datetime()
155 tm->tm_mon = bcd2bin(date[RX4581_REG_MO] & 0x1F) - 1; /* rtc mn 1-12 */ in rx4581_get_datetime()
156 tm->tm_year = bcd2bin(date[RX4581_REG_YR]); in rx4581_get_datetime()
157 if (tm->tm_year < 70) in rx4581_get_datetime()
158 tm->tm_year += 100; /* assume we are in 1970...2069 */ in rx4581_get_datetime()
161 dev_dbg(dev, "%s: tm is secs=%d, mins=%d, hours=%d, " in rx4581_get_datetime()
164 tm->tm_sec, tm->tm_min, tm->tm_hour, in rx4581_get_datetime()
165 tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); in rx4581_get_datetime()
176 dev_dbg(dev, "%s: secs=%d, mins=%d, hours=%d, " in rx4581_set_datetime()
179 tm->tm_sec, tm->tm_min, tm->tm_hour, in rx4581_set_datetime()
180 tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); in rx4581_set_datetime()
183 /* hours, minutes and seconds */ in rx4581_set_datetime()
184 buf[RX4581_REG_SC+1] = bin2bcd(tm->tm_sec); in rx4581_set_datetime()
185 buf[RX4581_REG_MN+1] = bin2bcd(tm->tm_min); in rx4581_set_datetime()
186 buf[RX4581_REG_HR+1] = bin2bcd(tm->tm_hour); in rx4581_set_datetime()
188 buf[RX4581_REG_DM+1] = bin2bcd(tm->tm_mday); in rx4581_set_datetime()
190 /* month, 1 - 12 */ in rx4581_set_datetime()
191 buf[RX4581_REG_MO+1] = bin2bcd(tm->tm_mon + 1); in rx4581_set_datetime()
194 buf[RX4581_REG_YR+1] = bin2bcd(tm->tm_year % 100); in rx4581_set_datetime()
195 buf[RX4581_REG_DW+1] = (0x1 << tm->tm_wday); in rx4581_set_datetime()
201 return -EIO; in rx4581_set_datetime()
208 return -EIO; in rx4581_set_datetime()
215 return -EIO; in rx4581_set_datetime()
222 return -EIO; in rx4581_set_datetime()
229 return -EIO; in rx4581_set_datetime()
236 return -EIO; in rx4581_set_datetime()
243 return -EIO; in rx4581_set_datetime()
260 res = rx4581_get_reg(&spi->dev, RX4581_REG_SC, &tmp); in rx4581_probe()
264 rtc = devm_rtc_device_register(&spi->dev, "rx4581", in rx4581_probe()
281 .name = "rtc-rx4581",
292 MODULE_ALIAS("spi:rtc-rx4581");