#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/workqueue.h>
#include <linux/devm-helpers.h>
#include <linux/mutex.h>
#include <linux/err.h>
#include <linux/irq.h>
#include <linux/spi/spi.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/trigger.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/buffer.h>
#include <linux/iio/triggered_buffer.h>
#define AS3935_AFE_GAIN …
#define AS3935_AFE_MASK …
#define AS3935_AFE_GAIN_MAX …
#define AS3935_AFE_PWR_BIT …
#define AS3935_NFLWDTH …
#define AS3935_NFLWDTH_MASK …
#define AS3935_INT …
#define AS3935_INT_MASK …
#define AS3935_DISTURB_INT …
#define AS3935_EVENT_INT …
#define AS3935_NOISE_INT …
#define AS3935_DATA …
#define AS3935_DATA_MASK …
#define AS3935_TUNE_CAP …
#define AS3935_DEFAULTS …
#define AS3935_CALIBRATE …
#define AS3935_READ_DATA …
#define AS3935_ADDRESS(x) …
#define MAX_PF_CAP …
#define TUNE_CAP_DIV …
struct as3935_state { … };
static const struct iio_chan_spec as3935_channels[] = …;
static int as3935_read(struct as3935_state *st, unsigned int reg, int *val)
{ … }
static int as3935_write(struct as3935_state *st,
unsigned int reg,
unsigned int val)
{ … }
static ssize_t as3935_sensor_sensitivity_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t as3935_sensor_sensitivity_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t len)
{ … }
static ssize_t as3935_noise_level_tripped_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static IIO_DEVICE_ATTR(sensor_sensitivity, S_IRUGO | S_IWUSR,
as3935_sensor_sensitivity_show, as3935_sensor_sensitivity_store, 0);
static IIO_DEVICE_ATTR(noise_level_tripped, S_IRUGO,
as3935_noise_level_tripped_show, NULL, 0);
static struct attribute *as3935_attributes[] = …;
static const struct attribute_group as3935_attribute_group = …;
static int as3935_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val,
int *val2,
long m)
{ … }
static const struct iio_info as3935_info = …;
static irqreturn_t as3935_trigger_handler(int irq, void *private)
{ … }
static void as3935_event_work(struct work_struct *work)
{ … }
static irqreturn_t as3935_interrupt_handler(int irq, void *private)
{ … }
static void calibrate_as3935(struct as3935_state *st)
{ … }
static int as3935_suspend(struct device *dev)
{ … }
static int as3935_resume(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(as3935_pm_ops, as3935_suspend, as3935_resume);
static int as3935_probe(struct spi_device *spi)
{ … }
static const struct of_device_id as3935_of_match[] = …;
MODULE_DEVICE_TABLE(of, as3935_of_match);
static const struct spi_device_id as3935_id[] = …;
MODULE_DEVICE_TABLE(spi, as3935_id);
static struct spi_driver as3935_driver = …;
module_spi_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;