#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/iio/events.h>
#include <linux/iio/iio.h>
#include <linux/iio/buffer.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/trigger.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#include "fxas21002c.h"
#define FXAS21002C_CHIP_ID_1 …
#define FXAS21002C_CHIP_ID_2 …
enum fxas21002c_mode_state { … };
#define FXAS21002C_STANDBY_ACTIVE_TIME_MS …
#define FXAS21002C_READY_ACTIVE_TIME_MS …
#define FXAS21002C_ODR_LIST_MAX …
#define FXAS21002C_SCALE_FRACTIONAL …
#define FXAS21002C_RANGE_LIMIT_DOUBLE …
#define FXAS21002C_AXIS_TO_REG(axis) …
static const struct reg_field fxas21002c_reg_fields[] = …;
static const int fxas21002c_odr_values[] = …;
static const int fxas21002c_lpf_values[] = …;
static const int fxas21002c_hpf_values[] = …;
static const int fxas21002c_range_values[] = …;
struct fxas21002c_data { … };
enum fxas21002c_channel_index { … };
static int fxas21002c_odr_hz_from_value(struct fxas21002c_data *data, u8 value)
{ … }
static int fxas21002c_odr_value_from_hz(struct fxas21002c_data *data,
unsigned int hz)
{ … }
static int fxas21002c_lpf_bw_from_value(struct fxas21002c_data *data, u8 value)
{ … }
static int fxas21002c_lpf_value_from_bw(struct fxas21002c_data *data,
unsigned int hz)
{ … }
static int fxas21002c_hpf_sel_from_value(struct fxas21002c_data *data, u8 value)
{ … }
static int fxas21002c_hpf_value_from_sel(struct fxas21002c_data *data,
unsigned int hz)
{ … }
static int fxas21002c_range_fs_from_value(struct fxas21002c_data *data,
u8 value)
{ … }
static int fxas21002c_range_value_from_fs(struct fxas21002c_data *data,
unsigned int range)
{ … }
static int fxas21002c_mode_get(struct fxas21002c_data *data)
{ … }
static int fxas21002c_mode_set(struct fxas21002c_data *data,
enum fxas21002c_mode_state mode)
{ … }
static int fxas21002c_write(struct fxas21002c_data *data,
enum fxas21002c_fields field, int bits)
{ … }
static int fxas21002c_pm_get(struct fxas21002c_data *data)
{ … }
static int fxas21002c_pm_put(struct fxas21002c_data *data)
{ … }
static int fxas21002c_temp_get(struct fxas21002c_data *data, int *val)
{ … }
static int fxas21002c_axis_get(struct fxas21002c_data *data,
int index, int *val)
{ … }
static int fxas21002c_odr_get(struct fxas21002c_data *data, int *odr)
{ … }
static int fxas21002c_odr_set(struct fxas21002c_data *data, int odr)
{ … }
static int fxas21002c_lpf_get(struct fxas21002c_data *data, int *val2)
{ … }
static int fxas21002c_lpf_set(struct fxas21002c_data *data, int bw)
{ … }
static int fxas21002c_hpf_get(struct fxas21002c_data *data, int *val2)
{ … }
static int fxas21002c_hpf_set(struct fxas21002c_data *data, int sel)
{ … }
static int fxas21002c_scale_get(struct fxas21002c_data *data, int *val)
{ … }
static int fxas21002c_scale_set(struct fxas21002c_data *data, int range)
{ … }
static int fxas21002c_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int *val,
int *val2, long mask)
{ … }
static int fxas21002c_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int val,
int val2, long mask)
{ … }
static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("12.5 25 50 100 200 400 800");
static IIO_CONST_ATTR(in_anglvel_filter_low_pass_3db_frequency_available,
"0.32 0.16 0.08");
static IIO_CONST_ATTR(in_anglvel_filter_high_pass_3db_frequency_available,
"0.018750 0.009625 0.004875 0.002475");
static IIO_CONST_ATTR(in_anglvel_scale_available,
"125.0 62.5 31.25 15.625 7.8125");
static struct attribute *fxas21002c_attributes[] = …;
static const struct attribute_group fxas21002c_attrs_group = …;
#define FXAS21002C_CHANNEL(_axis) …
static const struct iio_chan_spec fxas21002c_channels[] = …;
static const struct iio_info fxas21002c_info = …;
static irqreturn_t fxas21002c_trigger_handler(int irq, void *p)
{ … }
static int fxas21002c_chip_init(struct fxas21002c_data *data)
{ … }
static int fxas21002c_data_rdy_trigger_set_state(struct iio_trigger *trig,
bool state)
{ … }
static const struct iio_trigger_ops fxas21002c_trigger_ops = …;
static irqreturn_t fxas21002c_data_rdy_handler(int irq, void *private)
{ … }
static irqreturn_t fxas21002c_data_rdy_thread(int irq, void *private)
{ … }
static int fxas21002c_trigger_probe(struct fxas21002c_data *data)
{ … }
static int fxas21002c_power_enable(struct fxas21002c_data *data)
{ … }
static void fxas21002c_power_disable(struct fxas21002c_data *data)
{ … }
static void fxas21002c_power_disable_action(void *_data)
{ … }
static int fxas21002c_regulators_get(struct fxas21002c_data *data)
{ … }
int fxas21002c_core_probe(struct device *dev, struct regmap *regmap, int irq,
const char *name)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
void fxas21002c_core_remove(struct device *dev)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
static int fxas21002c_suspend(struct device *dev)
{ … }
static int fxas21002c_resume(struct device *dev)
{ … }
static int fxas21002c_runtime_suspend(struct device *dev)
{ … }
static int fxas21002c_runtime_resume(struct device *dev)
{ … }
EXPORT_NS_GPL_DEV_PM_OPS(fxas21002c_pm_ops, IIO_FXAS21002C) = …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
MODULE_DESCRIPTION(…) …;