linux_dsm_epyc7002/drivers/iio/gyro
Linus Walleij 65925b65ed iio: st_sensors: switch to a threaded interrupt
commit 98ad8b41f58dff6b30713d7f09ae3834b8df7ded
("iio: st_sensors: verify interrupt event to status") caused
a regression when reading ST sensors from a HRTimer trigger
rather than the intrinsic interrupts: the HRTimer may
trigger faster than the sensor provides new values, and
as the check against new values available as a cause of
the interrupt trigger was done in the poll function,
this would bail out of the HRTimer interrupt with
IRQ_NONE.

So clearly we need to only check the new values available
from the proper interrupt handler and not from the poll
function, which should rather just read the raw values
from the registers, put them into the buffer and be happy.

To achieve this: switch the ST Sensors over to using a true
threaded interrupt handler.

In the interrupt thread, check if new values are available,
else yield to the (potential) next device on the same
interrupt line to check the registers. If the interrupt
was ours, proceed to poll the values.

Instead of relying on iio_trigger_generic_data_rdy_poll() as
a top half to wake up the thread that polls the sensor for
new data, have the thread call iio_trigger_poll_chained()
after determining that is is the proper source of the
interrupt. This is modelled on drivers/iio/accel/mma8452.c
which is already using a properly threaded interrupt handler.

In order to get the same precision in timestamps as
previously, where samples would be timestamped in the
poll function pf->timestamp when calling
iio_trigger_generic_data_rdy_poll() we introduce a
local timestamp in the sensor data, set it in the top half
(fastpath) of the interrupt handler and provide that to the
core when calling iio_push_to_buffers_with_timestamp().

Additionally: if the active scanmask is not set for the
sensor no IRQs should be enabled and we need to bail out
with IRQ_NONE. This can happen if spurious IRQs fire when
installing the threaded interrupt handler.

Tested with hard interrupt triggers on LIS331DL, then also
tested with hrtimers on the same sensor by creating a 75Hz
HRTimer and using it to poll the sensor.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Giuseppe Barba <giuseppe.barba@st.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Reported-by: Crestez Dan Leonard <cdleonard@gmail.com>
Tested-by: Crestez Dan Leonard <cdleonard@gmail.com>
Tested-by: Jonathan Cameron <jic23@kernel.org>
Fixes: 97865fe413 ("iio: st_sensors: verify interrupt event to status")
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-29 20:21:41 +01:00
..
adis16080.c spi: Drop owner assignment from spi_drivers 2015-10-28 10:30:17 +09:00
adis16130.c spi: Drop owner assignment from spi_drivers 2015-10-28 10:30:17 +09:00
adis16136.c First set of new device support, features and cleanups for IIO in the 4.5 cycle 2015-12-01 09:13:29 -08:00
adis16260.c spi: Drop owner assignment from spi_drivers 2015-10-28 10:30:17 +09:00
adxrs450.c spi: Drop owner assignment from spi_drivers 2015-10-28 10:30:17 +09:00
bmg160_core.c 2nd set of new device support, features and cleanup for IIO in the 4.7 cycle. 2016-04-26 15:07:23 -07:00
bmg160_i2c.c iio: bmg160: Separate i2c and core driver 2015-08-31 17:04:23 +01:00
bmg160_spi.c iio: bmg160: Add SPI driver 2015-08-31 17:06:11 +01:00
bmg160.h iio: bmg160: Separate i2c and core driver 2015-08-31 17:04:23 +01:00
hid-sensor-gyro-3d.c iio: gyro: hid-sensor-gyro-3d: Fix memory leak in probe() 2015-05-17 09:09:49 +01:00
itg3200_buffer.c iio: gyro: itg3200: Fix indio_dev->trig assignment 2014-08-25 21:49:00 +01:00
itg3200_core.c iio: Drop owner assignment from i2c_driver 2015-07-11 18:50:07 +01:00
Kconfig iio: st_gyro: Add lsm9ds0-gyro support 2016-04-23 22:47:18 +01:00
Makefile iio: bmg160: Add SPI driver 2015-08-31 17:06:11 +01:00
ssp_gyro_sensor.c iio: common: ssp_sensors: Add sensorhub gyroscope sensor 2015-01-29 18:49:56 +00:00
st_gyro_buffer.c iio: st_sensors: switch to a threaded interrupt 2016-05-29 20:21:41 +01:00
st_gyro_core.c iio: st_sensors: switch to a threaded interrupt 2016-05-29 20:21:41 +01:00
st_gyro_i2c.c iio: st_gyro: Add lsm9ds0-gyro support 2016-04-23 22:47:18 +01:00
st_gyro_spi.c iio: st_gyro: Add lsm9ds0-gyro support 2016-04-23 22:47:18 +01:00
st_gyro.h iio: st_gyro: Add lsm9ds0-gyro support 2016-04-23 22:47:18 +01:00