#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/mutex.h>
#include <linux/rtc.h>
#include <linux/delay.h>
#include <linux/mfd/core.h>
#include <linux/mfd/88pm860x.h>
#define VRTC_CALIBRATION
struct pm860x_rtc_info { … };
#define REG_VRTC_MEAS1 …
#define REG0_ADDR …
#define REG1_ADDR …
#define REG2_ADDR …
#define REG3_ADDR …
#define REG0_DATA …
#define REG1_DATA …
#define REG2_DATA …
#define REG3_DATA …
#define MEAS2_VRTC …
#define ALARM_EN …
#define ALARM_WAKEUP …
#define ALARM …
#define RTC1_USE_XO …
#define VRTC_CALIB_INTERVAL …
static irqreturn_t rtc_update_handler(int irq, void *data)
{ … }
static int pm860x_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
{ … }
static int pm860x_rtc_read_time(struct device *dev, struct rtc_time *tm)
{ … }
static int pm860x_rtc_set_time(struct device *dev, struct rtc_time *tm)
{ … }
static int pm860x_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{ … }
static int pm860x_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{ … }
static const struct rtc_class_ops pm860x_rtc_ops = …;
#ifdef VRTC_CALIBRATION
static void calibrate_vrtc_work(struct work_struct *work)
{ … }
#endif
#ifdef CONFIG_OF
static int pm860x_rtc_dt_init(struct platform_device *pdev,
struct pm860x_rtc_info *info)
{ … }
#else
#define pm860x_rtc_dt_init …
#endif
static int pm860x_rtc_probe(struct platform_device *pdev)
{ … }
static void pm860x_rtc_remove(struct platform_device *pdev)
{ … }
#ifdef CONFIG_PM_SLEEP
static int pm860x_rtc_suspend(struct device *dev)
{ … }
static int pm860x_rtc_resume(struct device *dev)
{ … }
#endif
static SIMPLE_DEV_PM_OPS(pm860x_rtc_pm_ops, pm860x_rtc_suspend, pm860x_rtc_resume);
static struct platform_driver pm860x_rtc_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;