linux/drivers/iio/temperature/tmp007.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * tmp007.c - Support for TI TMP007 IR thermopile sensor with integrated math engine
 *
 * Copyright (c) 2017 Manivannan Sadhasivam <[email protected]>
 *
 * Driver for the Texas Instruments I2C 16-bit IR thermopile sensor
 *
 * (7-bit I2C slave address (0x40 - 0x47), changeable via ADR pins)
 *
 * Note:
 * 1. This driver assumes that the sensor has been calibrated beforehand
 * 2. Limit threshold events are enabled at the start
 * 3. Operating mode: INT
 */

#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/pm.h>
#include <linux/bitops.h>
#include <linux/mod_devicetable.h>
#include <linux/irq.h>
#include <linux/interrupt.h>

#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/events.h>

#define TMP007_TDIE
#define TMP007_CONFIG
#define TMP007_TOBJECT
#define TMP007_STATUS
#define TMP007_STATUS_MASK
#define TMP007_TOBJ_HIGH_LIMIT
#define TMP007_TOBJ_LOW_LIMIT
#define TMP007_TDIE_HIGH_LIMIT
#define TMP007_TDIE_LOW_LIMIT
#define TMP007_MANUFACTURER_ID
#define TMP007_DEVICE_ID

#define TMP007_CONFIG_CONV_EN
#define TMP007_CONFIG_TC_EN
#define TMP007_CONFIG_CR_MASK
#define TMP007_CONFIG_ALERT_EN
#define TMP007_CONFIG_CR_SHIFT

/* Status register flags */
#define TMP007_STATUS_ALERT
#define TMP007_STATUS_CONV_READY
#define TMP007_STATUS_OHF
#define TMP007_STATUS_OLF
#define TMP007_STATUS_LHF
#define TMP007_STATUS_LLF
#define TMP007_STATUS_DATA_VALID

#define TMP007_MANUFACTURER_MAGIC
#define TMP007_DEVICE_MAGIC

#define TMP007_TEMP_SHIFT

struct tmp007_data {};

static const int tmp007_avgs[5][2] =;

static int tmp007_read_temperature(struct tmp007_data *data, u8 reg)
{}

static int tmp007_powerdown(struct tmp007_data *data)
{}

static int tmp007_read_raw(struct iio_dev *indio_dev,
		struct iio_chan_spec const *channel, int *val,
		int *val2, long mask)
{}

static int tmp007_write_raw(struct iio_dev *indio_dev,
		struct iio_chan_spec const *channel, int val,
		int val2, long mask)
{}

static irqreturn_t tmp007_interrupt_handler(int irq, void *private)
{}

static int tmp007_write_event_config(struct iio_dev *indio_dev,
		const struct iio_chan_spec *chan, enum iio_event_type type,
		enum iio_event_direction dir, int state)
{}

static int tmp007_read_event_config(struct iio_dev *indio_dev,
		const struct iio_chan_spec *chan, enum iio_event_type type,
		enum iio_event_direction dir)
{}

static int tmp007_read_thresh(struct iio_dev *indio_dev,
		const struct iio_chan_spec *chan, enum iio_event_type type,
		enum iio_event_direction dir, enum iio_event_info info,
		int *val, int *val2)
{}

static int tmp007_write_thresh(struct iio_dev *indio_dev,
		const struct iio_chan_spec *chan, enum iio_event_type type,
		enum iio_event_direction dir, enum iio_event_info info,
		int val, int val2)
{}

static IIO_CONST_ATTR(sampling_frequency_available, "4 2 1 0.5 0.25");

static struct attribute *tmp007_attributes[] =;

static const struct attribute_group tmp007_attribute_group =;

static const struct iio_event_spec tmp007_obj_event[] =;

static const struct iio_event_spec tmp007_die_event[] =;

static const struct iio_chan_spec tmp007_channels[] =;

static const struct iio_info tmp007_info =;

static bool tmp007_identify(struct i2c_client *client)
{}

static void tmp007_powerdown_action_cb(void *priv)
{}

static int tmp007_probe(struct i2c_client *client)
{}

static int tmp007_suspend(struct device *dev)
{}

static int tmp007_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(tmp007_pm_ops, tmp007_suspend, tmp007_resume);

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

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

static struct i2c_driver tmp007_driver =;
module_i2c_driver();

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