linux/drivers/iio/chemical/atlas-ezo-sensor.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * atlas-ezo-sensor.c - Support for Atlas Scientific EZO sensors
 *
 * Copyright (C) 2020 Konsulko Group
 * Author: Matt Ranostay <[email protected]>
 */

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

#include <linux/iio/iio.h>

#define ATLAS_EZO_DRV_NAME
#define ATLAS_INT_TIME_IN_MS
#define ATLAS_INT_HUM_TIME_IN_MS

enum {};

struct atlas_ezo_device {};

struct atlas_ezo_data {};

#define ATLAS_CONCENTRATION_CHANNEL(_modifier)

static const struct iio_chan_spec atlas_co2_ezo_channels[] =;

static const struct iio_chan_spec atlas_o2_ezo_channels[] =;

static const struct iio_chan_spec atlas_hum_ezo_channels[] =;

static struct atlas_ezo_device atlas_ezo_devices[] =;

static void atlas_ezo_sanitize(char *buf)
{}

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

static const struct iio_info atlas_info =;

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

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

static int atlas_ezo_probe(struct i2c_client *client)
{
	const struct atlas_ezo_device *chip;
	struct atlas_ezo_data *data;
	struct iio_dev *indio_dev;

	indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
	if (!indio_dev)
		return -ENOMEM;

	chip = i2c_get_match_data(client);
	if (!chip)
		return -EINVAL;

	indio_dev->info = &atlas_info;
	indio_dev->name = ATLAS_EZO_DRV_NAME;
	indio_dev->channels = chip->channels;
	indio_dev->num_channels = chip->num_channels;
	indio_dev->modes = INDIO_DIRECT_MODE;

	data = iio_priv(indio_dev);
	data->client = client;
	data->chip = chip;
	mutex_init(&data->lock);

	return devm_iio_device_register(&client->dev, indio_dev);
};

static struct i2c_driver atlas_ezo_driver =;
module_i2c_driver();

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