linux/drivers/iio/imu/fxos8700_core.c

// SPDX-License-Identifier: GPL-2.0
/*
 * FXOS8700 - NXP IMU (accelerometer plus magnetometer)
 *
 * IIO core driver for FXOS8700, with support for I2C/SPI busses
 *
 * TODO: Buffer, trigger, and IRQ support
 */
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/acpi.h>
#include <linux/bitops.h>
#include <linux/bitfield.h>

#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>

#include "fxos8700.h"

/* Register Definitions */
#define FXOS8700_STATUS
#define FXOS8700_OUT_X_MSB
#define FXOS8700_OUT_X_LSB
#define FXOS8700_OUT_Y_MSB
#define FXOS8700_OUT_Y_LSB
#define FXOS8700_OUT_Z_MSB
#define FXOS8700_OUT_Z_LSB
#define FXOS8700_F_SETUP
#define FXOS8700_TRIG_CFG
#define FXOS8700_SYSMOD
#define FXOS8700_INT_SOURCE
#define FXOS8700_WHO_AM_I
#define FXOS8700_XYZ_DATA_CFG
#define FXOS8700_HP_FILTER_CUTOFF
#define FXOS8700_PL_STATUS
#define FXOS8700_PL_CFG
#define FXOS8700_PL_COUNT
#define FXOS8700_PL_BF_ZCOMP
#define FXOS8700_PL_THS_REG
#define FXOS8700_A_FFMT_CFG
#define FXOS8700_A_FFMT_SRC
#define FXOS8700_A_FFMT_THS
#define FXOS8700_A_FFMT_COUNT
#define FXOS8700_TRANSIENT_CFG
#define FXOS8700_TRANSIENT_SRC
#define FXOS8700_TRANSIENT_THS
#define FXOS8700_TRANSIENT_COUNT
#define FXOS8700_PULSE_CFG
#define FXOS8700_PULSE_SRC
#define FXOS8700_PULSE_THSX
#define FXOS8700_PULSE_THSY
#define FXOS8700_PULSE_THSZ
#define FXOS8700_PULSE_TMLT
#define FXOS8700_PULSE_LTCY
#define FXOS8700_PULSE_WIND
#define FXOS8700_ASLP_COUNT
#define FXOS8700_CTRL_REG1
#define FXOS8700_CTRL_REG2
#define FXOS8700_CTRL_REG3
#define FXOS8700_CTRL_REG4
#define FXOS8700_CTRL_REG5
#define FXOS8700_OFF_X
#define FXOS8700_OFF_Y
#define FXOS8700_OFF_Z
#define FXOS8700_M_DR_STATUS
#define FXOS8700_M_OUT_X_MSB
#define FXOS8700_M_OUT_X_LSB
#define FXOS8700_M_OUT_Y_MSB
#define FXOS8700_M_OUT_Y_LSB
#define FXOS8700_M_OUT_Z_MSB
#define FXOS8700_M_OUT_Z_LSB
#define FXOS8700_CMP_X_MSB
#define FXOS8700_CMP_X_LSB
#define FXOS8700_CMP_Y_MSB
#define FXOS8700_CMP_Y_LSB
#define FXOS8700_CMP_Z_MSB
#define FXOS8700_CMP_Z_LSB
#define FXOS8700_M_OFF_X_MSB
#define FXOS8700_M_OFF_X_LSB
#define FXOS8700_M_OFF_Y_MSB
#define FXOS8700_M_OFF_Y_LSB
#define FXOS8700_M_OFF_Z_MSB
#define FXOS8700_M_OFF_Z_LSB
#define FXOS8700_MAX_X_MSB
#define FXOS8700_MAX_X_LSB
#define FXOS8700_MAX_Y_MSB
#define FXOS8700_MAX_Y_LSB
#define FXOS8700_MAX_Z_MSB
#define FXOS8700_MAX_Z_LSB
#define FXOS8700_MIN_X_MSB
#define FXOS8700_MIN_X_LSB
#define FXOS8700_MIN_Y_MSB
#define FXOS8700_MIN_Y_LSB
#define FXOS8700_MIN_Z_MSB
#define FXOS8700_MIN_Z_LSB
#define FXOS8700_TEMP
#define FXOS8700_M_THS_CFG
#define FXOS8700_M_THS_SRC
#define FXOS8700_M_THS_X_MSB
#define FXOS8700_M_THS_X_LSB
#define FXOS8700_M_THS_Y_MSB
#define FXOS8700_M_THS_Y_LSB
#define FXOS8700_M_THS_Z_MSB
#define FXOS8700_M_THS_Z_LSB
#define FXOS8700_M_THS_COUNT
#define FXOS8700_M_CTRL_REG1
#define FXOS8700_M_CTRL_REG2
#define FXOS8700_M_CTRL_REG3
#define FXOS8700_M_INT_SRC
#define FXOS8700_A_VECM_CFG
#define FXOS8700_A_VECM_THS_MSB
#define FXOS8700_A_VECM_THS_LSB
#define FXOS8700_A_VECM_CNT
#define FXOS8700_A_VECM_INITX_MSB
#define FXOS8700_A_VECM_INITX_LSB
#define FXOS8700_A_VECM_INITY_MSB
#define FXOS8700_A_VECM_INITY_LSB
#define FXOS8700_A_VECM_INITZ_MSB
#define FXOS8700_A_VECM_INITZ_LSB
#define FXOS8700_M_VECM_CFG
#define FXOS8700_M_VECM_THS_MSB
#define FXOS8700_M_VECM_THS_LSB
#define FXOS8700_M_VECM_CNT
#define FXOS8700_M_VECM_INITX_MSB
#define FXOS8700_M_VECM_INITX_LSB
#define FXOS8700_M_VECM_INITY_MSB
#define FXOS8700_M_VECM_INITY_LSB
#define FXOS8700_M_VECM_INITZ_MSB
#define FXOS8700_M_VECM_INITZ_LSB
#define FXOS8700_A_FFMT_THS_X_MSB
#define FXOS8700_A_FFMT_THS_X_LSB
#define FXOS8700_A_FFMT_THS_Y_MSB
#define FXOS8700_A_FFMT_THS_Y_LSB
#define FXOS8700_A_FFMT_THS_Z_MSB
#define FXOS8700_A_FFMT_THS_Z_LSB
#define FXOS8700_A_TRAN_INIT_MSB
#define FXOS8700_A_TRAN_INIT_LSB_X
#define FXOS8700_A_TRAN_INIT_LSB_Y
#define FXOS8700_A_TRAN_INIT_LSB_Z
#define FXOS8700_TM_NVM_LOCK
#define FXOS8700_NVM_DATA0_35
#define FXOS8700_NVM_DATA_BNK3
#define FXOS8700_NVM_DATA_BNK2
#define FXOS8700_NVM_DATA_BNK1
#define FXOS8700_NVM_DATA_BNK0

/* Bit definitions for FXOS8700_CTRL_REG1 */
#define FXOS8700_CTRL_ODR_MAX
#define FXOS8700_CTRL_ODR_MSK

/* Bit definitions for FXOS8700_M_CTRL_REG1 */
#define FXOS8700_HMS_MASK
#define FXOS8700_OS_MASK

/* Bit definitions for FXOS8700_M_CTRL_REG2 */
#define FXOS8700_MAXMIN_RST
#define FXOS8700_MAXMIN_DIS_THS
#define FXOS8700_MAXMIN_DIS

#define FXOS8700_ACTIVE
#define FXOS8700_ACTIVE_MIN_USLEEP

#define FXOS8700_DEVICE_ID
#define FXOS8700_PRE_DEVICE_ID
#define FXOS8700_DATA_BUF_SIZE

struct fxos8700_data {};

/* Regmap info */
static const struct regmap_range read_range[] =;

static const struct regmap_range write_range[] =;

static const struct regmap_access_table driver_read_table =;

static const struct regmap_access_table driver_write_table =;

const struct regmap_config fxos8700_regmap_config =;
EXPORT_SYMBOL();

#define FXOS8700_CHANNEL(_type, _axis)

enum fxos8700_accel_scale_bits {};

/* scan indexes follow DATA register order */
enum fxos8700_scan_axis {};

enum fxos8700_sensor {};

enum fxos8700_int_pin {};

struct fxos8700_scale {};

struct fxos8700_odr {};

static const struct fxos8700_scale fxos8700_accel_scale[] =;

/*
 * Accellerometer and magnetometer have the same ODR options, set in the
 * CTRL_REG1 register. ODR is halved when using both sensors at once in
 * hybrid mode.
 */
static const struct fxos8700_odr fxos8700_odr[] =;

static const struct iio_chan_spec fxos8700_channels[] =;

static enum fxos8700_sensor fxos8700_to_sensor(enum iio_chan_type iio_type)
{}

static int fxos8700_set_active_mode(struct fxos8700_data *data,
				    enum fxos8700_sensor t, bool mode)
{}

static int fxos8700_set_scale(struct fxos8700_data *data,
			      enum fxos8700_sensor t, int uscale)
{}

static int fxos8700_get_scale(struct fxos8700_data *data,
			      enum fxos8700_sensor t, int *uscale)
{}

static int fxos8700_get_data(struct fxos8700_data *data, int chan_type,
			     int axis, int *val)
{}

static int fxos8700_set_odr(struct fxos8700_data *data, enum fxos8700_sensor t,
			    int odr, int uodr)
{}

static int fxos8700_get_odr(struct fxos8700_data *data, enum fxos8700_sensor t,
			    int *odr, int *uodr)
{}

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

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

static IIO_CONST_ATTR(in_accel_sampling_frequency_available,
		      "1.5625 6.25 12.5 50 100 200 400 800");
static IIO_CONST_ATTR(in_magn_sampling_frequency_available,
		      "1.5625 6.25 12.5 50 100 200 400 800");
static IIO_CONST_ATTR(in_accel_scale_available, "0.000244 0.000488 0.000976");
static IIO_CONST_ATTR(in_magn_scale_available, "0.001000");

static struct attribute *fxos8700_attrs[] =;

static const struct attribute_group fxos8700_attrs_group =;

static const struct iio_info fxos8700_info =;

static int fxos8700_chip_init(struct fxos8700_data *data, bool use_spi)
{}

static void fxos8700_chip_uninit(void *data)
{}

int fxos8700_core_probe(struct device *dev, struct regmap *regmap,
			const char *name, bool use_spi)
{}
EXPORT_SYMBOL_GPL();

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