Return a proper error code instead of a bare -1 (-EPERM) when VL
indicates the time is not reliable, matching rv3032 and the Linux
driver behaviour.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
#include <log.h>
#include <rtc.h>
#include <i2c.h>
+#include <linux/errno.h>
#if !CONFIG_IS_ENABLED(DM_RTC)
static uchar rtc_read (uchar reg);
if (sec & 0x80) {
puts("### Warning: RTC Low Voltage - date/time not reliable\n");
- rel = -1;
+ rel = -EINVAL;
}
tmp->tm_sec = bcd2bin(sec & 0x7F);