#include <linux/init.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/device.h>
#include <linux/spi/spi.h>
#include <linux/regmap.h>
#include <linux/rtc.h>
#include <linux/bcd.h>
#include <linux/pm.h>
#include <linux/pm_wakeirq.h>
#include <linux/slab.h>
#define DALLAS_MAXIM_DS1343 …
#define DALLAS_MAXIM_DS1344 …
#define DS1343_SECONDS_REG …
#define DS1343_MINUTES_REG …
#define DS1343_HOURS_REG …
#define DS1343_DAY_REG …
#define DS1343_DATE_REG …
#define DS1343_MONTH_REG …
#define DS1343_YEAR_REG …
#define DS1343_ALM0_SEC_REG …
#define DS1343_ALM0_MIN_REG …
#define DS1343_ALM0_HOUR_REG …
#define DS1343_ALM0_DAY_REG …
#define DS1343_ALM1_SEC_REG …
#define DS1343_ALM1_MIN_REG …
#define DS1343_ALM1_HOUR_REG …
#define DS1343_ALM1_DAY_REG …
#define DS1343_CONTROL_REG …
#define DS1343_STATUS_REG …
#define DS1343_TRICKLE_REG …
#define DS1343_NVRAM …
#define DS1343_NVRAM_LEN …
#define DS1343_EOSC …
#define DS1343_DOSF …
#define DS1343_EGFIL …
#define DS1343_SQW …
#define DS1343_INTCN …
#define DS1343_A1IE …
#define DS1343_A0IE …
#define DS1343_OSF …
#define DS1343_IRQF1 …
#define DS1343_IRQF0 …
#define DS1343_TRICKLE_MAGIC …
#define DS1343_TRICKLE_DS1 …
#define DS1343_TRICKLE_1K …
#define DS1343_TRICKLE_2K …
#define DS1343_TRICKLE_4K …
static const struct spi_device_id ds1343_id[] = …;
MODULE_DEVICE_TABLE(spi, ds1343_id);
struct ds1343_priv { … };
static ssize_t ds1343_show_glitchfilter(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t ds1343_store_glitchfilter(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR(glitch_filter, S_IRUGO | S_IWUSR, ds1343_show_glitchfilter,
ds1343_store_glitchfilter);
static int ds1343_nvram_write(void *priv, unsigned int off, void *val,
size_t bytes)
{ … }
static int ds1343_nvram_read(void *priv, unsigned int off, void *val,
size_t bytes)
{ … }
static ssize_t ds1343_show_tricklecharger(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR(trickle_charger, S_IRUGO, ds1343_show_tricklecharger, NULL);
static struct attribute *ds1343_attrs[] = …;
static const struct attribute_group ds1343_attr_group = …;
static int ds1343_read_time(struct device *dev, struct rtc_time *dt)
{ … }
static int ds1343_set_time(struct device *dev, struct rtc_time *dt)
{ … }
static int ds1343_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
{ … }
static int ds1343_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
{ … }
static int ds1343_alarm_irq_enable(struct device *dev, unsigned int enabled)
{ … }
static irqreturn_t ds1343_thread(int irq, void *dev_id)
{ … }
static const struct rtc_class_ops ds1343_rtc_ops = …;
static int ds1343_probe(struct spi_device *spi)
{ … }
static void ds1343_remove(struct spi_device *spi)
{ … }
#ifdef CONFIG_PM_SLEEP
static int ds1343_suspend(struct device *dev)
{ … }
static int ds1343_resume(struct device *dev)
{ … }
#endif
static SIMPLE_DEV_PM_OPS(ds1343_pm, ds1343_suspend, ds1343_resume);
static struct spi_driver ds1343_driver = …;
module_spi_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;