#define pr_fmt(fmt) …
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/i2c.h>
#include <linux/spi/spi.h>
#include <linux/rtc.h>
#include <linux/bcd.h>
#include <linux/slab.h>
#include <linux/regmap.h>
#include <linux/hwmon.h>
#define DS3232_REG_SECONDS …
#define DS3232_REG_MINUTES …
#define DS3232_REG_HOURS …
#define DS3232_REG_AMPM …
#define DS3232_REG_DAY …
#define DS3232_REG_DATE …
#define DS3232_REG_MONTH …
#define DS3232_REG_CENTURY …
#define DS3232_REG_YEAR …
#define DS3232_REG_ALARM1 …
#define DS3232_REG_ALARM2 …
#define DS3232_REG_CR …
#define DS3232_REG_CR_nEOSC …
#define DS3232_REG_CR_INTCN …
#define DS3232_REG_CR_A2IE …
#define DS3232_REG_CR_A1IE …
#define DS3232_REG_SR …
#define DS3232_REG_SR_OSF …
#define DS3232_REG_SR_BSY …
#define DS3232_REG_SR_A2F …
#define DS3232_REG_SR_A1F …
#define DS3232_REG_TEMPERATURE …
#define DS3232_REG_SRAM_START …
#define DS3232_REG_SRAM_END …
#define DS3232_REG_SRAM_SIZE …
struct ds3232 { … };
static int ds3232_check_rtc_status(struct device *dev)
{ … }
static int ds3232_read_time(struct device *dev, struct rtc_time *time)
{ … }
static int ds3232_set_time(struct device *dev, struct rtc_time *time)
{ … }
static int ds3232_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
{ … }
static int ds3232_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
{ … }
static int ds3232_update_alarm(struct device *dev, unsigned int enabled)
{ … }
static int ds3232_hwmon_read_temp(struct device *dev, long int *mC)
{ … }
static umode_t ds3232_hwmon_is_visible(const void *data,
enum hwmon_sensor_types type,
u32 attr, int channel)
{ … }
static int ds3232_hwmon_read(struct device *dev,
enum hwmon_sensor_types type,
u32 attr, int channel, long *temp)
{ … }
static u32 ds3232_hwmon_chip_config[] = …;
static const struct hwmon_channel_info ds3232_hwmon_chip = …;
static u32 ds3232_hwmon_temp_config[] = …;
static const struct hwmon_channel_info ds3232_hwmon_temp = …;
static const struct hwmon_channel_info * const ds3232_hwmon_info[] = …;
static const struct hwmon_ops ds3232_hwmon_hwmon_ops = …;
static const struct hwmon_chip_info ds3232_hwmon_chip_info = …;
static void ds3232_hwmon_register(struct device *dev, const char *name)
{ … }
static int ds3232_alarm_irq_enable(struct device *dev, unsigned int enabled)
{ … }
static irqreturn_t ds3232_irq(int irq, void *dev_id)
{ … }
static const struct rtc_class_ops ds3232_rtc_ops = …;
static int ds3232_nvmem_read(void *priv, unsigned int offset, void *val,
size_t bytes)
{ … }
static int ds3232_nvmem_write(void *priv, unsigned int offset, void *val,
size_t bytes)
{ … }
static int ds3232_probe(struct device *dev, struct regmap *regmap, int irq,
const char *name)
{ … }
#if IS_ENABLED(CONFIG_I2C)
#ifdef CONFIG_PM_SLEEP
static int ds3232_suspend(struct device *dev)
{ … }
static int ds3232_resume(struct device *dev)
{ … }
#endif
static const struct dev_pm_ops ds3232_pm_ops = …;
static int ds3232_i2c_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id ds3232_id[] = …;
MODULE_DEVICE_TABLE(i2c, ds3232_id);
static const __maybe_unused struct of_device_id ds3232_of_match[] = …;
MODULE_DEVICE_TABLE(of, ds3232_of_match);
static struct i2c_driver ds3232_driver = …;
static int ds3232_register_driver(void)
{ … }
static void ds3232_unregister_driver(void)
{ … }
#else
static int ds3232_register_driver(void)
{
return 0;
}
static void ds3232_unregister_driver(void)
{
}
#endif
#if IS_ENABLED(CONFIG_SPI_MASTER)
static int ds3234_probe(struct spi_device *spi)
{ … }
static struct spi_driver ds3234_driver = …;
static int ds3234_register_driver(void)
{ … }
static void ds3234_unregister_driver(void)
{ … }
#else
static int ds3234_register_driver(void)
{
return 0;
}
static void ds3234_unregister_driver(void)
{
}
#endif
static int __init ds323x_init(void)
{ … }
module_init(…) …
static void __exit ds323x_exit(void)
{ … }
module_exit(…)
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS(…) …;