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

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. itg3200_remove_trigger
  2. itg3200_probe_trigger
  3. itg3200_buffer_configure
  4. itg3200_buffer_unconfigure

   1 /* SPDX-License-Identifier: GPL-2.0-only */
   2 /*
   3  * itg3200.h -- support InvenSense ITG3200
   4  *              Digital 3-Axis Gyroscope driver
   5  *
   6  * Copyright (c) 2011 Christian Strobel <christian.strobel@iis.fraunhofer.de>
   7  * Copyright (c) 2011 Manuel Stahl <manuel.stahl@iis.fraunhofer.de>
   8  * Copyright (c) 2012 Thorsten Nowak <thorsten.nowak@iis.fraunhofer.de>
   9  */
  10 
  11 #ifndef I2C_ITG3200_H_
  12 #define I2C_ITG3200_H_
  13 
  14 #include <linux/iio/iio.h>
  15 
  16 /* Register with I2C address (34h) */
  17 #define ITG3200_REG_ADDRESS             0x00
  18 
  19 /* Sample rate divider
  20  * Range: 0 to 255
  21  * Default value: 0x00 */
  22 #define ITG3200_REG_SAMPLE_RATE_DIV     0x15
  23 
  24 /* Digital low pass filter settings */
  25 #define ITG3200_REG_DLPF                0x16
  26 /* DLPF full scale range */
  27 #define ITG3200_DLPF_FS_SEL_2000        0x18
  28 /* Bandwidth (Hz) and internal sample rate
  29  * (kHz) of DLPF */
  30 #define ITG3200_DLPF_256_8              0x00
  31 #define ITG3200_DLPF_188_1              0x01
  32 #define ITG3200_DLPF_98_1               0x02
  33 #define ITG3200_DLPF_42_1               0x03
  34 #define ITG3200_DLPF_20_1               0x04
  35 #define ITG3200_DLPF_10_1               0x05
  36 #define ITG3200_DLPF_5_1                0x06
  37 
  38 #define ITG3200_DLPF_CFG_MASK           0x07
  39 
  40 /* Configuration for interrupt operations */
  41 #define ITG3200_REG_IRQ_CONFIG          0x17
  42 /* Logic level */
  43 #define ITG3200_IRQ_ACTIVE_LOW          0x80
  44 #define ITG3200_IRQ_ACTIVE_HIGH         0x00
  45 /* Drive type */
  46 #define ITG3200_IRQ_OPEN_DRAIN          0x40
  47 #define ITG3200_IRQ_PUSH_PULL           0x00
  48 /* Latch mode */
  49 #define ITG3200_IRQ_LATCH_UNTIL_CLEARED 0x20
  50 #define ITG3200_IRQ_LATCH_50US_PULSE    0x00
  51 /* Latch clear method */
  52 #define ITG3200_IRQ_LATCH_CLEAR_ANY     0x10
  53 #define ITG3200_IRQ_LATCH_CLEAR_STATUS  0x00
  54 /* Enable interrupt when device is ready */
  55 #define ITG3200_IRQ_DEVICE_RDY_ENABLE   0x04
  56 /* Enable interrupt when data is available */
  57 #define ITG3200_IRQ_DATA_RDY_ENABLE     0x01
  58 
  59 /* Determine the status of ITG-3200 interrupts */
  60 #define ITG3200_REG_IRQ_STATUS          0x1A
  61 /* Status of 'device is ready'-interrupt */
  62 #define ITG3200_IRQ_DEVICE_RDY_STATUS   0x04
  63 /* Status of 'data is available'-interrupt */
  64 #define ITG3200_IRQ_DATA_RDY_STATUS     0x01
  65 
  66 /* Sensor registers */
  67 #define ITG3200_REG_TEMP_OUT_H          0x1B
  68 #define ITG3200_REG_TEMP_OUT_L          0x1C
  69 #define ITG3200_REG_GYRO_XOUT_H         0x1D
  70 #define ITG3200_REG_GYRO_XOUT_L         0x1E
  71 #define ITG3200_REG_GYRO_YOUT_H         0x1F
  72 #define ITG3200_REG_GYRO_YOUT_L         0x20
  73 #define ITG3200_REG_GYRO_ZOUT_H         0x21
  74 #define ITG3200_REG_GYRO_ZOUT_L         0x22
  75 
  76 /* Power management */
  77 #define ITG3200_REG_POWER_MANAGEMENT    0x3E
  78 /* Reset device and internal registers to the
  79  * power-up-default settings */
  80 #define ITG3200_RESET                   0x80
  81 /* Enable low power sleep mode */
  82 #define ITG3200_SLEEP                   0x40
  83 /* Put according gyroscope in standby mode */
  84 #define ITG3200_STANDBY_GYRO_X          0x20
  85 #define ITG3200_STANDBY_GYRO_Y          0x10
  86 #define ITG3200_STANDBY_GYRO_Z          0x08
  87 /* Determine the device clock source */
  88 #define ITG3200_CLK_INTERNAL            0x00
  89 #define ITG3200_CLK_GYRO_X              0x01
  90 #define ITG3200_CLK_GYRO_Y              0x02
  91 #define ITG3200_CLK_GYRO_Z              0x03
  92 #define ITG3200_CLK_EXT_32K             0x04
  93 #define ITG3200_CLK_EXT_19M             0x05
  94 
  95 
  96 /**
  97  * struct itg3200 - device instance specific data
  98  * @i2c:    actual i2c_client
  99  * @trig:   data ready trigger from itg3200 pin
 100  **/
 101 struct itg3200 {
 102         struct i2c_client       *i2c;
 103         struct iio_trigger      *trig;
 104         struct iio_mount_matrix orientation;
 105 };
 106 
 107 enum ITG3200_SCAN_INDEX {
 108         ITG3200_SCAN_TEMP,
 109         ITG3200_SCAN_GYRO_X,
 110         ITG3200_SCAN_GYRO_Y,
 111         ITG3200_SCAN_GYRO_Z,
 112         ITG3200_SCAN_ELEMENTS,
 113 };
 114 
 115 int itg3200_write_reg_8(struct iio_dev *indio_dev,
 116                 u8 reg_address, u8 val);
 117 
 118 int itg3200_read_reg_8(struct iio_dev *indio_dev,
 119                 u8 reg_address, u8 *val);
 120 
 121 
 122 #ifdef CONFIG_IIO_BUFFER
 123 
 124 void itg3200_remove_trigger(struct iio_dev *indio_dev);
 125 int itg3200_probe_trigger(struct iio_dev *indio_dev);
 126 
 127 int itg3200_buffer_configure(struct iio_dev *indio_dev);
 128 void itg3200_buffer_unconfigure(struct iio_dev *indio_dev);
 129 
 130 #else /* CONFIG_IIO_BUFFER */
 131 
 132 static inline void itg3200_remove_trigger(struct iio_dev *indio_dev)
 133 {
 134 }
 135 
 136 static inline int itg3200_probe_trigger(struct iio_dev *indio_dev)
 137 {
 138         return 0;
 139 }
 140 
 141 static inline int itg3200_buffer_configure(struct iio_dev *indio_dev)
 142 {
 143         return 0;
 144 }
 145 
 146 static inline void itg3200_buffer_unconfigure(struct iio_dev *indio_dev)
 147 {
 148 }
 149 
 150 #endif  /* CONFIG_IIO_BUFFER */
 151 
 152 #endif /* ITG3200_H_ */

/* [<][>][^][v][top][bottom][index][help] */