#define pr_fmt(fmt) …
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/pci.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/init.h>
#include <linux/mutex.h>
#include <linux/sysfs.h>
#include <linux/acpi.h>
#include <linux/io.h>
#define DRIVER_NAME …
static unsigned short force_addr;
module_param(force_addr, ushort, 0);
MODULE_PARM_DESC(…) …;
static struct platform_device *pdev;
#define VIA686A_EXTENT …
#define VIA686A_BASE_REG …
#define VIA686A_ENABLE_REG …
#define VIA686A_REG_IN_MAX(nr) …
#define VIA686A_REG_IN_MIN(nr) …
#define VIA686A_REG_IN(nr) …
#define VIA686A_REG_FAN_MIN(nr) …
#define VIA686A_REG_FAN(nr) …
static const u8 VIA686A_REG_TEMP[] = …;
static const u8 VIA686A_REG_TEMP_OVER[] = …;
static const u8 VIA686A_REG_TEMP_HYST[] = …;
#define VIA686A_REG_TEMP_LOW1 …
#define VIA686A_REG_TEMP_LOW23 …
#define VIA686A_REG_ALARM1 …
#define VIA686A_REG_ALARM2 …
#define VIA686A_REG_FANDIV …
#define VIA686A_REG_CONFIG …
#define VIA686A_REG_TEMP_MODE …
#define VIA686A_TEMP_MODE_MASK …
#define VIA686A_TEMP_MODE_CONTINUOUS …
static inline u8 IN_TO_REG(long val, int in_num)
{ … }
static inline long IN_FROM_REG(u8 val, int in_num)
{ … }
static inline u8 FAN_TO_REG(long rpm, int div)
{ … }
#define FAN_FROM_REG(val, div) …
static const s16 temp_lut[] = …;
static const u8 via_lut[] = …;
static inline u8 TEMP_TO_REG(long val)
{ … }
#define TEMP_FROM_REG(val) …
static inline long TEMP_FROM_REG10(u16 val)
{ … }
#define DIV_FROM_REG(val) …
#define DIV_TO_REG(val) …
struct via686a_data { … };
static struct pci_dev *s_bridge;
static inline int via686a_read_value(struct via686a_data *data, u8 reg)
{ … }
static inline void via686a_write_value(struct via686a_data *data, u8 reg,
u8 value)
{ … }
static void via686a_update_fan_div(struct via686a_data *data)
{ … }
static struct via686a_data *via686a_update_device(struct device *dev)
{ … }
static ssize_t in_show(struct device *dev, struct device_attribute *da,
char *buf) { … }
static ssize_t in_min_show(struct device *dev, struct device_attribute *da,
char *buf) { … }
static ssize_t in_max_show(struct device *dev, struct device_attribute *da,
char *buf) { … }
static ssize_t in_min_store(struct device *dev, struct device_attribute *da,
const char *buf, size_t count) { … }
static ssize_t in_max_store(struct device *dev, struct device_attribute *da,
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 ssize_t temp_show(struct device *dev, struct device_attribute *da,
char *buf) { … }
static ssize_t temp_over_show(struct device *dev, struct device_attribute *da,
char *buf) { … }
static ssize_t temp_hyst_show(struct device *dev, struct device_attribute *da,
char *buf) { … }
static ssize_t temp_over_store(struct device *dev,
struct device_attribute *da, const char *buf,
size_t count) { … }
static ssize_t temp_hyst_store(struct device *dev,
struct device_attribute *da, const char *buf,
size_t count) { … }
static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, 0);
static SENSOR_DEVICE_ATTR_RW(temp1_max, temp_over, 0);
static SENSOR_DEVICE_ATTR_RW(temp1_max_hyst, temp_hyst, 0);
static SENSOR_DEVICE_ATTR_RO(temp2_input, temp, 1);
static SENSOR_DEVICE_ATTR_RW(temp2_max, temp_over, 1);
static SENSOR_DEVICE_ATTR_RW(temp2_max_hyst, temp_hyst, 1);
static SENSOR_DEVICE_ATTR_RO(temp3_input, temp, 2);
static SENSOR_DEVICE_ATTR_RW(temp3_max, temp_over, 2);
static SENSOR_DEVICE_ATTR_RW(temp3_max_hyst, temp_hyst, 2);
static ssize_t fan_show(struct device *dev, struct device_attribute *da,
char *buf) { … }
static ssize_t fan_min_show(struct device *dev, struct device_attribute *da,
char *buf) { … }
static ssize_t fan_div_show(struct device *dev, struct device_attribute *da,
char *buf) { … }
static ssize_t fan_min_store(struct device *dev, struct device_attribute *da,
const char *buf, size_t count) { … }
static ssize_t fan_div_store(struct device *dev, struct device_attribute *da,
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_RW(fan1_div, fan_div, 0);
static SENSOR_DEVICE_ATTR_RO(fan2_input, fan, 1);
static SENSOR_DEVICE_ATTR_RW(fan2_min, fan_min, 1);
static SENSOR_DEVICE_ATTR_RW(fan2_div, fan_div, 1);
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(temp1_alarm, alarm, 4);
static SENSOR_DEVICE_ATTR_RO(temp2_alarm, alarm, 11);
static SENSOR_DEVICE_ATTR_RO(temp3_alarm, alarm, 15);
static SENSOR_DEVICE_ATTR_RO(fan1_alarm, alarm, 6);
static SENSOR_DEVICE_ATTR_RO(fan2_alarm, alarm, 7);
static ssize_t name_show(struct device *dev, struct device_attribute
*devattr, char *buf)
{ … }
static DEVICE_ATTR_RO(name);
static struct attribute *via686a_attributes[] = …;
static const struct attribute_group via686a_group = …;
static void via686a_init_device(struct via686a_data *data)
{ … }
static int via686a_probe(struct platform_device *pdev)
{ … }
static void via686a_remove(struct platform_device *pdev)
{ … }
static struct platform_driver via686a_driver = …;
static const struct pci_device_id via686a_pci_ids[] = …;
MODULE_DEVICE_TABLE(pci, via686a_pci_ids);
static int via686a_device_add(unsigned short address)
{ … }
static int via686a_pci_probe(struct pci_dev *dev,
const struct pci_device_id *id)
{ … }
static struct pci_driver via686a_pci_driver = …;
static int __init sm_via686a_init(void)
{ … }
static void __exit sm_via686a_exit(void)
{ … }
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
module_init(…) …;
module_exit(sm_via686a_exit);