#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/acpi.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/buffer.h>
#include <linux/iio/trigger.h>
#include <linux/iio/events.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include "bmg160.h"
#define BMG160_IRQ_NAME …
#define BMG160_REG_CHIP_ID …
#define BMG160_CHIP_ID_VAL …
#define BMG160_REG_PMU_LPW …
#define BMG160_MODE_NORMAL …
#define BMG160_MODE_DEEP_SUSPEND …
#define BMG160_MODE_SUSPEND …
#define BMG160_REG_RANGE …
#define BMG160_RANGE_2000DPS …
#define BMG160_RANGE_1000DPS …
#define BMG160_RANGE_500DPS …
#define BMG160_RANGE_250DPS …
#define BMG160_RANGE_125DPS …
#define BMG160_REG_PMU_BW …
#define BMG160_NO_FILTER …
#define BMG160_DEF_BW …
#define BMG160_REG_PMU_BW_RES …
#define BMG160_GYRO_REG_RESET …
#define BMG160_GYRO_RESET_VAL …
#define BMG160_REG_INT_MAP_0 …
#define BMG160_INT_MAP_0_BIT_ANY …
#define BMG160_REG_INT_MAP_1 …
#define BMG160_INT_MAP_1_BIT_NEW_DATA …
#define BMG160_REG_INT_RST_LATCH …
#define BMG160_INT_MODE_LATCH_RESET …
#define BMG160_INT_MODE_LATCH_INT …
#define BMG160_INT_MODE_NON_LATCH_INT …
#define BMG160_REG_INT_EN_0 …
#define BMG160_DATA_ENABLE_INT …
#define BMG160_REG_INT_EN_1 …
#define BMG160_INT1_BIT_OD …
#define BMG160_REG_XOUT_L …
#define BMG160_AXIS_TO_REG(axis) …
#define BMG160_REG_SLOPE_THRES …
#define BMG160_SLOPE_THRES_MASK …
#define BMG160_REG_MOTION_INTR …
#define BMG160_INT_MOTION_X …
#define BMG160_INT_MOTION_Y …
#define BMG160_INT_MOTION_Z …
#define BMG160_ANY_DUR_MASK …
#define BMG160_ANY_DUR_SHIFT …
#define BMG160_REG_INT_STATUS_2 …
#define BMG160_ANY_MOTION_MASK …
#define BMG160_ANY_MOTION_BIT_X …
#define BMG160_ANY_MOTION_BIT_Y …
#define BMG160_ANY_MOTION_BIT_Z …
#define BMG160_REG_TEMP …
#define BMG160_TEMP_CENTER_VAL …
#define BMG160_MAX_STARTUP_TIME_MS …
#define BMG160_AUTO_SUSPEND_DELAY_MS …
struct bmg160_data { … };
enum bmg160_axis { … };
static const struct { … } bmg160_samp_freq_table[] = …;
static const struct { … } bmg160_scale_table[] = …;
static int bmg160_set_mode(struct bmg160_data *data, u8 mode)
{ … }
static int bmg160_convert_freq_to_bit(int val)
{ … }
static int bmg160_set_bw(struct bmg160_data *data, int val)
{ … }
static int bmg160_get_filter(struct bmg160_data *data, int *val)
{ … }
static int bmg160_set_filter(struct bmg160_data *data, int val)
{ … }
static int bmg160_chip_init(struct bmg160_data *data)
{ … }
static int bmg160_set_power_state(struct bmg160_data *data, bool on)
{ … }
static int bmg160_setup_any_motion_interrupt(struct bmg160_data *data,
bool status)
{ … }
static int bmg160_setup_new_data_interrupt(struct bmg160_data *data,
bool status)
{ … }
static int bmg160_get_bw(struct bmg160_data *data, int *val)
{ … }
static int bmg160_set_scale(struct bmg160_data *data, int val)
{ … }
static int bmg160_get_temp(struct bmg160_data *data, int *val)
{ … }
static int bmg160_get_axis(struct bmg160_data *data, int axis, int *val)
{ … }
static int bmg160_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{ … }
static int bmg160_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int val, int val2, long mask)
{ … }
static int bmg160_read_event(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan,
enum iio_event_type type,
enum iio_event_direction dir,
enum iio_event_info info,
int *val, int *val2)
{ … }
static int bmg160_write_event(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan,
enum iio_event_type type,
enum iio_event_direction dir,
enum iio_event_info info,
int val, int val2)
{ … }
static int bmg160_read_event_config(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan,
enum iio_event_type type,
enum iio_event_direction dir)
{ … }
static int bmg160_write_event_config(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan,
enum iio_event_type type,
enum iio_event_direction dir,
int state)
{ … }
static const struct iio_mount_matrix *
bmg160_get_mount_matrix(const struct iio_dev *indio_dev,
const struct iio_chan_spec *chan)
{ … }
static const struct iio_chan_spec_ext_info bmg160_ext_info[] = …;
static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("100 200 400 1000 2000");
static IIO_CONST_ATTR(in_anglvel_scale_available,
"0.001065 0.000532 0.000266 0.000133 0.000066");
static struct attribute *bmg160_attributes[] = …;
static const struct attribute_group bmg160_attrs_group = …;
static const struct iio_event_spec bmg160_event = …;
#define BMG160_CHANNEL(_axis) …
static const struct iio_chan_spec bmg160_channels[] = …;
static const struct iio_info bmg160_info = …;
static const unsigned long bmg160_accel_scan_masks[] = …;
static irqreturn_t bmg160_trigger_handler(int irq, void *p)
{ … }
static void bmg160_trig_reen(struct iio_trigger *trig)
{ … }
static int bmg160_data_rdy_trigger_set_state(struct iio_trigger *trig,
bool state)
{ … }
static const struct iio_trigger_ops bmg160_trigger_ops = …;
static irqreturn_t bmg160_event_handler(int irq, void *private)
{ … }
static irqreturn_t bmg160_data_rdy_trig_poll(int irq, void *private)
{ … }
static int bmg160_buffer_preenable(struct iio_dev *indio_dev)
{ … }
static int bmg160_buffer_postdisable(struct iio_dev *indio_dev)
{ … }
static const struct iio_buffer_setup_ops bmg160_buffer_setup_ops = …;
static const char *bmg160_match_acpi_device(struct device *dev)
{ … }
int bmg160_core_probe(struct device *dev, struct regmap *regmap, int irq,
const char *name)
{ … }
EXPORT_SYMBOL_GPL(…);
void bmg160_core_remove(struct device *dev)
{ … }
EXPORT_SYMBOL_GPL(…);
#ifdef CONFIG_PM_SLEEP
static int bmg160_suspend(struct device *dev)
{ … }
static int bmg160_resume(struct device *dev)
{ … }
#endif
#ifdef CONFIG_PM
static int bmg160_runtime_suspend(struct device *dev)
{ … }
static int bmg160_runtime_resume(struct device *dev)
{ … }
#endif
const struct dev_pm_ops bmg160_pm_ops = …;
EXPORT_SYMBOL_GPL(…);
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
MODULE_DESCRIPTION(…) …;