linux/include/linux/iio/gyro/itg3200.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * itg3200.h -- support InvenSense ITG3200
 *              Digital 3-Axis Gyroscope driver
 *
 * Copyright (c) 2011 Christian Strobel <[email protected]>
 * Copyright (c) 2011 Manuel Stahl <[email protected]>
 * Copyright (c) 2012 Thorsten Nowak <[email protected]>
 */

#ifndef I2C_ITG3200_H_
#define I2C_ITG3200_H_

#include <linux/iio/iio.h>

/* Register with I2C address (34h) */
#define ITG3200_REG_ADDRESS

/* Sample rate divider
 * Range: 0 to 255
 * Default value: 0x00 */
#define ITG3200_REG_SAMPLE_RATE_DIV

/* Digital low pass filter settings */
#define ITG3200_REG_DLPF
/* DLPF full scale range */
#define ITG3200_DLPF_FS_SEL_2000
/* Bandwidth (Hz) and internal sample rate
 * (kHz) of DLPF */
#define ITG3200_DLPF_256_8
#define ITG3200_DLPF_188_1
#define ITG3200_DLPF_98_1
#define ITG3200_DLPF_42_1
#define ITG3200_DLPF_20_1
#define ITG3200_DLPF_10_1
#define ITG3200_DLPF_5_1

#define ITG3200_DLPF_CFG_MASK

/* Configuration for interrupt operations */
#define ITG3200_REG_IRQ_CONFIG
/* Logic level */
#define ITG3200_IRQ_ACTIVE_LOW
#define ITG3200_IRQ_ACTIVE_HIGH
/* Drive type */
#define ITG3200_IRQ_OPEN_DRAIN
#define ITG3200_IRQ_PUSH_PULL
/* Latch mode */
#define ITG3200_IRQ_LATCH_UNTIL_CLEARED
#define ITG3200_IRQ_LATCH_50US_PULSE
/* Latch clear method */
#define ITG3200_IRQ_LATCH_CLEAR_ANY
#define ITG3200_IRQ_LATCH_CLEAR_STATUS
/* Enable interrupt when device is ready */
#define ITG3200_IRQ_DEVICE_RDY_ENABLE
/* Enable interrupt when data is available */
#define ITG3200_IRQ_DATA_RDY_ENABLE

/* Determine the status of ITG-3200 interrupts */
#define ITG3200_REG_IRQ_STATUS
/* Status of 'device is ready'-interrupt */
#define ITG3200_IRQ_DEVICE_RDY_STATUS
/* Status of 'data is available'-interrupt */
#define ITG3200_IRQ_DATA_RDY_STATUS

/* Sensor registers */
#define ITG3200_REG_TEMP_OUT_H
#define ITG3200_REG_TEMP_OUT_L
#define ITG3200_REG_GYRO_XOUT_H
#define ITG3200_REG_GYRO_XOUT_L
#define ITG3200_REG_GYRO_YOUT_H
#define ITG3200_REG_GYRO_YOUT_L
#define ITG3200_REG_GYRO_ZOUT_H
#define ITG3200_REG_GYRO_ZOUT_L

/* Power management */
#define ITG3200_REG_POWER_MANAGEMENT
/* Reset device and internal registers to the
 * power-up-default settings */
#define ITG3200_RESET
/* Enable low power sleep mode */
#define ITG3200_SLEEP
/* Put according gyroscope in standby mode */
#define ITG3200_STANDBY_GYRO_X
#define ITG3200_STANDBY_GYRO_Y
#define ITG3200_STANDBY_GYRO_Z
/* Determine the device clock source */
#define ITG3200_CLK_INTERNAL
#define ITG3200_CLK_GYRO_X
#define ITG3200_CLK_GYRO_Y
#define ITG3200_CLK_GYRO_Z
#define ITG3200_CLK_EXT_32K
#define ITG3200_CLK_EXT_19M


/**
 * struct itg3200 - device instance specific data
 * @i2c:    actual i2c_client
 * @trig:   data ready trigger from itg3200 pin
 **/
struct itg3200 {};

enum ITG3200_SCAN_INDEX {};

int itg3200_write_reg_8(struct iio_dev *indio_dev,
		u8 reg_address, u8 val);

int itg3200_read_reg_8(struct iio_dev *indio_dev,
		u8 reg_address, u8 *val);


#ifdef CONFIG_IIO_BUFFER

void itg3200_remove_trigger(struct iio_dev *indio_dev);
int itg3200_probe_trigger(struct iio_dev *indio_dev);

int itg3200_buffer_configure(struct iio_dev *indio_dev);
void itg3200_buffer_unconfigure(struct iio_dev *indio_dev);

#else /* CONFIG_IIO_BUFFER */

static inline void itg3200_remove_trigger(struct iio_dev *indio_dev)
{
}

static inline int itg3200_probe_trigger(struct iio_dev *indio_dev)
{
	return 0;
}

static inline int itg3200_buffer_configure(struct iio_dev *indio_dev)
{
	return 0;
}

static inline void itg3200_buffer_unconfigure(struct iio_dev *indio_dev)
{
}

#endif  /* CONFIG_IIO_BUFFER */

#endif /* ITG3200_H_ */