#include <linux/device.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/spi/spi.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 <linux/unaligned.h>
#include "afe440x.h"
#define AFE4403_DRIVER_NAME …
#define AFE4403_TIAGAIN …
#define AFE4403_TIA_AMB_GAIN …
enum afe4403_fields { … };
static const struct reg_field afe4403_reg_fields[] = …;
struct afe4403_data { … };
enum afe4403_chan_id { … };
static const unsigned int afe4403_channel_values[] = …;
static const unsigned int afe4403_channel_leds[] = …;
static const struct iio_chan_spec afe4403_channels[] = …;
static const struct afe440x_val_table afe4403_res_table[] = …;
AFE440X_TABLE_ATTR(…);
static const struct afe440x_val_table afe4403_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_RF_LED, afe4403_res_table);
static AFE440X_ATTR(in_intensity1_capacitance, F_CF_LED, afe4403_cap_table);
static AFE440X_ATTR(in_intensity2_resistance, F_RF_LED, afe4403_res_table);
static AFE440X_ATTR(in_intensity2_capacitance, F_CF_LED, afe4403_cap_table);
static AFE440X_ATTR(in_intensity3_resistance, F_RF_LED1, afe4403_res_table);
static AFE440X_ATTR(in_intensity3_capacitance, F_CF_LED1, afe4403_cap_table);
static AFE440X_ATTR(in_intensity4_resistance, F_RF_LED1, afe4403_res_table);
static AFE440X_ATTR(in_intensity4_capacitance, F_CF_LED1, afe4403_cap_table);
static struct attribute *afe440x_attributes[] = …;
static const struct attribute_group afe440x_attribute_group = …;
static int afe4403_read(struct afe4403_data *afe, unsigned int reg, u32 *val)
{ … }
static int afe4403_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{ … }
static int afe4403_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int val, int val2, long mask)
{ … }
static const struct iio_info afe4403_iio_info = …;
static irqreturn_t afe4403_trigger_handler(int irq, void *private)
{ … }
static void afe4403_regulator_disable(void *data)
{ … }
#define AFE4403_TIMING_PAIRS …
static const struct reg_sequence afe4403_reg_sequences[] = …;
static const struct regmap_range afe4403_yes_ranges[] = …;
static const struct regmap_access_table afe4403_volatile_table = …;
static const struct regmap_config afe4403_regmap_config = …;
static const struct of_device_id afe4403_of_match[] = …;
MODULE_DEVICE_TABLE(of, afe4403_of_match);
static int afe4403_suspend(struct device *dev)
{ … }
static int afe4403_resume(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(afe4403_pm_ops, afe4403_suspend,
afe4403_resume);
static int afe4403_probe(struct spi_device *spi)
{ … }
static const struct spi_device_id afe4403_ids[] = …;
MODULE_DEVICE_TABLE(spi, afe4403_ids);
static struct spi_driver afe4403_spi_driver = …;
module_spi_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;