[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f1f77ced-be0d-4501-b38d-91a796170649@email.android.com>
Date: Thu, 16 Aug 2012 06:36:16 +0100
From: Jonathan Cameron <jic23@...23.retrosnub.co.uk>
To: "Kim, Milo" <Milo.Kim@...com>,
Lars-Peter Clausen <lars@...afoo.de>,
"jic23@....ac.uk" <jic23@....ac.uk>
CC: "jic23@...nel.org" <jic23@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
"sameo@...ux.intel.com" <sameo@...ux.intel.com>
Subject: RE: [PATCH v2] iio: adc: add new lp8788 adc driver
"Kim, Milo" <Milo.Kim@...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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists