summaryrefslogtreecommitdiffstats
path: root/include/linux/iio
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2016-03-24 09:18:05 -0400
committerJonathan Cameron <jic23@kernel.org>2016-04-19 14:58:12 -0400
commit97865fe41322d83dac4373fe0a0de5b1a1b318c5 (patch)
tree6d14571a7fed1c01d8e6ed74d5817aa5edd6b5d0 /include/linux/iio
parent6436db37b4a5da1ae1f381e4791e17e2236fd276 (diff)
iio: st_sensors: verify interrupt event to status
This makes all ST sensor drivers check that they actually have new data available for the requested channel(s) before claiming an IRQ, by reading the status register (which is conveniently the same for all ST sensors) and check that the channel has new data before proceeding to read it and fill the buffer. This way sensors can share an interrupt line: it can be flaged as shared and then the sensor that did not fire will return NO_IRQ, and the sensor that fired will handle the IRQ and return IRQ_HANDLED. Cc: Giuseppe Barba <giuseppe.barba@st.com> Cc: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'include/linux/iio')
-rw-r--r--include/linux/iio/common/st_sensors.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 6670c3d25c58..d8da075bfda0 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,7 @@ 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_stat_drdy: address to read status of DRDY (data ready) interrupt
124 * struct ig1 - represents the Interrupt Generator 1 of sensors. 126 * struct ig1 - represents the Interrupt Generator 1 of sensors.
125 * @en_addr: address of the enable ig1 register. 127 * @en_addr: address of the enable ig1 register.
126 * @en_mask: mask to write the on/off value for enable. 128 * @en_mask: mask to write the on/off value for enable.
@@ -131,6 +133,7 @@ struct st_sensor_data_ready_irq {
131 u8 mask_int2; 133 u8 mask_int2;
132 u8 addr_ihl; 134 u8 addr_ihl;
133 u8 mask_ihl; 135 u8 mask_ihl;
136 u8 addr_stat_drdy;
134 struct { 137 struct {
135 u8 en_addr; 138 u8 en_addr;
136 u8 en_mask; 139 u8 en_mask;