linux/drivers/iio/accel/kionix-kx022a.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * Copyright (C) 2022 ROHM Semiconductors
 *
 * ROHM/KIONIX KX022A accelerometer driver
 */

#ifndef _KX022A_H_
#define _KX022A_H_

#include <linux/bits.h>
#include <linux/regmap.h>

#define KX022A_REG_WHO
#define KX022A_ID
#define KX132ACR_LBZ_ID

#define KX022A_REG_CNTL2
#define KX022A_MASK_SRST
#define KX022A_REG_CNTL
#define KX022A_MASK_PC1
#define KX022A_MASK_RES
#define KX022A_MASK_DRDY
#define KX022A_MASK_GSEL
#define KX022A_GSEL_SHIFT
#define KX022A_GSEL_2
#define KX022A_GSEL_4
#define KX022A_GSEL_8
#define KX022A_GSEL_16

#define KX022A_REG_INS2
#define KX022A_MASK_INS2_DRDY
#define KX122_MASK_INS2_WMI

#define KX022A_REG_XHP_L
#define KX022A_REG_XOUT_L
#define KX022A_REG_YOUT_L
#define KX022A_REG_ZOUT_L
#define KX022A_REG_COTR
#define KX022A_REG_TSCP
#define KX022A_REG_INT_REL

#define KX022A_REG_ODCNTL

#define KX022A_REG_BTS_WUF_TH
#define KX022A_REG_MAN_WAKE

#define KX022A_REG_BUF_CNTL1
#define KX022A_MASK_WM_TH
#define KX022A_REG_BUF_CNTL2
#define KX022A_MASK_BUF_EN
#define KX022A_MASK_BRES16
#define KX022A_REG_BUF_STATUS_1
#define KX022A_REG_BUF_STATUS_2
#define KX022A_REG_BUF_CLEAR
#define KX022A_REG_BUF_READ
#define KX022A_MASK_ODR
#define KX022A_ODR_SHIFT
#define KX022A_FIFO_MAX_WMI_TH

#define KX022A_REG_INC1
#define KX022A_REG_INC5
#define KX022A_REG_INC6
#define KX022A_MASK_IEN
#define KX022A_MASK_IPOL
#define KX022A_IPOL_LOW
#define KX022A_IPOL_HIGH
#define KX022A_MASK_ITYP
#define KX022A_ITYP_PULSE
#define KX022A_ITYP_LEVEL

#define KX022A_REG_INC4
#define KX022A_MASK_WMI

#define KX022A_REG_SELF_TEST
#define KX022A_MAX_REGISTER

#define KX132_REG_WHO
#define KX132_ID

#define KX132_FIFO_LENGTH

#define KX132_REG_CNTL
#define KX132_REG_CNTL2
#define KX132_REG_CNTL5
#define KX132_MASK_RES
#define KX132_GSEL_2
#define KX132_GSEL_4
#define KX132_GSEL_8
#define KX132_GSEL_16

#define KX132_REG_INS2
#define KX132_MASK_INS2_WMI

#define KX132_REG_XADP_L
#define KX132_REG_XOUT_L
#define KX132_REG_YOUT_L
#define KX132_REG_ZOUT_L
#define KX132_REG_COTR
#define KX132_REG_TSCP
#define KX132_REG_INT_REL

#define KX132_REG_ODCNTL

#define KX132_REG_BTS_WUF_TH

#define KX132_REG_BUF_CNTL1
#define KX132_REG_BUF_CNTL2
#define KX132_REG_BUF_STATUS_1
#define KX132_REG_BUF_STATUS_2
#define KX132_MASK_BUF_SMP_LVL
#define KX132_REG_BUF_CLEAR
#define KX132_REG_BUF_READ
#define KX132_ODR_SHIFT
#define KX132_FIFO_MAX_WMI_TH

#define KX132_REG_INC1
#define KX132_REG_INC5
#define KX132_REG_INC6
#define KX132_IPOL_LOW
#define KX132_IPOL_HIGH
#define KX132_ITYP_PULSE

#define KX132_REG_INC4

#define KX132_REG_SELF_TEST
#define KX132_MAX_REGISTER

struct device;

struct kx022a_data;

/**
 * struct kx022a_chip_info - Kionix accelerometer chip specific information
 *
 * @name:			name of the device
 * @regmap_config:		pointer to register map configuration
 * @channels:			pointer to iio_chan_spec array
 * @num_channels:		number of iio_chan_spec channels
 * @fifo_length:		number of 16-bit samples in a full buffer
 * @buf_smp_lvl_mask:		buffer sample level mask
 * @who:			WHO_AM_I register
 * @id:				WHO_AM_I register value
 * @cntl:			control register 1
 * @cntl2:			control register 2
 * @odcntl:			output data control register
 * @buf_cntl1:			buffer control register 1
 * @buf_cntl2:			buffer control register 2
 * @buf_clear:			buffer clear register
 * @buf_status1:		buffer status register 1
 * @buf_read:			buffer read register
 * @inc1:			interrupt control register 1
 * @inc4:			interrupt control register 4
 * @inc5:			interrupt control register 5
 * @inc6:			interrupt control register 6
 * @xout_l:			x-axis output least significant byte
 * @get_fifo_bytes_available:	function pointer to get amount of acceleration
 *				data bytes currently stored in the sensor's FIFO
 *				buffer
 */
struct kx022a_chip_info {};

int kx022a_probe_internal(struct device *dev, const struct kx022a_chip_info *chip_info);

extern const struct kx022a_chip_info kx022a_chip_info;
extern const struct kx022a_chip_info kx132_chip_info;
extern const struct kx022a_chip_info kx132acr_chip_info;

#endif