linux/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * Copyright (C) 2020 Invensense, Inc.
 */

#ifndef INV_ICM42600_BUFFER_H_
#define INV_ICM42600_BUFFER_H_

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

struct inv_icm42600_state;

#define INV_ICM42600_SENSOR_GYRO
#define INV_ICM42600_SENSOR_ACCEL
#define INV_ICM42600_SENSOR_TEMP

/**
 * struct inv_icm42600_fifo - FIFO state variables
 * @on:		reference counter for FIFO on.
 * @en:		bits field of INV_ICM42600_SENSOR_* for FIFO EN bits.
 * @period:	FIFO internal period.
 * @watermark:	watermark configuration values for accel and gyro.
 * @count:	number of bytes in the FIFO data buffer.
 * @nb:		gyro, accel and total samples in the FIFO data buffer.
 * @data:	FIFO data buffer aligned for DMA (2kB + 32 bytes of read cache).
 */
struct inv_icm42600_fifo {};

/* FIFO data packet */
struct inv_icm42600_fifo_sensor_data {} __packed;
#define INV_ICM42600_FIFO_DATA_INVALID

static inline int16_t inv_icm42600_fifo_get_sensor_data(__be16 d)
{}

static inline bool
inv_icm42600_fifo_is_data_valid(const struct inv_icm42600_fifo_sensor_data *s)
{}

ssize_t inv_icm42600_fifo_decode_packet(const void *packet, const void **accel,
					const void **gyro, const int8_t **temp,
					const void **timestamp, unsigned int *odr);

extern const struct iio_buffer_setup_ops inv_icm42600_buffer_ops;

int inv_icm42600_buffer_init(struct inv_icm42600_state *st);

void inv_icm42600_buffer_update_fifo_period(struct inv_icm42600_state *st);

int inv_icm42600_buffer_set_fifo_en(struct inv_icm42600_state *st,
				    unsigned int fifo_en);

int inv_icm42600_buffer_update_watermark(struct inv_icm42600_state *st);

int inv_icm42600_buffer_fifo_read(struct inv_icm42600_state *st,
				  unsigned int max);

int inv_icm42600_buffer_fifo_parse(struct inv_icm42600_state *st);

int inv_icm42600_buffer_hwfifo_flush(struct inv_icm42600_state *st,
				     unsigned int count);

#endif