Lines Matching +full:battery +full:- +full:trip +full:- +full:levels +full:- +full:microvolt
1 // SPDX-License-Identifier: GPL-2.0-only
13 #include <linux/clk-provider.h>
68 * A user-initiated temperature conversion is not started by this function,
81 * Temperature is represented as a 10-bit number, unit half-Kelvins. in isl12022_hwmon_read_temp()
85 temp -= 273000; in isl12022_hwmon_read_temp()
99 return -EOPNOTSUPP; in isl12022_hwmon_read()
142 * rtc_time -- month 0-11, hour 0-23, yr = calendar year-epoch.
166 tm->tm_sec = bcd2bin(buf[ISL12022_REG_SC] & 0x7F); in isl12022_rtc_read_time()
167 tm->tm_min = bcd2bin(buf[ISL12022_REG_MN] & 0x7F); in isl12022_rtc_read_time()
168 tm->tm_hour = bcd2bin(buf[ISL12022_REG_HR] & 0x3F); in isl12022_rtc_read_time()
169 tm->tm_mday = bcd2bin(buf[ISL12022_REG_DT] & 0x3F); in isl12022_rtc_read_time()
170 tm->tm_wday = buf[ISL12022_REG_DW] & 0x07; in isl12022_rtc_read_time()
171 tm->tm_mon = bcd2bin(buf[ISL12022_REG_MO] & 0x1F) - 1; in isl12022_rtc_read_time()
172 tm->tm_year = bcd2bin(buf[ISL12022_REG_YR]) + 100; in isl12022_rtc_read_time()
194 buf[ISL12022_REG_SC] = bin2bcd(tm->tm_sec); in isl12022_rtc_set_time()
195 buf[ISL12022_REG_MN] = bin2bcd(tm->tm_min); in isl12022_rtc_set_time()
196 buf[ISL12022_REG_HR] = bin2bcd(tm->tm_hour) | ISL12022_HR_MIL; in isl12022_rtc_set_time()
198 buf[ISL12022_REG_DT] = bin2bcd(tm->tm_mday); in isl12022_rtc_set_time()
200 /* month, 1 - 12 */ in isl12022_rtc_set_time()
201 buf[ISL12022_REG_MO] = bin2bcd(tm->tm_mon + 1); in isl12022_rtc_set_time()
204 buf[ISL12022_REG_YR] = bin2bcd(tm->tm_year % 100); in isl12022_rtc_set_time()
206 buf[ISL12022_REG_DW] = tm->tm_wday & 0x07; in isl12022_rtc_set_time()
233 return -ENOIOCTLCMD; in isl12022_rtc_ioctl()
255 if (!device_property_present(dev, "#clock-cells")) { in isl12022_register_clock()
258 * consumption in battery mode by ~25%. in isl12022_register_clock()
292 u32 levels[2] = {0, 0}; in isl12022_set_trip_levels() local
296 device_property_read_u32_array(dev, "isil,battery-trip-levels-microvolt", in isl12022_set_trip_levels()
297 levels, 2); in isl12022_set_trip_levels()
300 for (j = 0; j < ARRAY_SIZE(trip_levels[i]) - 1; j++) { in isl12022_set_trip_levels()
301 if (levels[i] <= trip_levels[i][j]) in isl12022_set_trip_levels()
313 dev_warn(dev, "unable to set battery alarm levels: %d\n", ret); in isl12022_set_trip_levels()
318 * status register. In battery backup mode, those bits have in isl12022_set_trip_levels()
320 * values for up to a minute after power-on. in isl12022_set_trip_levels()
332 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) in isl12022_probe()
333 return -ENODEV; in isl12022_probe()
337 dev_err(&client->dev, "regmap allocation failed\n"); in isl12022_probe()
341 dev_set_drvdata(&client->dev, regmap); in isl12022_probe()
343 ret = isl12022_register_clock(&client->dev); in isl12022_probe()
347 isl12022_set_trip_levels(&client->dev); in isl12022_probe()
348 isl12022_hwmon_register(&client->dev); in isl12022_probe()
350 rtc = devm_rtc_allocate_device(&client->dev); in isl12022_probe()
354 rtc->ops = &isl12022_rtc_ops; in isl12022_probe()
355 rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; in isl12022_probe()
356 rtc->range_max = RTC_TIMESTAMP_END_2099; in isl12022_probe()
376 .name = "rtc-isl12022",