Thread (5 messages) 5 messages, 4 authors, 2012-08-16

RE: [PATCH v2] iio: adc: add new lp8788 adc driver

From: Jonathan Cameron <hidden>
Date: 2012-08-16 05:36:23
Also in: lkml


"Kim, Milo" [off-list ref] wrote:
quoted
quoted
+	switch (mask) {
+	case IIO_CHAN_INFO_RAW:
+		*val =3D result;
+		return IIO_VAL_INT;
+	case IIO_CHAN_INFO_SCALE:
+		*val =3D adc_const[id] * ((result * 1000 + 500) / 1000);
=20
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
quoted
unit,
which is specified in the IIO ABI spec. E.g. milli volts for
voltages.
quoted
=20
What you return here seems to be the IIO_CHAN_INFO_PROCESSED
attribute.
quoted
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 =3D 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
--=20
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help