linux/drivers/hwmon/max1668.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (c) 2011 David George <[email protected]>
 *
 * based on adm1021.c
 * some credit to Christoph Scheurer, but largely a rewrite
 */

#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 max1668_addr_list[] =;

/* max1668 registers */

#define MAX1668_REG_TEMP(nr)
#define MAX1668_REG_STAT1
#define MAX1668_REG_STAT2
#define MAX1668_REG_MAN_ID
#define MAX1668_REG_DEV_ID

/* limits */

/* write high limits */
#define MAX1668_REG_LIMH_WR(nr)
/* write low limits */
#define MAX1668_REG_LIML_WR(nr)
/* read high limits */
#define MAX1668_REG_LIMH_RD(nr)
/* read low limits */
#define MAX1668_REG_LIML_RD(nr)

/* manufacturer and device ID Constants */
#define MAN_ID_MAXIM
#define DEV_ID_MAX1668
#define DEV_ID_MAX1805
#define DEV_ID_MAX1989

/* read only mode module parameter */
static bool read_only;
module_param(read_only, bool, 0);
MODULE_PARM_DESC();

enum chips {};

struct max1668_data {};

static struct max1668_data *max1668_update_device(struct device *dev)
{}

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

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

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

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

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

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

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

static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0);
static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, show_temp_max,
				set_temp_max, 0);
static SENSOR_DEVICE_ATTR(temp1_min, S_IRUGO, show_temp_min,
				set_temp_min, 0);
static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1);
static SENSOR_DEVICE_ATTR(temp2_max, S_IRUGO, show_temp_max,
				set_temp_max, 1);
static SENSOR_DEVICE_ATTR(temp2_min, S_IRUGO, show_temp_min,
				set_temp_min, 1);
static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2);
static SENSOR_DEVICE_ATTR(temp3_max, S_IRUGO, show_temp_max,
				set_temp_max, 2);
static SENSOR_DEVICE_ATTR(temp3_min, S_IRUGO, show_temp_min,
				set_temp_min, 2);
static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_temp, NULL, 3);
static SENSOR_DEVICE_ATTR(temp4_max, S_IRUGO, show_temp_max,
				set_temp_max, 3);
static SENSOR_DEVICE_ATTR(temp4_min, S_IRUGO, show_temp_min,
				set_temp_min, 3);
static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, show_temp, NULL, 4);
static SENSOR_DEVICE_ATTR(temp5_max, S_IRUGO, show_temp_max,
				set_temp_max, 4);
static SENSOR_DEVICE_ATTR(temp5_min, S_IRUGO, show_temp_min,
				set_temp_min, 4);

static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 14);
static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_alarm, NULL, 13);
static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, show_alarm, NULL, 7);
static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_alarm, NULL, 6);
static SENSOR_DEVICE_ATTR(temp3_min_alarm, S_IRUGO, show_alarm, NULL, 5);
static SENSOR_DEVICE_ATTR(temp3_max_alarm, S_IRUGO, show_alarm, NULL, 4);
static SENSOR_DEVICE_ATTR(temp4_min_alarm, S_IRUGO, show_alarm, NULL, 3);
static SENSOR_DEVICE_ATTR(temp4_max_alarm, S_IRUGO, show_alarm, NULL, 2);
static SENSOR_DEVICE_ATTR(temp5_min_alarm, S_IRUGO, show_alarm, NULL, 1);
static SENSOR_DEVICE_ATTR(temp5_max_alarm, S_IRUGO, show_alarm, NULL, 0);

static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_fault, NULL, 1);
static SENSOR_DEVICE_ATTR(temp3_fault, S_IRUGO, show_fault, NULL, 2);
static SENSOR_DEVICE_ATTR(temp4_fault, S_IRUGO, show_fault, NULL, 3);
static SENSOR_DEVICE_ATTR(temp5_fault, S_IRUGO, show_fault, NULL, 4);

/* Attributes common to MAX1668, MAX1989 and MAX1805 */
static struct attribute *max1668_attribute_common[] =;

/* Attributes not present on MAX1805 */
static struct attribute *max1668_attribute_unique[] =;

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

static const struct attribute_group max1668_group_common =;

static const struct attribute_group max1668_group_unique =;

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

static int max1668_probe(struct i2c_client *client)
{}

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

/* This is the driver that will be inserted */
static struct i2c_driver max1668_driver =;

module_i2c_driver();

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