linux/drivers/hwmon/lm95234.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Driver for Texas Instruments / National Semiconductor LM95234
 *
 * Copyright (c) 2013, 2014 Guenter Roeck <[email protected]>
 *
 * Derived from lm95241.c
 * Copyright (C) 2008, 2010 Davide Rizzo <[email protected]>
 */

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

#define DRVNAME

enum chips {};

static const unsigned short normal_i2c[] =;

/* LM95234 registers */
#define LM95234_REG_MAN_ID
#define LM95234_REG_CHIP_ID
#define LM95234_REG_STATUS
#define LM95234_REG_CONFIG
#define LM95234_REG_CONVRATE
#define LM95234_REG_STS_FAULT
#define LM95234_REG_STS_TCRIT1
#define LM95234_REG_STS_TCRIT2
#define LM95234_REG_TEMPH(x)
#define LM95234_REG_TEMPL(x)
#define LM95234_REG_UTEMPH(x)
#define LM95234_REG_UTEMPL(x)
#define LM95234_REG_REM_MODEL
#define LM95234_REG_REM_MODEL_STS
#define LM95234_REG_OFFSET(x)
#define LM95234_REG_TCRIT1(x)
#define LM95234_REG_TCRIT2(x)
#define LM95234_REG_TCRIT_HYST

#define NATSEMI_MAN_ID
#define LM95233_CHIP_ID
#define LM95234_CHIP_ID

/* Client data (each client gets its own) */
struct lm95234_data {};

static int lm95234_read_temp(struct i2c_client *client, int index, int *t)
{}

static u16 update_intervals[] =;

/* Fill value cache. Must be called with update lock held. */

static int lm95234_fill_cache(struct lm95234_data *data,
			      struct i2c_client *client)
{}

static int lm95234_update_device(struct lm95234_data *data)
{}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

static ssize_t update_interval_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_RO(temp2_input, temp, 1);
static SENSOR_DEVICE_ATTR_RO(temp3_input, temp, 2);
static SENSOR_DEVICE_ATTR_RO(temp4_input, temp, 3);
static SENSOR_DEVICE_ATTR_RO(temp5_input, temp, 4);

static SENSOR_DEVICE_ATTR_RO(temp2_fault, alarm, BIT(0) | BIT(1));
static SENSOR_DEVICE_ATTR_RO(temp3_fault, alarm, BIT(2) | BIT(3));
static SENSOR_DEVICE_ATTR_RO(temp4_fault, alarm, BIT(4) | BIT(5));
static SENSOR_DEVICE_ATTR_RO(temp5_fault, alarm, BIT(6) | BIT(7));

static SENSOR_DEVICE_ATTR_RW(temp2_type, type, BIT(1));
static SENSOR_DEVICE_ATTR_RW(temp3_type, type, BIT(2));
static SENSOR_DEVICE_ATTR_RW(temp4_type, type, BIT(3));
static SENSOR_DEVICE_ATTR_RW(temp5_type, type, BIT(4));

static SENSOR_DEVICE_ATTR_RW(temp1_max, tcrit1, 0);
static SENSOR_DEVICE_ATTR_RW(temp2_max, tcrit2, 0);
static SENSOR_DEVICE_ATTR_RW(temp3_max, tcrit2, 1);
static SENSOR_DEVICE_ATTR_RW(temp4_max, tcrit1, 3);
static SENSOR_DEVICE_ATTR_RW(temp5_max, tcrit1, 4);

static SENSOR_DEVICE_ATTR_RW(temp1_max_hyst, tcrit1_hyst, 0);
static SENSOR_DEVICE_ATTR_RO(temp2_max_hyst, tcrit2_hyst, 0);
static SENSOR_DEVICE_ATTR_RO(temp3_max_hyst, tcrit2_hyst, 1);
static SENSOR_DEVICE_ATTR_RO(temp4_max_hyst, tcrit1_hyst, 3);
static SENSOR_DEVICE_ATTR_RO(temp5_max_hyst, tcrit1_hyst, 4);

static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, alarm, BIT(0 + 8));
static SENSOR_DEVICE_ATTR_RO(temp2_max_alarm, alarm, BIT(1 + 16));
static SENSOR_DEVICE_ATTR_RO(temp3_max_alarm, alarm, BIT(2 + 16));
static SENSOR_DEVICE_ATTR_RO(temp4_max_alarm, alarm, BIT(3 + 8));
static SENSOR_DEVICE_ATTR_RO(temp5_max_alarm, alarm, BIT(4 + 8));

static SENSOR_DEVICE_ATTR_RW(temp2_crit, tcrit1, 1);
static SENSOR_DEVICE_ATTR_RW(temp3_crit, tcrit1, 2);

static SENSOR_DEVICE_ATTR_RO(temp2_crit_hyst, tcrit1_hyst, 1);
static SENSOR_DEVICE_ATTR_RO(temp3_crit_hyst, tcrit1_hyst, 2);

static SENSOR_DEVICE_ATTR_RO(temp2_crit_alarm, alarm, BIT(1 + 8));
static SENSOR_DEVICE_ATTR_RO(temp3_crit_alarm, alarm, BIT(2 + 8));

static SENSOR_DEVICE_ATTR_RW(temp2_offset, offset, 0);
static SENSOR_DEVICE_ATTR_RW(temp3_offset, offset, 1);
static SENSOR_DEVICE_ATTR_RW(temp4_offset, offset, 2);
static SENSOR_DEVICE_ATTR_RW(temp5_offset, offset, 3);

static DEVICE_ATTR_RW(update_interval);

static struct attribute *lm95234_common_attrs[] =;

static const struct attribute_group lm95234_common_group =;

static struct attribute *lm95234_attrs[] =;

static const struct attribute_group lm95234_group =;

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

static int lm95234_init_client(struct i2c_client *client)
{}

static int lm95234_probe(struct i2c_client *client)
{}

/* Driver data (common to all clients) */
static const struct i2c_device_id lm95234_id[] =;
MODULE_DEVICE_TABLE(i2c, lm95234_id);

static struct i2c_driver lm95234_driver =;

module_i2c_driver();

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