#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/events.h>
#include <linux/pm_runtime.h>
#include "mma9551_core.h"
#define MMA9551_DRV_NAME …
#define MMA9551_IRQ_NAME …
#define MMA9551_GPIO_COUNT …
#define MMA9551_TILT_XZ_ANG_REG …
#define MMA9551_TILT_YZ_ANG_REG …
#define MMA9551_TILT_XY_ANG_REG …
#define MMA9551_TILT_ANGFLG …
#define MMA9551_TILT_QUAD_REG …
#define MMA9551_TILT_XY_QUAD_SHIFT …
#define MMA9551_TILT_YZ_QUAD_SHIFT …
#define MMA9551_TILT_XZ_QUAD_SHIFT …
#define MMA9551_TILT_CFG_REG …
#define MMA9551_TILT_ANG_THRESH_MASK …
#define MMA9551_DEFAULT_SAMPLE_RATE …
enum mma9551_tilt_axis { … };
struct mma9551_data { … };
static int mma9551_read_incli_chan(struct i2c_client *client,
const struct iio_chan_spec *chan,
int *val)
{ … }
static int mma9551_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{ … }
static int mma9551_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 mma9551_config_incli_event(struct iio_dev *indio_dev,
enum iio_modifier axis,
int state)
{ … }
static int mma9551_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 int mma9551_write_event_value(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 mma9551_read_event_value(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 const struct iio_event_spec mma9551_incli_event = …;
#define MMA9551_INCLI_CHANNEL(axis) …
static const struct iio_chan_spec mma9551_channels[] = …;
static const struct iio_info mma9551_info = …;
static irqreturn_t mma9551_event_handler(int irq, void *private)
{ … }
static int mma9551_init(struct mma9551_data *data)
{ … }
static int mma9551_gpio_probe(struct iio_dev *indio_dev)
{ … }
static const char *mma9551_match_acpi_device(struct device *dev)
{ … }
static int mma9551_probe(struct i2c_client *client)
{ … }
static void mma9551_remove(struct i2c_client *client)
{ … }
static int mma9551_runtime_suspend(struct device *dev)
{ … }
static int mma9551_runtime_resume(struct device *dev)
{ … }
static int mma9551_suspend(struct device *dev)
{ … }
static int mma9551_resume(struct device *dev)
{ … }
static const struct dev_pm_ops mma9551_pm_ops = …;
static const struct acpi_device_id mma9551_acpi_match[] = …;
MODULE_DEVICE_TABLE(acpi, mma9551_acpi_match);
static const struct i2c_device_id mma9551_id[] = …;
MODULE_DEVICE_TABLE(i2c, mma9551_id);
static struct i2c_driver mma9551_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_IMPORT_NS(…);