Lines Matching refs:rv3028

95 	struct rv3028_data *rv3028 = dev_get_drvdata(dev->parent);  in timestamp0_store()  local
97 regmap_update_bits(rv3028->regmap, RV3028_EVT_CTRL, RV3028_EVT_CTRL_TSR, in timestamp0_store()
106 struct rv3028_data *rv3028 = dev_get_drvdata(dev->parent); in timestamp0_show() local
111 ret = regmap_read(rv3028->regmap, RV3028_TS_COUNT, &count); in timestamp0_show()
118 ret = regmap_bulk_read(rv3028->regmap, RV3028_TS_SEC, date, in timestamp0_show()
143 struct rv3028_data *rv3028 = dev_get_drvdata(dev->parent); in timestamp0_count_show() local
146 ret = regmap_read(rv3028->regmap, RV3028_TS_COUNT, &count); in timestamp0_count_show()
167 struct rv3028_data *rv3028 = dev_id; in rv3028_handle_irq() local
171 if (regmap_read(rv3028->regmap, RV3028_STATUS, &status) < 0 || in rv3028_handle_irq()
177 dev_warn(&rv3028->rtc->dev, "Voltage low, data loss detected.\n"); in rv3028_handle_irq()
198 rtc_update_irq(rv3028->rtc, 1, events); in rv3028_handle_irq()
199 regmap_update_bits(rv3028->regmap, RV3028_STATUS, status, 0); in rv3028_handle_irq()
200 regmap_update_bits(rv3028->regmap, RV3028_CTRL2, ctrl, 0); in rv3028_handle_irq()
204 sysfs_notify(&rv3028->rtc->dev.kobj, NULL, in rv3028_handle_irq()
206 dev_warn(&rv3028->rtc->dev, "event detected"); in rv3028_handle_irq()
214 struct rv3028_data *rv3028 = dev_get_drvdata(dev); in rv3028_get_time() local
218 ret = regmap_read(rv3028->regmap, RV3028_STATUS, &status); in rv3028_get_time()
227 ret = regmap_bulk_read(rv3028->regmap, RV3028_SEC, date, sizeof(date)); in rv3028_get_time()
244 struct rv3028_data *rv3028 = dev_get_drvdata(dev); in rv3028_set_time() local
260 ret = regmap_bulk_write(rv3028->regmap, RV3028_SEC, date, in rv3028_set_time()
265 ret = regmap_update_bits(rv3028->regmap, RV3028_STATUS, in rv3028_set_time()
273 struct rv3028_data *rv3028 = dev_get_drvdata(dev); in rv3028_get_alarm() local
277 ret = regmap_bulk_read(rv3028->regmap, RV3028_ALARM_MIN, alarmvals, in rv3028_get_alarm()
282 ret = regmap_read(rv3028->regmap, RV3028_STATUS, &status); in rv3028_get_alarm()
286 ret = regmap_read(rv3028->regmap, RV3028_CTRL2, &ctrl); in rv3028_get_alarm()
303 struct rv3028_data *rv3028 = dev_get_drvdata(dev); in rv3028_set_alarm() local
316 ret = regmap_update_bits(rv3028->regmap, RV3028_CTRL2, in rv3028_set_alarm()
325 ret = regmap_update_bits(rv3028->regmap, RV3028_STATUS, in rv3028_set_alarm()
330 ret = regmap_bulk_write(rv3028->regmap, RV3028_ALARM_MIN, alarmvals, in rv3028_set_alarm()
336 if (rv3028->rtc->uie_rtctimer.enabled) in rv3028_set_alarm()
338 if (rv3028->rtc->aie_timer.enabled) in rv3028_set_alarm()
342 ret = regmap_update_bits(rv3028->regmap, RV3028_CTRL2, in rv3028_set_alarm()
350 struct rv3028_data *rv3028 = dev_get_drvdata(dev); in rv3028_alarm_irq_enable() local
354 if (rv3028->rtc->uie_rtctimer.enabled) in rv3028_alarm_irq_enable()
356 if (rv3028->rtc->aie_timer.enabled) in rv3028_alarm_irq_enable()
360 ret = regmap_update_bits(rv3028->regmap, RV3028_STATUS, in rv3028_alarm_irq_enable()
365 ret = regmap_update_bits(rv3028->regmap, RV3028_CTRL2, in rv3028_alarm_irq_enable()
375 struct rv3028_data *rv3028 = dev_get_drvdata(dev); in rv3028_read_offset() local
378 ret = regmap_read(rv3028->regmap, RV3028_OFFSET, &value); in rv3028_read_offset()
384 ret = regmap_read(rv3028->regmap, RV3028_BACKUP, &value); in rv3028_read_offset()
397 struct rv3028_data *rv3028 = dev_get_drvdata(dev); in rv3028_set_offset() local
403 ret = regmap_write(rv3028->regmap, RV3028_OFFSET, offset >> 1); in rv3028_set_offset()
407 return regmap_update_bits(rv3028->regmap, RV3028_BACKUP, BIT(7), in rv3028_set_offset()
413 struct rv3028_data *rv3028 = dev_get_drvdata(dev); in rv3028_ioctl() local
418 ret = regmap_read(rv3028->regmap, RV3028_STATUS, &status); in rv3028_ioctl()
423 dev_warn(&rv3028->rtc->dev, "Voltage low, data loss detected.\n"); in rv3028_ioctl()
433 ret = regmap_update_bits(rv3028->regmap, RV3028_STATUS, in rv3028_ioctl()
600 struct rv3028_data *rv3028; in rv3028_probe() local
622 rv3028 = devm_kzalloc(&client->dev, sizeof(struct rv3028_data), in rv3028_probe()
624 if (!rv3028) in rv3028_probe()
627 rv3028->regmap = devm_regmap_init_i2c(client, &regmap_config); in rv3028_probe()
629 i2c_set_clientdata(client, rv3028); in rv3028_probe()
631 ret = regmap_read(rv3028->regmap, RV3028_STATUS, &status); in rv3028_probe()
641 rv3028->rtc = devm_rtc_allocate_device(&client->dev); in rv3028_probe()
642 if (IS_ERR(rv3028->rtc)) in rv3028_probe()
643 return PTR_ERR(rv3028->rtc); in rv3028_probe()
649 "rv3028", rv3028); in rv3028_probe()
660 ret = regmap_update_bits(rv3028->regmap, RV3028_CTRL1, in rv3028_probe()
666 ret = regmap_update_bits(rv3028->regmap, RV3028_CTRL2, in rv3028_probe()
682 ret = regmap_update_bits(rv3028->regmap, RV3028_BACKUP, in rv3028_probe()
693 ret = rtc_add_group(rv3028->rtc, &rv3028_attr_group); in rv3028_probe()
697 rv3028->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; in rv3028_probe()
698 rv3028->rtc->range_max = RTC_TIMESTAMP_END_2099; in rv3028_probe()
699 rv3028->rtc->ops = &rv3028_rtc_ops; in rv3028_probe()
700 ret = rtc_register_device(rv3028->rtc); in rv3028_probe()
704 nvmem_cfg.priv = rv3028->regmap; in rv3028_probe()
705 rtc_nvmem_register(rv3028->rtc, &nvmem_cfg); in rv3028_probe()
706 eeprom_cfg.priv = rv3028->regmap; in rv3028_probe()
707 rtc_nvmem_register(rv3028->rtc, &eeprom_cfg); in rv3028_probe()
709 rv3028->rtc->max_user_freq = 1; in rv3028_probe()