#define pr_fmt(fmt) …
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/rtc.h>
#include <linux/bcd.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/of.h>
#include <linux/mfd/twl.h>
enum twl_class { … };
enum { … };
static const u8 twl4030_rtc_reg_map[] = …;
static const u8 twl6030_rtc_reg_map[] = …;
#define BIT_RTC_CTRL_REG_STOP_RTC_M …
#define BIT_RTC_CTRL_REG_ROUND_30S_M …
#define BIT_RTC_CTRL_REG_AUTO_COMP_M …
#define BIT_RTC_CTRL_REG_MODE_12_24_M …
#define BIT_RTC_CTRL_REG_TEST_MODE_M …
#define BIT_RTC_CTRL_REG_SET_32_COUNTER_M …
#define BIT_RTC_CTRL_REG_GET_TIME_M …
#define BIT_RTC_CTRL_REG_RTC_V_OPT …
#define BIT_RTC_STATUS_REG_RUN_M …
#define BIT_RTC_STATUS_REG_1S_EVENT_M …
#define BIT_RTC_STATUS_REG_1M_EVENT_M …
#define BIT_RTC_STATUS_REG_1H_EVENT_M …
#define BIT_RTC_STATUS_REG_1D_EVENT_M …
#define BIT_RTC_STATUS_REG_ALARM_M …
#define BIT_RTC_STATUS_REG_POWER_UP_M …
#define BIT_RTC_INTERRUPTS_REG_EVERY_M …
#define BIT_RTC_INTERRUPTS_REG_IT_TIMER_M …
#define BIT_RTC_INTERRUPTS_REG_IT_ALARM_M …
#define ALL_TIME_REGS …
struct twl_rtc { … };
static int twl_rtc_read_u8(struct twl_rtc *twl_rtc, u8 *data, u8 reg)
{ … }
static int twl_rtc_write_u8(struct twl_rtc *twl_rtc, u8 data, u8 reg)
{ … }
static int set_rtc_irq_bit(struct twl_rtc *twl_rtc, unsigned char bit)
{ … }
static int mask_rtc_irq_bit(struct twl_rtc *twl_rtc, unsigned char bit)
{ … }
static int twl_rtc_alarm_irq_enable(struct device *dev, unsigned enabled)
{ … }
static int twl_rtc_read_time(struct device *dev, struct rtc_time *tm)
{ … }
static int twl_rtc_set_time(struct device *dev, struct rtc_time *tm)
{ … }
static int twl_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
{ … }
static int twl_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
{ … }
static irqreturn_t twl_rtc_interrupt(int irq, void *data)
{ … }
static const struct rtc_class_ops twl_rtc_ops = …;
static int twl_nvram_read(void *priv, unsigned int offset, void *val,
size_t bytes)
{ … }
static int twl_nvram_write(void *priv, unsigned int offset, void *val,
size_t bytes)
{ … }
static int twl_rtc_probe(struct platform_device *pdev)
{ … }
static void twl_rtc_remove(struct platform_device *pdev)
{ … }
static void twl_rtc_shutdown(struct platform_device *pdev)
{ … }
#ifdef CONFIG_PM_SLEEP
static int twl_rtc_suspend(struct device *dev)
{ … }
static int twl_rtc_resume(struct device *dev)
{ … }
#endif
static SIMPLE_DEV_PM_OPS(twl_rtc_pm_ops, twl_rtc_suspend, twl_rtc_resume);
static const struct of_device_id twl_rtc_of_match[] = …;
MODULE_DEVICE_TABLE(of, twl_rtc_of_match);
static struct platform_driver twl4030rtc_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;