Lines Matching +full:trickle +full:- +full:resistor +full:- +full:ohms
1 // SPDX-License-Identifier: GPL-2.0
3 * Real Time Clock driver for AB-RTCMC-32.768kHz-EOZ9 chip.
15 #include <linux/hwmon-sysfs.h>
62 #define ABEOZ953_TEMP_MIN -60
84 struct regmap *regmap = data->regmap; in abeoz9_check_validity()
96 dev_warn(dev, "power-on reset detected, date is invalid\n"); in abeoz9_check_validity()
97 return -EINVAL; in abeoz9_check_validity()
103 return -EINVAL; in abeoz9_check_validity()
109 return -EINVAL; in abeoz9_check_validity()
134 ret = regmap_bulk_read(data->regmap, ABEOZ9_REG_SEC, in abeoz9_rtc_get_time()
142 tm->tm_sec = bcd2bin(regs[ABEOZ9_REG_SEC - ABEOZ9_REG_SEC] & 0x7F); in abeoz9_rtc_get_time()
143 tm->tm_min = bcd2bin(regs[ABEOZ9_REG_MIN - ABEOZ9_REG_SEC] & 0x7F); in abeoz9_rtc_get_time()
145 if (regs[ABEOZ9_REG_HOURS - ABEOZ9_REG_SEC] & ABEOZ9_HOURS_PM) { in abeoz9_rtc_get_time()
146 tm->tm_hour = in abeoz9_rtc_get_time()
147 bcd2bin(regs[ABEOZ9_REG_HOURS - ABEOZ9_REG_SEC] & 0x1f); in abeoz9_rtc_get_time()
148 if (regs[ABEOZ9_REG_HOURS - ABEOZ9_REG_SEC] & ABEOZ9_HOURS_PM) in abeoz9_rtc_get_time()
149 tm->tm_hour += 12; in abeoz9_rtc_get_time()
151 tm->tm_hour = bcd2bin(regs[ABEOZ9_REG_HOURS - ABEOZ9_REG_SEC]); in abeoz9_rtc_get_time()
154 tm->tm_mday = bcd2bin(regs[ABEOZ9_REG_DAYS - ABEOZ9_REG_SEC]); in abeoz9_rtc_get_time()
155 tm->tm_wday = bcd2bin(regs[ABEOZ9_REG_WEEKDAYS - ABEOZ9_REG_SEC]); in abeoz9_rtc_get_time()
156 tm->tm_mon = bcd2bin(regs[ABEOZ9_REG_MONTHS - ABEOZ9_REG_SEC]) - 1; in abeoz9_rtc_get_time()
157 tm->tm_year = bcd2bin(regs[ABEOZ9_REG_YEARS - ABEOZ9_REG_SEC]) + 100; in abeoz9_rtc_get_time()
165 struct regmap *regmap = data->regmap; in abeoz9_rtc_set_time()
169 regs[ABEOZ9_REG_SEC - ABEOZ9_REG_SEC] = bin2bcd(tm->tm_sec); in abeoz9_rtc_set_time()
170 regs[ABEOZ9_REG_MIN - ABEOZ9_REG_SEC] = bin2bcd(tm->tm_min); in abeoz9_rtc_set_time()
171 regs[ABEOZ9_REG_HOURS - ABEOZ9_REG_SEC] = bin2bcd(tm->tm_hour); in abeoz9_rtc_set_time()
172 regs[ABEOZ9_REG_DAYS - ABEOZ9_REG_SEC] = bin2bcd(tm->tm_mday); in abeoz9_rtc_set_time()
173 regs[ABEOZ9_REG_WEEKDAYS - ABEOZ9_REG_SEC] = bin2bcd(tm->tm_wday); in abeoz9_rtc_set_time()
174 regs[ABEOZ9_REG_MONTHS - ABEOZ9_REG_SEC] = bin2bcd(tm->tm_mon + 1); in abeoz9_rtc_set_time()
175 regs[ABEOZ9_REG_YEARS - ABEOZ9_REG_SEC] = bin2bcd(tm->tm_year - 100); in abeoz9_rtc_set_time()
177 ret = regmap_bulk_write(data->regmap, ABEOZ9_REG_SEC, in abeoz9_rtc_set_time()
191 u32 ohms = 0; in abeoz9_trickle_parse_dt() local
193 if (of_property_read_u32(node, "trickle-resistor-ohms", &ohms)) in abeoz9_trickle_parse_dt()
196 switch (ohms) { in abeoz9_trickle_parse_dt()
213 struct regmap *regmap = data->regmap; in abeoz9_rtc_setup()
245 /* Enable built-in termometer */ in abeoz9_rtc_setup()
276 struct regmap *regmap = data->regmap; in abeoz9z3_temp_read()
288 return -EINVAL; in abeoz9z3_temp_read()
305 return -EOPNOTSUPP; in abeoz9z3_temp_read()
362 data->hwmon_dev = in abeoz9_hwmon_register()
368 if (IS_ERR(data->hwmon_dev)) { in abeoz9_hwmon_register()
370 PTR_ERR(data->hwmon_dev)); in abeoz9_hwmon_register()
387 struct device *dev = &client->dev; in abeoz9_probe()
391 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C | in abeoz9_probe()
394 return -ENODEV; in abeoz9_probe()
405 return -ENOMEM; in abeoz9_probe()
407 data->regmap = regmap; in abeoz9_probe()
410 ret = abeoz9_rtc_setup(dev, client->dev.of_node); in abeoz9_probe()
414 data->rtc = devm_rtc_allocate_device(dev); in abeoz9_probe()
415 ret = PTR_ERR_OR_ZERO(data->rtc); in abeoz9_probe()
419 data->rtc->ops = &rtc_ops; in abeoz9_probe()
420 data->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; in abeoz9_probe()
421 data->rtc->range_max = RTC_TIMESTAMP_END_2099; in abeoz9_probe()
423 ret = rtc_register_device(data->rtc); in abeoz9_probe()
446 .name = "rtc-ab-eoz9",
456 MODULE_DESCRIPTION("Abracon AB-RTCMC-32.768kHz-EOZ9 RTC driver");