linux/drivers/iio/accel/fxls8962af-core.c

// SPDX-License-Identifier: GPL-2.0
/*
 * NXP FXLS8962AF/FXLS8964AF Accelerometer Core Driver
 *
 * Copyright 2021 Connected Cars A/S
 *
 * Datasheet:
 * https://www.nxp.com/docs/en/data-sheet/FXLS8962AF.pdf
 * https://www.nxp.com/docs/en/data-sheet/FXLS8964AF.pdf
 *
 * Errata:
 * https://www.nxp.com/docs/en/errata/ES_FXLS8962AF.pdf
 */

#include <linux/bits.h>
#include <linux/bitfield.h>
#include <linux/i2c.h>
#include <linux/irq.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/pm_runtime.h>
#include <linux/property.h>
#include <linux/regulator/consumer.h>
#include <linux/regmap.h>

#include <linux/iio/buffer.h>
#include <linux/iio/events.h>
#include <linux/iio/iio.h>
#include <linux/iio/kfifo_buf.h>
#include <linux/iio/sysfs.h>

#include "fxls8962af.h"

#define FXLS8962AF_INT_STATUS
#define FXLS8962AF_INT_STATUS_SRC_BOOT
#define FXLS8962AF_INT_STATUS_SRC_SDCD_OT
#define FXLS8962AF_INT_STATUS_SRC_BUF
#define FXLS8962AF_INT_STATUS_SRC_DRDY
#define FXLS8962AF_TEMP_OUT
#define FXLS8962AF_VECM_LSB
#define FXLS8962AF_OUT_X_LSB
#define FXLS8962AF_OUT_Y_LSB
#define FXLS8962AF_OUT_Z_LSB
#define FXLS8962AF_BUF_STATUS
#define FXLS8962AF_BUF_STATUS_BUF_CNT
#define FXLS8962AF_BUF_STATUS_BUF_OVF
#define FXLS8962AF_BUF_STATUS_BUF_WMRK
#define FXLS8962AF_BUF_X_LSB
#define FXLS8962AF_BUF_Y_LSB
#define FXLS8962AF_BUF_Z_LSB

#define FXLS8962AF_PROD_REV
#define FXLS8962AF_WHO_AM_I

#define FXLS8962AF_SYS_MODE
#define FXLS8962AF_SENS_CONFIG1
#define FXLS8962AF_SENS_CONFIG1_ACTIVE
#define FXLS8962AF_SENS_CONFIG1_RST
#define FXLS8962AF_SC1_FSR_MASK
#define FXLS8962AF_SC1_FSR_PREP(x)
#define FXLS8962AF_SC1_FSR_GET(x)

#define FXLS8962AF_SENS_CONFIG2
#define FXLS8962AF_SENS_CONFIG3
#define FXLS8962AF_SC3_WAKE_ODR_MASK
#define FXLS8962AF_SC3_WAKE_ODR_PREP(x)
#define FXLS8962AF_SC3_WAKE_ODR_GET(x)
#define FXLS8962AF_SENS_CONFIG4
#define FXLS8962AF_SC4_INT_PP_OD_MASK
#define FXLS8962AF_SC4_INT_PP_OD_PREP(x)
#define FXLS8962AF_SC4_INT_POL_MASK
#define FXLS8962AF_SC4_INT_POL_PREP(x)
#define FXLS8962AF_SENS_CONFIG5

#define FXLS8962AF_WAKE_IDLE_LSB
#define FXLS8962AF_SLEEP_IDLE_LSB
#define FXLS8962AF_ASLP_COUNT_LSB

#define FXLS8962AF_INT_EN
#define FXLS8962AF_INT_EN_SDCD_OT_EN
#define FXLS8962AF_INT_EN_BUF_EN
#define FXLS8962AF_INT_PIN_SEL
#define FXLS8962AF_INT_PIN_SEL_MASK
#define FXLS8962AF_INT_PIN_SEL_INT1
#define FXLS8962AF_INT_PIN_SEL_INT2

#define FXLS8962AF_OFF_X
#define FXLS8962AF_OFF_Y
#define FXLS8962AF_OFF_Z

#define FXLS8962AF_BUF_CONFIG1
#define FXLS8962AF_BC1_BUF_MODE_MASK
#define FXLS8962AF_BC1_BUF_MODE_PREP(x)
#define FXLS8962AF_BUF_CONFIG2
#define FXLS8962AF_BUF_CONFIG2_BUF_WMRK

#define FXLS8962AF_ORIENT_STATUS
#define FXLS8962AF_ORIENT_CONFIG
#define FXLS8962AF_ORIENT_DBCOUNT
#define FXLS8962AF_ORIENT_BF_ZCOMP
#define FXLS8962AF_ORIENT_THS_REG

#define FXLS8962AF_SDCD_INT_SRC1
#define FXLS8962AF_SDCD_INT_SRC1_X_OT
#define FXLS8962AF_SDCD_INT_SRC1_X_POL
#define FXLS8962AF_SDCD_INT_SRC1_Y_OT
#define FXLS8962AF_SDCD_INT_SRC1_Y_POL
#define FXLS8962AF_SDCD_INT_SRC1_Z_OT
#define FXLS8962AF_SDCD_INT_SRC1_Z_POL
#define FXLS8962AF_SDCD_INT_SRC2
#define FXLS8962AF_SDCD_CONFIG1
#define FXLS8962AF_SDCD_CONFIG1_Z_OT_EN
#define FXLS8962AF_SDCD_CONFIG1_Y_OT_EN
#define FXLS8962AF_SDCD_CONFIG1_X_OT_EN
#define FXLS8962AF_SDCD_CONFIG1_OT_ELE
#define FXLS8962AF_SDCD_CONFIG2
#define FXLS8962AF_SDCD_CONFIG2_SDCD_EN
#define FXLS8962AF_SC2_REF_UPDM_AC
#define FXLS8962AF_SDCD_OT_DBCNT
#define FXLS8962AF_SDCD_WT_DBCNT
#define FXLS8962AF_SDCD_LTHS_LSB
#define FXLS8962AF_SDCD_UTHS_LSB

#define FXLS8962AF_SELF_TEST_CONFIG1
#define FXLS8962AF_SELF_TEST_CONFIG2

#define FXLS8962AF_MAX_REG

#define FXLS8962AF_DEVICE_ID
#define FXLS8964AF_DEVICE_ID

/* Raw temp channel offset */
#define FXLS8962AF_TEMP_CENTER_VAL

#define FXLS8962AF_AUTO_SUSPEND_DELAY_MS

#define FXLS8962AF_FIFO_LENGTH
#define FXLS8962AF_SCALE_TABLE_LEN
#define FXLS8962AF_SAMP_FREQ_TABLE_LEN

static const int fxls8962af_scale_table[FXLS8962AF_SCALE_TABLE_LEN][2] =;

static const int fxls8962af_samp_freq_table[FXLS8962AF_SAMP_FREQ_TABLE_LEN][2] =;

struct fxls8962af_chip_info {};

struct fxls8962af_data {};

const struct regmap_config fxls8962af_i2c_regmap_conf =;
EXPORT_SYMBOL_NS_GPL();

const struct regmap_config fxls8962af_spi_regmap_conf =;
EXPORT_SYMBOL_NS_GPL();

enum {};

enum fxls8962af_int_pin {};

static int fxls8962af_power_on(struct fxls8962af_data *data)
{}

static int fxls8962af_power_off(struct fxls8962af_data *data)
{}

static int fxls8962af_standby(struct fxls8962af_data *data)
{}

static int fxls8962af_active(struct fxls8962af_data *data)
{}

static int fxls8962af_is_active(struct fxls8962af_data *data)
{}

static int fxls8962af_get_out(struct fxls8962af_data *data,
			      struct iio_chan_spec const *chan, int *val)
{}

static int fxls8962af_read_avail(struct iio_dev *indio_dev,
				 struct iio_chan_spec const *chan,
				 const int **vals, int *type, int *length,
				 long mask)
{}

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

static int fxls8962af_update_config(struct fxls8962af_data *data, u8 reg,
				    u8 mask, u8 val)
{}

static int fxls8962af_set_full_scale(struct fxls8962af_data *data, u32 scale)
{}

static unsigned int fxls8962af_read_full_scale(struct fxls8962af_data *data,
					       int *val)
{}

static int fxls8962af_set_samp_freq(struct fxls8962af_data *data, u32 val,
				    u32 val2)
{}

static unsigned int fxls8962af_read_samp_freq(struct fxls8962af_data *data,
					      int *val, int *val2)
{}

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

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

static int fxls8962af_event_setup(struct fxls8962af_data *data, int state)
{}

static int fxls8962af_set_watermark(struct iio_dev *indio_dev, unsigned val)
{}

static int __fxls8962af_set_thresholds(struct fxls8962af_data *data,
				       const struct iio_chan_spec *chan,
				       enum iio_event_direction dir,
				       int val)
{}

static int fxls8962af_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 fxls8962af_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
fxls8962af_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
fxls8962af_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_event_spec fxls8962af_event[] =;

#define FXLS8962AF_CHANNEL(axis, reg, idx)

#define FXLS8962AF_TEMP_CHANNEL

static const struct iio_chan_spec fxls8962af_channels[] =;

static const struct fxls8962af_chip_info fxls_chip_info_table[] =;

static const struct iio_info fxls8962af_info =;

static int fxls8962af_reset(struct fxls8962af_data *data)
{}

static int __fxls8962af_fifo_set_mode(struct fxls8962af_data *data, bool onoff)
{}

static int fxls8962af_buffer_preenable(struct iio_dev *indio_dev)
{}

static int fxls8962af_buffer_postenable(struct iio_dev *indio_dev)
{}

static int fxls8962af_buffer_predisable(struct iio_dev *indio_dev)
{}

static int fxls8962af_buffer_postdisable(struct iio_dev *indio_dev)
{}

static const struct iio_buffer_setup_ops fxls8962af_buffer_ops =;

static int fxls8962af_i2c_raw_read_errata3(struct fxls8962af_data *data,
					   u16 *buffer, int samples,
					   int sample_length)
{}

static int fxls8962af_fifo_transfer(struct fxls8962af_data *data,
				    u16 *buffer, int samples)
{}

static int fxls8962af_fifo_flush(struct iio_dev *indio_dev)
{}

static int fxls8962af_event_interrupt(struct iio_dev *indio_dev)
{}

static irqreturn_t fxls8962af_interrupt(int irq, void *p)
{}

static void fxls8962af_pm_disable(void *dev_ptr)
{}

static void fxls8962af_get_irq(struct device *dev,
			       enum fxls8962af_int_pin *pin)
{}

static int fxls8962af_irq_setup(struct iio_dev *indio_dev, int irq)
{}

int fxls8962af_core_probe(struct device *dev, struct regmap *regmap, int irq)
{}
EXPORT_SYMBOL_NS_GPL();

static int fxls8962af_runtime_suspend(struct device *dev)
{}

static int fxls8962af_runtime_resume(struct device *dev)
{}

static int fxls8962af_suspend(struct device *dev)
{}

static int fxls8962af_resume(struct device *dev)
{}

EXPORT_NS_GPL_DEV_PM_OPS(fxls8962af_pm_ops, IIO_FXLS8962AF) =;

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