All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Giedrius Trainavičius" <giedrius@blokas.io>
To: linux-iio@vger.kernel.org
Subject: Dynamically configured channels, overlap with GPIO, encoder support
Date: Tue, 28 Jun 2022 13:05:09 +0300	[thread overview]
Message-ID: <CAMONXLtN9-t=SuNzDWk22ufYXQHh7ZkXD2FhrRmR_uRgJFmZng@mail.gmail.com> (raw)

Hello,

I am developing an extension board for Raspberry Pi, it has a
microcontroller on it and I'm trying to expose its pins as a I/O
expander via I²C bus. I've recently successfully implemented gpiochip
interface as well as irq_chip in a kernel module, and now I'm looking
at adding ADC support, Industrial IO seems like a good candidate for
exposing it, but I have a couple of questions:

1. Can the IIO channels be configured dynamically? On the
microcontroller, the same pins can be used for GPIO, ADC, etc... - can
things like the channel direction, the function (simple high or low
GPIO pin, ADC, PWM output) be configured by userspace programs? Can it
be configured within a kernel module, if I provide my own sysfs
interface for function setup?

2. Can IIO channels be appended and removed to/from the list during runtime?

3. Are encoders supported by IIO? I'd like to decode encoders within
the firmware of the microcontroller, and provide only
increments/decrements to the kernel module via I²C, can encoders built
in such a way be exposed via IIO? I've seen some patches on the
internet adding 'counter' interface to IIO, but it seems it never made
it to be within IIO, and instead the 'counter' in its own subsystem.

4. How does IIO interact with gpiochip? As I'm implementing gpiochip
interface, I could simply return -EBUSY for pins already used by the
other subsystem.

Thank you!
Giedrius.

             reply	other threads:[~2022-06-28 10:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-28 10:05 Giedrius Trainavičius [this message]
2022-06-28 12:35 ` Dynamically configured channels, overlap with GPIO, encoder support Andy Shevchenko
2022-07-16 16:16   ` 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='CAMONXLtN9-t=SuNzDWk22ufYXQHh7ZkXD2FhrRmR_uRgJFmZng@mail.gmail.com' \
    --to=giedrius@blokas.io \
    --cc=linux-iio@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.