[lkml]   [2019]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 1/3] iio: light: Add driver for ap3216c
On Tue, Feb 12, 2019 at 11:40 PM Sven Van Asbroeck <> wrote:
> Next, read ALS and PS _exclusively_ in the irq handler, guard it with
> a mutex:

Wait a second, that wouldn't work, because we don't get an interrupt
on every ALS/PS
conversion, correct ?

In that case, don't cache the als/ps value in the irq handler, but
read it from the hardware in
ap3216c_read_raw, while holding the mutex.

That would still guard against:
- _LO and _HI getting interleaved
- userspace reading the value in between sending the event, and
clearing the int bit
- the int handler not immediately seeing _thresh_en

Apologies for the confusion :)

 \ /
  Last update: 2019-02-13 05:57    [W:0.106 / U:3.344 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site