linux/drivers/iio/chemical/vz89x.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * vz89x.c - Support for SGX Sensortech MiCS VZ89X VOC sensors
 *
 * Copyright (C) 2015-2018
 * Author: Matt Ranostay <[email protected]>
 */

#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/init.h>
#include <linux/i2c.h>
#include <linux/mod_devicetable.h>

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

#define VZ89X_REG_MEASUREMENT
#define VZ89X_REG_MEASUREMENT_RD_SIZE
#define VZ89X_REG_MEASUREMENT_WR_SIZE

#define VZ89X_VOC_CO2_IDX
#define VZ89X_VOC_SHORT_IDX
#define VZ89X_VOC_TVOC_IDX
#define VZ89X_VOC_RESISTANCE_IDX

#define VZ89TE_REG_MEASUREMENT
#define VZ89TE_REG_MEASUREMENT_RD_SIZE
#define VZ89TE_REG_MEASUREMENT_WR_SIZE

#define VZ89TE_VOC_TVOC_IDX
#define VZ89TE_VOC_CO2_IDX
#define VZ89TE_VOC_RESISTANCE_IDX

enum {};

struct vz89x_chip_data;

struct vz89x_data {};

struct vz89x_chip_data {};

static const struct iio_chan_spec vz89x_channels[] =;

static const struct iio_chan_spec vz89te_channels[] =;

static IIO_CONST_ATTR(in_concentration_co2_scale, "0.00000698689");
static IIO_CONST_ATTR(in_concentration_voc_scale, "0.00000000436681223");

static struct attribute *vz89x_attributes[] =;

static const struct attribute_group vz89x_attrs_group =;

/*
 * Chipset sometime updates in the middle of a reading causing it to reset the
 * data pointer, and causing invalid reading of previous data.
 * We can check for this by reading MSB of the resistance reading that is
 * always zero, and by also confirming the VOC_short isn't zero.
 */

static bool vz89x_measurement_is_valid(struct vz89x_data *data)
{}

/* VZ89TE device has a modified CRC-8 two complement check */
static bool vz89te_measurement_is_valid(struct vz89x_data *data)
{}

static int vz89x_i2c_xfer(struct vz89x_data *data, u8 cmd)
{}

static int vz89x_smbus_xfer(struct vz89x_data *data, u8 cmd)
{}

static int vz89x_get_measurement(struct vz89x_data *data)
{}

static int vz89x_get_resistance_reading(struct vz89x_data *data,
					struct iio_chan_spec const *chan,
					int *val)
{}

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

static const struct iio_info vz89x_info =;

static const struct vz89x_chip_data vz89x_chips[] =;

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

static int vz89x_probe(struct i2c_client *client)
{}

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

static struct i2c_driver vz89x_driver =;
module_i2c_driver();

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