#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/ioport.h>
#include <linux/acpi.h>
#include <linux/io.h>
#include "lm75.h"
static struct platform_device *pdev;
#define DRVNAME …
enum chips { … };
struct w83627hf_sio_data { … };
static u8 force_i2c = …;
module_param(force_i2c, byte, 0);
MODULE_PARM_DESC(…) …;
static bool init = …;
module_param(init, bool, 0);
MODULE_PARM_DESC(…) …;
static unsigned short force_id;
module_param(force_id, ushort, 0);
MODULE_PARM_DESC(…) …;
#define DEV …
#define W83627HF_LD_FDC …
#define W83627HF_LD_PRT …
#define W83627HF_LD_UART1 …
#define W83627HF_LD_UART2 …
#define W83627HF_LD_KBC …
#define W83627HF_LD_CIR …
#define W83627HF_LD_GAME …
#define W83627HF_LD_MIDI …
#define W83627HF_LD_GPIO1 …
#define W83627HF_LD_GPIO5 …
#define W83627HF_LD_GPIO2 …
#define W83627HF_LD_GPIO3 …
#define W83627HF_LD_GPIO4 …
#define W83627HF_LD_ACPI …
#define W83627HF_LD_HWM …
#define DEVID …
#define W83627THF_GPIO5_EN …
#define W83627THF_GPIO5_IOSR …
#define W83627THF_GPIO5_DR …
#define W83687THF_VID_EN …
#define W83687THF_VID_CFG …
#define W83687THF_VID_DATA …
static inline void
superio_outb(struct w83627hf_sio_data *sio, int reg, int val)
{ … }
static inline int
superio_inb(struct w83627hf_sio_data *sio, int reg)
{ … }
static inline void
superio_select(struct w83627hf_sio_data *sio, int ld)
{ … }
static inline int
superio_enter(struct w83627hf_sio_data *sio)
{ … }
static inline void
superio_exit(struct w83627hf_sio_data *sio)
{ … }
#define W627_DEVID …
#define W627THF_DEVID …
#define W697_DEVID …
#define W637_DEVID …
#define W687THF_DEVID …
#define WINB_ACT_REG …
#define WINB_BASE_REG …
#define WINB_ALIGNMENT …
#define WINB_REGION_OFFSET …
#define WINB_REGION_SIZE …
#define W83781D_ADDR_REG_OFFSET …
#define W83781D_DATA_REG_OFFSET …
#define W83781D_REG_IN_MAX(nr) …
#define W83781D_REG_IN_MIN(nr) …
#define W83781D_REG_IN(nr) …
#define W83627HF_REG_FAN_MIN(nr) …
#define W83627HF_REG_FAN(nr) …
#define W83627HF_REG_TEMP2_CONFIG …
#define W83627HF_REG_TEMP3_CONFIG …
static const u16 w83627hf_reg_temp[] = …;
static const u16 w83627hf_reg_temp_hyst[] = …;
static const u16 w83627hf_reg_temp_over[] = …;
#define W83781D_REG_BANK …
#define W83781D_REG_CONFIG …
#define W83781D_REG_ALARM1 …
#define W83781D_REG_ALARM2 …
#define W83781D_REG_ALARM3 …
#define W83781D_REG_BEEP_CONFIG …
#define W83781D_REG_BEEP_INTS1 …
#define W83781D_REG_BEEP_INTS2 …
#define W83781D_REG_BEEP_INTS3 …
#define W83781D_REG_VID_FANDIV …
#define W83781D_REG_CHIPID …
#define W83781D_REG_WCHIPID …
#define W83781D_REG_CHIPMAN …
#define W83781D_REG_PIN …
#define W83781D_REG_VBAT …
#define W83627HF_REG_PWM1 …
#define W83627HF_REG_PWM2 …
static const u8 W83627THF_REG_PWM_ENABLE[] = …;
static const u8 W83627THF_PWM_ENABLE_SHIFT[] = …;
#define W83627THF_REG_PWM1 …
#define W83627THF_REG_PWM2 …
#define W83627THF_REG_PWM3 …
#define W83627THF_REG_VRM_OVT_CFG …
static const u8 regpwm_627hf[] = …;
static const u8 regpwm[] = …;
#define W836X7HF_REG_PWM(type, nr) …
#define W83627HF_REG_PWM_FREQ …
#define W83637HF_REG_PWM_FREQ1 …
#define W83637HF_REG_PWM_FREQ2 …
#define W83637HF_REG_PWM_FREQ3 …
static const u8 W83637HF_REG_PWM_FREQ[] = …;
#define W83627HF_BASE_PWM_FREQ …
#define W83781D_REG_I2C_ADDR …
#define W83781D_REG_I2C_SUBADDR …
#define W83781D_REG_SCFG1 …
static const u8 BIT_SCFG1[] = …;
#define W83781D_REG_SCFG2 …
static const u8 BIT_SCFG2[] = …;
#define W83781D_DEFAULT_BETA …
#define IN_TO_REG(val) …
#define IN_FROM_REG(val) …
static inline u8 FAN_TO_REG(long rpm, int div)
{ … }
#define TEMP_MIN …
#define TEMP_MAX …
static u8 TEMP_TO_REG(long temp)
{ … }
static int TEMP_FROM_REG(u8 reg)
{ … }
#define FAN_FROM_REG(val,div) …
#define PWM_TO_REG(val) …
static inline unsigned long pwm_freq_from_reg_627hf(u8 reg)
{ … }
static inline u8 pwm_freq_to_reg_627hf(unsigned long val)
{ … }
static inline unsigned long pwm_freq_from_reg(u8 reg)
{ … }
static inline u8 pwm_freq_to_reg(unsigned long val)
{ … }
#define BEEP_MASK_FROM_REG(val) …
#define BEEP_MASK_TO_REG(val) …
#define DIV_FROM_REG(val) …
static inline u8 DIV_TO_REG(long val)
{ … }
struct w83627hf_data { … };
static inline void w83627hf_set_bank(struct w83627hf_data *data, u16 reg)
{ … }
static inline void w83627hf_reset_bank(struct w83627hf_data *data, u16 reg)
{ … }
static int w83627hf_read_value(struct w83627hf_data *data, u16 reg)
{ … }
static int w83627hf_write_value(struct w83627hf_data *data, u16 reg, u16 value)
{ … }
static void w83627hf_update_fan_div(struct w83627hf_data *data)
{ … }
static struct w83627hf_data *w83627hf_update_device(struct device *dev)
{ … }
#ifdef CONFIG_PM
static int w83627hf_suspend(struct device *dev)
{ … }
static int w83627hf_resume(struct device *dev)
{ … }
static const struct dev_pm_ops w83627hf_dev_pm_ops = …;
#define W83627HF_DEV_PM_OPS …
#else
#define W83627HF_DEV_PM_OPS …
#endif
static int w83627thf_read_gpio5(struct platform_device *pdev)
{ … }
static int w83687thf_read_vid(struct platform_device *pdev)
{ … }
static void w83627hf_init_device(struct platform_device *pdev)
{ … }
static ssize_t show_in_0(struct w83627hf_data *data, char *buf, u8 reg)
{ … }
static ssize_t in0_input_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(in0_input);
static ssize_t in0_min_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t in0_min_store(struct device *dev,
struct device_attribute *attr, const char *buf,
size_t count)
{ … }
static DEVICE_ATTR_RW(in0_min);
static ssize_t in0_max_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t in0_max_store(struct device *dev,
struct device_attribute *attr, const char *buf,
size_t count)
{ … }
static DEVICE_ATTR_RW(in0_max);
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, 9);
static SENSOR_DEVICE_ATTR_RO(in6_alarm, alarm, 10);
static SENSOR_DEVICE_ATTR_RO(in7_alarm, alarm, 16);
static SENSOR_DEVICE_ATTR_RO(in8_alarm, alarm, 17);
static SENSOR_DEVICE_ATTR_RO(fan1_alarm, alarm, 6);
static SENSOR_DEVICE_ATTR_RO(fan2_alarm, alarm, 7);
static SENSOR_DEVICE_ATTR_RO(fan3_alarm, alarm, 11);
static SENSOR_DEVICE_ATTR_RO(temp1_alarm, alarm, 4);
static SENSOR_DEVICE_ATTR_RO(temp2_alarm, alarm, 5);
static SENSOR_DEVICE_ATTR_RO(temp3_alarm, alarm, 13);
static ssize_t
beep_show(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
beep_store(struct device *dev, struct device_attribute *attr, const char *buf,
size_t count)
{ … }
static SENSOR_DEVICE_ATTR_RW(in0_beep, beep, 0);
static SENSOR_DEVICE_ATTR_RW(in1_beep, beep, 1);
static SENSOR_DEVICE_ATTR_RW(in2_beep, beep, 2);
static SENSOR_DEVICE_ATTR_RW(in3_beep, beep, 3);
static SENSOR_DEVICE_ATTR_RW(in4_beep, beep, 8);
static SENSOR_DEVICE_ATTR_RW(in5_beep, beep, 9);
static SENSOR_DEVICE_ATTR_RW(in6_beep, beep, 10);
static SENSOR_DEVICE_ATTR_RW(in7_beep, beep, 16);
static SENSOR_DEVICE_ATTR_RW(in8_beep, beep, 17);
static SENSOR_DEVICE_ATTR_RW(fan1_beep, beep, 6);
static SENSOR_DEVICE_ATTR_RW(fan2_beep, beep, 7);
static SENSOR_DEVICE_ATTR_RW(fan3_beep, beep, 11);
static SENSOR_DEVICE_ATTR_RW(temp1_beep, beep, 4);
static SENSOR_DEVICE_ATTR_RW(temp2_beep, beep, 5);
static SENSOR_DEVICE_ATTR_RW(temp3_beep, beep, 13);
static SENSOR_DEVICE_ATTR_RW(beep_enable, beep, 15);
static ssize_t
in_input_show(struct device *dev, struct device_attribute *devattr, char *buf)
{ … }
static ssize_t
in_min_show(struct device *dev, struct device_attribute *devattr, char *buf)
{ … }
static ssize_t
in_min_store(struct device *dev, struct device_attribute *devattr,
const char *buf, size_t count)
{ … }
static ssize_t
in_max_show(struct device *dev, struct device_attribute *devattr, char *buf)
{ … }
static ssize_t
in_max_store(struct device *dev, struct device_attribute *devattr,
const char *buf, size_t count)
{ … }
static SENSOR_DEVICE_ATTR_RO(in1_input, in_input, 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_input, 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_input, 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_input, 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_input, 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_input, 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_input, 7);
static SENSOR_DEVICE_ATTR_RW(in7_min, in_min, 7);
static SENSOR_DEVICE_ATTR_RW(in7_max, in_max, 7);
static SENSOR_DEVICE_ATTR_RO(in8_input, in_input, 8);
static SENSOR_DEVICE_ATTR_RW(in8_min, in_min, 8);
static SENSOR_DEVICE_ATTR_RW(in8_max, in_max, 8);
static ssize_t
fan_input_show(struct device *dev, struct device_attribute *devattr,
char *buf)
{ … }
static ssize_t
fan_min_show(struct device *dev, struct device_attribute *devattr, char *buf)
{ … }
static ssize_t
fan_min_store(struct device *dev, struct device_attribute *devattr,
const char *buf, size_t count)
{ … }
static SENSOR_DEVICE_ATTR_RO(fan1_input, fan_input, 0);
static SENSOR_DEVICE_ATTR_RW(fan1_min, fan_min, 0);
static SENSOR_DEVICE_ATTR_RO(fan2_input, fan_input, 1);
static SENSOR_DEVICE_ATTR_RW(fan2_min, fan_min, 1);
static SENSOR_DEVICE_ATTR_RO(fan3_input, fan_input, 2);
static SENSOR_DEVICE_ATTR_RW(fan3_min, fan_min, 2);
static ssize_t
fan_div_show(struct device *dev, struct device_attribute *devattr, char *buf)
{ … }
static ssize_t
fan_div_store(struct device *dev, struct device_attribute *devattr,
const char *buf, size_t count)
{ … }
static SENSOR_DEVICE_ATTR_RW(fan1_div, fan_div, 0);
static SENSOR_DEVICE_ATTR_RW(fan2_div, fan_div, 1);
static SENSOR_DEVICE_ATTR_RW(fan3_div, fan_div, 2);
static ssize_t
temp_show(struct device *dev, struct device_attribute *devattr, char *buf)
{ … }
static ssize_t
temp_max_show(struct device *dev, struct device_attribute *devattr, char *buf)
{ … }
static ssize_t
temp_max_store(struct device *dev, struct device_attribute *devattr,
const char *buf, size_t count)
{ … }
static ssize_t
temp_max_hyst_show(struct device *dev, struct device_attribute *devattr,
char *buf)
{ … }
static ssize_t
temp_max_hyst_store(struct device *dev, struct device_attribute *devattr,
const char *buf, size_t count)
{ … }
static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, 0);
static SENSOR_DEVICE_ATTR_RW(temp1_max, temp_max, 0);
static SENSOR_DEVICE_ATTR_RW(temp1_max_hyst, temp_max_hyst, 0);
static SENSOR_DEVICE_ATTR_RO(temp2_input, temp, 1);
static SENSOR_DEVICE_ATTR_RW(temp2_max, temp_max, 1);
static SENSOR_DEVICE_ATTR_RW(temp2_max_hyst, temp_max_hyst, 1);
static SENSOR_DEVICE_ATTR_RO(temp3_input, temp, 2);
static SENSOR_DEVICE_ATTR_RW(temp3_max, temp_max, 2);
static SENSOR_DEVICE_ATTR_RW(temp3_max_hyst, temp_max_hyst, 2);
static ssize_t
temp_type_show(struct device *dev, struct device_attribute *devattr,
char *buf)
{ … }
static ssize_t
temp_type_store(struct device *dev, struct device_attribute *devattr,
const char *buf, size_t count)
{ … }
static SENSOR_DEVICE_ATTR_RW(temp1_type, temp_type, 0);
static SENSOR_DEVICE_ATTR_RW(temp2_type, temp_type, 1);
static SENSOR_DEVICE_ATTR_RW(temp3_type, temp_type, 2);
static ssize_t
alarms_show(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(alarms);
#define VIN_UNIT_ATTRS(_X_) …
#define FAN_UNIT_ATTRS(_X_) …
#define TEMP_UNIT_ATTRS(_X_) …
static ssize_t
beep_mask_show(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
beep_mask_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR_RW(beep_mask);
static ssize_t
pwm_show(struct device *dev, struct device_attribute *devattr, char *buf)
{ … }
static ssize_t
pwm_store(struct device *dev, struct device_attribute *devattr,
const char *buf, size_t count)
{ … }
static SENSOR_DEVICE_ATTR_RW(pwm1, pwm, 0);
static SENSOR_DEVICE_ATTR_RW(pwm2, pwm, 1);
static SENSOR_DEVICE_ATTR_RW(pwm3, pwm, 2);
static ssize_t
name_show(struct device *dev, struct device_attribute *devattr, char *buf)
{ … }
static DEVICE_ATTR_RO(name);
static struct attribute *w83627hf_attributes[] = …;
static const struct attribute_group w83627hf_group = …;
static ssize_t
pwm_freq_show(struct device *dev, struct device_attribute *devattr, char *buf)
{ … }
static ssize_t
pwm_freq_store(struct device *dev, struct device_attribute *devattr,
const char *buf, size_t count)
{ … }
static SENSOR_DEVICE_ATTR_RW(pwm1_freq, pwm_freq, 0);
static SENSOR_DEVICE_ATTR_RW(pwm2_freq, pwm_freq, 1);
static SENSOR_DEVICE_ATTR_RW(pwm3_freq, pwm_freq, 2);
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
pwm_enable_show(struct device *dev, struct device_attribute *devattr,
char *buf)
{ … }
static ssize_t
pwm_enable_store(struct device *dev, struct device_attribute *devattr,
const char *buf, size_t count)
{ … }
static SENSOR_DEVICE_ATTR_RW(pwm1_enable, pwm_enable, 0);
static SENSOR_DEVICE_ATTR_RW(pwm2_enable, pwm_enable, 1);
static SENSOR_DEVICE_ATTR_RW(pwm3_enable, pwm_enable, 2);
static struct attribute *w83627hf_attributes_opt[] = …;
static const struct attribute_group w83627hf_group_opt = …;
static int w83627hf_probe(struct platform_device *pdev)
{ … }
static void w83627hf_remove(struct platform_device *pdev)
{ … }
static struct platform_driver w83627hf_driver = …;
static int __init w83627hf_find(int sioaddr, unsigned short *addr,
struct w83627hf_sio_data *sio_data)
{ … }
static int __init w83627hf_device_add(unsigned short address,
const struct w83627hf_sio_data *sio_data)
{ … }
static int __init sensors_w83627hf_init(void)
{ … }
static void __exit sensors_w83627hf_exit(void)
{ … }
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
module_init(…) …;
module_exit(sensors_w83627hf_exit);