Lines Matching +full:power +full:- +full:stable +full:- +full:time

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
71 #define RV3032_STATUS_PORF (1 << 1) /* Power On Reset Flag */
75 #define RV3032_STATUS_UF (1 << 5) /* periodic time Update Flag */
112 #define RV3032_CTRL2_UIE (1 << 5) /* Periodic time update interrupt enable bit */
179 if ((rv = iicdev_readfrom(sc->dev, reg, &data, 1, IIC_WAIT)) != 0) in rv3032_update_register()
183 if ((rv = iicdev_writeto(sc->dev, reg, &data, 1, IIC_WAIT)) != 0) in rv3032_update_register()
194 for (timeout = 1000; timeout > 0; timeout--) { in rv3032_eeprom_wait()
195 if ((rv = iicdev_readfrom(sc->dev, RV3032_TEMP_LSB, &data, sizeof(data), IIC_WAIT)) != 0) in rv3032_eeprom_wait()
202 device_printf(sc->dev, "Timeout updating the eeprom\n"); in rv3032_eeprom_wait()
230 if ((rv = iicdev_writeto(sc->dev, RV3032_EEPROM_COMMAND, &data, sizeof(data), IIC_WAIT)) != 0) in rv3032_eeprom_update()
258 /* Save configuration in eeprom and re-enable it */ in rv3032_update_cfg()
270 if ((rv = iicdev_readfrom(sc->dev, RV3032_TEMP_LSB, &data, sizeof(data), IIC_WAIT)) != 0) in rv3032_temp_read()
273 /* Wait for temp to be stable */ in rv3032_temp_read()
309 config_intrhook_disestablish(&sc->init_hook); in rv3032_init()
317 device_printf(sc->dev, "Cannot set to DSM mode (%d)\n", rv); in rv3032_init()
322 clock_register_flags(sc->dev, 1000000, CLOCKF_SETTIME_NO_ADJ); in rv3032_init()
323 clock_schedule(sc->dev, 1); in rv3032_init()
325 ctx = device_get_sysctl_ctx(sc->dev); in rv3032_init()
326 tree_node = device_get_sysctl_tree(sc->dev); in rv3032_init()
340 if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) { in rv3032_probe()
353 sc->dev = dev; in rv3032_attach()
354 sc->busdev = device_get_parent(sc->dev); in rv3032_attach()
356 sc->init_hook.ich_func = rv3032_init; in rv3032_attach()
357 sc->init_hook.ich_arg = sc; in rv3032_attach()
358 if (config_intrhook_establish(&sc->init_hook) != 0) in rv3032_attach()
383 if ((rv = iicdev_readfrom(sc->dev, RV3032_STATUS, &status, sizeof(status), IIC_WAIT)) != 0) in rv3032_gettime()
387 if ((rv = iicdev_readfrom(sc->dev, RV3032_SECS, &time_regs, sizeof(time_regs), IIC_WAIT)) != 0) in rv3032_gettime()
395 ct.mon = FROMBCD(time_regs.month & 0x1f) - 1; in rv3032_gettime()
411 if ((rv = iicdev_readfrom(sc->dev, RV3032_STATUS, &status, sizeof(status), IIC_WAIT)) != 0) in rv3032_settime()
421 time_regs.year = TOBCD(ct.year - 2000); in rv3032_settime()
423 if ((rv = iicdev_writeto(sc->dev, RV3032_SECS, &time_regs, sizeof(time_regs), IIC_WAIT)) != 0) in rv3032_settime()
426 /* Force a power on reset event so rv3032 reload the registers */ in rv3032_settime()
428 if ((rv = iicdev_writeto(sc->dev, RV3032_STATUS, &status, sizeof(status), IIC_WAIT)) != 0) in rv3032_settime()