#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/mutex.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/delay.h>
#include <linux/iio/buffer.h>
#include <linux/iio/common/inv_sensors_timestamp.h>
#include <linux/iio/iio.h>
#include "inv_icm42600.h"
#include "inv_icm42600_buffer.h"
#define INV_ICM42600_FIFO_HEADER_MSG …
#define INV_ICM42600_FIFO_HEADER_ACCEL …
#define INV_ICM42600_FIFO_HEADER_GYRO …
#define INV_ICM42600_FIFO_HEADER_TMST_FSYNC …
#define INV_ICM42600_FIFO_HEADER_ODR_ACCEL …
#define INV_ICM42600_FIFO_HEADER_ODR_GYRO …
struct inv_icm42600_fifo_1sensor_packet { … } __packed;
#define INV_ICM42600_FIFO_1SENSOR_PACKET_SIZE …
struct inv_icm42600_fifo_2sensors_packet { … } __packed;
#define INV_ICM42600_FIFO_2SENSORS_PACKET_SIZE …
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)
{ … }
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)
{ … }
static size_t inv_icm42600_get_packet_size(unsigned int fifo_en)
{ … }
static unsigned int inv_icm42600_wm_truncate(unsigned int watermark,
size_t packet_size)
{ … }
int inv_icm42600_buffer_update_watermark(struct inv_icm42600_state *st)
{ … }
static int inv_icm42600_buffer_preenable(struct iio_dev *indio_dev)
{ … }
static int inv_icm42600_buffer_postenable(struct iio_dev *indio_dev)
{ … }
static int inv_icm42600_buffer_predisable(struct iio_dev *indio_dev)
{ … }
static int inv_icm42600_buffer_postdisable(struct iio_dev *indio_dev)
{ … }
const struct iio_buffer_setup_ops inv_icm42600_buffer_ops = …;
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)
{ … }
int inv_icm42600_buffer_init(struct inv_icm42600_state *st)
{ … }