#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/iio/buffer.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/trigger.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/iio/trigger_consumer.h>
#define STK8BA50_REG_XOUT …
#define STK8BA50_REG_YOUT …
#define STK8BA50_REG_ZOUT …
#define STK8BA50_REG_RANGE …
#define STK8BA50_REG_BWSEL …
#define STK8BA50_REG_POWMODE …
#define STK8BA50_REG_SWRST …
#define STK8BA50_REG_INTEN2 …
#define STK8BA50_REG_INTMAP2 …
#define STK8BA50_MODE_NORMAL …
#define STK8BA50_MODE_SUSPEND …
#define STK8BA50_MODE_POWERBIT …
#define STK8BA50_DATA_SHIFT …
#define STK8BA50_RESET_CMD …
#define STK8BA50_SR_1792HZ_IDX …
#define STK8BA50_DREADY_INT_MASK …
#define STK8BA50_DREADY_INT_MAP …
#define STK8BA50_ALL_CHANNEL_MASK …
#define STK8BA50_ALL_CHANNEL_SIZE …
#define STK8BA50_DRIVER_NAME …
#define STK8BA50_IRQ_NAME …
#define STK8BA50_SCALE_AVAIL …
static const struct { … } stk8ba50_scale_table[] = …;
static const struct { … } stk8ba50_samp_freq_table[] = …;
static const int stk8ba50_channel_table[] = …;
struct stk8ba50_data { … };
#define STK8BA50_ACCEL_CHANNEL(index, reg, axis) …
static const struct iio_chan_spec stk8ba50_channels[] = …;
static IIO_CONST_ATTR(in_accel_scale_available, STK8BA50_SCALE_AVAIL);
static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("14 25 56 112 224 448 896 1792");
static struct attribute *stk8ba50_attributes[] = …;
static const struct attribute_group stk8ba50_attribute_group = …;
static int stk8ba50_read_accel(struct stk8ba50_data *data, u8 reg)
{ … }
static int stk8ba50_data_rdy_trigger_set_state(struct iio_trigger *trig,
bool state)
{ … }
static const struct iio_trigger_ops stk8ba50_trigger_ops = …;
static int stk8ba50_set_power(struct stk8ba50_data *data, bool mode)
{ … }
static int stk8ba50_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{ … }
static int stk8ba50_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int val, int val2, long mask)
{ … }
static const struct iio_info stk8ba50_info = …;
static irqreturn_t stk8ba50_trigger_handler(int irq, void *p)
{ … }
static irqreturn_t stk8ba50_data_rdy_trig_poll(int irq, void *private)
{ … }
static int stk8ba50_buffer_preenable(struct iio_dev *indio_dev)
{ … }
static int stk8ba50_buffer_postdisable(struct iio_dev *indio_dev)
{ … }
static const struct iio_buffer_setup_ops stk8ba50_buffer_setup_ops = …;
static int stk8ba50_probe(struct i2c_client *client)
{ … }
static void stk8ba50_remove(struct i2c_client *client)
{ … }
static int stk8ba50_suspend(struct device *dev)
{ … }
static int stk8ba50_resume(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(stk8ba50_pm_ops, stk8ba50_suspend,
stk8ba50_resume);
static const struct i2c_device_id stk8ba50_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, stk8ba50_i2c_id);
static const struct acpi_device_id stk8ba50_acpi_id[] = …;
MODULE_DEVICE_TABLE(acpi, stk8ba50_acpi_id);
static struct i2c_driver stk8ba50_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;