Lines Matching +full:trickle +full:- +full:charge

1 // SPDX-License-Identifier: GPL-2.0-only
6 * Copyright (C) 2003 - 2007 Paul Mundt
25 #define RTC_ADDR_TCR 0x08 /* Address of trickle charge register */
58 *bp++ = bin2bcd(time->tm_sec); in ds1302_rtc_set_time()
59 *bp++ = bin2bcd(time->tm_min); in ds1302_rtc_set_time()
60 *bp++ = bin2bcd(time->tm_hour); in ds1302_rtc_set_time()
61 *bp++ = bin2bcd(time->tm_mday); in ds1302_rtc_set_time()
62 *bp++ = bin2bcd(time->tm_mon + 1); in ds1302_rtc_set_time()
63 *bp++ = time->tm_wday + 1; in ds1302_rtc_set_time()
64 *bp++ = bin2bcd(time->tm_year % 100); in ds1302_rtc_set_time()
67 /* use write-then-read since dma from stack is nonportable */ in ds1302_rtc_set_time()
76 u8 buf[RTC_CLCK_LEN - 1]; in ds1302_rtc_get_time()
79 /* Use write-then-read to get all the date/time registers in ds1302_rtc_get_time()
88 time->tm_sec = bcd2bin(buf[RTC_ADDR_SEC]); in ds1302_rtc_get_time()
89 time->tm_min = bcd2bin(buf[RTC_ADDR_MIN]); in ds1302_rtc_get_time()
90 time->tm_hour = bcd2bin(buf[RTC_ADDR_HOUR]); in ds1302_rtc_get_time()
91 time->tm_wday = buf[RTC_ADDR_DAY] - 1; in ds1302_rtc_get_time()
92 time->tm_mday = bcd2bin(buf[RTC_ADDR_DATE]); in ds1302_rtc_get_time()
93 time->tm_mon = bcd2bin(buf[RTC_ADDR_MON]) - 1; in ds1302_rtc_get_time()
94 time->tm_year = bcd2bin(buf[RTC_ADDR_YEAR]) + 100; in ds1302_rtc_get_time()
116 if (spi->bits_per_word && (spi->bits_per_word != 8)) { in ds1302_probe()
117 dev_err(&spi->dev, "bad word length\n"); in ds1302_probe()
118 return -EINVAL; in ds1302_probe()
119 } else if (spi->max_speed_hz > 2000000) { in ds1302_probe()
120 dev_err(&spi->dev, "speed is too high\n"); in ds1302_probe()
121 return -EINVAL; in ds1302_probe()
122 } else if (spi->mode & SPI_CPHA) { in ds1302_probe()
123 dev_err(&spi->dev, "bad mode\n"); in ds1302_probe()
124 return -EINVAL; in ds1302_probe()
130 dev_err(&spi->dev, "control register read error %d\n", in ds1302_probe()
138 dev_err(&spi->dev, "control register read error %d\n", in ds1302_probe()
144 dev_err(&spi->dev, "junk in control register\n"); in ds1302_probe()
145 return -ENODEV; in ds1302_probe()
155 dev_err(&spi->dev, "control register write error %d\n", in ds1302_probe()
163 dev_err(&spi->dev, in ds1302_probe()
170 dev_err(&spi->dev, "failed to detect chip\n"); in ds1302_probe()
171 return -ENODEV; in ds1302_probe()
177 rtc = devm_rtc_device_register(&spi->dev, "ds1302", in ds1302_probe()
181 dev_err(&spi->dev, "error %d registering rtc\n", status); in ds1302_probe()
203 .driver.name = "rtc-ds1302",