linux/drivers/hwmon/smsc47m192.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * smsc47m192.c - Support for hardware monitoring block of
 *		  SMSC LPC47M192 and compatible Super I/O chips
 *
 * Copyright (C) 2006  Hartmut Rick <[email protected]>
 *
 * Derived from lm78.c and other chip drivers.
 */

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

/* Addresses to scan */
static const unsigned short normal_i2c[] =;

/* SMSC47M192 registers */
#define SMSC47M192_REG_IN(nr)
#define SMSC47M192_REG_IN_MAX(nr)
#define SMSC47M192_REG_IN_MIN(nr)
static u8 SMSC47M192_REG_TEMP[3] =;
static u8 SMSC47M192_REG_TEMP_MAX[3] =;
static u8 SMSC47M192_REG_TEMP_MIN[3] =;
#define SMSC47M192_REG_TEMP_OFFSET(nr)
#define SMSC47M192_REG_ALARM1
#define SMSC47M192_REG_ALARM2
#define SMSC47M192_REG_VID
#define SMSC47M192_REG_VID4
#define SMSC47M192_REG_CONFIG
#define SMSC47M192_REG_SFR
#define SMSC47M192_REG_COMPANY_ID
#define SMSC47M192_REG_VERSION

/* generalised scaling with integer rounding */
static inline int SCALE(long val, int mul, int div)
{}

/* Conversions */

/* smsc47m192 internally scales voltage measurements */
static const u16 nom_mv[] =;

static inline unsigned int IN_FROM_REG(u8 reg, int n)
{}

static inline u8 IN_TO_REG(unsigned long val, int n)
{}

/*
 * TEMP: 0.001 degC units (-128C to +127C)
 * REG: 1C/bit, two's complement
 */
static inline s8 TEMP_TO_REG(long val)
{}

static inline int TEMP_FROM_REG(s8 val)
{}

struct smsc47m192_data {};

static struct smsc47m192_data *smsc47m192_update_device(struct device *dev)
{}

/* Voltages */
static ssize_t in_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, 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 SENSOR_DEVICE_ATTR_RO(in5_input, in, 5);
static SENSOR_DEVICE_ATTR_RW(in5_min, in_min, 5);
static SENSOR_DEVICE_ATTR_RW(in5_max, in_max, 5);
static SENSOR_DEVICE_ATTR_RO(in6_input, in, 6);
static SENSOR_DEVICE_ATTR_RW(in6_min, in_min, 6);
static SENSOR_DEVICE_ATTR_RW(in6_max, in_max, 6);
static SENSOR_DEVICE_ATTR_RO(in7_input, in, 7);
static SENSOR_DEVICE_ATTR_RW(in7_min, in_min, 7);
static SENSOR_DEVICE_ATTR_RW(in7_max, in_max, 7);

/* Temperatures */
static ssize_t temp_show(struct device *dev, struct device_attribute *attr,
			 char *buf)
{}

static ssize_t temp_min_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_min_store(struct device *dev,
			      struct device_attribute *attr, const char *buf,
			      size_t count)
{}

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

static ssize_t temp_offset_show(struct device *dev,
				struct device_attribute *attr, char *buf)
{}

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

static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, 0);
static SENSOR_DEVICE_ATTR_RW(temp1_min, temp_min, 0);
static SENSOR_DEVICE_ATTR_RW(temp1_max, temp_max, 0);
static SENSOR_DEVICE_ATTR_RW(temp1_offset, temp_offset, 0);
static SENSOR_DEVICE_ATTR_RO(temp2_input, temp, 1);
static SENSOR_DEVICE_ATTR_RW(temp2_min, temp_min, 1);
static SENSOR_DEVICE_ATTR_RW(temp2_max, temp_max, 1);
static SENSOR_DEVICE_ATTR_RW(temp2_offset, temp_offset, 1);
static SENSOR_DEVICE_ATTR_RO(temp3_input, temp, 2);
static SENSOR_DEVICE_ATTR_RW(temp3_min, temp_min, 2);
static SENSOR_DEVICE_ATTR_RW(temp3_max, temp_max, 2);
static SENSOR_DEVICE_ATTR_RW(temp3_offset, temp_offset, 2);

/* VID */
static ssize_t cpu0_vid_show(struct device *dev,
			     struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(cpu0_vid);

static ssize_t vrm_show(struct device *dev, struct device_attribute *attr,
		char *buf)
{}

static ssize_t vrm_store(struct device *dev, struct device_attribute *attr,
			 const char *buf, size_t count)
{}
static DEVICE_ATTR_RW(vrm);

/* Alarms */
static ssize_t alarm_show(struct device *dev, struct device_attribute *attr,
			  char *buf)
{}

static SENSOR_DEVICE_ATTR_RO(temp1_alarm, alarm, 0x0010);
static SENSOR_DEVICE_ATTR_RO(temp2_alarm, alarm, 0x0020);
static SENSOR_DEVICE_ATTR_RO(temp3_alarm, alarm, 0x0040);
static SENSOR_DEVICE_ATTR_RO(temp2_fault, alarm, 0x4000);
static SENSOR_DEVICE_ATTR_RO(temp3_fault, alarm, 0x8000);
static SENSOR_DEVICE_ATTR_RO(in0_alarm, alarm, 0x0001);
static SENSOR_DEVICE_ATTR_RO(in1_alarm, alarm, 0x0002);
static SENSOR_DEVICE_ATTR_RO(in2_alarm, alarm, 0x0004);
static SENSOR_DEVICE_ATTR_RO(in3_alarm, alarm, 0x0008);
static SENSOR_DEVICE_ATTR_RO(in4_alarm, alarm, 0x0100);
static SENSOR_DEVICE_ATTR_RO(in5_alarm, alarm, 0x0200);
static SENSOR_DEVICE_ATTR_RO(in6_alarm, alarm, 0x0400);
static SENSOR_DEVICE_ATTR_RO(in7_alarm, alarm, 0x0800);

static struct attribute *smsc47m192_attributes[] =;

static const struct attribute_group smsc47m192_group =;

static struct attribute *smsc47m192_attributes_in4[] =;

static const struct attribute_group smsc47m192_group_in4 =;

static void smsc47m192_init_client(struct i2c_client *client)
{}

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

static int smsc47m192_probe(struct i2c_client *client)
{}

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

static struct i2c_driver smsc47m192_driver =;

module_i2c_driver();

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