linux/drivers/iio/imu/adis16400.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * adis16400.c	support Analog Devices ADIS16400/5
 *		3d 2g Linear Accelerometers,
 *		3d Gyroscopes,
 *		3d Magnetometers via SPI
 *
 * Copyright (c) 2009 Manuel Stahl <[email protected]>
 * Copyright (c) 2007 Jonathan Cameron <[email protected]>
 * Copyright (c) 2011 Analog Devices Inc.
 */

#include <linux/irq.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/spi/spi.h>
#include <linux/module.h>
#include <linux/debugfs.h>
#include <linux/bitops.h>

#include <linux/iio/iio.h>
#include <linux/iio/buffer.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/imu/adis.h>

#define ADIS16400_STARTUP_DELAY
#define ADIS16400_MTEST_DELAY

#define ADIS16400_FLASH_CNT
#define ADIS16400_SUPPLY_OUT
#define ADIS16400_XGYRO_OUT
#define ADIS16400_YGYRO_OUT
#define ADIS16400_ZGYRO_OUT
#define ADIS16400_XACCL_OUT
#define ADIS16400_YACCL_OUT
#define ADIS16400_ZACCL_OUT
#define ADIS16400_XMAGN_OUT
#define ADIS16400_YMAGN_OUT
#define ADIS16400_ZMAGN_OUT
#define ADIS16400_TEMP_OUT
#define ADIS16400_AUX_ADC

#define ADIS16350_XTEMP_OUT
#define ADIS16350_YTEMP_OUT
#define ADIS16350_ZTEMP_OUT

#define ADIS16300_PITCH_OUT
#define ADIS16300_ROLL_OUT
#define ADIS16300_AUX_ADC

#define ADIS16448_BARO_OUT
#define ADIS16448_TEMP_OUT

/* Calibration parameters */
#define ADIS16400_XGYRO_OFF
#define ADIS16400_YGYRO_OFF
#define ADIS16400_ZGYRO_OFF
#define ADIS16400_XACCL_OFF
#define ADIS16400_YACCL_OFF
#define ADIS16400_ZACCL_OFF
#define ADIS16400_XMAGN_HIF
#define ADIS16400_YMAGN_HIF
#define ADIS16400_ZMAGN_HIF
#define ADIS16400_XMAGN_SIF
#define ADIS16400_YMAGN_SIF
#define ADIS16400_ZMAGN_SIF

#define ADIS16400_GPIO_CTRL
#define ADIS16400_MSC_CTRL
#define ADIS16400_SMPL_PRD
#define ADIS16400_SENS_AVG
#define ADIS16400_SLP_CNT
#define ADIS16400_DIAG_STAT

/* Alarm functions */
#define ADIS16400_GLOB_CMD
#define ADIS16400_ALM_MAG1
#define ADIS16400_ALM_MAG2
#define ADIS16400_ALM_SMPL1
#define ADIS16400_ALM_SMPL2
#define ADIS16400_ALM_CTRL
#define ADIS16400_AUX_DAC

#define ADIS16334_LOT_ID1
#define ADIS16334_LOT_ID2
#define ADIS16400_PRODUCT_ID
#define ADIS16334_SERIAL_NUMBER

#define ADIS16400_ERROR_ACTIVE
#define ADIS16400_NEW_DATA

/* MSC_CTRL */
#define ADIS16400_MSC_CTRL_MEM_TEST
#define ADIS16400_MSC_CTRL_INT_SELF_TEST
#define ADIS16400_MSC_CTRL_NEG_SELF_TEST
#define ADIS16400_MSC_CTRL_POS_SELF_TEST
#define ADIS16400_MSC_CTRL_GYRO_BIAS
#define ADIS16400_MSC_CTRL_ACCL_ALIGN
#define ADIS16400_MSC_CTRL_DATA_RDY_EN
#define ADIS16400_MSC_CTRL_DATA_RDY_POL_HIGH
#define ADIS16400_MSC_CTRL_DATA_RDY_DIO2

/* SMPL_PRD */
#define ADIS16400_SMPL_PRD_TIME_BASE
#define ADIS16400_SMPL_PRD_DIV_MASK

/* DIAG_STAT */
#define ADIS16400_DIAG_STAT_ZACCL_FAIL
#define ADIS16400_DIAG_STAT_YACCL_FAIL
#define ADIS16400_DIAG_STAT_XACCL_FAIL
#define ADIS16400_DIAG_STAT_XGYRO_FAIL
#define ADIS16400_DIAG_STAT_YGYRO_FAIL
#define ADIS16400_DIAG_STAT_ZGYRO_FAIL
#define ADIS16400_DIAG_STAT_ALARM2
#define ADIS16400_DIAG_STAT_ALARM1
#define ADIS16400_DIAG_STAT_FLASH_CHK
#define ADIS16400_DIAG_STAT_SELF_TEST
#define ADIS16400_DIAG_STAT_OVERFLOW
#define ADIS16400_DIAG_STAT_SPI_FAIL
#define ADIS16400_DIAG_STAT_FLASH_UPT
#define ADIS16400_DIAG_STAT_POWER_HIGH
#define ADIS16400_DIAG_STAT_POWER_LOW

/* GLOB_CMD */
#define ADIS16400_GLOB_CMD_SW_RESET
#define ADIS16400_GLOB_CMD_P_AUTO_NULL
#define ADIS16400_GLOB_CMD_FLASH_UPD
#define ADIS16400_GLOB_CMD_DAC_LATCH
#define ADIS16400_GLOB_CMD_FAC_CALIB
#define ADIS16400_GLOB_CMD_AUTO_NULL

/* SLP_CNT */
#define ADIS16400_SLP_CNT_POWER_OFF

#define ADIS16334_RATE_DIV_SHIFT
#define ADIS16334_RATE_INT_CLK

#define ADIS16400_SPI_SLOW
#define ADIS16400_SPI_BURST
#define ADIS16400_SPI_FAST

#define ADIS16400_HAS_PROD_ID
#define ADIS16400_NO_BURST
#define ADIS16400_HAS_SLOW_MODE
#define ADIS16400_HAS_SERIAL_NUMBER
#define ADIS16400_BURST_DIAG_STAT

struct adis16400_state;

struct adis16400_chip_info {};

/**
 * struct adis16400_state - device instance specific data
 * @variant:	chip variant info
 * @filt_int:	integer part of requested filter frequency
 * @adis:	adis device
 * @avail_scan_mask:	NULL terminated array of bitmaps of channels
 *			that must be enabled together
 **/
struct adis16400_state {};

/* At the moment triggers are only used for ring buffer
 * filling. This may change!
 */

enum {};

static ssize_t adis16400_show_serial_number(struct file *file,
		char __user *userbuf, size_t count, loff_t *ppos)
{}

static const struct file_operations adis16400_serial_number_fops =;

static int adis16400_show_product_id(void *arg, u64 *val)
{}
DEFINE_DEBUGFS_ATTRIBUTE();

static int adis16400_show_flash_count(void *arg, u64 *val)
{}
DEFINE_DEBUGFS_ATTRIBUTE();

static void adis16400_debugfs_init(struct iio_dev *indio_dev)
{}

enum adis16400_chip_variant {};

static int adis16334_get_freq(struct adis16400_state *st)
{}

static int adis16334_set_freq(struct adis16400_state *st, unsigned int freq)
{}

static int adis16400_get_freq(struct adis16400_state *st)
{}

static int adis16400_set_freq(struct adis16400_state *st, unsigned int freq)
{}

static const unsigned int adis16400_3db_divisors[] =;

static int __adis16400_set_filter(struct iio_dev *indio_dev, int sps, int val)
{}

/* Power down the device */
static int adis16400_stop_device(struct iio_dev *indio_dev)
{}

static int adis16400_initial_setup(struct iio_dev *indio_dev)
{}

static const uint8_t adis16400_addresses[] =;

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

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

#if IS_ENABLED(CONFIG_IIO_BUFFER)
static irqreturn_t adis16400_trigger_handler(int irq, void *p)
{}
#else
#define adis16400_trigger_handler
#endif /* IS_ENABLED(CONFIG_IIO_BUFFER) */

#define ADIS16400_VOLTAGE_CHAN(addr, bits, name, si, chn)

#define ADIS16400_SUPPLY_CHAN(addr, bits)

#define ADIS16400_AUX_ADC_CHAN(addr, bits)

#define ADIS16400_GYRO_CHAN(mod, addr, bits)

#define ADIS16400_ACCEL_CHAN(mod, addr, bits)

#define ADIS16400_MAGN_CHAN(mod, addr, bits)

#define ADIS16400_MOD_TEMP_NAME_X
#define ADIS16400_MOD_TEMP_NAME_Y
#define ADIS16400_MOD_TEMP_NAME_Z

#define ADIS16400_MOD_TEMP_CHAN(mod, addr, bits)

#define ADIS16400_TEMP_CHAN(addr, bits)

#define ADIS16400_INCLI_CHAN(mod, addr, bits)

static const struct iio_chan_spec adis16400_channels[] =;

static const struct iio_chan_spec adis16445_channels[] =;

static const struct iio_chan_spec adis16448_channels[] =;

static const struct iio_chan_spec adis16350_channels[] =;

static const struct iio_chan_spec adis16300_channels[] =;

static const struct iio_chan_spec adis16334_channels[] =;

static const char * const adis16400_status_error_msgs[] =;

#define ADIS16400_DATA(_timeouts, _burst_len)

static const struct adis_timeout adis16300_timeouts =;

static const struct adis_timeout adis16334_timeouts =;

static const struct adis_timeout adis16362_timeouts =;

static const struct adis_timeout adis16400_timeouts =;

static const struct adis_timeout adis16445_timeouts =;

static const struct adis_timeout adis16448_timeouts =;

static struct adis16400_chip_info adis16400_chips[] =;

static const struct iio_info adis16400_info =;

static void adis16400_setup_chan_mask(struct adis16400_state *st)
{}

static void adis16400_stop(void *data)
{}

static int adis16400_probe(struct spi_device *spi)
{}

static const struct spi_device_id adis16400_id[] =;
MODULE_DEVICE_TABLE(spi, adis16400_id);

static struct spi_driver adis16400_driver =;
module_spi_driver();

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