From: Jeff LaBundy <jeff@labundy.com>
To: David Lechner <dlechner@baylibre.com>
Cc: Sicelo <absicsz@gmail.com>,
linux-iio@vger.kernel.org, maemo-leste@lists.dyne.org,
Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>,
linux-input@vger.kernel.org
Subject: Re: supporting binary (near-far) proximity sensors over gpio
Date: Sat, 25 Nov 2023 22:33:53 -0600 [thread overview]
Message-ID: <ZWLKsVu/v8m9nA0U@nixie71> (raw)
In-Reply-To: <CAMknhBE5A3w7ntdWC9cFDYSrPQNPoH7sQ5PVXKEy6MAJmZ93SA@mail.gmail.com>
Hi Sicelo and David,
On Sat, Nov 18, 2023 at 06:09:18PM -0600, David Lechner wrote:
> On Fri, Nov 17, 2023 at 12:22 PM Sicelo <absicsz@gmail.com> wrote:
> >
> > Hi
> >
> > Some phones have 1-bit proximity sensors, which simply toggle a GPIO
> > line to indicate that an object is near or far. Thresholds are set at
> > hardware level. One such sensor is OSRAM SFH 7741 [1], which is used on
> > the Nokia N900.
> >
> > It is currently exported over evdev, emitting the SW_FRONT_PROXIMITY key
> > code [2].
> >
> > So the question is: should a new, general purpose iio-gpio driver be
> > written, that would switch such a proximity sensor to the iio framework?
> > Or evdev is really the best place to support it?
> >
> > There are a couple of people who are willing to write such an iio
> > driver, if iio is the way to go.
> >
> > Regards,
> > Sicelo
> >
> > [1] https://media.digikey.com/pdf/Data%20Sheets/Osram%20PDFs/SFH_7741.pdf
> > [2] https://elixir.bootlin.com/linux/v6.6.1/source/arch/arm/boot/dts/ti/omap/omap3-n900.dts#L111
> >
> Since this is really a proximity switch (it is either on or off)
> rather than measuring a proximity value over a continuous range, it
> doesn't seem like a good fit for the iio subsystem. If the sensor is
> on a phone, then it is likely to detect human presence so the input
> subsystem does seem like the right one for that application.
>
> More at https://www.kernel.org/doc/html/latest/driver-api/iio/intro.html
>
I tend to agree; if there are only two discrete states as is the case for a
GPIO, then this is technically a switch and not a sensor. Therefore, input
seems like a better fit; that is just my $.02.
FWIW, a similar discussion came up a few years ago in [1] and again the key
differentiator was whether the output is discrete or continuous.
Kind regards,
Jeff LaBundy
[1] https://lore.kernel.org/linux-iio/9f9b0ff6-3bf1-63c4-eb36-901cecd7c4d9@redhat.com/
next prev parent reply other threads:[~2023-11-26 4:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-17 18:21 supporting binary (near-far) proximity sensors over gpio Sicelo
2023-11-19 0:09 ` David Lechner
2023-11-20 17:31 ` Jonathan Cameron
2023-11-20 20:23 ` Sicelo
2023-11-26 4:33 ` Jeff LaBundy [this message]
2023-11-26 10:59 ` Philipp Jungkamp
2023-12-04 10:09 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZWLKsVu/v8m9nA0U@nixie71 \
--to=jeff@labundy.com \
--cc=absicsz@gmail.com \
--cc=dlechner@baylibre.com \
--cc=ivo.g.dimitrov.75@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=maemo-leste@lists.dyne.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).