#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/jiffies.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/slab.h>
#define ADT7411_REG_STAT_1 …
#define ADT7411_STAT_1_INT_TEMP_HIGH …
#define ADT7411_STAT_1_INT_TEMP_LOW …
#define ADT7411_STAT_1_EXT_TEMP_HIGH_AIN1 …
#define ADT7411_STAT_1_EXT_TEMP_LOW …
#define ADT7411_STAT_1_EXT_TEMP_FAULT …
#define ADT7411_STAT_1_AIN2 …
#define ADT7411_STAT_1_AIN3 …
#define ADT7411_STAT_1_AIN4 …
#define ADT7411_REG_STAT_2 …
#define ADT7411_STAT_2_AIN5 …
#define ADT7411_STAT_2_AIN6 …
#define ADT7411_STAT_2_AIN7 …
#define ADT7411_STAT_2_AIN8 …
#define ADT7411_STAT_2_VDD …
#define ADT7411_REG_INT_TEMP_VDD_LSB …
#define ADT7411_REG_EXT_TEMP_AIN14_LSB …
#define ADT7411_REG_VDD_MSB …
#define ADT7411_REG_INT_TEMP_MSB …
#define ADT7411_REG_EXT_TEMP_AIN1_MSB …
#define ADT7411_REG_CFG1 …
#define ADT7411_CFG1_START_MONITOR …
#define ADT7411_CFG1_RESERVED_BIT1 …
#define ADT7411_CFG1_EXT_TDM …
#define ADT7411_CFG1_RESERVED_BIT3 …
#define ADT7411_REG_CFG2 …
#define ADT7411_CFG2_DISABLE_AVG …
#define ADT7411_REG_CFG3 …
#define ADT7411_CFG3_ADC_CLK_225 …
#define ADT7411_CFG3_RESERVED_BIT1 …
#define ADT7411_CFG3_RESERVED_BIT2 …
#define ADT7411_CFG3_RESERVED_BIT3 …
#define ADT7411_CFG3_REF_VDD …
#define ADT7411_REG_VDD_HIGH …
#define ADT7411_REG_VDD_LOW …
#define ADT7411_REG_TEMP_HIGH(nr) …
#define ADT7411_REG_TEMP_LOW(nr) …
#define ADT7411_REG_IN_HIGH(nr) …
#define ADT7411_REG_IN_LOW(nr) …
#define ADT7411_REG_DEVICE_ID …
#define ADT7411_REG_MANUFACTURER_ID …
#define ADT7411_DEVICE_ID …
#define ADT7411_MANUFACTURER_ID …
static const unsigned short normal_i2c[] = …;
static const u8 adt7411_in_alarm_reg[] = …;
static const u8 adt7411_in_alarm_bits[] = …;
struct adt7411_data { … };
static int adt7411_read_10_bit(struct i2c_client *client, u8 lsb_reg,
u8 msb_reg, u8 lsb_shift)
{ … }
static int adt7411_modify_bit(struct i2c_client *client, u8 reg, u8 bit,
bool flag)
{ … }
static ssize_t adt7411_show_bit(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t adt7411_set_bit(struct device *dev,
struct device_attribute *attr, const char *buf,
size_t count)
{ … }
#define ADT7411_BIT_ATTR(__name, __reg, __bit) …
static ADT7411_BIT_ATTR(no_average, ADT7411_REG_CFG2, ADT7411_CFG2_DISABLE_AVG);
static ADT7411_BIT_ATTR(fast_sampling, ADT7411_REG_CFG3, ADT7411_CFG3_ADC_CLK_225);
static ADT7411_BIT_ATTR(adc_ref_vdd, ADT7411_REG_CFG3, ADT7411_CFG3_REF_VDD);
static struct attribute *adt7411_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static int adt7411_read_in_alarm(struct device *dev, int channel, long *val)
{ … }
static int adt7411_read_in_vdd(struct device *dev, u32 attr, long *val)
{ … }
static int adt7411_update_vref(struct device *dev)
{ … }
static int adt7411_read_in_chan(struct device *dev, u32 attr, int channel,
long *val)
{ … }
static int adt7411_read_in(struct device *dev, u32 attr, int channel,
long *val)
{ … }
static int adt7411_read_temp_alarm(struct device *dev, u32 attr, int channel,
long *val)
{ … }
static int adt7411_read_temp(struct device *dev, u32 attr, int channel,
long *val)
{ … }
static int adt7411_read(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long *val)
{ … }
static int adt7411_write_in_vdd(struct device *dev, u32 attr, long val)
{ … }
static int adt7411_write_in_chan(struct device *dev, u32 attr, int channel,
long val)
{ … }
static int adt7411_write_in(struct device *dev, u32 attr, int channel,
long val)
{ … }
static int adt7411_write_temp(struct device *dev, u32 attr, int channel,
long val)
{ … }
static int adt7411_write(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long val)
{ … }
static umode_t adt7411_is_visible(const void *_data,
enum hwmon_sensor_types type,
u32 attr, int channel)
{ … }
static int adt7411_detect(struct i2c_client *client,
struct i2c_board_info *info)
{ … }
static int adt7411_init_device(struct adt7411_data *data)
{ … }
static const struct hwmon_channel_info * const adt7411_info[] = …;
static const struct hwmon_ops adt7411_hwmon_ops = …;
static const struct hwmon_chip_info adt7411_chip_info = …;
static int adt7411_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id adt7411_id[] = …;
MODULE_DEVICE_TABLE(i2c, adt7411_id);
static struct i2c_driver adt7411_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;