#include <linux/module.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/mutex.h>
#include <linux/err.h>
#include <linux/irq.h>
#include <linux/irq_work.h>
#include <linux/i2c.h>
#include <linux/mod_devicetable.h>
#include <linux/regmap.h>
#include <linux/iio/iio.h>
#include <linux/iio/buffer.h>
#include <linux/iio/trigger.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/pm_runtime.h>
#define ATLAS_REGMAP_NAME …
#define ATLAS_DRV_NAME …
#define ATLAS_REG_DEV_TYPE …
#define ATLAS_REG_DEV_VERSION …
#define ATLAS_REG_INT_CONTROL …
#define ATLAS_REG_INT_CONTROL_EN …
#define ATLAS_REG_PWR_CONTROL …
#define ATLAS_REG_PH_CALIB_STATUS …
#define ATLAS_REG_PH_CALIB_STATUS_MASK …
#define ATLAS_REG_PH_CALIB_STATUS_LOW …
#define ATLAS_REG_PH_CALIB_STATUS_MID …
#define ATLAS_REG_PH_CALIB_STATUS_HIGH …
#define ATLAS_REG_EC_CALIB_STATUS …
#define ATLAS_REG_EC_CALIB_STATUS_MASK …
#define ATLAS_REG_EC_CALIB_STATUS_DRY …
#define ATLAS_REG_EC_CALIB_STATUS_SINGLE …
#define ATLAS_REG_EC_CALIB_STATUS_LOW …
#define ATLAS_REG_EC_CALIB_STATUS_HIGH …
#define ATLAS_REG_DO_CALIB_STATUS …
#define ATLAS_REG_DO_CALIB_STATUS_MASK …
#define ATLAS_REG_DO_CALIB_STATUS_PRESSURE …
#define ATLAS_REG_DO_CALIB_STATUS_DO …
#define ATLAS_REG_RTD_DATA …
#define ATLAS_REG_PH_TEMP_DATA …
#define ATLAS_REG_PH_DATA …
#define ATLAS_REG_EC_PROBE …
#define ATLAS_REG_EC_TEMP_DATA …
#define ATLAS_REG_EC_DATA …
#define ATLAS_REG_TDS_DATA …
#define ATLAS_REG_PSS_DATA …
#define ATLAS_REG_ORP_CALIB_STATUS …
#define ATLAS_REG_ORP_DATA …
#define ATLAS_REG_DO_TEMP_DATA …
#define ATLAS_REG_DO_DATA …
#define ATLAS_PH_INT_TIME_IN_MS …
#define ATLAS_EC_INT_TIME_IN_MS …
#define ATLAS_ORP_INT_TIME_IN_MS …
#define ATLAS_DO_INT_TIME_IN_MS …
#define ATLAS_RTD_INT_TIME_IN_MS …
enum { … };
struct atlas_data { … };
static const struct regmap_config atlas_regmap_config = …;
static int atlas_buffer_num_channels(const struct iio_chan_spec *spec)
{
int idx = 0;
for (; spec->type != IIO_TIMESTAMP; spec++)
idx++;
return idx;
};
static const struct iio_chan_spec atlas_ph_channels[] = …;
#define ATLAS_CONCENTRATION_CHANNEL(_idx, _addr) …
static const struct iio_chan_spec atlas_ec_channels[] = …;
static const struct iio_chan_spec atlas_orp_channels[] = …;
static const struct iio_chan_spec atlas_do_channels[] = …;
static const struct iio_chan_spec atlas_rtd_channels[] = …;
static int atlas_check_ph_calibration(struct atlas_data *data)
{ … }
static int atlas_check_ec_calibration(struct atlas_data *data)
{ … }
static int atlas_check_orp_calibration(struct atlas_data *data)
{ … }
static int atlas_check_do_calibration(struct atlas_data *data)
{ … }
struct atlas_device { … };
static const struct atlas_device atlas_devices[] = …;
static int atlas_set_powermode(struct atlas_data *data, int on)
{ … }
static int atlas_set_interrupt(struct atlas_data *data, bool state)
{ … }
static int atlas_buffer_postenable(struct iio_dev *indio_dev)
{ … }
static int atlas_buffer_predisable(struct iio_dev *indio_dev)
{ … }
static const struct iio_buffer_setup_ops atlas_buffer_setup_ops = …;
static void atlas_work_handler(struct irq_work *work)
{ … }
static irqreturn_t atlas_trigger_handler(int irq, void *private)
{ … }
static irqreturn_t atlas_interrupt_handler(int irq, void *private)
{ … }
static int atlas_read_measurement(struct atlas_data *data, int reg, __be32 *val)
{ … }
static int atlas_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{ … }
static int atlas_write_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_id[] = …;
MODULE_DEVICE_TABLE(i2c, atlas_id);
static const struct of_device_id atlas_dt_ids[] = …;
MODULE_DEVICE_TABLE(of, atlas_dt_ids);
static int atlas_probe(struct i2c_client *client)
{ … }
static void atlas_remove(struct i2c_client *client)
{ … }
static int atlas_runtime_suspend(struct device *dev)
{ … }
static int atlas_runtime_resume(struct device *dev)
{ … }
static const struct dev_pm_ops atlas_pm_ops = …;
static struct i2c_driver atlas_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;