Linux IIO development
 help / color / mirror / Atom feed
* [PATCH 1/7] staging:iio:ad7291: Use IIO_VAL_FRACTIONAL_LOG2
@ 2013-06-14 15:58 Lars-Peter Clausen
  2013-06-14 15:58 ` [PATCH 2/7] staging:iio:ad7291: Remove userspace reset Lars-Peter Clausen
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Lars-Peter Clausen @ 2013-06-14 15:58 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio, Lars-Peter Clausen

This is a bit more straight forward and also allows better precession when using
the an in-kernel consumer.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/staging/iio/adc/ad7291.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/iio/adc/ad7291.c b/drivers/staging/iio/adc/ad7291.c
index d088c66..a3a3a2f 100644
--- a/drivers/staging/iio/adc/ad7291.c
+++ b/drivers/staging/iio/adc/ad7291.c
@@ -456,7 +456,6 @@ static int ad7291_read_raw(struct iio_dev *indio_dev,
 {
 	int ret;
 	struct ad7291_chip_info *chip = iio_priv(indio_dev);
-	unsigned int scale_uv;
 	u16 regval;
 	s16 signval;
 
@@ -513,10 +512,9 @@ static int ad7291_read_raw(struct iio_dev *indio_dev,
 	case IIO_CHAN_INFO_SCALE:
 		switch (chan->type) {
 		case IIO_VOLTAGE:
-			scale_uv = (chip->int_vref_mv * 1000) >> AD7291_BITS;
-			*val =  scale_uv / 1000;
-			*val2 = (scale_uv % 1000) * 1000;
-			return IIO_VAL_INT_PLUS_MICRO;
+			*val = chip->int_vref_mv;
+			*val2 = AD7291_BITS;
+			return IIO_VAL_FRACTIONAL_LOG2;
 		case IIO_TEMP:
 			/*
 			 * One LSB of the ADC corresponds to 0.25 deg C.
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-06-15  9:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-14 15:58 [PATCH 1/7] staging:iio:ad7291: Use IIO_VAL_FRACTIONAL_LOG2 Lars-Peter Clausen
2013-06-14 15:58 ` [PATCH 2/7] staging:iio:ad7291: Remove userspace reset Lars-Peter Clausen
2013-06-14 20:51   ` Jonathan Cameron
2013-06-14 15:58 ` [PATCH 3/7] staging:iio:ad7291: Remove unnecessary dev_info() from probe() Lars-Peter Clausen
2013-06-14 15:58 ` [PATCH 4/7] staging:iio:ad7291: Simplify threshold register lookup Lars-Peter Clausen
2013-06-14 15:58 ` [PATCH 5/7] staging:iio:ad7291: Use i2c_smbus_{read,write}_word_swapped instead of open-coding it Lars-Peter Clausen
2013-06-14 15:58 ` [PATCH 6/7] staging:iio:ad7291: Use sign_extend32 " Lars-Peter Clausen
2013-06-14 20:54   ` Jonathan Cameron
2013-06-14 15:58 ` [PATCH 7/7] staging:iio:ad7291: Rework regulator handling Lars-Peter Clausen
2013-06-14 20:55   ` Jonathan Cameron
2013-06-14 20:50 ` [PATCH 1/7] staging:iio:ad7291: Use IIO_VAL_FRACTIONAL_LOG2 Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox