From 640aecb416cff52cf8a89d786d41e6eee54c94ff Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Tue, 22 Nov 2022 12:54:52 -0500 Subject: [PATCH] rtc: Add fallbacks for dm functions This adds fallbacks for the various dm_rtc_* functions. This allows common code to use these functions without ifdefs. Fixes: c8ce7ba87d1 ("misc: Add support for nvmem cells") Reviewed-by: Simon Glass Signed-off-by: Sean Anderson --- include/rtc.h | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/include/rtc.h b/include/rtc.h index 10104e3bf5..b6fdbb60dc 100644 --- a/include/rtc.h +++ b/include/rtc.h @@ -15,13 +15,12 @@ #include #include +#include typedef int64_t time64_t; - -#ifdef CONFIG_DM_RTC - struct udevice; +#if CONFIG_IS_ENABLED(DM_RTC) struct rtc_ops { /** * get() - get the current time @@ -222,6 +221,33 @@ int rtc_enable_32khz_output(int busnum, int chip_addr); #endif #else +static inline int dm_rtc_get(struct udevice *dev, struct rtc_time *time) +{ + return -ENOSYS; +} + +static inline int dm_rtc_set(struct udevice *dev, struct rtc_time *time) +{ + return -ENOSYS; +} + +static inline int dm_rtc_reset(struct udevice *dev) +{ + return -ENOSYS; +} + +static inline int dm_rtc_read(struct udevice *dev, unsigned int reg, u8 *buf, + unsigned int len) +{ + return -ENOSYS; +} + +static inline int dm_rtc_write(struct udevice *dev, unsigned int reg, + const u8 *buf, unsigned int len) +{ + return -ENOSYS; +} + int rtc_get (struct rtc_time *); int rtc_set (struct rtc_time *); void rtc_reset (void);