~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/iio/gyro/itg3200.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  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         /* lock to protect against multiple access to the device */
106         struct mutex            lock;
107 };
108 
109 enum ITG3200_SCAN_INDEX {
110         ITG3200_SCAN_TEMP,
111         ITG3200_SCAN_GYRO_X,
112         ITG3200_SCAN_GYRO_Y,
113         ITG3200_SCAN_GYRO_Z,
114         ITG3200_SCAN_ELEMENTS,
115 };
116 
117 int itg3200_write_reg_8(struct iio_dev *indio_dev,
118                 u8 reg_address, u8 val);
119 
120 int itg3200_read_reg_8(struct iio_dev *indio_dev,
121                 u8 reg_address, u8 *val);
122 
123 
124 #ifdef CONFIG_IIO_BUFFER
125 
126 void itg3200_remove_trigger(struct iio_dev *indio_dev);
127 int itg3200_probe_trigger(struct iio_dev *indio_dev);
128 
129 int itg3200_buffer_configure(struct iio_dev *indio_dev);
130 void itg3200_buffer_unconfigure(struct iio_dev *indio_dev);
131 
132 #else /* CONFIG_IIO_BUFFER */
133 
134 static inline void itg3200_remove_trigger(struct iio_dev *indio_dev)
135 {
136 }
137 
138 static inline int itg3200_probe_trigger(struct iio_dev *indio_dev)
139 {
140         return 0;
141 }
142 
143 static inline int itg3200_buffer_configure(struct iio_dev *indio_dev)
144 {
145         return 0;
146 }
147 
148 static inline void itg3200_buffer_unconfigure(struct iio_dev *indio_dev)
149 {
150 }
151 
152 #endif  /* CONFIG_IIO_BUFFER */
153 
154 #endif /* ITG3200_H_ */
155 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php