staging:iio:spear_adc: Report scale as fractional value
Move the complexity of calculating the fixed point scale to the core. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Cc: Stefan Roese <sr@denx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
4f9be98586
commit
bfbab2bcf9
1 changed files with 3 additions and 4 deletions
|
@ -168,10 +168,9 @@ static int spear_read_raw(struct iio_dev *indio_dev,
|
||||||
return IIO_VAL_INT;
|
return IIO_VAL_INT;
|
||||||
|
|
||||||
case IIO_CHAN_INFO_SCALE:
|
case IIO_CHAN_INFO_SCALE:
|
||||||
scale_mv = (info->vref_external * 1000) >> DATA_BITS;
|
*val = info->vref_external;
|
||||||
*val = scale_mv / 1000;
|
*val2 = DATA_BITS;
|
||||||
*val2 = (scale_mv % 1000) * 1000;
|
return IIO_VAL_FRACTIONAL_LOG2;
|
||||||
return IIO_VAL_INT_PLUS_MICRO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
Loading…
Add table
Reference in a new issue