linux/drivers/hwmon/lm83.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * lm83.c - Part of lm_sensors, Linux kernel modules for hardware
 *          monitoring
 * Copyright (C) 2003-2009  Jean Delvare <[email protected]>
 *
 * Heavily inspired from the lm78, lm75 and adm1021 drivers. The LM83 is
 * a sensor chip made by National Semiconductor. It reports up to four
 * temperatures (its own plus up to three external ones) with a 1 deg
 * resolution and a 3-4 deg accuracy. Complete datasheet can be obtained
 * from National's website at:
 *   http://www.national.com/pf/LM/LM83.html
 * Since the datasheet omits to give the chip stepping code, I give it
 * here: 0x03 (at register 0xff).
 *
 * Also supports the LM82 temp sensor, which is basically a stripped down
 * model of the LM83.  Datasheet is here:
 * http://www.national.com/pf/LM/LM82.html
 */

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

/*
 * Addresses to scan
 * Address is selected using 2 three-level pins, resulting in 9 possible
 * addresses.
 */

static const unsigned short normal_i2c[] =;

enum chips {};

/*
 * The LM83 registers
 * Manufacturer ID is 0x01 for National Semiconductor.
 */

#define LM83_REG_R_MAN_ID
#define LM83_REG_R_CHIP_ID
#define LM83_REG_R_CONFIG
#define LM83_REG_W_CONFIG
#define LM83_REG_R_STATUS1
#define LM83_REG_R_STATUS2
#define LM83_REG_R_LOCAL_TEMP
#define LM83_REG_R_LOCAL_HIGH
#define LM83_REG_W_LOCAL_HIGH
#define LM83_REG_R_REMOTE1_TEMP
#define LM83_REG_R_REMOTE1_HIGH
#define LM83_REG_W_REMOTE1_HIGH
#define LM83_REG_R_REMOTE2_TEMP
#define LM83_REG_R_REMOTE2_HIGH
#define LM83_REG_W_REMOTE2_HIGH
#define LM83_REG_R_REMOTE3_TEMP
#define LM83_REG_R_REMOTE3_HIGH
#define LM83_REG_W_REMOTE3_HIGH
#define LM83_REG_R_TCRIT
#define LM83_REG_W_TCRIT

static const u8 LM83_REG_TEMP[] =;

static const u8 LM83_REG_MAX[] =;

/* alarm and fault registers and bits, indexed by channel */
static const u8 LM83_ALARM_REG[] =;

static const u8 LM83_MAX_ALARM_BIT[] =;

static const u8 LM83_CRIT_ALARM_BIT[] =;

static const u8 LM83_FAULT_BIT[] =;

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

struct lm83_data {};

/* regmap code */

static int lm83_regmap_reg_read(void *context, unsigned int reg, unsigned int *val)
{}

/*
 * The regmap write function maps read register addresses to write register
 * addresses. This is necessary for regmap register caching to work.
 * An alternative would be to clear the regmap cache whenever a register is
 * written, but that would be much more expensive.
 */
static int lm83_regmap_reg_write(void *context, unsigned int reg, unsigned int val)
{}

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

static const struct regmap_config lm83_regmap_config =;

/* hwmon API */

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

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

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

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

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

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

static const struct hwmon_channel_info * const lm83_info[] =;

static const struct hwmon_ops lm83_hwmon_ops =;

static const struct hwmon_chip_info lm83_chip_info =;

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

static int lm83_probe(struct i2c_client *client)
{}

/*
 * Driver data (common to all clients)
 */

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

static struct i2c_driver lm83_driver =;

module_i2c_driver();

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