linux/drivers/hwmon/adm1025.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * adm1025.c
 *
 * Copyright (C) 2000       Chen-Yuan Wu <[email protected]>
 * Copyright (C) 2003-2009  Jean Delvare <[email protected]>
 *
 * The ADM1025 is a sensor chip made by Analog Devices. It reports up to 6
 * voltages (including its own power source) and up to two temperatures
 * (its own plus up to one external one). Voltages are scaled internally
 * (which is not the common way) with ratios such that the nominal value
 * of each voltage correspond to a register value of 192 (which means a
 * resolution of about 0.5% of the nominal value). Temperature values are
 * reported with a 1 deg resolution and a 3 deg accuracy. Complete
 * datasheet can be obtained from Analog's website at:
 *   https://www.onsemi.com/PowerSolutions/product.do?id=ADM1025
 *
 * This driver also supports the ADM1025A, which differs from the ADM1025
 * only in that it has "open-drain VID inputs while the ADM1025 has
 * on-chip 100k pull-ups on the VID inputs". It doesn't make any
 * difference for us.
 *
 * This driver also supports the NE1619, a sensor chip made by Philips.
 * That chip is similar to the ADM1025A, with a few differences. The only
 * difference that matters to us is that the NE1619 has only two possible
 * addresses while the ADM1025A has a third one. Complete datasheet can be
 * obtained from Philips's website at:
 *   http://www.semiconductors.philips.com/pip/NE1619DS.html
 *
 * Since the ADM1025 was the first chipset supported by this driver, most
 * comments will refer to this chipset, but are actually general and
 * concern all supported chipsets, unless mentioned otherwise.
 */

#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>

/*
 * Addresses to scan
 * ADM1025 and ADM1025A have three possible addresses: 0x2c, 0x2d and 0x2e.
 * NE1619 has two possible addresses: 0x2c and 0x2d.
 */

static const unsigned short normal_i2c[] =;

enum chips {};

/*
 * The ADM1025 registers
 */

#define ADM1025_REG_MAN_ID
#define ADM1025_REG_CHIP_ID
#define ADM1025_REG_CONFIG
#define ADM1025_REG_STATUS1
#define ADM1025_REG_STATUS2
#define ADM1025_REG_IN(nr)
#define ADM1025_REG_IN_MAX(nr)
#define ADM1025_REG_IN_MIN(nr)
#define ADM1025_REG_TEMP(nr)
#define ADM1025_REG_TEMP_HIGH(nr)
#define ADM1025_REG_TEMP_LOW(nr)
#define ADM1025_REG_VID
#define ADM1025_REG_VID4

/*
 * Conversions and various macros
 * The ADM1025 uses signed 8-bit values for temperatures.
 */

static const int in_scale[6] =;

#define IN_FROM_REG(reg, scale)
#define IN_TO_REG(val, scale)

#define TEMP_FROM_REG(reg)
#define TEMP_TO_REG(val)

/*
 * Client data (each client gets its own)
 */

struct adm1025_data {};

static struct adm1025_data *adm1025_update_device(struct device *dev)
{}

/*
 * Sysfs stuff
 */

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
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 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 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 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_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 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(in5_alarm, alarm, 9);
static SENSOR_DEVICE_ATTR_RO(temp1_alarm, alarm, 5);
static SENSOR_DEVICE_ATTR_RO(temp2_alarm, alarm, 4);
static SENSOR_DEVICE_ATTR_RO(temp1_fault, alarm, 14);

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);

/*
 * Real code
 */

static struct attribute *adm1025_attributes[] =;

static const struct attribute_group adm1025_group =;

static struct attribute *adm1025_attributes_in4[] =;

static const struct attribute_group adm1025_group_in4 =;

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

static void adm1025_init_client(struct i2c_client *client)
{}

static int adm1025_probe(struct i2c_client *client)
{}

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

static struct i2c_driver adm1025_driver =;

module_i2c_driver();

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