#include <linux/kernel.h>
#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>
#include <linux/util_macros.h>
static const unsigned short normal_i2c[] = …;
static bool reset;
module_param(reset, bool, 0);
MODULE_PARM_DESC(…) …;
#define W83795_REG_BANKSEL …
#define W83795_REG_VENDORID …
#define W83795_REG_CHIPID …
#define W83795_REG_DEVICEID …
#define W83795_REG_DEVICEID_A …
#define W83795_REG_I2C_ADDR …
#define W83795_REG_CONFIG …
#define W83795_REG_CONFIG_CONFIG48 …
#define W83795_REG_CONFIG_START …
#define W83795_REG_VOLT_CTRL1 …
#define W83795_REG_VOLT_CTRL2 …
#define W83795_REG_TEMP_CTRL1 …
#define W83795_REG_TEMP_CTRL2 …
#define W83795_REG_FANIN_CTRL1 …
#define W83795_REG_FANIN_CTRL2 …
#define W83795_REG_VMIGB_CTRL …
#define TEMP_READ …
#define TEMP_CRIT …
#define TEMP_CRIT_HYST …
#define TEMP_WARN …
#define TEMP_WARN_HYST …
static const u16 W83795_REG_TEMP[][5] = …;
#define IN_READ …
#define IN_MAX …
#define IN_LOW …
static const u16 W83795_REG_IN[][3] = …;
#define W83795_REG_VRLSB …
static const u8 W83795_REG_IN_HL_LSB[] = …;
#define IN_LSB_REG(index, type) …
#define IN_LSB_SHIFT …
#define IN_LSB_IDX …
static const u8 IN_LSB_SHIFT_IDX[][2] = …;
#define W83795_REG_FAN(index) …
#define W83795_REG_FAN_MIN_HL(index) …
#define W83795_REG_FAN_MIN_LSB(index) …
#define W83795_REG_FAN_MIN_LSB_SHIFT(index) …
#define W83795_REG_VID_CTRL …
#define W83795_REG_ALARM_CTRL …
#define ALARM_CTRL_RTSACS …
#define W83795_REG_ALARM(index) …
#define W83795_REG_CLR_CHASSIS …
#define W83795_REG_BEEP(index) …
#define W83795_REG_OVT_CFG …
#define OVT_CFG_SEL …
#define W83795_REG_FCMS1 …
#define W83795_REG_FCMS2 …
#define W83795_REG_TFMR(index) …
#define W83795_REG_FOMC …
#define W83795_REG_TSS(index) …
#define TSS_MAP_RESERVED …
static const u8 tss_map[4][6] = …;
#define PWM_OUTPUT …
#define PWM_FREQ …
#define PWM_START …
#define PWM_NONSTOP …
#define PWM_STOP_TIME …
#define W83795_REG_PWM(index, nr) …
#define W83795_REG_FTSH(index) …
#define W83795_REG_FTSL(index) …
#define W83795_REG_TFTS …
#define TEMP_PWM_TTTI …
#define TEMP_PWM_CTFS …
#define TEMP_PWM_HCT …
#define TEMP_PWM_HOT …
#define W83795_REG_TTTI(index) …
#define W83795_REG_CTFS(index) …
#define W83795_REG_HT(index) …
#define SF4_TEMP …
#define SF4_PWM …
#define W83795_REG_SF4_TEMP(temp_num, index) …
#define W83795_REG_SF4_PWM(temp_num, index) …
#define W83795_REG_DTSC …
#define W83795_REG_DTSE …
#define W83795_REG_DTS(index) …
#define W83795_REG_PECI_TBASE(index) …
#define DTS_CRIT …
#define DTS_CRIT_HYST …
#define DTS_WARN …
#define DTS_WARN_HYST …
#define W83795_REG_DTS_EXT(index) …
#define SETUP_PWM_DEFAULT …
#define SETUP_PWM_UPTIME …
#define SETUP_PWM_DOWNTIME …
#define W83795_REG_SETUP_PWM(index) …
static inline u16 in_from_reg(u8 index, u16 val)
{ … }
static inline u16 in_to_reg(u8 index, u16 val)
{ … }
static inline unsigned long fan_from_reg(u16 val)
{ … }
static inline u16 fan_to_reg(long rpm)
{ … }
static inline unsigned long time_from_reg(u8 reg)
{ … }
static inline u8 time_to_reg(unsigned long val)
{ … }
static inline long temp_from_reg(s8 reg)
{ … }
static inline s8 temp_to_reg(long val, s8 min, s8 max)
{ … }
static const u16 pwm_freq_cksel0[16] = …;
static unsigned int pwm_freq_from_reg(u8 reg, u16 clkin)
{ … }
static u8 pwm_freq_to_reg(unsigned long val, u16 clkin)
{ … }
enum chip_types { … };
struct w83795_data { … };
static int w83795_set_bank(struct i2c_client *client, u8 bank)
{ … }
static u8 w83795_read(struct i2c_client *client, u16 reg)
{ … }
static int w83795_write(struct i2c_client *client, u16 reg, u8 value)
{ … }
static void w83795_update_limits(struct i2c_client *client)
{ … }
static struct w83795_data *w83795_update_pwm_config(struct device *dev)
{ … }
static struct w83795_data *w83795_update_device(struct device *dev)
{ … }
#define ALARM_STATUS …
#define BEEP_ENABLE …
static ssize_t
show_alarm_beep(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
store_beep(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t
store_chassis_clear(struct device *dev,
struct device_attribute *attr, const char *buf,
size_t count)
{ … }
#define FAN_INPUT …
#define FAN_MIN …
static ssize_t
show_fan(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
store_fan_min(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t
show_pwm(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
store_pwm(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t
show_pwm_enable(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
store_pwm_enable(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t
show_pwm_mode(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static int w83795_tss_useful(const struct w83795_data *data, int tsrc)
{ … }
static ssize_t
show_temp_src(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
store_temp_src(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
#define TEMP_PWM_ENABLE …
#define TEMP_PWM_FAN_MAP …
static ssize_t
show_temp_pwm_enable(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t
store_temp_pwm_enable(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
#define FANIN_TARGET …
#define FANIN_TOL …
static ssize_t
show_fanin(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
store_fanin(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t
show_temp_pwm(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
store_temp_pwm(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t
show_sf4_pwm(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
store_sf4_pwm(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t
show_sf4_temp(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
store_sf4_temp(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
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 ssize_t
show_dts_mode(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
show_dts(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
show_dts_ext(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
store_dts_ext(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t
show_temp_mode(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
store_temp_mode(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t
show_in(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
store_in(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
#ifdef CONFIG_SENSORS_W83795_FANCTRL
static ssize_t
show_sf_setup(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
store_sf_setup(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
#endif
#define NOT_USED …
#define SENSOR_ATTR_IN(index) …
#define SENSOR_ATTR_FAN(index) …
#define SENSOR_ATTR_PWM(index) …
#define SENSOR_ATTR_DTS(index) …
#define SENSOR_ATTR_TEMP(index) …
static struct sensor_device_attribute_2 w83795_in[][5] = …;
static const struct sensor_device_attribute_2 w83795_fan[][4] = …;
static const struct sensor_device_attribute_2 w83795_temp[][28] = …;
static const struct sensor_device_attribute_2 w83795_dts[][8] = …;
static const struct sensor_device_attribute_2 w83795_pwm[][8] = …;
static const struct sensor_device_attribute_2 w83795_tss[6] = …;
static const struct sensor_device_attribute_2 sda_single_files[] = …;
static const struct sensor_device_attribute_2 sda_beep_files[] = …;
static void w83795_init_client(struct i2c_client *client)
{ … }
static int w83795_get_device_id(struct i2c_client *client)
{ … }
static int w83795_detect(struct i2c_client *client,
struct i2c_board_info *info)
{ … }
#ifdef CONFIG_SENSORS_W83795_FANCTRL
#define NUM_PWM_ATTRIBUTES …
#define NUM_TEMP_ATTRIBUTES …
#else
#define NUM_PWM_ATTRIBUTES …
#define NUM_TEMP_ATTRIBUTES …
#endif
static int w83795_handle_files(struct device *dev, int (*fn)(struct device *,
const struct device_attribute *))
{ … }
static int device_remove_file_wrapper(struct device *dev,
const struct device_attribute *attr)
{ … }
static void w83795_check_dynamic_in_limits(struct i2c_client *client)
{ … }
static void w83795_apply_temp_config(struct w83795_data *data, u8 config,
int temp_chan, int in_chan)
{ … }
static int w83795_probe(struct i2c_client *client)
{ … }
static void w83795_remove(struct i2c_client *client)
{ … }
static const struct i2c_device_id w83795_id[] = …;
MODULE_DEVICE_TABLE(i2c, w83795_id);
static struct i2c_driver w83795_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;