// SPDX-License-Identifier: GPL-2.0-or-later /* * The Netronix embedded controller is a microcontroller found in some * e-book readers designed by the original design manufacturer Netronix, Inc. * It contains RTC, battery monitoring, system power management, and PWM * functionality. * * This driver implements access to the RTC time and date. * * Copyright 2020 Jonathan Neuschäfer <j.neuschaefer@gmx.net>
*/
/* * Read the minutes/seconds field again. If it changed since the first * read, we can't assume that the values read so far are consistent, * and should start from the beginning.
*/
res = regmap_read(rtc->ec->regmap, NTXEC_REG_READ_MINUTE_SECOND, &value); if (res < 0) return res;
if (tm->tm_min != value >> 8 || tm->tm_sec != (value & 0xff)) goto retry;
/* * To avoid time overflows while we're writing the full date/time, * set the seconds field to zero before doing anything else. For the * next 59 seconds (plus however long it takes until the RTC's next * update of the second field), the seconds field will not overflow * into the other fields.
*/ struct reg_sequence regs[] = {
{ NTXEC_REG_WRITE_SECOND, ntxec_reg8(0) },
{ NTXEC_REG_WRITE_YEAR, ntxec_reg8(tm->tm_year - 100) },
{ NTXEC_REG_WRITE_MONTH, ntxec_reg8(tm->tm_mon + 1) },
{ NTXEC_REG_WRITE_DAY, ntxec_reg8(tm->tm_mday) },
{ NTXEC_REG_WRITE_HOUR, ntxec_reg8(tm->tm_hour) },
{ NTXEC_REG_WRITE_MINUTE, ntxec_reg8(tm->tm_min) },
{ NTXEC_REG_WRITE_SECOND, ntxec_reg8(tm->tm_sec) },
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.