linux/drivers/hwmon/tmp108.c

// SPDX-License-Identifier: GPL-2.0-or-later
/* Texas Instruments TMP108 SMBus temperature sensor driver
 *
 * Copyright (C) 2016 John Muir <[email protected]>
 */

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

#define DRIVER_NAME

#define TMP108_REG_TEMP
#define TMP108_REG_CONF
#define TMP108_REG_TLOW
#define TMP108_REG_THIGH

#define TMP108_TEMP_MIN_MC
#define TMP108_TEMP_MAX_MC

/* Configuration register bits.
 * Note: these bit definitions are byte swapped.
 */
#define TMP108_CONF_M0
#define TMP108_CONF_M1
#define TMP108_CONF_TM
#define TMP108_CONF_FL
#define TMP108_CONF_FH
#define TMP108_CONF_CR0
#define TMP108_CONF_CR1
#define TMP108_CONF_ID
#define TMP108_CONF_HYS0
#define TMP108_CONF_HYS1
#define TMP108_CONF_POL

/* Defaults set by the hardware upon reset. */
#define TMP108_CONF_DEFAULTS
/* These bits are read-only. */
#define TMP108_CONF_READ_ONLY

#define TMP108_CONF_MODE_MASK
#define TMP108_MODE_SHUTDOWN
#define TMP108_MODE_ONE_SHOT
#define TMP108_MODE_CONTINUOUS
					/* When M1 is set, M0 is ignored. */

#define TMP108_CONF_CONVRATE_MASK
#define TMP108_CONVRATE_0P25HZ
#define TMP108_CONVRATE_1HZ
#define TMP108_CONVRATE_4HZ
#define TMP108_CONVRATE_16HZ

#define TMP108_CONF_HYSTERESIS_MASK
#define TMP108_HYSTERESIS_0C
#define TMP108_HYSTERESIS_1C
#define TMP108_HYSTERESIS_2C
#define TMP108_HYSTERESIS_4C

#define TMP108_CONVERSION_TIME_MS

struct tmp108 {};

/* convert 12-bit TMP108 register value to milliCelsius */
static inline int tmp108_temp_reg_to_mC(s16 val)
{}

/* convert milliCelsius to left adjusted 12-bit TMP108 register value */
static inline u16 tmp108_mC_to_temp_reg(int val)
{}

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

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

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

static const struct hwmon_channel_info * const tmp108_info[] =;

static const struct hwmon_ops tmp108_hwmon_ops =;

static const struct hwmon_chip_info tmp108_chip_info =;

static void tmp108_restore_config(void *data)
{}

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

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

static const struct regmap_config tmp108_regmap_config =;

static int tmp108_probe(struct i2c_client *client)
{}

static int tmp108_suspend(struct device *dev)
{}

static int tmp108_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(tmp108_dev_pm_ops, tmp108_suspend, tmp108_resume);

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

#ifdef CONFIG_OF
static const struct of_device_id tmp108_of_ids[] =;
MODULE_DEVICE_TABLE(of, tmp108_of_ids);
#endif

static struct i2c_driver tmp108_driver =;

module_i2c_driver();

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