linux/drivers/iio/accel/adxl380.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * ADXL380 3-Axis Digital Accelerometer core driver
 *
 * Copyright 2024 Analog Devices Inc.
 */

#include <linux/bitfield.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/module.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/units.h>

#include <linux/unaligned.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 <linux/regulator/consumer.h>

#include "adxl380.h"

#define ADXL380_ID_VAL
#define ADXL382_ID_VAL

#define ADXL380_DEVID_AD_REG
#define ADLX380_PART_ID_REG

#define ADXL380_X_DATA_H_REG
#define ADXL380_Y_DATA_H_REG
#define ADXL380_Z_DATA_H_REG
#define ADXL380_T_DATA_H_REG

#define ADXL380_MISC_0_REG
#define ADXL380_XL382_MSK

#define ADXL380_MISC_1_REG

#define ADXL380_X_DSM_OFFSET_REG

#define ADXL380_ACT_INACT_CTL_REG
#define ADXL380_INACT_EN_MSK
#define ADXL380_ACT_EN_MSK

#define ADXL380_SNSR_AXIS_EN_REG
#define ADXL380_ACT_INACT_AXIS_EN_MSK

#define ADXL380_THRESH_ACT_H_REG
#define ADXL380_TIME_ACT_H_REG
#define ADXL380_THRESH_INACT_H_REG
#define ADXL380_TIME_INACT_H_REG
#define ADXL380_THRESH_MAX
#define ADXL380_TIME_MAX

#define ADXL380_FIFO_CONFIG_0_REG
#define ADXL380_FIFO_SAMPLES_8_MSK
#define ADXL380_FIFO_MODE_MSK

#define ADXL380_FIFO_DISABLED
#define ADXL380_FIFO_NORMAL
#define ADXL380_FIFO_STREAMED
#define ADXL380_FIFO_TRIGGERED

#define ADXL380_FIFO_CONFIG_1_REG
#define ADXL380_FIFO_STATUS_0_REG

#define ADXL380_TAP_THRESH_REG
#define ADXL380_TAP_DUR_REG
#define ADXL380_TAP_LATENT_REG
#define ADXL380_TAP_WINDOW_REG
#define ADXL380_TAP_TIME_MAX

#define ADXL380_TAP_CFG_REG
#define ADXL380_TAP_AXIS_MSK

#define ADXL380_TRIG_CFG_REG
#define ADXL380_TRIG_CFG_DEC_2X_MSK
#define ADXL380_TRIG_CFG_SINC_RATE_MSK

#define ADXL380_FILTER_REG
#define ADXL380_FILTER_EQ_FILT_MSK
#define ADXL380_FILTER_LPF_MODE_MSK
#define ADXL380_FILTER_HPF_PATH_MSK
#define ADXL380_FILTER_HPF_CORNER_MSK

#define ADXL380_OP_MODE_REG
#define ADXL380_OP_MODE_RANGE_MSK
#define ADXL380_OP_MODE_MSK
#define ADXL380_OP_MODE_STANDBY
#define ADXL380_OP_MODE_HEART_SOUND
#define ADXL380_OP_MODE_ULP
#define ADXL380_OP_MODE_VLP
#define ADXL380_OP_MODE_LP
#define ADXL380_OP_MODE_LP_ULP
#define ADXL380_OP_MODE_LP_VLP
#define ADXL380_OP_MODE_RBW
#define ADXL380_OP_MODE_RBW_ULP
#define ADXL380_OP_MODE_RBW_VLP
#define ADXL380_OP_MODE_HP
#define ADXL380_OP_MODE_HP_ULP
#define ADXL380_OP_MODE_HP_VLP

#define ADXL380_OP_MODE_4G_RANGE
#define ADXL382_OP_MODE_15G_RANGE
#define ADXL380_OP_MODE_8G_RANGE
#define ADXL382_OP_MODE_30G_RANGE
#define ADXL380_OP_MODE_16G_RANGE
#define ADXL382_OP_MODE_60G_RANGE

#define ADXL380_DIG_EN_REG
#define ADXL380_CHAN_EN_MSK(chan)
#define ADXL380_FIFO_EN_MSK

#define ADXL380_INT0_MAP0_REG
#define ADXL380_INT1_MAP0_REG
#define ADXL380_INT_MAP0_INACT_INT0_MSK
#define ADXL380_INT_MAP0_ACT_INT0_MSK
#define ADXL380_INT_MAP0_FIFO_WM_INT0_MSK

#define ADXL380_INT0_MAP1_REG
#define ADXL380_INT1_MAP1_REG
#define ADXL380_INT_MAP1_DOUBLE_TAP_INT0_MSK
#define ADXL380_INT_MAP1_SINGLE_TAP_INT0_MSK

#define ADXL380_INT0_REG
#define ADXL380_INT0_POL_MSK

#define ADXL380_RESET_REG
#define ADXL380_FIFO_DATA

#define ADXL380_DEVID_AD_VAL
#define ADXL380_RESET_CODE

#define ADXL380_STATUS_0_REG
#define ADXL380_STATUS_0_FIFO_FULL_MSK
#define ADXL380_STATUS_0_FIFO_WM_MSK

#define ADXL380_STATUS_1_INACT_MSK
#define ADXL380_STATUS_1_ACT_MSK
#define ADXL380_STATUS_1_DOUBLE_TAP_MSK
#define ADXL380_STATUS_1_SINGLE_TAP_MSK

#define ADXL380_FIFO_SAMPLES

enum adxl380_channels {};

enum adxl380_axis {};

enum adxl380_activity_type {};

enum adxl380_tap_type {};

enum adxl380_tap_time_type {};

static const int adxl380_range_scale_factor_tbl[] =;

const struct adxl380_chip_info adxl380_chip_info =;
EXPORT_SYMBOL_NS_GPL();

const struct adxl380_chip_info adxl382_chip_info =;
EXPORT_SYMBOL_NS_GPL();

static const unsigned int adxl380_th_reg_high_addr[2] =;

static const unsigned int adxl380_time_reg_high_addr[2] =;

static const unsigned int adxl380_tap_time_reg[2] =;

struct adxl380_state {};

bool adxl380_readable_noinc_reg(struct device *dev, unsigned int reg)
{}
EXPORT_SYMBOL_NS_GPL();

static int adxl380_set_measure_en(struct adxl380_state *st, bool en)
{}

static void adxl380_scale_act_inact_thresholds(struct adxl380_state *st,
					       u8 old_range,
					       u8 new_range)
{}

static int adxl380_write_act_inact_threshold(struct adxl380_state *st,
					     enum adxl380_activity_type act,
					     unsigned int th)
{}

static int adxl380_set_act_inact_threshold(struct iio_dev *indio_dev,
					   enum adxl380_activity_type act,
					   u16 th)
{}

static int adxl380_set_tap_threshold_value(struct iio_dev *indio_dev, u8 th)
{}

static int _adxl380_write_tap_time_us(struct adxl380_state *st,
				      enum adxl380_tap_time_type tap_time_type,
				      u32 us)
{}

static int adxl380_write_tap_time_us(struct adxl380_state *st,
				     enum adxl380_tap_time_type tap_time_type, u32 us)
{}

static int adxl380_write_tap_dur_us(struct iio_dev *indio_dev, u32 us)
{}

static int adxl380_read_chn(struct adxl380_state *st, u8 addr)
{}

static int adxl380_get_odr(struct adxl380_state *st, int *odr)
{}

static const int adxl380_lpf_div[] =;

static int adxl380_fill_lpf_tbl(struct adxl380_state *st)
{}

static const int adxl380_hpf_mul[] =;

static int adxl380_fill_hpf_tbl(struct adxl380_state *st)
{}

static int adxl380_set_odr(struct adxl380_state *st, u8 odr)
{}

static int adxl380_find_match_1d_tbl(const int *array, unsigned int size,
				     int val)
{}

static int adxl380_find_match_2d_tbl(const int (*freq_tbl)[2], int n, int val, int val2)
{}

static int adxl380_get_lpf(struct adxl380_state *st, int *lpf)
{}

static int adxl380_set_lpf(struct adxl380_state *st, u8 lpf)
{}

static int adxl380_get_hpf(struct adxl380_state *st, int *hpf_int, int *hpf_frac)
{}

static int adxl380_set_hpf(struct adxl380_state *st, u8 hpf)
{}

static int _adxl380_set_act_inact_time_ms(struct adxl380_state *st,
					  enum adxl380_activity_type act,
					  u32 ms)
{}

static int adxl380_set_act_inact_time_ms(struct adxl380_state *st,
					 enum adxl380_activity_type act,
					 u32 ms)
{}

static int adxl380_set_range(struct adxl380_state *st, u8 range)
{}

static int adxl380_write_act_inact_en(struct adxl380_state *st,
				      enum adxl380_activity_type type,
				      bool en)
{}

static int adxl380_read_act_inact_int(struct adxl380_state *st,
				      enum adxl380_activity_type type,
				      bool *en)
{}

static int adxl380_write_act_inact_int(struct adxl380_state *st,
				       enum adxl380_activity_type act,
				       bool en)
{}

static int adxl380_act_inact_config(struct adxl380_state *st,
				    enum adxl380_activity_type type,
				    bool en)
{}

static int adxl380_write_tap_axis(struct adxl380_state *st,
				  enum adxl380_axis axis)
{}

static int adxl380_read_tap_int(struct adxl380_state *st, enum adxl380_tap_type type, bool *en)
{}

static int adxl380_write_tap_int(struct adxl380_state *st, enum adxl380_tap_type type, bool en)
{}

static int adxl380_tap_config(struct adxl380_state *st,
			      enum adxl380_axis axis,
			      enum adxl380_tap_type type,
			      bool en)
{}

static int adxl380_set_fifo_samples(struct adxl380_state *st)
{}

static int adxl380_get_status(struct adxl380_state *st, u8 *status0, u8 *status1)
{}

static int adxl380_get_fifo_entries(struct adxl380_state *st, u16 *fifo_entries)
{}

static void adxl380_push_event(struct iio_dev *indio_dev, s64 timestamp,
			       u8 status1)
{}

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

static int adxl380_write_calibbias_value(struct adxl380_state *st,
					 unsigned long chan_addr,
					 s8 calibbias)
{}

static int adxl380_read_calibbias_value(struct adxl380_state *st,
					unsigned long chan_addr,
					int *calibbias)
{}

static ssize_t hwfifo_watermark_min_show(struct device *dev,
					 struct device_attribute *attr,
					 char *buf)
{}

static ssize_t hwfifo_watermark_max_show(struct device *dev,
					 struct device_attribute *attr,
					 char *buf)
{}

static ssize_t adxl380_get_fifo_watermark(struct device *dev,
					  struct device_attribute *attr,
					  char *buf)
{}

static ssize_t adxl380_get_fifo_enabled(struct device *dev,
					struct device_attribute *attr,
					char *buf)
{}

static IIO_DEVICE_ATTR_RO(hwfifo_watermark_min, 0);
static IIO_DEVICE_ATTR_RO(hwfifo_watermark_max, 0);
static IIO_DEVICE_ATTR(hwfifo_watermark, 0444,
		       adxl380_get_fifo_watermark, NULL, 0);
static IIO_DEVICE_ATTR(hwfifo_enabled, 0444,
		       adxl380_get_fifo_enabled, NULL, 0);

static const struct iio_dev_attr *adxl380_fifo_attributes[] =;

static int adxl380_buffer_postenable(struct iio_dev *indio_dev)
{}

static int adxl380_buffer_predisable(struct iio_dev *indio_dev)
{}

static const struct iio_buffer_setup_ops adxl380_buffer_ops =;

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

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

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

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

static int adxl380_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 adxl380_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 adxl380_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 int adxl380_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 ssize_t in_accel_gesture_tap_maxtomin_time_show(struct device *dev,
						       struct device_attribute *attr,
						       char *buf)
{}

static ssize_t in_accel_gesture_tap_maxtomin_time_store(struct device *dev,
							struct device_attribute *attr,
							const char *buf, size_t len)
{}

static IIO_DEVICE_ATTR_RW(in_accel_gesture_tap_maxtomin_time, 0);

static struct attribute *adxl380_event_attributes[] =;

static const struct attribute_group adxl380_event_attribute_group =;

static int adxl380_reg_access(struct iio_dev *indio_dev,
			      unsigned int reg,
			      unsigned int writeval,
			      unsigned int *readval)
{}

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

static const struct iio_info adxl380_info =;

static const struct iio_event_spec adxl380_events[] =;

#define ADXL380_ACCEL_CHANNEL(index, reg, axis)

static const struct iio_chan_spec adxl380_channels[] =;

static int adxl380_config_irq(struct iio_dev *indio_dev)
{}

static int adxl380_setup(struct iio_dev *indio_dev)
{}

int adxl380_probe(struct device *dev, struct regmap *regmap,
		  const struct adxl380_chip_info *chip_info)
{}
EXPORT_SYMBOL_NS_GPL();

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