#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/spi/spi.h>
#include <linux/bcd.h>
#include <linux/rtc.h>
#include <linux/delay.h>
#include <linux/of.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/kstrtox.h>
#include <linux/regmap.h>
#define RV3029_ONOFF_CTRL …
#define RV3029_ONOFF_CTRL_WE …
#define RV3029_ONOFF_CTRL_TE …
#define RV3029_ONOFF_CTRL_TAR …
#define RV3029_ONOFF_CTRL_EERE …
#define RV3029_ONOFF_CTRL_SRON …
#define RV3029_ONOFF_CTRL_TD0 …
#define RV3029_ONOFF_CTRL_TD1 …
#define RV3029_ONOFF_CTRL_CLKINT …
#define RV3029_IRQ_CTRL …
#define RV3029_IRQ_CTRL_AIE …
#define RV3029_IRQ_CTRL_TIE …
#define RV3029_IRQ_CTRL_V1IE …
#define RV3029_IRQ_CTRL_V2IE …
#define RV3029_IRQ_CTRL_SRIE …
#define RV3029_IRQ_FLAGS …
#define RV3029_IRQ_FLAGS_AF …
#define RV3029_IRQ_FLAGS_TF …
#define RV3029_IRQ_FLAGS_V1IF …
#define RV3029_IRQ_FLAGS_V2IF …
#define RV3029_IRQ_FLAGS_SRF …
#define RV3029_STATUS …
#define RV3029_STATUS_VLOW1 …
#define RV3029_STATUS_VLOW2 …
#define RV3029_STATUS_SR …
#define RV3029_STATUS_PON …
#define RV3029_STATUS_EEBUSY …
#define RV3029_RST_CTRL …
#define RV3029_RST_CTRL_SYSR …
#define RV3029_CONTROL_SECTION_LEN …
#define RV3029_W_SEC …
#define RV3029_W_MINUTES …
#define RV3029_W_HOURS …
#define RV3029_REG_HR_12_24 …
#define RV3029_REG_HR_PM …
#define RV3029_W_DATE …
#define RV3029_W_DAYS …
#define RV3029_W_MONTHS …
#define RV3029_W_YEARS …
#define RV3029_WATCH_SECTION_LEN …
#define RV3029_A_SC …
#define RV3029_A_MN …
#define RV3029_A_HR …
#define RV3029_A_DT …
#define RV3029_A_DW …
#define RV3029_A_MO …
#define RV3029_A_YR …
#define RV3029_A_AE_X …
#define RV3029_ALARM_SECTION_LEN …
#define RV3029_TIMER_LOW …
#define RV3029_TIMER_HIGH …
#define RV3029_TEMP_PAGE …
#define RV3029_E2P_EEDATA1 …
#define RV3029_E2P_EEDATA2 …
#define RV3029_E2PDATA_SECTION_LEN …
#define RV3029_CONTROL_E2P_EECTRL …
#define RV3029_EECTRL_THP …
#define RV3029_EECTRL_THE …
#define RV3029_EECTRL_FD0 …
#define RV3029_EECTRL_FD1 …
#define RV3029_TRICKLE_1K …
#define RV3029_TRICKLE_5K …
#define RV3029_TRICKLE_20K …
#define RV3029_TRICKLE_80K …
#define RV3029_TRICKLE_MASK …
#define RV3029_TRICKLE_SHIFT …
#define RV3029_CONTROL_E2P_XOFFS …
#define RV3029_CONTROL_E2P_XOFFS_SIGN …
#define RV3029_CONTROL_E2P_QCOEF …
#define RV3029_CONTROL_E2P_TURNOVER …
#define RV3029_CONTROL_E2P_TOV_MASK …
#define RV3029_RAM_PAGE …
#define RV3029_RAM_SECTION_LEN …
struct rv3029_data { … };
static int rv3029_eeprom_busywait(struct rv3029_data *rv3029)
{ … }
static int rv3029_eeprom_exit(struct rv3029_data *rv3029)
{ … }
static int rv3029_eeprom_enter(struct rv3029_data *rv3029)
{ … }
static int rv3029_eeprom_read(struct rv3029_data *rv3029, u8 reg,
u8 buf[], size_t len)
{ … }
static int rv3029_eeprom_write(struct rv3029_data *rv3029, u8 reg,
u8 const buf[], size_t len)
{ … }
static int rv3029_eeprom_update_bits(struct rv3029_data *rv3029,
u8 reg, u8 mask, u8 set)
{ … }
static irqreturn_t rv3029_handle_irq(int irq, void *dev_id)
{ … }
static int rv3029_read_time(struct device *dev, struct rtc_time *tm)
{ … }
static int rv3029_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
{ … }
static int rv3029_alarm_irq_enable(struct device *dev, unsigned int enable)
{ … }
static int rv3029_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
{ … }
static int rv3029_set_time(struct device *dev, struct rtc_time *tm)
{ … }
static int rv3029_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
{ … }
static int rv3029_nvram_write(void *priv, unsigned int offset, void *val,
size_t bytes)
{ … }
static int rv3029_nvram_read(void *priv, unsigned int offset, void *val,
size_t bytes)
{ … }
static const struct rv3029_trickle_tab_elem { … } rv3029_trickle_tab[] = …;
static void rv3029_trickle_config(struct device *dev)
{ … }
#ifdef CONFIG_RTC_DRV_RV3029_HWMON
static int rv3029_read_temp(struct rv3029_data *rv3029, int *temp_mC)
{ … }
static ssize_t rv3029_hwmon_show_temp(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t rv3029_hwmon_set_update_interval(struct device *dev,
struct device_attribute *attr,
const char *buf,
size_t count)
{ … }
static ssize_t rv3029_hwmon_show_update_interval(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, rv3029_hwmon_show_temp,
NULL, 0);
static SENSOR_DEVICE_ATTR(update_interval, S_IWUSR | S_IRUGO,
rv3029_hwmon_show_update_interval,
rv3029_hwmon_set_update_interval, 0);
static struct attribute *rv3029_hwmon_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static void rv3029_hwmon_register(struct device *dev, const char *name)
{ … }
#else
static void rv3029_hwmon_register(struct device *dev, const char *name)
{
}
#endif
static const struct rtc_class_ops rv3029_rtc_ops = …;
static int rv3029_probe(struct device *dev, struct regmap *regmap, int irq,
const char *name)
{ … }
static const struct regmap_range rv3029_holes_range[] = …;
static const struct regmap_access_table rv3029_regs = …;
static const struct regmap_config config = …;
#if IS_ENABLED(CONFIG_I2C)
static int rv3029_i2c_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id rv3029_id[] = …;
MODULE_DEVICE_TABLE(i2c, rv3029_id);
static const __maybe_unused struct of_device_id rv3029_of_match[] = …;
MODULE_DEVICE_TABLE(of, rv3029_of_match);
static struct i2c_driver rv3029_driver = …;
static int __init rv3029_register_driver(void)
{ … }
static void rv3029_unregister_driver(void)
{ … }
#else
static int __init rv3029_register_driver(void)
{
return 0;
}
static void rv3029_unregister_driver(void)
{
}
#endif
#if IS_ENABLED(CONFIG_SPI_MASTER)
static int rv3049_probe(struct spi_device *spi)
{ … }
static struct spi_driver rv3049_driver = …;
static int __init rv3049_register_driver(void)
{ … }
static void __exit rv3049_unregister_driver(void)
{ … }
#else
static int __init rv3049_register_driver(void)
{
return 0;
}
static void __exit rv3049_unregister_driver(void)
{
}
#endif
static int __init rv30x9_init(void)
{ … }
module_init(…) …
static void __exit rv30x9_exit(void)
{ … }
module_exit(…)
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS(…) …;