linux/drivers/hwmon/tmp401.c

// SPDX-License-Identifier: GPL-2.0-or-later
/* tmp401.c
 *
 * Copyright (C) 2007,2008 Hans de Goede <[email protected]>
 * Preliminary tmp411 support by:
 * Gabriel Konat, Sander Leget, Wouter Willems
 * Copyright (C) 2009 Andre Prendel <[email protected]>
 *
 * Cleanup and support for TMP431 and TMP432 by Guenter Roeck
 * Copyright (c) 2013 Guenter Roeck <[email protected]>
 */

/*
 * Driver for the Texas Instruments TMP401 SMBUS temperature sensor IC.
 *
 * Note this IC is in some aspect similar to the LM90, but it has quite a
 * few differences too, for example the local temp has a higher resolution
 * and thus has 16 bits registers for its value and limit instead of 8 bits.
 */

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

/* Addresses to scan */
static const unsigned short normal_i2c[] =;

enum chips {};

/*
 * The TMP401 registers, note some registers have different addresses for
 * reading and writing
 */
#define TMP401_STATUS
#define TMP401_CONFIG
#define TMP401_CONVERSION_RATE
#define TMP4XX_N_FACTOR_REG
#define TMP43X_BETA_RANGE
#define TMP401_TEMP_CRIT_HYST
#define TMP401_MANUFACTURER_ID_REG
#define TMP401_DEVICE_ID_REG

static const u8 TMP401_TEMP_MSB[7][3] =;

/* [0] = fault, [1] = low, [2] = high, [3] = therm/crit */
static const u8 TMP432_STATUS_REG[] =;

/* Flags */
#define TMP401_CONFIG_RANGE
#define TMP401_CONFIG_SHUTDOWN
#define TMP401_STATUS_LOCAL_CRIT
#define TMP401_STATUS_REMOTE_CRIT
#define TMP401_STATUS_REMOTE_OPEN
#define TMP401_STATUS_REMOTE_LOW
#define TMP401_STATUS_REMOTE_HIGH
#define TMP401_STATUS_LOCAL_LOW
#define TMP401_STATUS_LOCAL_HIGH

/* On TMP432, each status has its own register */
#define TMP432_STATUS_LOCAL
#define TMP432_STATUS_REMOTE1
#define TMP432_STATUS_REMOTE2

/* Manufacturer / Device ID's */
#define TMP401_MANUFACTURER_ID
#define TMP401_DEVICE_ID
#define TMP411A_DEVICE_ID
#define TMP411B_DEVICE_ID
#define TMP411C_DEVICE_ID
#define TMP431_DEVICE_ID
#define TMP432_DEVICE_ID
#define TMP435_DEVICE_ID

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

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

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

struct tmp401_data {};

/* regmap */

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

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

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

static const struct regmap_config tmp401_regmap_config =;

/* temperature conversion */

static int tmp401_register_to_temp(u16 reg, bool extended)
{}

static u16 tmp401_temp_to_register(long temp, bool extended, int zbits)
{}

/* hwmon API functions */

static const u8 tmp401_temp_reg_index[] =;

static const u8 tmp401_status_reg_index[] =;

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

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

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

static int tmp401_set_convrate(struct regmap *regmap, long val)
{}

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

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

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

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

static const struct hwmon_ops tmp401_ops =;

/* chip initialization, detect, probe */

static int tmp401_init_client(struct tmp401_data *data)
{}

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

static int tmp401_probe(struct i2c_client *client)
{}

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

static struct i2c_driver tmp401_driver =;

module_i2c_driver();

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