linux/drivers/iio/accel/mxc4005.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * 3-axis accelerometer driver for MXC4005XC Memsic sensor
 *
 * Copyright (c) 2014, Intel Corporation.
 */

#include <linux/delay.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/iio/iio.h>
#include <linux/mod_devicetable.h>
#include <linux/regmap.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/trigger.h>
#include <linux/iio/buffer.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/iio/trigger_consumer.h>

#define MXC4005_DRV_NAME
#define MXC4005_IRQ_NAME
#define MXC4005_REGMAP_NAME

#define MXC4005_REG_XOUT_UPPER
#define MXC4005_REG_XOUT_LOWER
#define MXC4005_REG_YOUT_UPPER
#define MXC4005_REG_YOUT_LOWER
#define MXC4005_REG_ZOUT_UPPER
#define MXC4005_REG_ZOUT_LOWER

#define MXC4005_REG_INT_MASK0

#define MXC4005_REG_INT_MASK1
#define MXC4005_REG_INT_MASK1_BIT_DRDYE

#define MXC4005_REG_INT_CLR0

#define MXC4005_REG_INT_CLR1
#define MXC4005_REG_INT_CLR1_BIT_DRDYC
#define MXC4005_REG_INT_CLR1_SW_RST

#define MXC4005_REG_CONTROL
#define MXC4005_REG_CONTROL_MASK_FSR
#define MXC4005_CONTROL_FSR_SHIFT

#define MXC4005_REG_DEVICE_ID

/* Datasheet does not specify a reset time, this is a conservative guess */
#define MXC4005_RESET_TIME_US

enum mxc4005_axis {};

enum mxc4005_range {};

struct mxc4005_data {};

/*
 * MXC4005 can operate in the following ranges:
 * +/- 2G, 4G, 8G (the default +/-2G)
 *
 * (2 + 2) * 9.81 / (2^12 - 1) = 0.009582
 * (4 + 4) * 9.81 / (2^12 - 1) = 0.019164
 * (8 + 8) * 9.81 / (2^12 - 1) = 0.038329
 */
static const struct {} mxc4005_scale_table[] =;


static IIO_CONST_ATTR(in_accel_scale_available, "0.009582 0.019164 0.038329");

static struct attribute *mxc4005_attributes[] =;

static const struct attribute_group mxc4005_attrs_group =;

static bool mxc4005_is_readable_reg(struct device *dev, unsigned int reg)
{}

static bool mxc4005_is_writeable_reg(struct device *dev, unsigned int reg)
{}

static const struct regmap_config mxc4005_regmap_config =;

static int mxc4005_read_xyz(struct mxc4005_data *data)
{}

static int mxc4005_read_axis(struct mxc4005_data *data,
			     unsigned int addr)
{}

static int mxc4005_read_scale(struct mxc4005_data *data)
{}

static int mxc4005_set_scale(struct mxc4005_data *data, int val)
{}

static int mxc4005_read_raw(struct iio_dev *indio_dev,
			    struct iio_chan_spec const *chan,
			    int *val, int *val2, long mask)
{}

static int mxc4005_write_raw(struct iio_dev *indio_dev,
			     struct iio_chan_spec const *chan,
			     int val, int val2, long mask)
{}

static const struct iio_mount_matrix *
mxc4005_get_mount_matrix(const struct iio_dev *indio_dev,
			   const struct iio_chan_spec *chan)
{}

static const struct iio_chan_spec_ext_info mxc4005_ext_info[] =;

static const struct iio_info mxc4005_info =;

static const unsigned long mxc4005_scan_masks[] =;

#define MXC4005_CHANNEL(_axis, _addr)

static const struct iio_chan_spec mxc4005_channels[] =;

static irqreturn_t mxc4005_trigger_handler(int irq, void *private)
{}

static void mxc4005_clr_intr(struct mxc4005_data *data)
{}

static int mxc4005_set_trigger_state(struct iio_trigger *trig,
				     bool state)
{}

static void mxc4005_trigger_reen(struct iio_trigger *trig)
{}

static const struct iio_trigger_ops mxc4005_trigger_ops =;

static int mxc4005_chip_init(struct mxc4005_data *data)
{}

static int mxc4005_probe(struct i2c_client *client)
{}

static int mxc4005_suspend(struct device *dev)
{}

static int mxc4005_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(mxc4005_pm_ops, mxc4005_suspend, mxc4005_resume);

static const struct acpi_device_id mxc4005_acpi_match[] =;
MODULE_DEVICE_TABLE(acpi, mxc4005_acpi_match);

static const struct of_device_id mxc4005_of_match[] =;
MODULE_DEVICE_TABLE(of, mxc4005_of_match);

static const struct i2c_device_id mxc4005_id[] =;
MODULE_DEVICE_TABLE(i2c, mxc4005_id);

static struct i2c_driver mxc4005_driver =;

module_i2c_driver();

MODULE_AUTHOR();
MODULE_LICENSE();
MODULE_DESCRIPTION();