From: Jonathan Cameron <jic23@jic23.retrosnub.co.uk>
To: "Kim, Milo" <Milo.Kim@ti.com>,
Lars-Peter Clausen <lars@metafoo.de>,
"jic23@cam.ac.uk" <jic23@cam.ac.uk>
Cc: "jic23@kernel.org" <jic23@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
"sameo@linux.intel.com" <sameo@linux.intel.com>
Subject: RE: [PATCH v2] iio: adc: add new lp8788 adc driver
Date: Thu, 16 Aug 2012 06:36:16 +0100 [thread overview]
Message-ID: <f1f77ced-be0d-4501-b38d-91a796170649@email.android.com> (raw)
In-Reply-To: <A874F61F95741C4A9BA573A70FE3998F41EEFD05@DQHE02.ent.ti.com>
"Kim, Milo" <Milo.Kim@ti.com> wrote:
>> > + switch (mask) {
>> > + case IIO_CHAN_INFO_RAW:
>> > + *val = result;
>> > + return IIO_VAL_INT;
>> > + case IIO_CHAN_INFO_SCALE:
>> > + *val = adc_const[id] * ((result * 1000 + 500) / 1000);
>>
>> This looks wrong. The IIO_CHAN_INFO_SCALE attribute is the factor by
>> which
>> IIO_CHAN_INFO_RAW needs to be multiplied to get the value in the
>proper
>> unit,
>> which is specified in the IIO ABI spec. E.g. milli volts for
>voltages.
>>
>> What you return here seems to be the IIO_CHAN_INFO_PROCESSED
>attribute.
>> Which
>> basically is raw * scale.
>
>Thanks a lot for your review.
>
>Any way to get the result with offset value in the iio-consumer side?
>What I need is as below.
>
> result = raw * scale + offset
>
>At this moment, there are two apis() for reading the iio channel
>- iio_read_channel_raw() and iio_read_channel_scale().
>
>Does it sound good if I add iio_read_channel_offset() consumer api
>using IIO_CHAN_INFO_OFFSET?
Yes. Please add that.
>
>Best Regards,
>Milo
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
prev parent reply other threads:[~2012-08-16 5:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-10 7:06 [PATCH v2] iio: adc: add new lp8788 adc driver Kim, Milo
2012-08-14 21:09 ` Jonathan Cameron
2012-08-15 8:49 ` Lars-Peter Clausen
2012-08-16 0:42 ` Kim, Milo
2012-08-16 5:36 ` Jonathan Cameron [this message]
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=f1f77ced-be0d-4501-b38d-91a796170649@email.android.com \
--to=jic23@jic23.retrosnub.co.uk \
--cc=Milo.Kim@ti.com \
--cc=jic23@cam.ac.uk \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sameo@linux.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).