#include <linux/bcd.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/rtc.h>
#include <linux/slab.h>
#define SD3078_REG_SC …
#define SD3078_REG_MN …
#define SD3078_REG_HR …
#define SD3078_REG_DW …
#define SD3078_REG_DM …
#define SD3078_REG_MO …
#define SD3078_REG_YR …
#define SD3078_REG_CTRL1 …
#define SD3078_REG_CTRL2 …
#define SD3078_REG_CTRL3 …
#define KEY_WRITE1 …
#define KEY_WRITE2 …
#define KEY_WRITE3 …
#define NUM_TIME_REGS …
#define WRITE_PROTECT_EN …
struct sd3078 { … };
static void sd3078_enable_reg_write(struct sd3078 *sd3078)
{ … }
#if WRITE_PROTECT_EN
static void sd3078_disable_reg_write(struct sd3078 *sd3078)
{
regmap_update_bits(sd3078->regmap, SD3078_REG_CTRL1,
KEY_WRITE2, 0);
regmap_update_bits(sd3078->regmap, SD3078_REG_CTRL1,
KEY_WRITE3, 0);
regmap_update_bits(sd3078->regmap, SD3078_REG_CTRL2,
KEY_WRITE1, 0);
}
#endif
static int sd3078_rtc_read_time(struct device *dev, struct rtc_time *tm)
{ … }
static int sd3078_rtc_set_time(struct device *dev, struct rtc_time *tm)
{ … }
static const struct rtc_class_ops sd3078_rtc_ops = …;
static const struct regmap_config regmap_config = …;
static int sd3078_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id sd3078_id[] = …;
MODULE_DEVICE_TABLE(i2c, sd3078_id);
static const __maybe_unused struct of_device_id rtc_dt_match[] = …;
MODULE_DEVICE_TABLE(of, rtc_dt_match);
static struct i2c_driver sd3078_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;