linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@cam.ac.uk>
To: "Ira W. Snyder" <iws@ovro.caltech.edu>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Kay Sievers <kay.sievers@vrfy.org>,
	Dmitry Torokhov <dtor@mail.ru>,
	"Hennerich, Michael" <Michael.Hennerich@analog.com>,
	Manuel Stahl <manuel.stahl@iis.fraunhofer.de>,
	"Frysinger, Michael" <Michael.Frysinger@analog.com>,
	"Getz, Robin" <Robin.Getz@analog.com>,
	"Trisal, Kalhan" <kalhan.trisal@intel.com>,
	"Zhang, Xing Z" <xing.z.zhang@intel.com>,
	Jean Delvare <khali@linux-fr.org>,
	Samu Onkalo <samu.p.onkalo@nokia.com>
Subject: Re: [RFC] Staging: IIO: New ABI V2
Date: Sat, 06 Feb 2010 13:59:33 +0000	[thread overview]
Message-ID: <4B6D75C5.70404@cam.ac.uk> (raw)
In-Reply-To: <20100205223224.GL5791@ovro.caltech.edu>

Hi Ira,

>> There are probably countless error in here. Please point any out you come
>> across.  This file may well need breaking up into sysfs-class-iio-in, accel
>> etc so as to keep it manageable.  Note this is not intended to obey the ABI
>> spec well.  It will be cleaned up before submission and all the other
>> required information added.
>>
> 
> How about current and power measurement devices?
We aren't applying any hard limits to what we will cover by IIO.  At the moment
the limits tend to be more precisely set by what is not adequately covered else
where than the other way around.  The other category of things we are including
tend to require facilities that IIO provides (buffering / event infrastructure)
that are not provided as is by an apparently more appropriate subsystem and
where the alternate subsystems.

For reference, Analog Devices have already suggested they will be using IIO
for a couple of energy meeting ICs which will have some similarities. 

https://docs.blackfin.uclinux.org/doku.php?id=adi_peripheral_drivers

For reference, we have a fairly dirty wiki page for IIO keeping track of devices
people are working on (or at least have and plan to work on for some of the ones
I'm listing!)

http://sourceforge.net/apps/mediawiki/iioutils/index.php?title=Device_List

As I don't have any equivalent devices in my development set, I'm happy to leave
those who do to hammer out any relevant details of naming etc as long as the
result fits nicely with the bits that are already being defined.
> I have an TI INA209
Interesting bit of kit.  The rest of my comments are based on a quick data sheet
browse, so please point out anything I have misunderstood or simply missed!
> chip which I've written a hwmon driver for, but the hwmon guys don't
> want to accept the driver upstream for the following reasons, and
> suggest IIO instead.
> 
> 1) it is sensitive enough to measure voltage in uV. This makes a huge
> difference when calculating current measurements, which I currently do
> in userspace with lm-sensors. The sense resistor is very likely to have
> a different value depending on the application the chip is used in. On
> my board, we have 5 of these chip, with 3 different resistor values.
To clarify things, do these resistors tend to specified accurately enough
on a per design basis, or are we at the level where we want to individually
calibrate individual devices?  The question is relevant to whether it makes
sense to specify these resistors as platform data or where else these values
need to be.
> 
> 2) it has "output pin enables". You can program an overcurrent limit
> into the device. When the current being drawn exceeds this limit, it
> drives an output pin so the power supply can be shut off quickly. In my
> case, it is wired to an LTC4215 hot swap controller.

Interesting setup..  If those output pin enables were routed to standard
interrupts (which clearly defeats the point!) then we could simply handle
them as event lines in IIO.  Here we have a rather convoluted situation
where  they act as hardware triggers of another device.   The first question
is whether it makes sense to make this know to the operating system, or whether
we effectively just ignore the physical link and configure the two interactive
devices appropriately (obviously we need to provide the means to do this!).

For the rest of this discussion, let us ignore the exact case you have here
and consider it as a more generic interrupt.  Obviously your current driver
has support for much if not all of what follows!

So things this device has:

* Current measurement.  For this we probably want to match naming with hwmon (no
  reason not to) with raw and conversion info as per in0_raw etc below.  I note
  we also have a controllable PGA so some of the conversion factors will be rw.
* trigger option for conversion. (IIO handles this fine)
* Peak-hold registers.  This one is new to us, so we will need to think of a suitable
  naming convention, but I'd guess reading these via sysfs will be adequate?
* Critical comparitor control.  Although much faster, these are basically threshold
  event detectors so we can use equivalents of the events described below.
* Lots of filtering controls.  Until we get a feel for how generalizable things like
  this are, we will keep them driver specific and out of the ABI spec.
* The smbus alert stuff should work fine as an event source.  I remember seeing
  some patches for support in i2c from David Brownell. We probably want to chase
  these up for this device driver.
* The single control handling data accuracy 8/10/12bit then averaging may take some thought!

So in conclusion, yes, this device falls within the scope of IIO but there are a number
of ABI elements that will need discussion.  Feel free to get that discussion going
here, by proposing the ABI you want!

Jonathan





  reply	other threads:[~2010-02-06 13:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-05 18:21 [RFC] Staging: IIO: New ABI V2 Jonathan Cameron
2010-02-05 22:32 ` Ira W. Snyder
2010-02-06 13:59   ` Jonathan Cameron [this message]
2010-02-06 14:49     ` Jean Delvare
2010-02-06 17:05     ` Ira W. Snyder
2010-02-15 20:26 ` Robin Getz
2010-02-16  0:58   ` Mike Frysinger
2010-02-16  2:49     ` Greg KH
2010-02-16 11:03       ` Jonathan Cameron
2010-02-16 19:18         ` Robin Getz
2010-02-17 10:50           ` 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=4B6D75C5.70404@cam.ac.uk \
    --to=jic23@cam.ac.uk \
    --cc=Michael.Frysinger@analog.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=Robin.Getz@analog.com \
    --cc=dtor@mail.ru \
    --cc=gregkh@suse.de \
    --cc=iws@ovro.caltech.edu \
    --cc=kalhan.trisal@intel.com \
    --cc=kay.sievers@vrfy.org \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manuel.stahl@iis.fraunhofer.de \
    --cc=samu.p.onkalo@nokia.com \
    --cc=xing.z.zhang@intel.com \
    /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).