linux/drivers/hwmon/lm95245.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (C) 2011 Alexander Stein <[email protected]>
 *
 * The LM95245 is a sensor chip made by TI / National Semiconductor.
 * It reports up to two temperatures (its own plus an external one).
 *
 * This driver is based on lm95241.c
 */

#include <linux/err.h>
#include <linux/init.h>
#include <linux/hwmon.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/regmap.h>
#include <linux/slab.h>

static const unsigned short normal_i2c[] =;

/* LM95245 registers */
/* general registers */
#define LM95245_REG_RW_CONFIG1
#define LM95245_REG_RW_CONVERS_RATE
#define LM95245_REG_W_ONE_SHOT

/* diode configuration */
#define LM95245_REG_RW_CONFIG2
#define LM95245_REG_RW_REMOTE_OFFH
#define LM95245_REG_RW_REMOTE_OFFL

/* status registers */
#define LM95245_REG_R_STATUS1
#define LM95245_REG_R_STATUS2

/* limit registers */
#define LM95245_REG_RW_REMOTE_OS_LIMIT
#define LM95245_REG_RW_LOCAL_OS_TCRIT_LIMIT
#define LM95245_REG_RW_REMOTE_TCRIT_LIMIT
#define LM95245_REG_RW_COMMON_HYSTERESIS

/* temperature signed */
#define LM95245_REG_R_LOCAL_TEMPH_S
#define LM95245_REG_R_LOCAL_TEMPL_S
#define LM95245_REG_R_REMOTE_TEMPH_S
#define LM95245_REG_R_REMOTE_TEMPL_S
/* temperature unsigned */
#define LM95245_REG_R_REMOTE_TEMPH_U
#define LM95245_REG_R_REMOTE_TEMPL_U

/* id registers */
#define LM95245_REG_R_MAN_ID
#define LM95245_REG_R_CHIP_ID

/* LM95245 specific bitfields */
#define CFG_STOP
#define CFG_REMOTE_TCRIT_MASK
#define CFG_REMOTE_OS_MASK
#define CFG_LOCAL_TCRIT_MASK
#define CFG_LOCAL_OS_MASK

#define CFG2_OS_A0
#define CFG2_DIODE_FAULT_OS
#define CFG2_DIODE_FAULT_TCRIT
#define CFG2_REMOTE_TT
#define CFG2_REMOTE_FILTER_DIS
#define CFG2_REMOTE_FILTER_EN

/* conversation rate in ms */
#define RATE_CR0063
#define RATE_CR0364
#define RATE_CR1000
#define RATE_CR2500

#define STATUS1_ROS
#define STATUS1_DIODE_FAULT
#define STATUS1_RTCRIT
#define STATUS1_LOC

#define MANUFACTURER_ID
#define LM95235_REVISION
#define LM95245_REVISION

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

/* Conversions */
static int temp_from_reg_unsigned(u8 val_h, u8 val_l)
{}

static int temp_from_reg_signed(u8 val_h, u8 val_l)
{}

static int lm95245_read_conversion_rate(struct lm95245_data *data)
{}

static int lm95245_set_conversion_rate(struct lm95245_data *data, long interval)
{}

static int lm95245_read_temp(struct device *dev, u32 attr, int channel,
			     long *val)
{}

static int lm95245_write_temp(struct device *dev, u32 attr, int channel,
			      long val)
{}

static int lm95245_read_chip(struct device *dev, u32 attr, int channel,
			     long *val)
{}

static int lm95245_write_chip(struct device *dev, u32 attr, int channel,
			      long val)
{}

static int lm95245_read(struct device *dev, enum hwmon_sensor_types type,
			u32 attr, int channel, long *val)
{}

static int lm95245_write(struct device *dev, enum hwmon_sensor_types type,
			 u32 attr, int channel, long val)
{}

static umode_t lm95245_temp_is_visible(const void *data, u32 attr, int channel)
{}

static umode_t lm95245_is_visible(const void *data,
				  enum hwmon_sensor_types type,
				  u32 attr, int channel)
{}

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

static int lm95245_init_client(struct lm95245_data *data)
{}

static bool lm95245_is_writeable_reg(struct device *dev, unsigned int reg)
{}

static bool lm95245_is_volatile_reg(struct device *dev, unsigned int reg)
{}

static const struct regmap_config lm95245_regmap_config =;

static const struct hwmon_channel_info * const lm95245_info[] =;

static const struct hwmon_ops lm95245_hwmon_ops =;

static const struct hwmon_chip_info lm95245_chip_info =;

static int lm95245_probe(struct i2c_client *client)
{}

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

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

static struct i2c_driver lm95245_driver =;

module_i2c_driver();

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