Linux IIO development
 help / color / mirror / Atom feed
From: "Vesa Jääskeläinen" <dachaac@gmail.com>
To: linux-iio@vger.kernel.org
Subject: IIO device indexing issue
Date: Mon, 2 Nov 2015 20:47:33 +0200	[thread overview]
Message-ID: <5637AFC5.7080007@gmail.com> (raw)

Hi,

When we were using kernel 3.2 and with that board files we just got IIO 
devices with static order so that we knew exactly what iio:device0 is.

Now with device tree that order is not so static anymore especially when 
using device overlays (have not yet tried that thou). If there would be 
deferred probe for the device then if we have multiple iio:device's then 
those could in theory be in any order.

In example libiio uses iio device index to open the IIO device. So the 
problem is to know what iio:device is what.

If we look files under /sys/bus/iio/iio:deviceX. They do not reveal what 
device this is (especially if there are multiple device of same type). 
There does not seem to be a way to give custom name for the iio device 
from device tree that could have been used as a cue.

Device tree aliases kinda sounded a good idea to try. Eg. define adc0 
alias and then link it to actual device node in tree.

Aliases could be found under /proc/device-tree/aliases. Looking at it 
shows what device tree node it is. However there does not seem to be 
actual link from any /proc/device-tree entries to kernel drivers exposed 
under sysfs. And even the path components in device tree are not in same 
format as in sysfs. So there is no 1:1 mapping possible here.

IIO devices in /sys/bus/iio/iio:deviceX seem to be symlinks to actual 
devices under /sys/devices and from there is physical path to the device 
and under that the IIO device with the same name as is under /sys/bus/iio.

So in theory we could make a mapping configuration file that specifies 
logical name for iio device and then physical parent path for the device 
and then find under it iio:device* files to determine what is the iio 
device index for this physical device. Then open IIO device with that 
index in example with libiio. Sounds a bit complex?

So did we miss something on how this should be defined/accessed or is 
there a slight issue here on how to identify iio devices?

Don't know how device tree overlays affect this if we first load device 
tree overlay with some configuration and then unload it and load another 
one with different configuration.

Thanks,
Vesa Jääskeläinen


             reply	other threads:[~2015-11-02 18:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-02 18:47 Vesa Jääskeläinen [this message]
2015-11-04  9:38 ` IIO device indexing issue Lars-Peter Clausen
2015-11-04 18:53   ` Vesa Jääskeläinen
2015-11-05  1:25     ` Phil Reid
2015-11-05  5:24       ` Phil Reid
2015-11-05 19:13     ` Jonathan Cameron
2015-11-06  9:49       ` Markus Pargmann
2015-11-07  9:03         ` Vesa Jääskeläinen
2015-11-09 10:33           ` Markus Pargmann

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=5637AFC5.7080007@gmail.com \
    --to=dachaac@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox