#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/io.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/rtc.h>
#include <linux/slab.h>
#include <linux/of.h>
#include <linux/stmp_device.h>
#include <linux/stmp3xxx_rtc_wdt.h>
#define STMP3XXX_RTC_CTRL …
#define STMP3XXX_RTC_CTRL_ALARM_IRQ_EN …
#define STMP3XXX_RTC_CTRL_ONEMSEC_IRQ_EN …
#define STMP3XXX_RTC_CTRL_ALARM_IRQ …
#define STMP3XXX_RTC_CTRL_WATCHDOGEN …
#define STMP3XXX_RTC_STAT …
#define STMP3XXX_RTC_STAT_STALE_SHIFT …
#define STMP3XXX_RTC_STAT_RTC_PRESENT …
#define STMP3XXX_RTC_STAT_XTAL32000_PRESENT …
#define STMP3XXX_RTC_STAT_XTAL32768_PRESENT …
#define STMP3XXX_RTC_SECONDS …
#define STMP3XXX_RTC_ALARM …
#define STMP3XXX_RTC_WATCHDOG …
#define STMP3XXX_RTC_PERSISTENT0 …
#define STMP3XXX_RTC_PERSISTENT0_CLOCKSOURCE …
#define STMP3XXX_RTC_PERSISTENT0_ALARM_WAKE_EN …
#define STMP3XXX_RTC_PERSISTENT0_ALARM_EN …
#define STMP3XXX_RTC_PERSISTENT0_XTAL24MHZ_PWRUP …
#define STMP3XXX_RTC_PERSISTENT0_XTAL32KHZ_PWRUP …
#define STMP3XXX_RTC_PERSISTENT0_XTAL32_FREQ …
#define STMP3XXX_RTC_PERSISTENT0_ALARM_WAKE …
#define STMP3XXX_RTC_PERSISTENT1 …
#define STMP3XXX_RTC_PERSISTENT1_FORCE_UPDATER …
struct stmp3xxx_rtc_data { … };
#if IS_ENABLED(CONFIG_STMP3XXX_RTC_WATCHDOG)
static void stmp3xxx_wdt_set_timeout(struct device *dev, u32 timeout)
{ … }
static struct stmp3xxx_wdt_pdata wdt_pdata = …;
static void stmp3xxx_wdt_register(struct platform_device *rtc_pdev)
{ … }
#else
static void stmp3xxx_wdt_register(struct platform_device *rtc_pdev)
{
}
#endif
static int stmp3xxx_wait_time(struct stmp3xxx_rtc_data *rtc_data)
{ … }
static int stmp3xxx_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm)
{ … }
static int stmp3xxx_rtc_settime(struct device *dev, struct rtc_time *rtc_tm)
{ … }
static irqreturn_t stmp3xxx_rtc_interrupt(int irq, void *dev_id)
{ … }
static int stmp3xxx_alarm_irq_enable(struct device *dev, unsigned int enabled)
{ … }
static int stmp3xxx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
{ … }
static int stmp3xxx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
{ … }
static const struct rtc_class_ops stmp3xxx_rtc_ops = …;
static void stmp3xxx_rtc_remove(struct platform_device *pdev)
{ … }
static int stmp3xxx_rtc_probe(struct platform_device *pdev)
{ … }
#ifdef CONFIG_PM_SLEEP
static int stmp3xxx_rtc_suspend(struct device *dev)
{ … }
static int stmp3xxx_rtc_resume(struct device *dev)
{ … }
#endif
static SIMPLE_DEV_PM_OPS(stmp3xxx_rtc_pm_ops, stmp3xxx_rtc_suspend,
stmp3xxx_rtc_resume);
static const struct of_device_id rtc_dt_ids[] = …;
MODULE_DEVICE_TABLE(of, rtc_dt_ids);
static struct platform_driver stmp3xxx_rtcdrv = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;