On Sun, Feb 10, 2019 at 3:39 PM Robert Eshleman <bobbyeshleman@xxxxxxxxx> wrote: > > This patch adds support for the ap3216c ambient light and proximity > sensor. PS Why not use the chip in the mode where the interrupt is automatically cleared by reading the data? This could work if you read the data in the interrupt routine, store it in a buffer, then send the event to iio. Then when userspace wants to read out the value, don't actually touch the hardware, but return the buffered value. I don't think you then need any synchronization primitives to accomplish this, such as mutexes, spin locks, etc. Because the interrupt routine is single-threaded. You don't even need a memory barrier for the buffered value, because the iio core uses a waitqueue internally, which automatically issues an mb(). As far as I know.