#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/jiffies.h>
#include <linux/i2c.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/sysfs.h>
static unsigned short extra_sensor_type;
module_param(extra_sensor_type, ushort, 0);
MODULE_PARM_DESC(…) …;
static const unsigned short normal_i2c[] = …;
#define GL520_REG_CHIP_ID …
#define GL520_REG_REVISION …
#define GL520_REG_CONF …
#define GL520_REG_MASK …
#define GL520_REG_VID_INPUT …
static const u8 GL520_REG_IN_INPUT[] = …;
static const u8 GL520_REG_IN_LIMIT[] = …;
static const u8 GL520_REG_IN_MIN[] = …;
static const u8 GL520_REG_IN_MAX[] = …;
static const u8 GL520_REG_TEMP_INPUT[] = …;
static const u8 GL520_REG_TEMP_MAX[] = …;
static const u8 GL520_REG_TEMP_MAX_HYST[] = …;
#define GL520_REG_FAN_INPUT …
#define GL520_REG_FAN_MIN …
#define GL520_REG_FAN_DIV …
#define GL520_REG_FAN_OFF …
#define GL520_REG_ALARMS …
#define GL520_REG_BEEP_MASK …
#define GL520_REG_BEEP_ENABLE …
struct gl520_data { … };
static int gl520_read_value(struct i2c_client *client, u8 reg)
{ … }
static int gl520_write_value(struct i2c_client *client, u8 reg, u16 value)
{ … }
static struct gl520_data *gl520_update_device(struct device *dev)
{ … }
static ssize_t cpu0_vid_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(cpu0_vid);
#define VDD_FROM_REG(val) …
#define VDD_CLAMP(val) …
#define VDD_TO_REG(val) …
#define IN_FROM_REG(val) …
#define IN_CLAMP(val) …
#define IN_TO_REG(val) …
static ssize_t in_input_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t in_min_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t in_max_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t in_min_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t in_max_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static SENSOR_DEVICE_ATTR_RO(in0_input, in_input, 0);
static SENSOR_DEVICE_ATTR_RO(in1_input, in_input, 1);
static SENSOR_DEVICE_ATTR_RO(in2_input, in_input, 2);
static SENSOR_DEVICE_ATTR_RO(in3_input, in_input, 3);
static SENSOR_DEVICE_ATTR_RO(in4_input, in_input, 4);
static SENSOR_DEVICE_ATTR_RW(in0_min, in_min, 0);
static SENSOR_DEVICE_ATTR_RW(in1_min, in_min, 1);
static SENSOR_DEVICE_ATTR_RW(in2_min, in_min, 2);
static SENSOR_DEVICE_ATTR_RW(in3_min, in_min, 3);
static SENSOR_DEVICE_ATTR_RW(in4_min, in_min, 4);
static SENSOR_DEVICE_ATTR_RW(in0_max, in_max, 0);
static SENSOR_DEVICE_ATTR_RW(in1_max, in_max, 1);
static SENSOR_DEVICE_ATTR_RW(in2_max, in_max, 2);
static SENSOR_DEVICE_ATTR_RW(in3_max, in_max, 3);
static SENSOR_DEVICE_ATTR_RW(in4_max, in_max, 4);
#define DIV_FROM_REG(val) …
#define FAN_FROM_REG(val, div) …
#define FAN_BASE(div) …
#define FAN_CLAMP(val, div) …
#define FAN_TO_REG(val, div) …
static ssize_t fan_input_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t fan_min_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t fan_div_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t fan1_off_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t fan_min_store(struct device *dev,
struct device_attribute *attr, const char *buf,
size_t count)
{ … }
static ssize_t fan_div_store(struct device *dev,
struct device_attribute *attr, const char *buf,
size_t count)
{ … }
static ssize_t fan1_off_store(struct device *dev,
struct device_attribute *attr, 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_RW(fan1_min, fan_min, 0);
static SENSOR_DEVICE_ATTR_RW(fan2_min, fan_min, 1);
static SENSOR_DEVICE_ATTR_RW(fan1_div, fan_div, 0);
static SENSOR_DEVICE_ATTR_RW(fan2_div, fan_div, 1);
static DEVICE_ATTR_RW(fan1_off);
#define TEMP_FROM_REG(val) …
#define TEMP_CLAMP(val) …
#define TEMP_TO_REG(val) …
static ssize_t temp_input_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t temp_max_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t temp_max_hyst_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t temp_max_store(struct device *dev,
struct device_attribute *attr, const char *buf,
size_t count)
{ … }
static ssize_t temp_max_hyst_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static SENSOR_DEVICE_ATTR_RO(temp1_input, temp_input, 0);
static SENSOR_DEVICE_ATTR_RO(temp2_input, temp_input, 1);
static SENSOR_DEVICE_ATTR_RW(temp1_max, temp_max, 0);
static SENSOR_DEVICE_ATTR_RW(temp2_max, temp_max, 1);
static SENSOR_DEVICE_ATTR_RW(temp1_max_hyst, temp_max_hyst, 0);
static SENSOR_DEVICE_ATTR_RW(temp2_max_hyst, temp_max_hyst, 1);
static ssize_t alarms_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t beep_enable_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t beep_mask_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 beep_mask_store(struct device *dev,
struct device_attribute *attr, const char *buf,
size_t count)
{ … }
static DEVICE_ATTR_RO(alarms);
static DEVICE_ATTR_RW(beep_enable);
static DEVICE_ATTR_RW(beep_mask);
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(temp1_alarm, alarm, 4);
static SENSOR_DEVICE_ATTR_RO(fan1_alarm, alarm, 5);
static SENSOR_DEVICE_ATTR_RO(fan2_alarm, alarm, 6);
static SENSOR_DEVICE_ATTR_RO(temp2_alarm, alarm, 7);
static SENSOR_DEVICE_ATTR_RO(in4_alarm, alarm, 7);
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(temp1_beep, beep, 4);
static SENSOR_DEVICE_ATTR_RW(fan1_beep, beep, 5);
static SENSOR_DEVICE_ATTR_RW(fan2_beep, beep, 6);
static SENSOR_DEVICE_ATTR_RW(temp2_beep, beep, 7);
static SENSOR_DEVICE_ATTR_RW(in4_beep, beep, 7);
static struct attribute *gl520_attributes[] = …;
static const struct attribute_group gl520_group = …;
static struct attribute *gl520_attributes_in4[] = …;
static struct attribute *gl520_attributes_temp2[] = …;
static const struct attribute_group gl520_group_in4 = …;
static const struct attribute_group gl520_group_temp2 = …;
static int gl520_detect(struct i2c_client *client, struct i2c_board_info *info)
{ … }
static void gl520_init_client(struct i2c_client *client)
{ … }
static int gl520_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id gl520_id[] = …;
MODULE_DEVICE_TABLE(i2c, gl520_id);
static struct i2c_driver gl520_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;