linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alban Bedel <alban.bedel@avionic-design.de>
To: Jonathan Cameron <jic23@jic23.retrosnub.co.uk>
Cc: Roland Stigge <stigge@antcom.de>,
	linux-iio@vger.kernel.org, Lars-Peter Clausen <lars@metafoo.de>,
	Alban Bedel <alban.bedel@avionic-design.de>
Subject: Re: [PATCH] staging:iio:lpc32xx_adc: Add scale/offset support
Date: Thu, 8 Nov 2012 17:56:17 +0100	[thread overview]
Message-ID: <20121108175617.06429ab1@avionic-0020.adnet.avionic-design.de> (raw)
In-Reply-To: <509BD1D9.20100@jic23.retrosnub.co.uk>

On Thu, 08 Nov 2012 15:38:01 +0000
Jonathan Cameron <jic23@jic23.retrosnub.co.uk> wrote:

> Why not do this with regulators?  That would give a more flexible
> system and all that stuff is already well supported (if fixed voltages
> are supplied then used fixed regulators).

I agree that would probably be better. But for me that raise the
question of having this stuff in the ADC driver at all. Most ADC just
return a value from 0 to MAX and have no way to find out their supply
voltage. If we start with binding to regulators in the drivers we'll
soon get a lots of non-flexible and duplicated code.

It would be a lot nicer if the ADC channels could be bound to a
regulator and a transform function that compute a real world voltage out
of:
 - The ADC value
 - The ADC range
 - The regulator representing the ADC reference voltage

The simplest transform would be a linear curve with an optional offset,
but any kind of transform would also be possible allowing to represent
about any circuit that might be between the supply regulator and the ADC
input.

Alban

  reply	other threads:[~2012-11-08 16:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-07 16:44 [PATCH] staging:iio:lpc32xx_adc: Add scale/offset support Alban Bedel
2012-11-08  9:31 ` Roland Stigge
2012-11-08 15:38   ` Jonathan Cameron
2012-11-08 16:56     ` Alban Bedel [this message]
2012-11-08 17:28       ` Jonathan Cameron
2012-11-14 11:17         ` Alban Bedel

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=20121108175617.06429ab1@avionic-0020.adnet.avionic-design.de \
    --to=alban.bedel@avionic-design.de \
    --cc=jic23@jic23.retrosnub.co.uk \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=stigge@antcom.de \
    /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).