mcp7940n: don't clobber the control & trim registers when setting time We were accidentally writing 0 to both control and trim. This resulted in MFP getting tied to ground (possibly drawing current via the external pull-up) and trim getting disabled. Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
1 files changed, 2 insertions(+), 1 deletions(-) M devices/i2c/mcp7940n.c
M devices/i2c/mcp7940n.c +2 -1
@@ 214,8 214,9 @@ bool mcp7940n_settime(const struct tm *t tmp.month = BIN2BCD(tm->month, 4, 0) & 0x1f; tmp.year = BIN2BCD(tm->year - 2000, 4, 0); + /* update date & time but leave control & trim alone */ if (!mcp7940n_write(offsetof(struct mcp7940n, timekeeping), &tmp, - sizeof(tmp))) + offsetof(struct mcp7940n, timekeeping.control))) return false; /* start the oscillator */