]> git.karo-electronics.de Git - linux-beck.git/commit
iio: st_sensors: read each channel individually
authorLinus Walleij <linus.walleij@linaro.org>
Thu, 24 Mar 2016 13:18:04 +0000 (14:18 +0100)
committerJonathan Cameron <jic23@kernel.org>
Tue, 19 Apr 2016 18:58:11 +0000 (19:58 +0100)
commit6436db37b4a5da1ae1f381e4791e17e2236fd276
tree42f70f16fa231520f1bf6691decce196eb4ffe90
parent850c25c857647e4095c4290e32eb62395f9c8117
iio: st_sensors: read each channel individually

The current buffer read code tries to optimize reads from the
sensor data registers by issuing a single read operation across
all the indata registers.

This doesn't work: when the LIS331DL accelerometer sensor is
configured to open drain, active low interrupt mode, this will
just clear the XDA (X-axis data available) bit in the STATUS_REG
register (0x27), while YDA, ZDA and even ZYXDA remain set to 1,
and the internal logic of the sensor holds the DRDY (INT1) line
asserted (the value of the status register is 0xee).

If we instead issue one read operation per enabled channel
(X, Y, Z) things start working and we can use open drain and
active low interrupts.

Note that a backported patch fixing this issue will be heading
via the fixes branch but changes in this file already in staging-next
will make that patch 'look' rather different.  The code in here
is the correct one when that clash hits.

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>
drivers/iio/common/st_sensors/st_sensors_buffer.c