linux/drivers/hwmon/emc6w201.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * emc6w201.c - Hardware monitoring driver for the SMSC EMC6W201
 * Copyright (C) 2011  Jean Delvare <[email protected]>
 */

#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/err.h>
#include <linux/mutex.h>

/*
 * Addresses to scan
 */

static const unsigned short normal_i2c[] =;

/*
 * The EMC6W201 registers
 */

#define EMC6W201_REG_IN(nr)
#define EMC6W201_REG_TEMP(nr)
#define EMC6W201_REG_FAN(nr)
#define EMC6W201_REG_COMPANY
#define EMC6W201_REG_VERSTEP
#define EMC6W201_REG_CONFIG
#define EMC6W201_REG_IN_LOW(nr)
#define EMC6W201_REG_IN_HIGH(nr)
#define EMC6W201_REG_TEMP_LOW(nr)
#define EMC6W201_REG_TEMP_HIGH(nr)
#define EMC6W201_REG_FAN_MIN(nr)

enum subfeature {};

/*
 * Per-device data
 */

struct emc6w201_data {};

/*
 * Combine LSB and MSB registers in a single value
 * Locking: must be called with data->update_lock held
 */
static u16 emc6w201_read16(struct i2c_client *client, u8 reg)
{}

/*
 * Write 16-bit value to LSB and MSB registers
 * Locking: must be called with data->update_lock held
 */
static int emc6w201_write16(struct i2c_client *client, u8 reg, u16 val)
{}

/* Read 8-bit value from register */
static u8 emc6w201_read8(struct i2c_client *client, u8 reg)
{}

/* Write 8-bit value to register */
static int emc6w201_write8(struct i2c_client *client, u8 reg, u8 val)
{}

static struct emc6w201_data *emc6w201_update_device(struct device *dev)
{}

/*
 * Sysfs callback functions
 */

static const s16 nominal_mv[6] =;

static ssize_t in_show(struct device *dev, struct device_attribute *devattr,
		       char *buf)
{}

static ssize_t in_store(struct device *dev, struct device_attribute *devattr,
			const char *buf, size_t count)
{}

static ssize_t temp_show(struct device *dev, struct device_attribute *devattr,
			 char *buf)
{}

static ssize_t temp_store(struct device *dev,
			  struct device_attribute *devattr, const char *buf,
			  size_t count)
{}

static ssize_t fan_show(struct device *dev, struct device_attribute *devattr,
			char *buf)
{}

static ssize_t fan_store(struct device *dev, struct device_attribute *devattr,
			 const char *buf, size_t count)
{}

static SENSOR_DEVICE_ATTR_2_RO(in0_input, in, 0, input);
static SENSOR_DEVICE_ATTR_2_RW(in0_min, in, 0, min);
static SENSOR_DEVICE_ATTR_2_RW(in0_max, in, 0, max);
static SENSOR_DEVICE_ATTR_2_RO(in1_input, in, 1, input);
static SENSOR_DEVICE_ATTR_2_RW(in1_min, in, 1, min);
static SENSOR_DEVICE_ATTR_2_RW(in1_max, in, 1, max);
static SENSOR_DEVICE_ATTR_2_RO(in2_input, in, 2, input);
static SENSOR_DEVICE_ATTR_2_RW(in2_min, in, 2, min);
static SENSOR_DEVICE_ATTR_2_RW(in2_max, in, 2, max);
static SENSOR_DEVICE_ATTR_2_RO(in3_input, in, 3, input);
static SENSOR_DEVICE_ATTR_2_RW(in3_min, in, 3, min);
static SENSOR_DEVICE_ATTR_2_RW(in3_max, in, 3, max);
static SENSOR_DEVICE_ATTR_2_RO(in4_input, in, 4, input);
static SENSOR_DEVICE_ATTR_2_RW(in4_min, in, 4, min);
static SENSOR_DEVICE_ATTR_2_RW(in4_max, in, 4, max);
static SENSOR_DEVICE_ATTR_2_RO(in5_input, in, 5, input);
static SENSOR_DEVICE_ATTR_2_RW(in5_min, in, 5, min);
static SENSOR_DEVICE_ATTR_2_RW(in5_max, in, 5, max);

static SENSOR_DEVICE_ATTR_2_RO(temp1_input, temp, 0, input);
static SENSOR_DEVICE_ATTR_2_RW(temp1_min, temp, 0, min);
static SENSOR_DEVICE_ATTR_2_RW(temp1_max, temp, 0, max);
static SENSOR_DEVICE_ATTR_2_RO(temp2_input, temp, 1, input);
static SENSOR_DEVICE_ATTR_2_RW(temp2_min, temp, 1, min);
static SENSOR_DEVICE_ATTR_2_RW(temp2_max, temp, 1, max);
static SENSOR_DEVICE_ATTR_2_RO(temp3_input, temp, 2, input);
static SENSOR_DEVICE_ATTR_2_RW(temp3_min, temp, 2, min);
static SENSOR_DEVICE_ATTR_2_RW(temp3_max, temp, 2, max);
static SENSOR_DEVICE_ATTR_2_RO(temp4_input, temp, 3, input);
static SENSOR_DEVICE_ATTR_2_RW(temp4_min, temp, 3, min);
static SENSOR_DEVICE_ATTR_2_RW(temp4_max, temp, 3, max);
static SENSOR_DEVICE_ATTR_2_RO(temp5_input, temp, 4, input);
static SENSOR_DEVICE_ATTR_2_RW(temp5_min, temp, 4, min);
static SENSOR_DEVICE_ATTR_2_RW(temp5_max, temp, 4, max);
static SENSOR_DEVICE_ATTR_2_RO(temp6_input, temp, 5, input);
static SENSOR_DEVICE_ATTR_2_RW(temp6_min, temp, 5, min);
static SENSOR_DEVICE_ATTR_2_RW(temp6_max, temp, 5, max);

static SENSOR_DEVICE_ATTR_2_RO(fan1_input, fan, 0, input);
static SENSOR_DEVICE_ATTR_2_RW(fan1_min, fan, 0, min);
static SENSOR_DEVICE_ATTR_2_RO(fan2_input, fan, 1, input);
static SENSOR_DEVICE_ATTR_2_RW(fan2_min, fan, 1, min);
static SENSOR_DEVICE_ATTR_2_RO(fan3_input, fan, 2, input);
static SENSOR_DEVICE_ATTR_2_RW(fan3_min, fan, 2, min);
static SENSOR_DEVICE_ATTR_2_RO(fan4_input, fan, 3, input);
static SENSOR_DEVICE_ATTR_2_RW(fan4_min, fan, 3, min);
static SENSOR_DEVICE_ATTR_2_RO(fan5_input, fan, 4, input);
static SENSOR_DEVICE_ATTR_2_RW(fan5_min, fan, 4, min);

static struct attribute *emc6w201_attrs[] =;

ATTRIBUTE_GROUPS();

/*
 * Driver interface
 */

/* Return 0 if detection is successful, -ENODEV otherwise */
static int emc6w201_detect(struct i2c_client *client,
			   struct i2c_board_info *info)
{}

static int emc6w201_probe(struct i2c_client *client)
{}

static const struct i2c_device_id emc6w201_id[] =;
MODULE_DEVICE_TABLE(i2c, emc6w201_id);

static struct i2c_driver emc6w201_driver =;

module_i2c_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();