1 // SPDX-License-Identifier: GPL-2.0+
8 #include <power/pmic.h>
11 int rtc_get(struct rtc_time *rtc)
15 struct pmic *p = pmic_get("FSL_PMIC");
21 ret = pmic_reg_read(p, REG_RTC_DAY, &day1);
25 ret = pmic_reg_read(p, REG_RTC_TIME, &time);
29 ret = pmic_reg_read(p, REG_RTC_DAY, &day2);
33 } while (day1 != day2 && i++ < 3);
35 tim = day1 * 86400 + time;
45 int rtc_set(struct rtc_time *rtc)
48 struct pmic *p = pmic_get("FSL_PMIC");
52 time = rtc_mktime(rtc);
56 pmic_reg_write(p, REG_RTC_DAY, day);
57 pmic_reg_write(p, REG_RTC_TIME, time);