#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/jiffies.h>
static const unsigned short normal_i2c[] = …;
static bool reset;
module_param(reset, bool, 0);
MODULE_PARM_DESC(…) …;
#define W83L786NG_REG_IN_MIN(nr) …
#define W83L786NG_REG_IN_MAX(nr) …
#define W83L786NG_REG_IN(nr) …
#define W83L786NG_REG_FAN(nr) …
#define W83L786NG_REG_FAN_MIN(nr) …
#define W83L786NG_REG_CONFIG …
#define W83L786NG_REG_ALARM1 …
#define W83L786NG_REG_ALARM2 …
#define W83L786NG_REG_GPIO_EN …
#define W83L786NG_REG_MAN_ID2 …
#define W83L786NG_REG_MAN_ID1 …
#define W83L786NG_REG_CHIP_ID …
#define W83L786NG_REG_DIODE …
#define W83L786NG_REG_FAN_DIV …
#define W83L786NG_REG_FAN_CFG …
#define W83L786NG_REG_TOLERANCE …
static const u8 W83L786NG_REG_TEMP[2][3] = …;
static const u8 W83L786NG_PWM_MODE_SHIFT[] = …;
static const u8 W83L786NG_PWM_ENABLE_SHIFT[] = …;
static const u8 W83L786NG_REG_PWM[] = …;
static inline u8
FAN_TO_REG(long rpm, int div)
{ … }
#define FAN_FROM_REG(val, div) …
#define TEMP_TO_REG(val) …
#define TEMP_FROM_REG(val) …
#define IN_TO_REG(val) …
#define IN_FROM_REG(val) …
#define DIV_FROM_REG(val) …
static inline u8
DIV_TO_REG(long val)
{ … }
struct w83l786ng_data { … };
static u8
w83l786ng_read_value(struct i2c_client *client, u8 reg)
{ … }
static int
w83l786ng_write_value(struct i2c_client *client, u8 reg, u8 value)
{ … }
static struct w83l786ng_data *w83l786ng_update_device(struct device *dev)
{ … }
#define show_in_reg(reg) …
show_in_reg(…) …
show_in_reg(…) …
show_in_reg(…) …
#define store_in_reg(REG, reg) …
store_in_reg(…)
store_in_reg(…)
static struct sensor_device_attribute sda_in_input[] = …;
static struct sensor_device_attribute sda_in_min[] = …;
static struct sensor_device_attribute sda_in_max[] = …;
#define show_fan_reg(reg) …
show_fan_reg(fan);
show_fan_reg(fan_min);
static ssize_t
store_fan_min(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t
show_fan_div(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t
store_fan_div(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static struct sensor_device_attribute sda_fan_input[] = …;
static struct sensor_device_attribute sda_fan_min[] = …;
static struct sensor_device_attribute sda_fan_div[] = …;
static ssize_t
show_temp(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
store_temp(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static struct sensor_device_attribute_2 sda_temp_input[] = …;
static struct sensor_device_attribute_2 sda_temp_max[] = …;
static struct sensor_device_attribute_2 sda_temp_max_hyst[] = …;
#define show_pwm_reg(reg) …
show_pwm_reg(…) …
show_pwm_reg(…) …
show_pwm_reg(…) …
static ssize_t
store_pwm_mode(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t
store_pwm(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t
store_pwm_enable(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static struct sensor_device_attribute sda_pwm[] = …;
static struct sensor_device_attribute sda_pwm_mode[] = …;
static struct sensor_device_attribute sda_pwm_enable[] = …;
static ssize_t
show_tolerance(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
store_tolerance(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static struct sensor_device_attribute sda_tolerance[] = …;
#define IN_UNIT_ATTRS(X) …
#define FAN_UNIT_ATTRS(X) …
#define TEMP_UNIT_ATTRS(X) …
#define PWM_UNIT_ATTRS(X) …
#define TOLERANCE_UNIT_ATTRS(X) …
static struct attribute *w83l786ng_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static int
w83l786ng_detect(struct i2c_client *client, struct i2c_board_info *info)
{ … }
static void w83l786ng_init_client(struct i2c_client *client)
{ … }
static int
w83l786ng_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id w83l786ng_id[] = …;
MODULE_DEVICE_TABLE(i2c, w83l786ng_id);
static struct i2c_driver w83l786ng_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;