#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/jiffies.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/sysfs.h>
#include <linux/kernel.h>
enum chips { … };
static int polarity = …;
module_param(polarity, int, 0);
MODULE_PARM_DESC(…) …;
#define DS1621_REG_CONFIG_NVB …
#define DS1621_REG_CONFIG_RESOL …
#define DS1621_REG_CONFIG_POLARITY …
#define DS1621_REG_CONFIG_1SHOT …
#define DS1621_REG_CONFIG_DONE …
#define DS1621_REG_CONFIG_RESOL_SHIFT …
static const unsigned short ds1721_convrates[] = …;
#define DS1621_CONVERSION_MAX …
#define DS1625_CONVERSION_MAX …
#define DS1621_TEMP_MAX …
#define DS1621_TEMP_MIN …
static const u8 DS1621_REG_TEMP[3] = …;
#define DS1621_REG_CONF …
#define DS1621_COM_START …
#define DS1721_COM_START …
#define DS1621_COM_STOP …
#define DS1621_ALARM_TEMP_HIGH …
#define DS1621_ALARM_TEMP_LOW …
#define ALARMS_FROM_REG(val) …
struct ds1621_data { … };
static inline int DS1621_TEMP_FROM_REG(u16 reg)
{ … }
static inline u16 DS1621_TEMP_TO_REG(long temp, u8 zbits)
{ … }
static void ds1621_init_client(struct ds1621_data *data,
struct i2c_client *client)
{ … }
static struct ds1621_data *ds1621_update_client(struct device *dev)
{ … }
static ssize_t temp_show(struct device *dev, struct device_attribute *da,
char *buf)
{ … }
static ssize_t temp_store(struct device *dev, struct device_attribute *da,
const char *buf, size_t count)
{ … }
static ssize_t alarms_show(struct device *dev, struct device_attribute *da,
char *buf)
{ … }
static ssize_t alarm_show(struct device *dev, struct device_attribute *da,
char *buf)
{ … }
static ssize_t update_interval_show(struct device *dev,
struct device_attribute *da, char *buf)
{ … }
static ssize_t update_interval_store(struct device *dev,
struct device_attribute *da,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR_RO(alarms);
static DEVICE_ATTR_RW(update_interval);
static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, 0);
static SENSOR_DEVICE_ATTR_RW(temp1_min, temp, 1);
static SENSOR_DEVICE_ATTR_RW(temp1_max, temp, 2);
static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, alarm, DS1621_ALARM_TEMP_LOW);
static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, alarm, DS1621_ALARM_TEMP_HIGH);
static struct attribute *ds1621_attributes[] = …;
static umode_t ds1621_attribute_visible(struct kobject *kobj,
struct attribute *attr, int index)
{ … }
static const struct attribute_group ds1621_group = …;
__ATTRIBUTE_GROUPS(…);
static int ds1621_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id ds1621_id[] = …;
MODULE_DEVICE_TABLE(i2c, ds1621_id);
static struct i2c_driver ds1621_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;