diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/dt-bindings/iio/adi,ad5592r.h | 16 | ||||
-rw-r--r-- | include/linux/iio/common/st_sensors.h | 9 | ||||
-rw-r--r-- | include/linux/iio/consumer.h | 53 | ||||
-rw-r--r-- | include/linux/iio/iio.h | 31 | ||||
-rw-r--r-- | include/linux/iio/imu/adis.h | 1 | ||||
-rw-r--r-- | include/linux/iio/magnetometer/ak8975.h | 16 | ||||
-rw-r--r-- | include/linux/platform_data/invensense_mpu6050.h | 5 | ||||
-rw-r--r-- | include/linux/platform_data/st_sensors_pdata.h | 2 |
8 files changed, 132 insertions, 1 deletions
diff --git a/include/dt-bindings/iio/adi,ad5592r.h b/include/dt-bindings/iio/adi,ad5592r.h new file mode 100644 index 000000000000..c48aca1dcade --- /dev/null +++ b/include/dt-bindings/iio/adi,ad5592r.h | |||
@@ -0,0 +1,16 @@ | |||
1 | |||
2 | #ifndef _DT_BINDINGS_ADI_AD5592R_H | ||
3 | #define _DT_BINDINGS_ADI_AD5592R_H | ||
4 | |||
5 | #define CH_MODE_UNUSED 0 | ||
6 | #define CH_MODE_ADC 1 | ||
7 | #define CH_MODE_DAC 2 | ||
8 | #define CH_MODE_DAC_AND_ADC 3 | ||
9 | #define CH_MODE_GPIO 8 | ||
10 | |||
11 | #define CH_OFFSTATE_PULLDOWN 0 | ||
12 | #define CH_OFFSTATE_OUT_LOW 1 | ||
13 | #define CH_OFFSTATE_OUT_HIGH 2 | ||
14 | #define CH_OFFSTATE_OUT_TRISTATE 3 | ||
15 | |||
16 | #endif /* _DT_BINDINGS_ADI_AD5592R_H */ | ||
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h index 6670c3d25c58..d029ffac0d69 100644 --- a/include/linux/iio/common/st_sensors.h +++ b/include/linux/iio/common/st_sensors.h | |||
@@ -37,6 +37,7 @@ | |||
37 | #define ST_SENSORS_DEFAULT_AXIS_ADDR 0x20 | 37 | #define ST_SENSORS_DEFAULT_AXIS_ADDR 0x20 |
38 | #define ST_SENSORS_DEFAULT_AXIS_MASK 0x07 | 38 | #define ST_SENSORS_DEFAULT_AXIS_MASK 0x07 |
39 | #define ST_SENSORS_DEFAULT_AXIS_N_BIT 3 | 39 | #define ST_SENSORS_DEFAULT_AXIS_N_BIT 3 |
40 | #define ST_SENSORS_DEFAULT_STAT_ADDR 0x27 | ||
40 | 41 | ||
41 | #define ST_SENSORS_MAX_NAME 17 | 42 | #define ST_SENSORS_MAX_NAME 17 |
42 | #define ST_SENSORS_MAX_4WAI 7 | 43 | #define ST_SENSORS_MAX_4WAI 7 |
@@ -121,6 +122,9 @@ struct st_sensor_bdu { | |||
121 | * @mask_int2: mask to enable/disable IRQ on INT2 pin. | 122 | * @mask_int2: mask to enable/disable IRQ on INT2 pin. |
122 | * @addr_ihl: address to enable/disable active low on the INT lines. | 123 | * @addr_ihl: address to enable/disable active low on the INT lines. |
123 | * @mask_ihl: mask to enable/disable active low on the INT lines. | 124 | * @mask_ihl: mask to enable/disable active low on the INT lines. |
125 | * @addr_od: address to enable/disable Open Drain on the INT lines. | ||
126 | * @mask_od: mask to enable/disable Open Drain on the INT lines. | ||
127 | * @addr_stat_drdy: address to read status of DRDY (data ready) interrupt | ||
124 | * struct ig1 - represents the Interrupt Generator 1 of sensors. | 128 | * struct ig1 - represents the Interrupt Generator 1 of sensors. |
125 | * @en_addr: address of the enable ig1 register. | 129 | * @en_addr: address of the enable ig1 register. |
126 | * @en_mask: mask to write the on/off value for enable. | 130 | * @en_mask: mask to write the on/off value for enable. |
@@ -131,6 +135,9 @@ struct st_sensor_data_ready_irq { | |||
131 | u8 mask_int2; | 135 | u8 mask_int2; |
132 | u8 addr_ihl; | 136 | u8 addr_ihl; |
133 | u8 mask_ihl; | 137 | u8 mask_ihl; |
138 | u8 addr_od; | ||
139 | u8 mask_od; | ||
140 | u8 addr_stat_drdy; | ||
134 | struct { | 141 | struct { |
135 | u8 en_addr; | 142 | u8 en_addr; |
136 | u8 en_mask; | 143 | u8 en_mask; |
@@ -212,6 +219,7 @@ struct st_sensor_settings { | |||
212 | * @odr: Output data rate of the sensor [Hz]. | 219 | * @odr: Output data rate of the sensor [Hz]. |
213 | * num_data_channels: Number of data channels used in buffer. | 220 | * num_data_channels: Number of data channels used in buffer. |
214 | * @drdy_int_pin: Redirect DRDY on pin 1 (1) or pin 2 (2). | 221 | * @drdy_int_pin: Redirect DRDY on pin 1 (1) or pin 2 (2). |
222 | * @int_pin_open_drain: Set the interrupt/DRDY to open drain. | ||
215 | * @get_irq_data_ready: Function to get the IRQ used for data ready signal. | 223 | * @get_irq_data_ready: Function to get the IRQ used for data ready signal. |
216 | * @tf: Transfer function structure used by I/O operations. | 224 | * @tf: Transfer function structure used by I/O operations. |
217 | * @tb: Transfer buffers and mutex used by I/O operations. | 225 | * @tb: Transfer buffers and mutex used by I/O operations. |
@@ -233,6 +241,7 @@ struct st_sensor_data { | |||
233 | unsigned int num_data_channels; | 241 | unsigned int num_data_channels; |
234 | 242 | ||
235 | u8 drdy_int_pin; | 243 | u8 drdy_int_pin; |
244 | bool int_pin_open_drain; | ||
236 | 245 | ||
237 | unsigned int (*get_irq_data_ready) (struct iio_dev *indio_dev); | 246 | unsigned int (*get_irq_data_ready) (struct iio_dev *indio_dev); |
238 | 247 | ||
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h index fad58671c49e..3d672f72e7ec 100644 --- a/include/linux/iio/consumer.h +++ b/include/linux/iio/consumer.h | |||
@@ -49,6 +49,33 @@ struct iio_channel *iio_channel_get(struct device *dev, | |||
49 | void iio_channel_release(struct iio_channel *chan); | 49 | void iio_channel_release(struct iio_channel *chan); |
50 | 50 | ||
51 | /** | 51 | /** |
52 | * devm_iio_channel_get() - Resource managed version of iio_channel_get(). | ||
53 | * @dev: Pointer to consumer device. Device name must match | ||
54 | * the name of the device as provided in the iio_map | ||
55 | * with which the desired provider to consumer mapping | ||
56 | * was registered. | ||
57 | * @consumer_channel: Unique name to identify the channel on the consumer | ||
58 | * side. This typically describes the channels use within | ||
59 | * the consumer. E.g. 'battery_voltage' | ||
60 | * | ||
61 | * Returns a pointer to negative errno if it is not able to get the iio channel | ||
62 | * otherwise returns valid pointer for iio channel. | ||
63 | * | ||
64 | * The allocated iio channel is automatically released when the device is | ||
65 | * unbound. | ||
66 | */ | ||
67 | struct iio_channel *devm_iio_channel_get(struct device *dev, | ||
68 | const char *consumer_channel); | ||
69 | /** | ||
70 | * devm_iio_channel_release() - Resource managed version of | ||
71 | * iio_channel_release(). | ||
72 | * @dev: Pointer to consumer device for which resource | ||
73 | * is allocared. | ||
74 | * @chan: The channel to be released. | ||
75 | */ | ||
76 | void devm_iio_channel_release(struct device *dev, struct iio_channel *chan); | ||
77 | |||
78 | /** | ||
52 | * iio_channel_get_all() - get all channels associated with a client | 79 | * iio_channel_get_all() - get all channels associated with a client |
53 | * @dev: Pointer to consumer device. | 80 | * @dev: Pointer to consumer device. |
54 | * | 81 | * |
@@ -65,6 +92,32 @@ struct iio_channel *iio_channel_get_all(struct device *dev); | |||
65 | */ | 92 | */ |
66 | void iio_channel_release_all(struct iio_channel *chan); | 93 | void iio_channel_release_all(struct iio_channel *chan); |
67 | 94 | ||
95 | /** | ||
96 | * devm_iio_channel_get_all() - Resource managed version of | ||
97 | * iio_channel_get_all(). | ||
98 | * @dev: Pointer to consumer device. | ||
99 | * | ||
100 | * Returns a pointer to negative errno if it is not able to get the iio channel | ||
101 | * otherwise returns an array of iio_channel structures terminated with one with | ||
102 | * null iio_dev pointer. | ||
103 | * | ||
104 | * This function is used by fairly generic consumers to get all the | ||
105 | * channels registered as having this consumer. | ||
106 | * | ||
107 | * The allocated iio channels are automatically released when the device is | ||
108 | * unbounded. | ||
109 | */ | ||
110 | struct iio_channel *devm_iio_channel_get_all(struct device *dev); | ||
111 | |||
112 | /** | ||
113 | * devm_iio_channel_release_all() - Resource managed version of | ||
114 | * iio_channel_release_all(). | ||
115 | * @dev: Pointer to consumer device for which resource | ||
116 | * is allocared. | ||
117 | * @chan: Array channel to be released. | ||
118 | */ | ||
119 | void devm_iio_channel_release_all(struct device *dev, struct iio_channel *chan); | ||
120 | |||
68 | struct iio_cb_buffer; | 121 | struct iio_cb_buffer; |
69 | /** | 122 | /** |
70 | * iio_channel_get_all_cb() - register callback for triggered capture | 123 | * iio_channel_get_all_cb() - register callback for triggered capture |
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index 0b2773ada0ba..7c29cb0124ae 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h | |||
@@ -148,6 +148,37 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev, | |||
148 | } | 148 | } |
149 | 149 | ||
150 | /** | 150 | /** |
151 | * struct iio_mount_matrix - iio mounting matrix | ||
152 | * @rotation: 3 dimensional space rotation matrix defining sensor alignment with | ||
153 | * main hardware | ||
154 | */ | ||
155 | struct iio_mount_matrix { | ||
156 | const char *rotation[9]; | ||
157 | }; | ||
158 | |||
159 | ssize_t iio_show_mount_matrix(struct iio_dev *indio_dev, uintptr_t priv, | ||
160 | const struct iio_chan_spec *chan, char *buf); | ||
161 | int of_iio_read_mount_matrix(const struct device *dev, const char *propname, | ||
162 | struct iio_mount_matrix *matrix); | ||
163 | |||
164 | typedef const struct iio_mount_matrix * | ||
165 | (iio_get_mount_matrix_t)(const struct iio_dev *indio_dev, | ||
166 | const struct iio_chan_spec *chan); | ||
167 | |||
168 | /** | ||
169 | * IIO_MOUNT_MATRIX() - Initialize mount matrix extended channel attribute | ||
170 | * @_shared: Whether the attribute is shared between all channels | ||
171 | * @_get: Pointer to an iio_get_mount_matrix_t accessor | ||
172 | */ | ||
173 | #define IIO_MOUNT_MATRIX(_shared, _get) \ | ||
174 | { \ | ||
175 | .name = "mount_matrix", \ | ||
176 | .shared = (_shared), \ | ||
177 | .read = iio_show_mount_matrix, \ | ||
178 | .private = (uintptr_t)(_get), \ | ||
179 | } | ||
180 | |||
181 | /** | ||
151 | * struct iio_event_spec - specification for a channel event | 182 | * struct iio_event_spec - specification for a channel event |
152 | * @type: Type of the event | 183 | * @type: Type of the event |
153 | * @dir: Direction of the event | 184 | * @dir: Direction of the event |
diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h index fa2d01ef8f55..360da7d18a3d 100644 --- a/include/linux/iio/imu/adis.h +++ b/include/linux/iio/imu/adis.h | |||
@@ -41,6 +41,7 @@ struct adis_data { | |||
41 | unsigned int diag_stat_reg; | 41 | unsigned int diag_stat_reg; |
42 | 42 | ||
43 | unsigned int self_test_mask; | 43 | unsigned int self_test_mask; |
44 | bool self_test_no_autoclear; | ||
44 | unsigned int startup_delay; | 45 | unsigned int startup_delay; |
45 | 46 | ||
46 | const char * const *status_error_msgs; | 47 | const char * const *status_error_msgs; |
diff --git a/include/linux/iio/magnetometer/ak8975.h b/include/linux/iio/magnetometer/ak8975.h new file mode 100644 index 000000000000..c8400959d197 --- /dev/null +++ b/include/linux/iio/magnetometer/ak8975.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef __IIO_MAGNETOMETER_AK8975_H__ | ||
2 | #define __IIO_MAGNETOMETER_AK8975_H__ | ||
3 | |||
4 | #include <linux/iio/iio.h> | ||
5 | |||
6 | /** | ||
7 | * struct ak8975_platform_data - AK8975 magnetometer driver platform data | ||
8 | * @eoc_gpio: data ready event gpio | ||
9 | * @orientation: mounting matrix relative to main hardware | ||
10 | */ | ||
11 | struct ak8975_platform_data { | ||
12 | int eoc_gpio; | ||
13 | struct iio_mount_matrix orientation; | ||
14 | }; | ||
15 | |||
16 | #endif | ||
diff --git a/include/linux/platform_data/invensense_mpu6050.h b/include/linux/platform_data/invensense_mpu6050.h index ad3aa7b95f35..554b59801aa8 100644 --- a/include/linux/platform_data/invensense_mpu6050.h +++ b/include/linux/platform_data/invensense_mpu6050.h | |||
@@ -16,13 +16,16 @@ | |||
16 | 16 | ||
17 | /** | 17 | /** |
18 | * struct inv_mpu6050_platform_data - Platform data for the mpu driver | 18 | * struct inv_mpu6050_platform_data - Platform data for the mpu driver |
19 | * @orientation: Orientation matrix of the chip | 19 | * @orientation: Orientation matrix of the chip (deprecated in favor of |
20 | * mounting matrix retrieved from device-tree) | ||
20 | * | 21 | * |
21 | * Contains platform specific information on how to configure the MPU6050 to | 22 | * Contains platform specific information on how to configure the MPU6050 to |
22 | * work on this platform. The orientation matricies are 3x3 rotation matricies | 23 | * work on this platform. The orientation matricies are 3x3 rotation matricies |
23 | * that are applied to the data to rotate from the mounting orientation to the | 24 | * that are applied to the data to rotate from the mounting orientation to the |
24 | * platform orientation. The values must be one of 0, 1, or -1 and each row and | 25 | * platform orientation. The values must be one of 0, 1, or -1 and each row and |
25 | * column should have exactly 1 non-zero value. | 26 | * column should have exactly 1 non-zero value. |
27 | * | ||
28 | * Deprecated in favor of mounting matrix retrieved from device-tree. | ||
26 | */ | 29 | */ |
27 | struct inv_mpu6050_platform_data { | 30 | struct inv_mpu6050_platform_data { |
28 | __s8 orientation[9]; | 31 | __s8 orientation[9]; |
diff --git a/include/linux/platform_data/st_sensors_pdata.h b/include/linux/platform_data/st_sensors_pdata.h index 753839187ba0..79b0e4cdb814 100644 --- a/include/linux/platform_data/st_sensors_pdata.h +++ b/include/linux/platform_data/st_sensors_pdata.h | |||
@@ -16,9 +16,11 @@ | |||
16 | * @drdy_int_pin: Redirect DRDY on pin 1 (1) or pin 2 (2). | 16 | * @drdy_int_pin: Redirect DRDY on pin 1 (1) or pin 2 (2). |
17 | * Available only for accelerometer and pressure sensors. | 17 | * Available only for accelerometer and pressure sensors. |
18 | * Accelerometer DRDY on LSM330 available only on pin 1 (see datasheet). | 18 | * Accelerometer DRDY on LSM330 available only on pin 1 (see datasheet). |
19 | * @open_drain: set the interrupt line to be open drain if possible. | ||
19 | */ | 20 | */ |
20 | struct st_sensors_platform_data { | 21 | struct st_sensors_platform_data { |
21 | u8 drdy_int_pin; | 22 | u8 drdy_int_pin; |
23 | bool open_drain; | ||
22 | }; | 24 | }; |
23 | 25 | ||
24 | #endif /* ST_SENSORS_PDATA_H */ | 26 | #endif /* ST_SENSORS_PDATA_H */ |