#define pr_fmt(fmt) …
#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/jiffies.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
enum kinds { … };
static bool force;
module_param(force, bool, 0);
MODULE_PARM_DESC(…) …;
static const char * const nct6683_device_names[] = …;
static const char * const nct6683_chip_names[] = …;
#define DRVNAME …
#define NCT6683_LD_ACPI …
#define NCT6683_LD_HWM …
#define NCT6683_LD_VID …
#define SIO_REG_LDSEL …
#define SIO_REG_DEVID …
#define SIO_REG_ENABLE …
#define SIO_REG_ADDR …
#define SIO_NCT6681_ID …
#define SIO_NCT6683_ID …
#define SIO_NCT6686_ID …
#define SIO_NCT6687_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 EC_PAGE_REG …
#define EC_INDEX_REG …
#define EC_DATA_REG …
#define EC_EVENT_REG …
#define NCT6683_NUM_REG_MON …
#define NCT6683_NUM_REG_FAN …
#define NCT6683_NUM_REG_PWM …
#define NCT6683_REG_MON(x) …
#define NCT6683_REG_FAN_RPM(x) …
#define NCT6683_REG_PWM(x) …
#define NCT6683_REG_PWM_WRITE(x) …
#define NCT6683_REG_MON_STS(x) …
#define NCT6683_REG_IDLE(x) …
#define NCT6683_REG_FAN_STS(x) …
#define NCT6683_REG_FAN_ERRSTS …
#define NCT6683_REG_FAN_INITSTS …
#define NCT6683_HWM_CFG …
#define NCT6683_REG_MON_CFG(x) …
#define NCT6683_REG_FANIN_CFG(x) …
#define NCT6683_REG_FANOUT_CFG(x) …
#define NCT6683_REG_INTEL_TEMP_MAX(x) …
#define NCT6683_REG_INTEL_TEMP_CRIT(x) …
#define NCT6683_REG_TEMP_HYST(x) …
#define NCT6683_REG_TEMP_MAX(x) …
#define NCT6683_REG_MON_HIGH(x) …
#define NCT6683_REG_MON_LOW(x) …
#define NCT6683_REG_FAN_MIN(x) …
#define NCT6683_REG_FAN_CFG_CTRL …
#define NCT6683_FAN_CFG_REQ …
#define NCT6683_FAN_CFG_DONE …
#define NCT6683_REG_CUSTOMER_ID …
#define NCT6683_CUSTOMER_ID_INTEL …
#define NCT6683_CUSTOMER_ID_MITAC …
#define NCT6683_CUSTOMER_ID_MSI …
#define NCT6683_CUSTOMER_ID_MSI2 …
#define NCT6683_CUSTOMER_ID_MSI3 …
#define NCT6683_CUSTOMER_ID_ASROCK …
#define NCT6683_CUSTOMER_ID_ASROCK2 …
#define NCT6683_CUSTOMER_ID_ASROCK3 …
#define NCT6683_REG_BUILD_YEAR …
#define NCT6683_REG_BUILD_MONTH …
#define NCT6683_REG_BUILD_DAY …
#define NCT6683_REG_SERIAL …
#define NCT6683_REG_VERSION_HI …
#define NCT6683_REG_VERSION_LO …
#define NCT6683_REG_CR_CASEOPEN …
#define NCT6683_CR_CASEOPEN_MASK …
#define NCT6683_REG_CR_BEEP …
#define NCT6683_CR_BEEP_MASK …
static const char *const nct6683_mon_label[] = …;
#define NUM_MON_LABELS …
#define MON_VOLTAGE_START …
struct nct6683_data { … };
struct nct6683_sio_data { … };
struct sensor_device_template { … };
struct sensor_device_attr_u { … };
#define __TEMPLATE_ATTR(_template, _mode, _show, _store) …
#define SENSOR_DEVICE_TEMPLATE(_template, _mode, _show, _store, _index) …
#define SENSOR_DEVICE_TEMPLATE_2(_template, _mode, _show, _store, \
_nr, _index) …
#define SENSOR_TEMPLATE(_name, _template, _mode, _show, _store, _index) …
#define SENSOR_TEMPLATE_2(_name, _template, _mode, _show, _store, \
_nr, _index) …
struct sensor_template_group { … };
static struct attribute_group *
nct6683_create_attr_group(struct device *dev,
const struct sensor_template_group *tg,
int repeat)
{ … }
#define MON_SRC_VCC …
#define MON_SRC_VSB …
#define MON_SRC_AVSB …
#define MON_SRC_VBAT …
static inline long in_from_reg(u16 reg, u8 src)
{ … }
static u16 nct6683_read(struct nct6683_data *data, u16 reg)
{ … }
static u16 nct6683_read16(struct nct6683_data *data, u16 reg)
{ … }
static void nct6683_write(struct nct6683_data *data, u16 reg, u16 value)
{ … }
static int get_in_reg(struct nct6683_data *data, int nr, int index)
{ … }
static int get_temp_reg(struct nct6683_data *data, int nr, int index)
{ … }
static void nct6683_update_pwm(struct device *dev)
{ … }
static struct nct6683_data *nct6683_update_device(struct device *dev)
{ … }
static ssize_t
show_in_label(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
show_in_reg(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static umode_t nct6683_in_is_visible(struct kobject *kobj,
struct attribute *attr, int index)
{ … }
SENSOR_TEMPLATE(in_label, "in%d_label", S_IRUGO, show_in_label, NULL, 0);
SENSOR_TEMPLATE_2(in_input, "in%d_input", S_IRUGO, show_in_reg, NULL, 0, 0);
SENSOR_TEMPLATE_2(in_min, "in%d_min", S_IRUGO, show_in_reg, NULL, 0, 1);
SENSOR_TEMPLATE_2(in_max, "in%d_max", S_IRUGO, show_in_reg, NULL, 0, 2);
static struct sensor_device_template *nct6683_attributes_in_template[] = …;
static const struct sensor_template_group nct6683_in_template_group = …;
static ssize_t
show_fan(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
show_fan_min(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
show_fan_pulses(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static umode_t nct6683_fan_is_visible(struct kobject *kobj,
struct attribute *attr, int index)
{ … }
SENSOR_TEMPLATE(fan_input, "fan%d_input", S_IRUGO, show_fan, NULL, 0);
SENSOR_TEMPLATE(fan_pulses, "fan%d_pulses", S_IRUGO, show_fan_pulses, NULL, 0);
SENSOR_TEMPLATE(fan_min, "fan%d_min", S_IRUGO, show_fan_min, NULL, 0);
static struct sensor_device_template *nct6683_attributes_fan_template[] = …;
static const struct sensor_template_group nct6683_fan_template_group = …;
static ssize_t
show_temp_label(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
show_temp8(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
show_temp_hyst(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
show_temp16(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static int get_temp_type(u8 src)
{ … }
static ssize_t
show_temp_type(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static umode_t nct6683_temp_is_visible(struct kobject *kobj,
struct attribute *attr, int index)
{ … }
SENSOR_TEMPLATE(temp_input, "temp%d_input", S_IRUGO, show_temp16, NULL, 0);
SENSOR_TEMPLATE(temp_label, "temp%d_label", S_IRUGO, show_temp_label, NULL, 0);
SENSOR_TEMPLATE_2(temp_min, "temp%d_min", S_IRUGO, show_temp8, NULL, 0, 0);
SENSOR_TEMPLATE_2(temp_max, "temp%d_max", S_IRUGO, show_temp8, NULL, 0, 1);
SENSOR_TEMPLATE(temp_max_hyst, "temp%d_max_hyst", S_IRUGO, show_temp_hyst, NULL,
0);
SENSOR_TEMPLATE_2(temp_crit, "temp%d_crit", S_IRUGO, show_temp8, NULL, 0, 3);
SENSOR_TEMPLATE(temp_type, "temp%d_type", S_IRUGO, show_temp_type, NULL, 0);
static struct sensor_device_template *nct6683_attributes_temp_template[] = …;
static const struct sensor_template_group nct6683_temp_template_group = …;
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)
{ … }
SENSOR_TEMPLATE(pwm, "pwm%d", S_IRUGO, show_pwm, store_pwm, 0);
static umode_t nct6683_pwm_is_visible(struct kobject *kobj,
struct attribute *attr, int index)
{ … }
static struct sensor_device_template *nct6683_attributes_pwm_template[] = …;
static const struct sensor_template_group nct6683_pwm_template_group = …;
static ssize_t
beep_enable_show(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
beep_enable_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t
intrusion0_alarm_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t
intrusion0_alarm_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR_RW(intrusion0_alarm);
static DEVICE_ATTR_RW(beep_enable);
static struct attribute *nct6683_attributes_other[] = …;
static const struct attribute_group nct6683_group_other = …;
static inline void nct6683_init_device(struct nct6683_data *data)
{ … }
static void
nct6683_setup_fans(struct nct6683_data *data)
{ … }
static void nct6683_setup_sensors(struct nct6683_data *data)
{ … }
static int nct6683_probe(struct platform_device *pdev)
{ … }
#ifdef CONFIG_PM
static int nct6683_suspend(struct device *dev)
{ … }
static int nct6683_resume(struct device *dev)
{ … }
static const struct dev_pm_ops nct6683_dev_pm_ops = …;
#define NCT6683_DEV_PM_OPS …
#else
#define NCT6683_DEV_PM_OPS …
#endif
static struct platform_driver nct6683_driver = …;
static int __init nct6683_find(int sioaddr, struct nct6683_sio_data *sio_data)
{ … }
static struct platform_device *pdev[2];
static int __init sensors_nct6683_init(void)
{ … }
static void __exit sensors_nct6683_exit(void)
{ … }
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
module_init(…) …;
module_exit(sensors_nct6683_exit);