#include <linux/bcd.h>
#include <linux/bitfield.h>
#include <linux/i2c.h>
#include <linux/kstrtox.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/rtc.h>
#include <linux/watchdog.h>
#define ABX8XX_REG_HTH …
#define ABX8XX_REG_SC …
#define ABX8XX_REG_MN …
#define ABX8XX_REG_HR …
#define ABX8XX_REG_DA …
#define ABX8XX_REG_MO …
#define ABX8XX_REG_YR …
#define ABX8XX_REG_WD …
#define ABX8XX_REG_AHTH …
#define ABX8XX_REG_ASC …
#define ABX8XX_REG_AMN …
#define ABX8XX_REG_AHR …
#define ABX8XX_REG_ADA …
#define ABX8XX_REG_AMO …
#define ABX8XX_REG_AWD …
#define ABX8XX_REG_STATUS …
#define ABX8XX_STATUS_AF …
#define ABX8XX_STATUS_BLF …
#define ABX8XX_STATUS_WDT …
#define ABX8XX_REG_CTRL1 …
#define ABX8XX_CTRL_WRITE …
#define ABX8XX_CTRL_ARST …
#define ABX8XX_CTRL_12_24 …
#define ABX8XX_REG_CTRL2 …
#define ABX8XX_CTRL2_RSVD …
#define ABX8XX_REG_IRQ …
#define ABX8XX_IRQ_AIE …
#define ABX8XX_IRQ_IM_1_4 …
#define ABX8XX_REG_CD_TIMER_CTL …
#define ABX8XX_REG_OSC …
#define ABX8XX_OSC_FOS …
#define ABX8XX_OSC_BOS …
#define ABX8XX_OSC_ACAL_512 …
#define ABX8XX_OSC_ACAL_1024 …
#define ABX8XX_OSC_OSEL …
#define ABX8XX_REG_OSS …
#define ABX8XX_OSS_OF …
#define ABX8XX_OSS_OMODE …
#define ABX8XX_REG_WDT …
#define ABX8XX_WDT_WDS …
#define ABX8XX_WDT_BMB_MASK …
#define ABX8XX_WDT_BMB_SHIFT …
#define ABX8XX_WDT_MAX_TIME …
#define ABX8XX_WDT_WRB_MASK …
#define ABX8XX_WDT_WRB_1HZ …
#define ABX8XX_REG_CFG_KEY …
#define ABX8XX_CFG_KEY_OSC …
#define ABX8XX_CFG_KEY_MISC …
#define ABX8XX_REG_ID0 …
#define ABX8XX_REG_OUT_CTRL …
#define ABX8XX_OUT_CTRL_EXDS …
#define ABX8XX_REG_TRICKLE …
#define ABX8XX_TRICKLE_CHARGE_ENABLE …
#define ABX8XX_TRICKLE_STANDARD_DIODE …
#define ABX8XX_TRICKLE_SCHOTTKY_DIODE …
#define ABX8XX_REG_EXTRAM …
#define ABX8XX_EXTRAM_XADS …
#define ABX8XX_SRAM_BASE …
#define ABX8XX_SRAM_WIN_SIZE …
#define ABX8XX_RAM_SIZE …
#define NVMEM_ADDR_LOWER …
#define NVMEM_ADDR_UPPER …
static u8 trickle_resistors[] = …;
enum abx80x_chip { … };
struct abx80x_cap { … };
static struct abx80x_cap abx80x_caps[] = …;
struct abx80x_priv { … };
static int abx80x_write_config_key(struct i2c_client *client, u8 key)
{ … }
static int abx80x_is_rc_mode(struct i2c_client *client)
{ … }
static int abx80x_enable_trickle_charger(struct i2c_client *client,
u8 trickle_cfg)
{ … }
static int abx80x_rtc_read_time(struct device *dev, struct rtc_time *tm)
{ … }
static int abx80x_rtc_set_time(struct device *dev, struct rtc_time *tm)
{ … }
static irqreturn_t abx80x_handle_irq(int irq, void *dev_id)
{ … }
static int abx80x_read_alarm(struct device *dev, struct rtc_wkalrm *t)
{ … }
static int abx80x_set_alarm(struct device *dev, struct rtc_wkalrm *t)
{ … }
static int abx80x_rtc_set_autocalibration(struct device *dev,
int autocalibration)
{ … }
static int abx80x_rtc_get_autocalibration(struct device *dev)
{ … }
static ssize_t autocalibration_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t autocalibration_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RW(autocalibration);
static ssize_t oscillator_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t oscillator_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RW(oscillator);
static struct attribute *rtc_calib_attrs[] = …;
static const struct attribute_group rtc_calib_attr_group = …;
static int abx80x_alarm_irq_enable(struct device *dev, unsigned int enabled)
{ … }
static int abx80x_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
{ … }
static const struct rtc_class_ops abx80x_rtc_ops = …;
static int abx80x_dt_trickle_cfg(struct i2c_client *client)
{ … }
#ifdef CONFIG_WATCHDOG
static inline u8 timeout_bits(unsigned int timeout)
{ … }
static int __abx80x_wdog_set_timeout(struct watchdog_device *wdog,
unsigned int timeout)
{ … }
static int abx80x_wdog_set_timeout(struct watchdog_device *wdog,
unsigned int new_timeout)
{ … }
static int abx80x_wdog_ping(struct watchdog_device *wdog)
{ … }
static int abx80x_wdog_start(struct watchdog_device *wdog)
{ … }
static int abx80x_wdog_stop(struct watchdog_device *wdog)
{ … }
static const struct watchdog_info abx80x_wdog_info = …;
static const struct watchdog_ops abx80x_wdog_ops = …;
static int abx80x_setup_watchdog(struct abx80x_priv *priv)
{ … }
#else
static int abx80x_setup_watchdog(struct abx80x_priv *priv)
{
return 0;
}
#endif
static int abx80x_nvmem_xfer(struct abx80x_priv *priv, unsigned int offset,
void *val, size_t bytes, bool write)
{ … }
static int abx80x_nvmem_read(void *priv, unsigned int offset, void *val,
size_t bytes)
{ … }
static int abx80x_nvmem_write(void *priv, unsigned int offset, void *val,
size_t bytes)
{ … }
static int abx80x_setup_nvmem(struct abx80x_priv *priv)
{ … }
static const struct i2c_device_id abx80x_id[] = …;
MODULE_DEVICE_TABLE(i2c, abx80x_id);
static int abx80x_probe(struct i2c_client *client)
{ … }
#ifdef CONFIG_OF
static const struct of_device_id abx80x_of_match[] = …;
MODULE_DEVICE_TABLE(of, abx80x_of_match);
#endif
static struct i2c_driver abx80x_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;