#include <linux/device.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/i2c.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/sysfs.h>
#include <linux/regulator/consumer.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/buffer.h>
#include <linux/iio/trigger.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/iio/trigger_consumer.h>
#include "afe440x.h"
#define AFE4404_DRIVER_NAME …
#define AFE4404_TIA_GAIN_SEP …
#define AFE4404_TIA_GAIN …
#define AFE4404_PROG_TG_STC …
#define AFE4404_PROG_TG_ENDC …
#define AFE4404_LED3LEDSTC …
#define AFE4404_LED3LEDENDC …
#define AFE4404_CLKDIV_PRF …
#define AFE4404_OFFDAC …
#define AFE4404_DEC …
#define AFE4404_AVG_LED2_ALED2VAL …
#define AFE4404_AVG_LED1_ALED1VAL …
#define AFE440X_CONTROL2_OSC_ENABLE …
enum afe4404_fields { … };
static const struct reg_field afe4404_reg_fields[] = …;
struct afe4404_data { … };
enum afe4404_chan_id { … };
static const unsigned int afe4404_channel_values[] = …;
static const unsigned int afe4404_channel_leds[] = …;
static const unsigned int afe4404_channel_offdacs[] = …;
static const struct iio_chan_spec afe4404_channels[] = …;
static const struct afe440x_val_table afe4404_res_table[] = …;
AFE440X_TABLE_ATTR(…);
static const struct afe440x_val_table afe4404_cap_table[] = …;
AFE440X_TABLE_ATTR(…);
static ssize_t afe440x_show_register(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t afe440x_store_register(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static AFE440X_ATTR(in_intensity1_resistance, F_TIA_GAIN_SEP, afe4404_res_table);
static AFE440X_ATTR(in_intensity1_capacitance, F_TIA_CF_SEP, afe4404_cap_table);
static AFE440X_ATTR(in_intensity2_resistance, F_TIA_GAIN_SEP, afe4404_res_table);
static AFE440X_ATTR(in_intensity2_capacitance, F_TIA_CF_SEP, afe4404_cap_table);
static AFE440X_ATTR(in_intensity3_resistance, F_TIA_GAIN, afe4404_res_table);
static AFE440X_ATTR(in_intensity3_capacitance, TIA_CF, afe4404_cap_table);
static AFE440X_ATTR(in_intensity4_resistance, F_TIA_GAIN, afe4404_res_table);
static AFE440X_ATTR(in_intensity4_capacitance, TIA_CF, afe4404_cap_table);
static struct attribute *afe440x_attributes[] = …;
static const struct attribute_group afe440x_attribute_group = …;
static int afe4404_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{ … }
static int afe4404_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int val, int val2, long mask)
{ … }
static const struct iio_info afe4404_iio_info = …;
static irqreturn_t afe4404_trigger_handler(int irq, void *private)
{ … }
static void afe4404_regulator_disable(void *data)
{ … }
#define AFE4404_TIMING_PAIRS …
static const struct reg_sequence afe4404_reg_sequences[] = …;
static const struct regmap_range afe4404_yes_ranges[] = …;
static const struct regmap_access_table afe4404_volatile_table = …;
static const struct regmap_config afe4404_regmap_config = …;
static const struct of_device_id afe4404_of_match[] = …;
MODULE_DEVICE_TABLE(of, afe4404_of_match);
static int afe4404_suspend(struct device *dev)
{ … }
static int afe4404_resume(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(afe4404_pm_ops, afe4404_suspend,
afe4404_resume);
static int afe4404_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id afe4404_ids[] = …;
MODULE_DEVICE_TABLE(i2c, afe4404_ids);
static struct i2c_driver afe4404_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;