Re: [PATCH 24/25] staging:iio:spear_adc: Report scale as fractional value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/28/13 10:31, Lars-Peter Clausen wrote:
> Move the complexity of calculating the fixed point scale to the core.
> 
> Signed-off-by: Lars-Peter Clausen <lars@xxxxxxxxxx>
> Cc: Stefan Roese <sr@xxxxxxx>
Applied to the togreg branch of iio.git

Thanks
> ---
>  drivers/staging/iio/adc/spear_adc.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/iio/adc/spear_adc.c b/drivers/staging/iio/adc/spear_adc.c
> index 20f2d55..657e01b 100644
> --- a/drivers/staging/iio/adc/spear_adc.c
> +++ b/drivers/staging/iio/adc/spear_adc.c
> @@ -168,10 +168,9 @@ static int spear_read_raw(struct iio_dev *indio_dev,
>  		return IIO_VAL_INT;
>  
>  	case IIO_CHAN_INFO_SCALE:
> -		scale_mv = (info->vref_external * 1000) >> DATA_BITS;
> -		*val =  scale_mv / 1000;
> -		*val2 = (scale_mv % 1000) * 1000;
> -		return IIO_VAL_INT_PLUS_MICRO;
> +		*val = info->vref_external;
> +		*val2 = DATA_BITS;
> +		return IIO_VAL_FRACTIONAL_LOG2;
>  	}
>  
>  	return -EINVAL;
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux