#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/i2c.h>
#include <linux/mutex.h>
#include <linux/property.h>
#include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h>
#include <linux/units.h>
#include <linux/iio/iio.h>
#include <linux/iio/types.h>
#define ADS1100_CFG_ST_BSY …
#define ADS1100_CFG_SC …
#define ADS1100_DR_MASK …
#define ADS1100_PGA_MASK …
#define ADS1100_CONTINUOUS …
#define ADS1100_SINGLESHOT …
#define ADS1100_SLEEP_DELAY_MS …
static const int ads1100_data_rate[] = …;
static const int ads1100_data_rate_bits[] = …;
struct ads1100_data { … };
static const struct iio_chan_spec ads1100_channel = …;
static int ads1100_set_config_bits(struct ads1100_data *data, u8 mask, u8 value)
{
int ret;
u8 config = (data->config & ~mask) | (value & mask);
if (data->config == config)
return 0;
ret = i2c_master_send(data->client, &config, 1);
if (ret < 0)
return ret;
data->config = config;
return 0;
};
static int ads1100_data_bits(struct ads1100_data *data)
{ … }
static int ads1100_get_adc_result(struct ads1100_data *data, int chan, int *val)
{ … }
static int ads1100_set_scale(struct ads1100_data *data, int val, int val2)
{ … }
static int ads1100_set_data_rate(struct ads1100_data *data, int chan, int rate)
{ … }
static int ads1100_get_vdd_millivolts(struct ads1100_data *data)
{ … }
static void ads1100_calc_scale_avail(struct ads1100_data *data)
{ … }
static int ads1100_read_avail(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
const int **vals, int *type, int *length,
long mask)
{ … }
static int ads1100_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int *val,
int *val2, long mask)
{ … }
static int ads1100_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int val,
int val2, long mask)
{ … }
static const struct iio_info ads1100_info = …;
static int ads1100_setup(struct ads1100_data *data)
{ … }
static void ads1100_reg_disable(void *reg)
{ … }
static void ads1100_disable_continuous(void *data)
{ … }
static int ads1100_probe(struct i2c_client *client)
{ … }
static int ads1100_runtime_suspend(struct device *dev)
{ … }
static int ads1100_runtime_resume(struct device *dev)
{ … }
static DEFINE_RUNTIME_DEV_PM_OPS(ads1100_pm_ops,
ads1100_runtime_suspend,
ads1100_runtime_resume,
NULL);
static const struct i2c_device_id ads1100_id[] = …;
MODULE_DEVICE_TABLE(i2c, ads1100_id);
static const struct of_device_id ads1100_of_match[] = …;
MODULE_DEVICE_TABLE(of, ads1100_of_match);
static struct i2c_driver ads1100_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;