linux/drivers/hwmon/adm1029.c

// SPDX-License-Identifier: GPL-2.0
/*
 * adm1029.c - Part of lm_sensors, Linux kernel modules for hardware monitoring
 *
 * Copyright (C) 2006 Corentin LABBE <[email protected]>
 *
 * Based on LM83 Driver by Jean Delvare <[email protected]>
 *
 * Give only processor, motherboard temperatures and fan tachs
 * Very rare chip please let me know if you use it
 *
 * http://www.analog.com/UploadedFiles/Data_Sheets/ADM1029.pdf
 */

#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/jiffies.h>
#include <linux/i2c.h>
#include <linux/hwmon-sysfs.h>
#include <linux/hwmon.h>
#include <linux/err.h>
#include <linux/mutex.h>

/*
 * Addresses to scan
 */

static const unsigned short normal_i2c[] =;

/*
 * The ADM1029 registers
 * Manufacturer ID is 0x41 for Analog Devices
 */

#define ADM1029_REG_MAN_ID
#define ADM1029_REG_CHIP_ID
#define ADM1029_REG_CONFIG
#define ADM1029_REG_NB_FAN_SUPPORT

#define ADM1029_REG_TEMP_DEVICES_INSTALLED

#define ADM1029_REG_LOCAL_TEMP
#define ADM1029_REG_REMOTE1_TEMP
#define ADM1029_REG_REMOTE2_TEMP

#define ADM1029_REG_LOCAL_TEMP_HIGH
#define ADM1029_REG_REMOTE1_TEMP_HIGH
#define ADM1029_REG_REMOTE2_TEMP_HIGH

#define ADM1029_REG_LOCAL_TEMP_LOW
#define ADM1029_REG_REMOTE1_TEMP_LOW
#define ADM1029_REG_REMOTE2_TEMP_LOW

#define ADM1029_REG_FAN1
#define ADM1029_REG_FAN2

#define ADM1029_REG_FAN1_MIN
#define ADM1029_REG_FAN2_MIN

#define ADM1029_REG_FAN1_CONFIG
#define ADM1029_REG_FAN2_CONFIG

#define TEMP_FROM_REG(val)

#define DIV_FROM_REG(val)

/* Registers to be checked by adm1029_update_device() */
static const u8 ADM1029_REG_TEMP[] =;

static const u8 ADM1029_REG_FAN[] =;

static const u8 ADM1029_REG_FAN_DIV[] =;

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

struct adm1029_data {};

/*
 * function that update the status of the chips (temperature for example)
 */
static struct adm1029_data *adm1029_update_device(struct device *dev)
{}

/*
 * Sysfs stuff
 */

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

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

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

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

/* Access rights on sysfs. */
static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, 0);
static SENSOR_DEVICE_ATTR_RO(temp2_input, temp, 1);
static SENSOR_DEVICE_ATTR_RO(temp3_input, temp, 2);

static SENSOR_DEVICE_ATTR_RO(temp1_max, temp, 3);
static SENSOR_DEVICE_ATTR_RO(temp2_max, temp, 4);
static SENSOR_DEVICE_ATTR_RO(temp3_max, temp, 5);

static SENSOR_DEVICE_ATTR_RO(temp1_min, temp, 6);
static SENSOR_DEVICE_ATTR_RO(temp2_min, temp, 7);
static SENSOR_DEVICE_ATTR_RO(temp3_min, temp, 8);

static SENSOR_DEVICE_ATTR_RO(fan1_input, fan, 0);
static SENSOR_DEVICE_ATTR_RO(fan2_input, fan, 1);

static SENSOR_DEVICE_ATTR_RO(fan1_min, fan, 2);
static SENSOR_DEVICE_ATTR_RO(fan2_min, fan, 3);

static SENSOR_DEVICE_ATTR_RW(fan1_div, fan_div, 0);
static SENSOR_DEVICE_ATTR_RW(fan2_div, fan_div, 1);

static struct attribute *adm1029_attrs[] =;

ATTRIBUTE_GROUPS();

/*
 * Real code
 */

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

static int adm1029_init_client(struct i2c_client *client)
{}

static int adm1029_probe(struct i2c_client *client)
{}

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

static struct i2c_driver adm1029_driver =;

module_i2c_driver();

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