#include <linux/module.h>
#include <linux/of.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/jiffies.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
#include <linux/hwmon-vid.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/util_macros.h>
static const unsigned short normal_i2c[] = …;
enum chips { … };
#define LM85_REG_IN(nr) …
#define LM85_REG_IN_MIN(nr) …
#define LM85_REG_IN_MAX(nr) …
#define LM85_REG_TEMP(nr) …
#define LM85_REG_TEMP_MIN(nr) …
#define LM85_REG_TEMP_MAX(nr) …
#define LM85_REG_FAN(nr) …
#define LM85_REG_FAN_MIN(nr) …
#define LM85_REG_PWM(nr) …
#define LM85_REG_COMPANY …
#define LM85_REG_VERSTEP …
#define ADT7468_REG_CFG5 …
#define ADT7468_OFF64 …
#define ADT7468_HFPWM …
#define IS_ADT7468_OFF64(data) …
#define IS_ADT7468_HFPWM(data) …
#define LM85_COMPANY_NATIONAL …
#define LM85_COMPANY_ANALOG_DEV …
#define LM85_COMPANY_SMSC …
#define LM85_VERSTEP_LM85C …
#define LM85_VERSTEP_LM85B …
#define LM85_VERSTEP_LM96000_1 …
#define LM85_VERSTEP_LM96000_2 …
#define LM85_VERSTEP_ADM1027 …
#define LM85_VERSTEP_ADT7463 …
#define LM85_VERSTEP_ADT7463C …
#define LM85_VERSTEP_ADT7468_1 …
#define LM85_VERSTEP_ADT7468_2 …
#define LM85_VERSTEP_EMC6D100_A0 …
#define LM85_VERSTEP_EMC6D100_A1 …
#define LM85_VERSTEP_EMC6D102 …
#define LM85_VERSTEP_EMC6D103_A0 …
#define LM85_VERSTEP_EMC6D103_A1 …
#define LM85_VERSTEP_EMC6D103S …
#define LM85_REG_CONFIG …
#define LM85_REG_ALARM1 …
#define LM85_REG_ALARM2 …
#define LM85_REG_VID …
#define LM85_REG_AFAN_CONFIG(nr) …
#define LM85_REG_AFAN_RANGE(nr) …
#define LM85_REG_AFAN_SPIKE1 …
#define LM85_REG_AFAN_MINPWM(nr) …
#define LM85_REG_AFAN_LIMIT(nr) …
#define LM85_REG_AFAN_CRITICAL(nr) …
#define LM85_REG_AFAN_HYST1 …
#define LM85_REG_AFAN_HYST2 …
#define ADM1027_REG_EXTEND_ADC1 …
#define ADM1027_REG_EXTEND_ADC2 …
#define EMC6D100_REG_ALARM3 …
#define EMC6D100_REG_IN(nr) …
#define EMC6D100_REG_IN_MIN(nr) …
#define EMC6D100_REG_IN_MAX(nr) …
#define EMC6D102_REG_EXTEND_ADC1 …
#define EMC6D102_REG_EXTEND_ADC2 …
#define EMC6D102_REG_EXTEND_ADC3 …
#define EMC6D102_REG_EXTEND_ADC4 …
static const int lm85_scaling[] = …;
#define SCALE(val, from, to) …
#define INS_TO_REG(n, val) …
#define INSEXT_FROM_REG(n, val, ext) …
#define INS_FROM_REG(n, val) …
static inline u16 FAN_TO_REG(unsigned long val)
{ … }
#define FAN_FROM_REG(val) …
#define TEMP_TO_REG(val) …
#define TEMPEXT_FROM_REG(val, ext) …
#define TEMP_FROM_REG(val) …
#define PWM_TO_REG(val) …
#define PWM_FROM_REG(val) …
static const int lm85_range_map[] = …;
static int RANGE_TO_REG(long range)
{ … }
#define RANGE_FROM_REG(val) …
static const int lm85_freq_map[] = …;
static const int lm96000_freq_map[] = …;
static const int adm1027_freq_map[] = …;
static int FREQ_TO_REG(const int *map,
unsigned int map_size, unsigned long freq)
{ … }
static int FREQ_FROM_REG(const int *map, unsigned int map_size, u8 reg)
{ … }
static const int lm85_zone_map[] = …;
#define ZONE_FROM_REG(val) …
static int ZONE_TO_REG(int zone)
{ … }
#define HYST_TO_REG(val) …
#define HYST_FROM_REG(val) …
#define LM85_DATA_INTERVAL …
#define LM85_CONFIG_INTERVAL …
struct lm85_zone { … };
struct lm85_autofan { … };
struct lm85_data { … };
static int lm85_read_value(struct i2c_client *client, u8 reg)
{ … }
static void lm85_write_value(struct i2c_client *client, u8 reg, int value)
{ … }
static struct lm85_data *lm85_update_device(struct device *dev)
{ … }
static ssize_t fan_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t fan_min_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t fan_min_store(struct device *dev,
struct device_attribute *attr, const char *buf,
size_t count)
{ … }
static SENSOR_DEVICE_ATTR_RO(fan1_input, fan, 0);
static SENSOR_DEVICE_ATTR_RW(fan1_min, fan_min, 0);
static SENSOR_DEVICE_ATTR_RO(fan2_input, fan, 1);
static SENSOR_DEVICE_ATTR_RW(fan2_min, fan_min, 1);
static SENSOR_DEVICE_ATTR_RO(fan3_input, fan, 2);
static SENSOR_DEVICE_ATTR_RW(fan3_min, fan_min, 2);
static SENSOR_DEVICE_ATTR_RO(fan4_input, fan, 3);
static SENSOR_DEVICE_ATTR_RW(fan4_min, fan_min, 3);
static ssize_t cpu0_vid_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(cpu0_vid);
static ssize_t vrm_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t vrm_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR_RW(vrm);
static ssize_t alarms_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR_RO(alarms);
static ssize_t alarm_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static SENSOR_DEVICE_ATTR_RO(in0_alarm, alarm, 0);
static SENSOR_DEVICE_ATTR_RO(in1_alarm, alarm, 1);
static SENSOR_DEVICE_ATTR_RO(in2_alarm, alarm, 2);
static SENSOR_DEVICE_ATTR_RO(in3_alarm, alarm, 3);
static SENSOR_DEVICE_ATTR_RO(in4_alarm, alarm, 8);
static SENSOR_DEVICE_ATTR_RO(in5_alarm, alarm, 18);
static SENSOR_DEVICE_ATTR_RO(in6_alarm, alarm, 16);
static SENSOR_DEVICE_ATTR_RO(in7_alarm, alarm, 17);
static SENSOR_DEVICE_ATTR_RO(temp1_alarm, alarm, 4);
static SENSOR_DEVICE_ATTR_RO(temp1_fault, alarm, 14);
static SENSOR_DEVICE_ATTR_RO(temp2_alarm, alarm, 5);
static SENSOR_DEVICE_ATTR_RO(temp3_alarm, alarm, 6);
static SENSOR_DEVICE_ATTR_RO(temp3_fault, alarm, 15);
static SENSOR_DEVICE_ATTR_RO(fan1_alarm, alarm, 10);
static SENSOR_DEVICE_ATTR_RO(fan2_alarm, alarm, 11);
static SENSOR_DEVICE_ATTR_RO(fan3_alarm, alarm, 12);
static SENSOR_DEVICE_ATTR_RO(fan4_alarm, alarm, 13);
static ssize_t pwm_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t pwm_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t pwm_enable_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t pwm_enable_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t pwm_freq_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t pwm_freq_store(struct device *dev,
struct device_attribute *attr, const char *buf,
size_t count)
{ … }
static SENSOR_DEVICE_ATTR_RW(pwm1, pwm, 0);
static SENSOR_DEVICE_ATTR_RW(pwm1_enable, pwm_enable, 0);
static SENSOR_DEVICE_ATTR_RW(pwm1_freq, pwm_freq, 0);
static SENSOR_DEVICE_ATTR_RW(pwm2, pwm, 1);
static SENSOR_DEVICE_ATTR_RW(pwm2_enable, pwm_enable, 1);
static SENSOR_DEVICE_ATTR_RW(pwm2_freq, pwm_freq, 1);
static SENSOR_DEVICE_ATTR_RW(pwm3, pwm, 2);
static SENSOR_DEVICE_ATTR_RW(pwm3_enable, pwm_enable, 2);
static SENSOR_DEVICE_ATTR_RW(pwm3_freq, pwm_freq, 2);
static ssize_t in_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t in_min_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t in_min_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t in_max_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t in_max_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static SENSOR_DEVICE_ATTR_RO(in0_input, in, 0);
static SENSOR_DEVICE_ATTR_RW(in0_min, in_min, 0);
static SENSOR_DEVICE_ATTR_RW(in0_max, in_max, 0);
static SENSOR_DEVICE_ATTR_RO(in1_input, in, 1);
static SENSOR_DEVICE_ATTR_RW(in1_min, in_min, 1);
static SENSOR_DEVICE_ATTR_RW(in1_max, in_max, 1);
static SENSOR_DEVICE_ATTR_RO(in2_input, in, 2);
static SENSOR_DEVICE_ATTR_RW(in2_min, in_min, 2);
static SENSOR_DEVICE_ATTR_RW(in2_max, in_max, 2);
static SENSOR_DEVICE_ATTR_RO(in3_input, in, 3);
static SENSOR_DEVICE_ATTR_RW(in3_min, in_min, 3);
static SENSOR_DEVICE_ATTR_RW(in3_max, in_max, 3);
static SENSOR_DEVICE_ATTR_RO(in4_input, in, 4);
static SENSOR_DEVICE_ATTR_RW(in4_min, in_min, 4);
static SENSOR_DEVICE_ATTR_RW(in4_max, in_max, 4);
static SENSOR_DEVICE_ATTR_RO(in5_input, in, 5);
static SENSOR_DEVICE_ATTR_RW(in5_min, in_min, 5);
static SENSOR_DEVICE_ATTR_RW(in5_max, in_max, 5);
static SENSOR_DEVICE_ATTR_RO(in6_input, in, 6);
static SENSOR_DEVICE_ATTR_RW(in6_min, in_min, 6);
static SENSOR_DEVICE_ATTR_RW(in6_max, in_max, 6);
static SENSOR_DEVICE_ATTR_RO(in7_input, in, 7);
static SENSOR_DEVICE_ATTR_RW(in7_min, in_min, 7);
static SENSOR_DEVICE_ATTR_RW(in7_max, in_max, 7);
static ssize_t temp_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t temp_min_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t temp_min_store(struct device *dev,
struct device_attribute *attr, const char *buf,
size_t count)
{ … }
static ssize_t temp_max_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t temp_max_store(struct device *dev,
struct device_attribute *attr, const char *buf,
size_t count)
{ … }
static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, 0);
static SENSOR_DEVICE_ATTR_RW(temp1_min, temp_min, 0);
static SENSOR_DEVICE_ATTR_RW(temp1_max, temp_max, 0);
static SENSOR_DEVICE_ATTR_RO(temp2_input, temp, 1);
static SENSOR_DEVICE_ATTR_RW(temp2_min, temp_min, 1);
static SENSOR_DEVICE_ATTR_RW(temp2_max, temp_max, 1);
static SENSOR_DEVICE_ATTR_RO(temp3_input, temp, 2);
static SENSOR_DEVICE_ATTR_RW(temp3_min, temp_min, 2);
static SENSOR_DEVICE_ATTR_RW(temp3_max, temp_max, 2);
static ssize_t pwm_auto_channels_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t pwm_auto_channels_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t pwm_auto_pwm_min_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t pwm_auto_pwm_min_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t pwm_auto_pwm_minctl_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t pwm_auto_pwm_minctl_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static SENSOR_DEVICE_ATTR_RW(pwm1_auto_channels, pwm_auto_channels, 0);
static SENSOR_DEVICE_ATTR_RW(pwm1_auto_pwm_min, pwm_auto_pwm_min, 0);
static SENSOR_DEVICE_ATTR_RW(pwm1_auto_pwm_minctl, pwm_auto_pwm_minctl, 0);
static SENSOR_DEVICE_ATTR_RW(pwm2_auto_channels, pwm_auto_channels, 1);
static SENSOR_DEVICE_ATTR_RW(pwm2_auto_pwm_min, pwm_auto_pwm_min, 1);
static SENSOR_DEVICE_ATTR_RW(pwm2_auto_pwm_minctl, pwm_auto_pwm_minctl, 1);
static SENSOR_DEVICE_ATTR_RW(pwm3_auto_channels, pwm_auto_channels, 2);
static SENSOR_DEVICE_ATTR_RW(pwm3_auto_pwm_min, pwm_auto_pwm_min, 2);
static SENSOR_DEVICE_ATTR_RW(pwm3_auto_pwm_minctl, pwm_auto_pwm_minctl, 2);
static ssize_t temp_auto_temp_off_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t temp_auto_temp_off_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t temp_auto_temp_min_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t temp_auto_temp_min_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t temp_auto_temp_max_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t temp_auto_temp_max_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t temp_auto_temp_crit_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t temp_auto_temp_crit_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static SENSOR_DEVICE_ATTR_RW(temp1_auto_temp_off, temp_auto_temp_off, 0);
static SENSOR_DEVICE_ATTR_RW(temp1_auto_temp_min, temp_auto_temp_min, 0);
static SENSOR_DEVICE_ATTR_RW(temp1_auto_temp_max, temp_auto_temp_max, 0);
static SENSOR_DEVICE_ATTR_RW(temp1_auto_temp_crit, temp_auto_temp_crit, 0);
static SENSOR_DEVICE_ATTR_RW(temp2_auto_temp_off, temp_auto_temp_off, 1);
static SENSOR_DEVICE_ATTR_RW(temp2_auto_temp_min, temp_auto_temp_min, 1);
static SENSOR_DEVICE_ATTR_RW(temp2_auto_temp_max, temp_auto_temp_max, 1);
static SENSOR_DEVICE_ATTR_RW(temp2_auto_temp_crit, temp_auto_temp_crit, 1);
static SENSOR_DEVICE_ATTR_RW(temp3_auto_temp_off, temp_auto_temp_off, 2);
static SENSOR_DEVICE_ATTR_RW(temp3_auto_temp_min, temp_auto_temp_min, 2);
static SENSOR_DEVICE_ATTR_RW(temp3_auto_temp_max, temp_auto_temp_max, 2);
static SENSOR_DEVICE_ATTR_RW(temp3_auto_temp_crit, temp_auto_temp_crit, 2);
static struct attribute *lm85_attributes[] = …;
static const struct attribute_group lm85_group = …;
static struct attribute *lm85_attributes_minctl[] = …;
static const struct attribute_group lm85_group_minctl = …;
static struct attribute *lm85_attributes_temp_off[] = …;
static const struct attribute_group lm85_group_temp_off = …;
static struct attribute *lm85_attributes_in4[] = …;
static const struct attribute_group lm85_group_in4 = …;
static struct attribute *lm85_attributes_in567[] = …;
static const struct attribute_group lm85_group_in567 = …;
static void lm85_init_client(struct i2c_client *client)
{ … }
static int lm85_is_fake(struct i2c_client *client)
{ … }
static int lm85_detect(struct i2c_client *client, struct i2c_board_info *info)
{ … }
static int lm85_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id lm85_id[] = …;
MODULE_DEVICE_TABLE(i2c, lm85_id);
static const struct of_device_id __maybe_unused lm85_of_match[] = …;
MODULE_DEVICE_TABLE(of, lm85_of_match);
static struct i2c_driver lm85_driver = …;
module_i2c_driver(…) …;
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;