#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/err.h>
#include <linux/mutex.h>
#include <linux/sysfs.h>
#include <linux/ioport.h>
#include <linux/acpi.h>
#include <linux/io.h>
static unsigned short force_id;
module_param(force_id, ushort, 0);
MODULE_PARM_DESC(…) …;
static struct platform_device *pdev;
#define DRVNAME …
struct pc87427_data { … };
struct pc87427_sio_data { … };
#define SIOREG_LDSEL …
#define SIOREG_DEVID …
#define SIOREG_CF2 …
#define SIOREG_CF3 …
#define SIOREG_CF4 …
#define SIOREG_CF5 …
#define SIOREG_CFB …
#define SIOREG_CFC …
#define SIOREG_CFD …
#define SIOREG_ACT …
#define SIOREG_MAP …
#define SIOREG_IOBASE …
static const u8 logdev[2] = …;
static const char *logdev_str[2] = …;
#define LD_FAN …
#define LD_IN …
#define LD_TEMP …
static inline int superio_enter(int sioaddr)
{ … }
static inline void superio_outb(int sioaddr, int reg, int val)
{ … }
static inline int superio_inb(int sioaddr, int reg)
{ … }
static inline void superio_exit(int sioaddr)
{ … }
#define REGION_LENGTH …
#define PC87427_REG_BANK …
#define BANK_FM(nr) …
#define BANK_FT(nr) …
#define BANK_FC(nr) …
#define BANK_TM(nr) …
#define BANK_VM(nr) …
static inline int pc87427_read8(struct pc87427_data *data, u8 ldi, u8 reg)
{ … }
static inline int pc87427_read8_bank(struct pc87427_data *data, u8 ldi,
u8 bank, u8 reg)
{ … }
static inline void pc87427_write8_bank(struct pc87427_data *data, u8 ldi,
u8 bank, u8 reg, u8 value)
{ … }
#define PC87427_REG_FAN …
#define PC87427_REG_FAN_MIN …
#define PC87427_REG_FAN_STATUS …
#define FAN_STATUS_STALL …
#define FAN_STATUS_LOSPD …
#define FAN_STATUS_MONEN …
static void pc87427_readall_fan(struct pc87427_data *data, u8 nr)
{ … }
static inline unsigned long fan_from_reg(u16 reg)
{ … }
static inline u16 fan_to_reg(unsigned long val)
{ … }
#define PC87427_REG_PWM_ENABLE …
#define PC87427_REG_PWM_DUTY …
#define PWM_ENABLE_MODE_MASK …
#define PWM_ENABLE_CTLEN …
#define PWM_MODE_MANUAL …
#define PWM_MODE_AUTO …
#define PWM_MODE_OFF …
#define PWM_MODE_ON …
static void pc87427_readall_pwm(struct pc87427_data *data, u8 nr)
{ … }
static inline int pwm_enable_from_reg(u8 reg)
{ … }
static inline u8 pwm_enable_to_reg(unsigned long val, u8 pwmval)
{ … }
#define PC87427_REG_TEMP_STATUS …
#define PC87427_REG_TEMP …
#define PC87427_REG_TEMP_MAX …
#define PC87427_REG_TEMP_MIN …
#define PC87427_REG_TEMP_CRIT …
#define PC87427_REG_TEMP_TYPE …
#define TEMP_STATUS_CHANEN …
#define TEMP_STATUS_LOWFLG …
#define TEMP_STATUS_HIGHFLG …
#define TEMP_STATUS_CRITFLG …
#define TEMP_STATUS_SENSERR …
#define TEMP_TYPE_MASK …
#define TEMP_TYPE_THERMISTOR …
#define TEMP_TYPE_REMOTE_DIODE …
#define TEMP_TYPE_LOCAL_DIODE …
static void pc87427_readall_temp(struct pc87427_data *data, u8 nr)
{ … }
static inline unsigned int temp_type_from_reg(u8 reg)
{ … }
static inline long temp_from_reg(s16 reg)
{ … }
static inline long temp_from_reg8(s8 reg)
{ … }
static struct pc87427_data *pc87427_update_device(struct device *dev)
{ … }
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_alarm_show(struct device *dev,
struct device_attribute *devattr, char *buf)
{ … }
static ssize_t fan_fault_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_RO(fan2_input, fan_input, 1);
static SENSOR_DEVICE_ATTR_RO(fan3_input, fan_input, 2);
static SENSOR_DEVICE_ATTR_RO(fan4_input, fan_input, 3);
static SENSOR_DEVICE_ATTR_RO(fan5_input, fan_input, 4);
static SENSOR_DEVICE_ATTR_RO(fan6_input, fan_input, 5);
static SENSOR_DEVICE_ATTR_RO(fan7_input, fan_input, 6);
static SENSOR_DEVICE_ATTR_RO(fan8_input, fan_input, 7);
static SENSOR_DEVICE_ATTR_RW(fan1_min, fan_min, 0);
static SENSOR_DEVICE_ATTR_RW(fan2_min, fan_min, 1);
static SENSOR_DEVICE_ATTR_RW(fan3_min, fan_min, 2);
static SENSOR_DEVICE_ATTR_RW(fan4_min, fan_min, 3);
static SENSOR_DEVICE_ATTR_RW(fan5_min, fan_min, 4);
static SENSOR_DEVICE_ATTR_RW(fan6_min, fan_min, 5);
static SENSOR_DEVICE_ATTR_RW(fan7_min, fan_min, 6);
static SENSOR_DEVICE_ATTR_RW(fan8_min, fan_min, 7);
static SENSOR_DEVICE_ATTR_RO(fan1_alarm, fan_alarm, 0);
static SENSOR_DEVICE_ATTR_RO(fan2_alarm, fan_alarm, 1);
static SENSOR_DEVICE_ATTR_RO(fan3_alarm, fan_alarm, 2);
static SENSOR_DEVICE_ATTR_RO(fan4_alarm, fan_alarm, 3);
static SENSOR_DEVICE_ATTR_RO(fan5_alarm, fan_alarm, 4);
static SENSOR_DEVICE_ATTR_RO(fan6_alarm, fan_alarm, 5);
static SENSOR_DEVICE_ATTR_RO(fan7_alarm, fan_alarm, 6);
static SENSOR_DEVICE_ATTR_RO(fan8_alarm, fan_alarm, 7);
static SENSOR_DEVICE_ATTR_RO(fan1_fault, fan_fault, 0);
static SENSOR_DEVICE_ATTR_RO(fan2_fault, fan_fault, 1);
static SENSOR_DEVICE_ATTR_RO(fan3_fault, fan_fault, 2);
static SENSOR_DEVICE_ATTR_RO(fan4_fault, fan_fault, 3);
static SENSOR_DEVICE_ATTR_RO(fan5_fault, fan_fault, 4);
static SENSOR_DEVICE_ATTR_RO(fan6_fault, fan_fault, 5);
static SENSOR_DEVICE_ATTR_RO(fan7_fault, fan_fault, 6);
static SENSOR_DEVICE_ATTR_RO(fan8_fault, fan_fault, 7);
static struct attribute *pc87427_attributes_fan[8][5] = …;
static const struct attribute_group pc87427_group_fan[8] = …;
static void update_pwm_enable(struct pc87427_data *data, int nr, u8 mode)
{ … }
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 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_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 SENSOR_DEVICE_ATTR_RW(pwm4_enable, pwm_enable, 3);
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 SENSOR_DEVICE_ATTR_RW(pwm4, pwm, 3);
static struct attribute *pc87427_attributes_pwm[4][3] = …;
static const struct attribute_group pc87427_group_pwm[4] = …;
static ssize_t temp_input_show(struct device *dev,
struct device_attribute *devattr, char *buf)
{ … }
static ssize_t temp_min_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_crit_show(struct device *dev,
struct device_attribute *devattr, char *buf)
{ … }
static ssize_t temp_type_show(struct device *dev,
struct device_attribute *devattr, char *buf)
{ … }
static ssize_t temp_min_alarm_show(struct device *dev,
struct device_attribute *devattr,
char *buf)
{ … }
static ssize_t temp_max_alarm_show(struct device *dev,
struct device_attribute *devattr,
char *buf)
{ … }
static ssize_t temp_crit_alarm_show(struct device *dev,
struct device_attribute *devattr,
char *buf)
{ … }
static ssize_t temp_fault_show(struct device *dev,
struct device_attribute *devattr, char *buf)
{ … }
static SENSOR_DEVICE_ATTR_RO(temp1_input, temp_input, 0);
static SENSOR_DEVICE_ATTR_RO(temp2_input, temp_input, 1);
static SENSOR_DEVICE_ATTR_RO(temp3_input, temp_input, 2);
static SENSOR_DEVICE_ATTR_RO(temp4_input, temp_input, 3);
static SENSOR_DEVICE_ATTR_RO(temp5_input, temp_input, 4);
static SENSOR_DEVICE_ATTR_RO(temp6_input, temp_input, 5);
static SENSOR_DEVICE_ATTR_RO(temp1_min, temp_min, 0);
static SENSOR_DEVICE_ATTR_RO(temp2_min, temp_min, 1);
static SENSOR_DEVICE_ATTR_RO(temp3_min, temp_min, 2);
static SENSOR_DEVICE_ATTR_RO(temp4_min, temp_min, 3);
static SENSOR_DEVICE_ATTR_RO(temp5_min, temp_min, 4);
static SENSOR_DEVICE_ATTR_RO(temp6_min, temp_min, 5);
static SENSOR_DEVICE_ATTR_RO(temp1_max, temp_max, 0);
static SENSOR_DEVICE_ATTR_RO(temp2_max, temp_max, 1);
static SENSOR_DEVICE_ATTR_RO(temp3_max, temp_max, 2);
static SENSOR_DEVICE_ATTR_RO(temp4_max, temp_max, 3);
static SENSOR_DEVICE_ATTR_RO(temp5_max, temp_max, 4);
static SENSOR_DEVICE_ATTR_RO(temp6_max, temp_max, 5);
static SENSOR_DEVICE_ATTR_RO(temp1_crit, temp_crit, 0);
static SENSOR_DEVICE_ATTR_RO(temp2_crit, temp_crit, 1);
static SENSOR_DEVICE_ATTR_RO(temp3_crit, temp_crit, 2);
static SENSOR_DEVICE_ATTR_RO(temp4_crit, temp_crit, 3);
static SENSOR_DEVICE_ATTR_RO(temp5_crit, temp_crit, 4);
static SENSOR_DEVICE_ATTR_RO(temp6_crit, temp_crit, 5);
static SENSOR_DEVICE_ATTR_RO(temp1_type, temp_type, 0);
static SENSOR_DEVICE_ATTR_RO(temp2_type, temp_type, 1);
static SENSOR_DEVICE_ATTR_RO(temp3_type, temp_type, 2);
static SENSOR_DEVICE_ATTR_RO(temp4_type, temp_type, 3);
static SENSOR_DEVICE_ATTR_RO(temp5_type, temp_type, 4);
static SENSOR_DEVICE_ATTR_RO(temp6_type, temp_type, 5);
static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, temp_min_alarm, 0);
static SENSOR_DEVICE_ATTR_RO(temp2_min_alarm, temp_min_alarm, 1);
static SENSOR_DEVICE_ATTR_RO(temp3_min_alarm, temp_min_alarm, 2);
static SENSOR_DEVICE_ATTR_RO(temp4_min_alarm, temp_min_alarm, 3);
static SENSOR_DEVICE_ATTR_RO(temp5_min_alarm, temp_min_alarm, 4);
static SENSOR_DEVICE_ATTR_RO(temp6_min_alarm, temp_min_alarm, 5);
static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, temp_max_alarm, 0);
static SENSOR_DEVICE_ATTR_RO(temp2_max_alarm, temp_max_alarm, 1);
static SENSOR_DEVICE_ATTR_RO(temp3_max_alarm, temp_max_alarm, 2);
static SENSOR_DEVICE_ATTR_RO(temp4_max_alarm, temp_max_alarm, 3);
static SENSOR_DEVICE_ATTR_RO(temp5_max_alarm, temp_max_alarm, 4);
static SENSOR_DEVICE_ATTR_RO(temp6_max_alarm, temp_max_alarm, 5);
static SENSOR_DEVICE_ATTR_RO(temp1_crit_alarm, temp_crit_alarm, 0);
static SENSOR_DEVICE_ATTR_RO(temp2_crit_alarm, temp_crit_alarm, 1);
static SENSOR_DEVICE_ATTR_RO(temp3_crit_alarm, temp_crit_alarm, 2);
static SENSOR_DEVICE_ATTR_RO(temp4_crit_alarm, temp_crit_alarm, 3);
static SENSOR_DEVICE_ATTR_RO(temp5_crit_alarm, temp_crit_alarm, 4);
static SENSOR_DEVICE_ATTR_RO(temp6_crit_alarm, temp_crit_alarm, 5);
static SENSOR_DEVICE_ATTR_RO(temp1_fault, temp_fault, 0);
static SENSOR_DEVICE_ATTR_RO(temp2_fault, temp_fault, 1);
static SENSOR_DEVICE_ATTR_RO(temp3_fault, temp_fault, 2);
static SENSOR_DEVICE_ATTR_RO(temp4_fault, temp_fault, 3);
static SENSOR_DEVICE_ATTR_RO(temp5_fault, temp_fault, 4);
static SENSOR_DEVICE_ATTR_RO(temp6_fault, temp_fault, 5);
static struct attribute *pc87427_attributes_temp[6][10] = …;
static const struct attribute_group pc87427_group_temp[6] = …;
static ssize_t name_show(struct device *dev, struct device_attribute
*devattr, char *buf)
{ … }
static DEVICE_ATTR_RO(name);
static int pc87427_request_regions(struct platform_device *pdev,
int count)
{ … }
static void pc87427_init_device(struct device *dev)
{ … }
static void pc87427_remove_files(struct device *dev)
{ … }
static int pc87427_probe(struct platform_device *pdev)
{ … }
static void pc87427_remove(struct platform_device *pdev)
{ … }
static struct platform_driver pc87427_driver = …;
static int __init pc87427_device_add(const struct pc87427_sio_data *sio_data)
{ … }
static int __init pc87427_find(int sioaddr, struct pc87427_sio_data *sio_data)
{ … }
static int __init pc87427_init(void)
{ … }
static void __exit pc87427_exit(void)
{ … }
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
module_init(…) …;
module_exit(pc87427_exit);