#define pr_fmt(fmt) …
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/jiffies.h>
#include <linux/platform_device.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/hwmon-vid.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/acpi.h>
#include <linux/io.h>
#include "lm75.h"
enum kinds { … };
static const char * const w83627ehf_device_names[] = …;
static unsigned short force_id;
module_param(force_id, ushort, 0);
MODULE_PARM_DESC(…) …;
#define DRVNAME …
#define W83627EHF_LD_HWM …
#define W83667HG_LD_VID …
#define SIO_REG_LDSEL …
#define SIO_REG_DEVID …
#define SIO_REG_EN_VRM10 …
#define SIO_REG_ENABLE …
#define SIO_REG_ADDR …
#define SIO_REG_VID_CTRL …
#define SIO_REG_VID_DATA …
#define SIO_W83627EHF_ID …
#define SIO_W83627EHG_ID …
#define SIO_W83627DHG_ID …
#define SIO_W83627DHG_P_ID …
#define SIO_W83627UHG_ID …
#define SIO_W83667HG_ID …
#define SIO_W83667HG_B_ID …
#define SIO_ID_MASK …
static inline void
superio_outb(int ioreg, int reg, int val)
{ … }
static inline int
superio_inb(int ioreg, int reg)
{ … }
static inline void
superio_select(int ioreg, int ld)
{ … }
static inline int
superio_enter(int ioreg)
{ … }
static inline void
superio_exit(int ioreg)
{ … }
#define IOREGION_ALIGNMENT …
#define IOREGION_OFFSET …
#define IOREGION_LENGTH …
#define ADDR_REG_OFFSET …
#define DATA_REG_OFFSET …
#define W83627EHF_REG_BANK …
#define W83627EHF_REG_CONFIG …
static const u16 W83627EHF_REG_FAN[] = …;
static const u16 W83627EHF_REG_FAN_MIN[] = …;
#define W83627EHF_REG_IN_MAX(nr) …
#define W83627EHF_REG_IN_MIN(nr) …
#define W83627EHF_REG_IN(nr) …
static const u16 W83627EHF_REG_TEMP[] = …;
static const u16 W83627EHF_REG_TEMP_HYST[] = …;
static const u16 W83627EHF_REG_TEMP_OVER[] = …;
static const u16 W83627EHF_REG_TEMP_CONFIG[] = …;
#define W83627EHF_REG_FANDIV1 …
#define W83627EHF_REG_FANDIV2 …
#define W83627EHF_REG_VBAT …
#define W83627EHF_REG_DIODE …
#define W83627EHF_REG_SMI_OVT …
#define W83627EHF_REG_ALARM1 …
#define W83627EHF_REG_ALARM2 …
#define W83627EHF_REG_ALARM3 …
#define W83627EHF_REG_CASEOPEN_DET …
#define W83627EHF_REG_CASEOPEN_CLR …
#define W83627EHF_REG_FAN_STEPUP_TIME …
#define W83627EHF_REG_FAN_STEPDOWN_TIME …
static const u8 W83627EHF_REG_PWM_ENABLE[] = …;
static const u8 W83627EHF_PWM_MODE_SHIFT[] = …;
static const u8 W83627EHF_PWM_ENABLE_SHIFT[] = …;
static const u16 W83627EHF_REG_PWM[] = …;
static const u16 W83627EHF_REG_TARGET[] = …;
static const u8 W83627EHF_REG_TOLERANCE[] = …;
static const u16 W83627EHF_REG_FAN_START_OUTPUT[] = …;
static const u16 W83627EHF_REG_FAN_STOP_OUTPUT[] = …;
static const u16 W83627EHF_REG_FAN_STOP_TIME[] = …;
static const u16 W83627EHF_REG_FAN_MAX_OUTPUT_COMMON[]
= …;
static const u16 W83627EHF_REG_FAN_STEP_OUTPUT_COMMON[]
= …;
static const u16 W83627EHF_REG_FAN_MAX_OUTPUT_W83667_B[] = …;
static const u16 W83627EHF_REG_FAN_STEP_OUTPUT_W83667_B[]
= …;
static const u16 W83627EHF_REG_TEMP_OFFSET[] = …;
static const char *const w83667hg_b_temp_label[] = …;
#define NUM_REG_TEMP …
static int is_word_sized(u16 reg)
{ … }
static inline unsigned int step_time_from_reg(u8 reg, u8 mode)
{ … }
static inline u8 step_time_to_reg(unsigned int msec, u8 mode)
{ … }
static unsigned int fan_from_reg8(u16 reg, unsigned int divreg)
{ … }
static inline unsigned int
div_from_reg(u8 reg)
{ … }
static const u16 scale_in_common[10] = …;
static const u16 scale_in_w83627uhg[9] = …;
static inline long in_from_reg(u8 reg, u8 nr, const u16 *scale_in)
{ … }
static inline u8 in_to_reg(u32 val, u8 nr, const u16 *scale_in)
{ … }
struct w83627ehf_data { … };
struct w83627ehf_sio_data { … };
static inline void w83627ehf_set_bank(struct w83627ehf_data *data, u16 reg)
{ … }
static u16 w83627ehf_read_value(struct w83627ehf_data *data, u16 reg)
{ … }
static int w83627ehf_write_value(struct w83627ehf_data *data, u16 reg,
u16 value)
{ … }
static u16 w83627ehf_read_temp(struct w83627ehf_data *data, u16 reg)
{ … }
static int w83627ehf_write_temp(struct w83627ehf_data *data, u16 reg,
u16 value)
{ … }
static void w83627ehf_write_fan_div(struct w83627ehf_data *data, int nr)
{ … }
static void w83627ehf_update_fan_div(struct w83627ehf_data *data)
{ … }
static void w83627ehf_update_pwm(struct w83627ehf_data *data)
{ … }
static struct w83627ehf_data *w83627ehf_update_device(struct device *dev)
{ … }
#define store_in_reg(REG, reg) …
store_in_reg(…)
store_in_reg(…)
static int
store_fan_min(struct device *dev, struct w83627ehf_data *data, int channel,
long val)
{ … }
#define store_temp_reg(addr, reg) …
store_temp_reg(reg_temp_over, temp_max);
store_temp_reg(reg_temp_hyst, temp_max_hyst);
static int
store_temp_offset(struct device *dev, struct w83627ehf_data *data, int channel,
long val)
{ … }
static int
store_pwm_mode(struct device *dev, struct w83627ehf_data *data, int channel,
long val)
{ … }
static int
store_pwm(struct device *dev, struct w83627ehf_data *data, int channel,
long val)
{ … }
static int
store_pwm_enable(struct device *dev, struct w83627ehf_data *data, int channel,
long val)
{ … }
#define show_tol_temp(reg) …
show_tol_temp(…) …
show_tol_temp(…) …
static ssize_t
store_target_temp(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t
store_tolerance(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static SENSOR_DEVICE_ATTR(pwm1_target, 0644, show_target_temp,
store_target_temp, 0);
static SENSOR_DEVICE_ATTR(pwm2_target, 0644, show_target_temp,
store_target_temp, 1);
static SENSOR_DEVICE_ATTR(pwm3_target, 0644, show_target_temp,
store_target_temp, 2);
static SENSOR_DEVICE_ATTR(pwm4_target, 0644, show_target_temp,
store_target_temp, 3);
static SENSOR_DEVICE_ATTR(pwm1_tolerance, 0644, show_tolerance,
store_tolerance, 0);
static SENSOR_DEVICE_ATTR(pwm2_tolerance, 0644, show_tolerance,
store_tolerance, 1);
static SENSOR_DEVICE_ATTR(pwm3_tolerance, 0644, show_tolerance,
store_tolerance, 2);
static SENSOR_DEVICE_ATTR(pwm4_tolerance, 0644, show_tolerance,
store_tolerance, 3);
#define fan_functions(reg, REG) …
fan_functions(…) …
fan_functions(…) …
fan_functions(…) …
fan_functions(…) …
#define fan_time_functions(reg, REG) … \
fan_time_functions(…) …
static SENSOR_DEVICE_ATTR(pwm4_stop_time, 0644, show_fan_stop_time,
store_fan_stop_time, 3);
static SENSOR_DEVICE_ATTR(pwm4_start_output, 0644, show_fan_start_output,
store_fan_start_output, 3);
static SENSOR_DEVICE_ATTR(pwm4_stop_output, 0644, show_fan_stop_output,
store_fan_stop_output, 3);
static SENSOR_DEVICE_ATTR(pwm4_max_output, 0644, show_fan_max_output,
store_fan_max_output, 3);
static SENSOR_DEVICE_ATTR(pwm4_step_output, 0644, show_fan_step_output,
store_fan_step_output, 3);
static SENSOR_DEVICE_ATTR(pwm3_stop_time, 0644, show_fan_stop_time,
store_fan_stop_time, 2);
static SENSOR_DEVICE_ATTR(pwm3_start_output, 0644, show_fan_start_output,
store_fan_start_output, 2);
static SENSOR_DEVICE_ATTR(pwm3_stop_output, 0644, show_fan_stop_output,
store_fan_stop_output, 2);
static SENSOR_DEVICE_ATTR(pwm1_stop_time, 0644, show_fan_stop_time,
store_fan_stop_time, 0);
static SENSOR_DEVICE_ATTR(pwm2_stop_time, 0644, show_fan_stop_time,
store_fan_stop_time, 1);
static SENSOR_DEVICE_ATTR(pwm1_start_output, 0644, show_fan_start_output,
store_fan_start_output, 0);
static SENSOR_DEVICE_ATTR(pwm2_start_output, 0644, show_fan_start_output,
store_fan_start_output, 1);
static SENSOR_DEVICE_ATTR(pwm1_stop_output, 0644, show_fan_stop_output,
store_fan_stop_output, 0);
static SENSOR_DEVICE_ATTR(pwm2_stop_output, 0644, show_fan_stop_output,
store_fan_stop_output, 1);
static SENSOR_DEVICE_ATTR(pwm1_max_output, 0644, show_fan_max_output,
store_fan_max_output, 0);
static SENSOR_DEVICE_ATTR(pwm1_step_output, 0644, show_fan_step_output,
store_fan_step_output, 0);
static SENSOR_DEVICE_ATTR(pwm2_max_output, 0644, show_fan_max_output,
store_fan_max_output, 1);
static SENSOR_DEVICE_ATTR(pwm2_step_output, 0644, show_fan_step_output,
store_fan_step_output, 1);
static SENSOR_DEVICE_ATTR(pwm3_max_output, 0644, show_fan_max_output,
store_fan_max_output, 2);
static SENSOR_DEVICE_ATTR(pwm3_step_output, 0644, show_fan_step_output,
store_fan_step_output, 2);
static ssize_t
cpu0_vid_show(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(cpu0_vid);
static int
clear_caseopen(struct device *dev, struct w83627ehf_data *data, int channel,
long val)
{ … }
static umode_t w83627ehf_attrs_visible(struct kobject *kobj,
struct attribute *a, int n)
{ … }
static struct attribute *w83627ehf_attrs[] = …;
static const struct attribute_group w83627ehf_group = …;
static const struct attribute_group *w83627ehf_groups[] = …;
static inline void w83627ehf_init_device(struct w83627ehf_data *data,
enum kinds kind)
{ … }
static void
w83627ehf_set_temp_reg_ehf(struct w83627ehf_data *data, int n_temp)
{ … }
static void
w83627ehf_check_fan_inputs(const struct w83627ehf_sio_data *sio_data,
struct w83627ehf_data *data)
{ … }
static umode_t
w83627ehf_is_visible(const void *drvdata, enum hwmon_sensor_types type,
u32 attr, int channel)
{ … }
static int
w83627ehf_do_read_temp(struct w83627ehf_data *data, u32 attr,
int channel, long *val)
{ … }
static int
w83627ehf_do_read_in(struct w83627ehf_data *data, u32 attr,
int channel, long *val)
{ … }
static int
w83627ehf_do_read_fan(struct w83627ehf_data *data, u32 attr,
int channel, long *val)
{ … }
static int
w83627ehf_do_read_pwm(struct w83627ehf_data *data, u32 attr,
int channel, long *val)
{ … }
static int
w83627ehf_do_read_intrusion(struct w83627ehf_data *data, u32 attr,
int channel, long *val)
{ … }
static int
w83627ehf_read(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long *val)
{ … }
static int
w83627ehf_read_string(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, const char **str)
{ … }
static int
w83627ehf_write(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long val)
{ … }
static const struct hwmon_ops w83627ehf_ops = …;
static const struct hwmon_channel_info * const w83627ehf_info[] = …;
static const struct hwmon_chip_info w83627ehf_chip_info = …;
static int __init w83627ehf_probe(struct platform_device *pdev)
{ … }
static int w83627ehf_suspend(struct device *dev)
{ … }
static int w83627ehf_resume(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(w83627ehf_dev_pm_ops, w83627ehf_suspend, w83627ehf_resume);
static struct platform_driver w83627ehf_driver = …;
static int __init w83627ehf_find(int sioaddr, unsigned short *addr,
struct w83627ehf_sio_data *sio_data)
{ … }
static struct platform_device *pdev;
static int __init sensors_w83627ehf_init(void)
{ … }
static void __exit sensors_w83627ehf_exit(void)
{ … }
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
module_init(…) …;
module_exit(sensors_w83627ehf_exit);