linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@cam.ac.uk>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Linus Walleij <linus.ml.walleij@gmail.com>,
	linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
	zdevai@gmail.com
Subject: Re: [PATCH] staging:iio:proof of concept in kernel interface.
Date: Mon, 17 Oct 2011 12:32:25 +0100	[thread overview]
Message-ID: <4E9C1249.5020408@cam.ac.uk> (raw)
In-Reply-To: <20111017111807.GA27266@opensource.wolfsonmicro.com>

On 10/17/11 12:18, Mark Brown wrote:
> On Mon, Oct 17, 2011 at 12:13:27PM +0100, Jonathan Cameron wrote:
>> On 10/17/11 11:46, Mark Brown wrote:
> 
>>> I think the PMIC case is a real one, assigning numbers people need to
>>> use to find things is doesn't really reflect actual usage.
> 
>> Just to make sure I'm understanding you correctly could you give an example
>> part.  The supplies one we explicitly handle anyway so I'm happy with that
>> one, I just want to confirm that this is what you are talking about.
> 
> The wm831x PMICs have an AUXADC with (actual wirings vary depending on
> the particular device):
Just to pin this down completely...
> 
>  - Some voltage inputs hard wired to particular system supplies.
Hard wired in the pmic?  (e.g. do not vary from device to device).
These I'm happy to see have names.  If it were a normal IIO device their
access attributes would be something like:

in_voltage0_supply3V_raw
in_voltage1_supply2.8V_raw

(have insist on indexing even with named channels because it is needed as
events codes don't want to carry a string.).

>  - One or more temperature inputs wired to particular place (eg, chip
>    and battery).
Not hard wired so to my mind these are just general purpose temperature inputs.
Hence naming doesn't make sense (at least not outside of board file or DT).
If there really is something that stops these being switched round then they can
be named (e.g. if one is actually in the pmic package!). IIO raw attribute would be: 

in_temp0_raw
in_temp1_raw etc

>  - Some channels that measure voltages on some of the pins with no
>    particular function allocated to them.
So these are nameless numbered channels.

in_voltage13_raw onwards.

There are some complexities to deal with that make me wonder if direct indexing
into a driver provided table isn't easier.  The other is channel types.

Perhaps something as involved as the following works - we are basically lifting about
half of struct iio_chan_spec into here:

struct adc_map {
/* Input / output side */
        struct device *adc_dev;
        const char *adc_dev_name;
	int channel_num1;
	int channel_num2;
	enum IIO_TYPE type /*adc etc*/
	bool differential.
/* User side */
        const char *channel;
        struct device *dev;
        const char *dev_name;
};

Is it so bad to insist that the dt writer or equivalent actually looks at the
driver in question and picks the underlying channel index directly?

I'm certainly going to implement that first then add the matching logic
afterwards anyway as it will make it easier to review / test.




  reply	other threads:[~2011-10-17 11:32 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-11 11:43 [PATCH RFC] IIO: Proof of concept in kernel interface Jonathan Cameron
2011-10-11 11:43 ` [PATCH] staging:iio:proof " Jonathan Cameron
2011-10-13 14:32   ` Mark Brown
2011-10-13 14:46     ` Jonathan Cameron
2011-10-13 20:44       ` Mark Brown
2011-10-14 15:59         ` Jonathan Cameron
2011-10-14 19:33           ` Mark Brown
2011-10-16 18:45           ` Linus Walleij
2011-10-17  9:39             ` Mark Brown
2011-10-17  9:44               ` Jonathan Cameron
2011-10-17  9:43             ` Jonathan Cameron
2011-10-17 10:19               ` Mark Brown
2011-10-17 10:32                 ` Jonathan Cameron
2011-10-17 10:46                   ` Mark Brown
2011-10-17 11:13                     ` Jonathan Cameron
2011-10-17 11:18                       ` Mark Brown
2011-10-17 11:32                         ` Jonathan Cameron [this message]
2011-10-17 12:08                           ` Mark Brown
2011-10-17 12:31                             ` Jonathan Cameron
2011-10-17 12:48                               ` Mark Brown
2011-10-17 13:03                                 ` Jonathan Cameron
2011-10-17 13:55                                   ` Mark Brown
2011-10-17 14:05                                     ` Jonathan Cameron
2011-10-17 13:55               ` Linus Walleij
2011-10-17 14:01                 ` 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=4E9C1249.5020408@cam.ac.uk \
    --to=jic23@cam.ac.uk \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linus.ml.walleij@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zdevai@gmail.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).