Lines Matching full:pcf85363

3  * drivers/rtc/rtc-pcf85363.c
5 * Driver for NXP PCF85363 real-time clock.
113 struct pcf85363 { struct
123 static int pcf85363_load_capacitance(struct pcf85363 *pcf85363, struct device_node *node) in pcf85363_load_capacitance() argument
132 dev_warn(&pcf85363->rtc->dev, "Unknown quartz-load-femtofarads value: %d. Assuming 7000", in pcf85363_load_capacitance()
145 return regmap_update_bits(pcf85363->regmap, CTRL_OSCILLATOR, in pcf85363_load_capacitance()
151 struct pcf85363 *pcf85363 = dev_get_drvdata(dev); in pcf85363_rtc_read_time() local
156 ret = regmap_bulk_read(pcf85363->regmap, DT_100THS, buf, len); in pcf85363_rtc_read_time()
180 struct pcf85363 *pcf85363 = dev_get_drvdata(dev); in pcf85363_rtc_set_time() local
197 ret = regmap_bulk_write(pcf85363->regmap, CTRL_STOP_EN, in pcf85363_rtc_set_time()
202 ret = regmap_bulk_write(pcf85363->regmap, DT_100THS, in pcf85363_rtc_set_time()
207 return regmap_write(pcf85363->regmap, CTRL_STOP_EN, 0); in pcf85363_rtc_set_time()
212 struct pcf85363 *pcf85363 = dev_get_drvdata(dev); in pcf85363_rtc_read_alarm() local
217 ret = regmap_bulk_read(pcf85363->regmap, DT_SECOND_ALM1, buf, in pcf85363_rtc_read_alarm()
228 ret = regmap_read(pcf85363->regmap, CTRL_INTA_EN, &val); in pcf85363_rtc_read_alarm()
237 static int _pcf85363_rtc_alarm_irq_enable(struct pcf85363 *pcf85363, unsigned in _pcf85363_rtc_alarm_irq_enable() argument
244 ret = regmap_update_bits(pcf85363->regmap, DT_ALARM_EN, alarm_flags, in _pcf85363_rtc_alarm_irq_enable()
249 ret = regmap_update_bits(pcf85363->regmap, CTRL_INTA_EN, in _pcf85363_rtc_alarm_irq_enable()
256 return regmap_update_bits(pcf85363->regmap, CTRL_FLAGS, FLAGS_A1F, 0); in _pcf85363_rtc_alarm_irq_enable()
262 struct pcf85363 *pcf85363 = dev_get_drvdata(dev); in pcf85363_rtc_alarm_irq_enable() local
264 return _pcf85363_rtc_alarm_irq_enable(pcf85363, enabled); in pcf85363_rtc_alarm_irq_enable()
269 struct pcf85363 *pcf85363 = dev_get_drvdata(dev); in pcf85363_rtc_set_alarm() local
283 ret = _pcf85363_rtc_alarm_irq_enable(pcf85363, 0); in pcf85363_rtc_set_alarm()
287 ret = regmap_bulk_write(pcf85363->regmap, DT_SECOND_ALM1, buf, in pcf85363_rtc_set_alarm()
292 return _pcf85363_rtc_alarm_irq_enable(pcf85363, alrm->enabled); in pcf85363_rtc_set_alarm()
297 struct pcf85363 *pcf85363 = i2c_get_clientdata(dev_id); in pcf85363_rtc_handle_irq() local
301 err = regmap_read(pcf85363->regmap, CTRL_FLAGS, &flags); in pcf85363_rtc_handle_irq()
306 rtc_update_irq(pcf85363->rtc, 1, RTC_IRQF | RTC_AF); in pcf85363_rtc_handle_irq()
307 regmap_update_bits(pcf85363->regmap, CTRL_FLAGS, FLAGS_A1F, 0); in pcf85363_rtc_handle_irq()
325 struct pcf85363 *pcf85363 = priv; in pcf85363_nvram_read() local
327 return regmap_bulk_read(pcf85363->regmap, CTRL_RAM + offset, in pcf85363_nvram_read()
334 struct pcf85363 *pcf85363 = priv; in pcf85363_nvram_write() local
336 return regmap_bulk_write(pcf85363->regmap, CTRL_RAM + offset, in pcf85363_nvram_write()
343 struct pcf85363 *pcf85363 = priv; in pcf85x63_nvram_read() local
347 ret = regmap_read(pcf85363->regmap, CTRL_RAMBYTE, &tmp_val); in pcf85x63_nvram_read()
356 struct pcf85363 *pcf85363 = priv; in pcf85x63_nvram_write() local
360 return regmap_write(pcf85363->regmap, CTRL_RAMBYTE, in pcf85x63_nvram_write()
384 struct pcf85363 *pcf85363; in pcf85363_probe() local
396 .name = "pcf85363-", in pcf85363_probe()
410 pcf85363 = devm_kzalloc(&client->dev, sizeof(struct pcf85363), in pcf85363_probe()
412 if (!pcf85363) in pcf85363_probe()
415 pcf85363->regmap = devm_regmap_init_i2c(client, &config->regmap); in pcf85363_probe()
416 if (IS_ERR(pcf85363->regmap)) { in pcf85363_probe()
418 return PTR_ERR(pcf85363->regmap); in pcf85363_probe()
421 i2c_set_clientdata(client, pcf85363); in pcf85363_probe()
423 pcf85363->rtc = devm_rtc_allocate_device(&client->dev); in pcf85363_probe()
424 if (IS_ERR(pcf85363->rtc)) in pcf85363_probe()
425 return PTR_ERR(pcf85363->rtc); in pcf85363_probe()
427 err = pcf85363_load_capacitance(pcf85363, client->dev.of_node); in pcf85363_probe()
432 pcf85363->rtc->ops = &rtc_ops; in pcf85363_probe()
433 pcf85363->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; in pcf85363_probe()
434 pcf85363->rtc->range_max = RTC_TIMESTAMP_END_2099; in pcf85363_probe()
439 regmap_write(pcf85363->regmap, CTRL_FLAGS, 0); in pcf85363_probe()
440 regmap_update_bits(pcf85363->regmap, CTRL_PIN_IO, in pcf85363_probe()
452 "pcf85363", client); in pcf85363_probe()
462 set_bit(RTC_FEATURE_ALARM, pcf85363->rtc->features); in pcf85363_probe()
464 clear_bit(RTC_FEATURE_ALARM, pcf85363->rtc->features); in pcf85363_probe()
467 ret = devm_rtc_register_device(pcf85363->rtc); in pcf85363_probe()
470 nvmem_cfg[i].priv = pcf85363; in pcf85363_probe()
471 devm_rtc_nvmem_register(pcf85363->rtc, &nvmem_cfg[i]); in pcf85363_probe()
479 { .compatible = "nxp,pcf85363", .data = &pcf_85363_config },
486 .name = "pcf85363",
495 MODULE_DESCRIPTION("pcf85263/pcf85363 I2C RTC driver");