linux/drivers/hwmon/adc128d818.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Driver for TI ADC128D818 System Monitor with Temperature Sensor
 *
 * Copyright (c) 2014 Guenter Roeck
 *
 * Derived from lm80.c
 * Copyright (C) 1998, 1999  Frodo Looijaard <[email protected]>
 *			     and Philip Edelbrock <[email protected]>
 */

#include <linux/module.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/regulator/consumer.h>
#include <linux/mutex.h>
#include <linux/bitops.h>
#include <linux/of.h>

/* Addresses to scan
 * The chip also supports addresses 0x35..0x37. Don't scan those addresses
 * since they are also used by some EEPROMs, which may result in false
 * positives.
 */
static const unsigned short normal_i2c[] =;

/* registers */
#define ADC128_REG_IN_MAX(nr)
#define ADC128_REG_IN_MIN(nr)
#define ADC128_REG_IN(nr)

#define ADC128_REG_TEMP
#define ADC128_REG_TEMP_MAX
#define ADC128_REG_TEMP_HYST

#define ADC128_REG_CONFIG
#define ADC128_REG_ALARM
#define ADC128_REG_MASK
#define ADC128_REG_CONV_RATE
#define ADC128_REG_ONESHOT
#define ADC128_REG_SHUTDOWN
#define ADC128_REG_CONFIG_ADV
#define ADC128_REG_BUSY_STATUS

#define ADC128_REG_MAN_ID
#define ADC128_REG_DEV_ID

/* No. of voltage entries in adc128_attrs */
#define ADC128_ATTR_NUM_VOLT

/* Voltage inputs visible per operation mode */
static const u8 num_inputs[] =;

struct adc128_data {};

static struct adc128_data *adc128_update_device(struct device *dev)
{}

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

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

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

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

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

static umode_t adc128_is_visible(struct kobject *kobj,
				 struct attribute *attr, int index)
{}

static SENSOR_DEVICE_ATTR_2_RO(in0_input, adc128_in, 0, 0);
static SENSOR_DEVICE_ATTR_2_RW(in0_min, adc128_in, 0, 1);
static SENSOR_DEVICE_ATTR_2_RW(in0_max, adc128_in, 0, 2);

static SENSOR_DEVICE_ATTR_2_RO(in1_input, adc128_in, 1, 0);
static SENSOR_DEVICE_ATTR_2_RW(in1_min, adc128_in, 1, 1);
static SENSOR_DEVICE_ATTR_2_RW(in1_max, adc128_in, 1, 2);

static SENSOR_DEVICE_ATTR_2_RO(in2_input, adc128_in, 2, 0);
static SENSOR_DEVICE_ATTR_2_RW(in2_min, adc128_in, 2, 1);
static SENSOR_DEVICE_ATTR_2_RW(in2_max, adc128_in, 2, 2);

static SENSOR_DEVICE_ATTR_2_RO(in3_input, adc128_in, 3, 0);
static SENSOR_DEVICE_ATTR_2_RW(in3_min, adc128_in, 3, 1);
static SENSOR_DEVICE_ATTR_2_RW(in3_max, adc128_in, 3, 2);

static SENSOR_DEVICE_ATTR_2_RO(in4_input, adc128_in, 4, 0);
static SENSOR_DEVICE_ATTR_2_RW(in4_min, adc128_in, 4, 1);
static SENSOR_DEVICE_ATTR_2_RW(in4_max, adc128_in, 4, 2);

static SENSOR_DEVICE_ATTR_2_RO(in5_input, adc128_in, 5, 0);
static SENSOR_DEVICE_ATTR_2_RW(in5_min, adc128_in, 5, 1);
static SENSOR_DEVICE_ATTR_2_RW(in5_max, adc128_in, 5, 2);

static SENSOR_DEVICE_ATTR_2_RO(in6_input, adc128_in, 6, 0);
static SENSOR_DEVICE_ATTR_2_RW(in6_min, adc128_in, 6, 1);
static SENSOR_DEVICE_ATTR_2_RW(in6_max, adc128_in, 6, 2);

static SENSOR_DEVICE_ATTR_2_RO(in7_input, adc128_in, 7, 0);
static SENSOR_DEVICE_ATTR_2_RW(in7_min, adc128_in, 7, 1);
static SENSOR_DEVICE_ATTR_2_RW(in7_max, adc128_in, 7, 2);

static SENSOR_DEVICE_ATTR_RO(temp1_input, adc128_temp, 0);
static SENSOR_DEVICE_ATTR_RW(temp1_max, adc128_temp, 1);
static SENSOR_DEVICE_ATTR_RW(temp1_max_hyst, adc128_temp, 2);

static SENSOR_DEVICE_ATTR_RO(in0_alarm, adc128_alarm, 0);
static SENSOR_DEVICE_ATTR_RO(in1_alarm, adc128_alarm, 1);
static SENSOR_DEVICE_ATTR_RO(in2_alarm, adc128_alarm, 2);
static SENSOR_DEVICE_ATTR_RO(in3_alarm, adc128_alarm, 3);
static SENSOR_DEVICE_ATTR_RO(in4_alarm, adc128_alarm, 4);
static SENSOR_DEVICE_ATTR_RO(in5_alarm, adc128_alarm, 5);
static SENSOR_DEVICE_ATTR_RO(in6_alarm, adc128_alarm, 6);
static SENSOR_DEVICE_ATTR_RO(in7_alarm, adc128_alarm, 7);
static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, adc128_alarm, 7);

static struct attribute *adc128_attrs[] =;

static const struct attribute_group adc128_group =;
__ATTRIBUTE_GROUPS();

static int adc128_detect(struct i2c_client *client, struct i2c_board_info *info)
{}

static int adc128_init_client(struct adc128_data *data, bool external_vref)
{}

static int adc128_probe(struct i2c_client *client)
{}

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

static const struct of_device_id __maybe_unused adc128_of_match[] =;
MODULE_DEVICE_TABLE(of, adc128_of_match);

static struct i2c_driver adc128_driver =;

module_i2c_driver();

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