Re: [PATCH v8 3/3] iio: adc: add support for Allwinner SoCs ADC

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

 



Hi Peter,

On 09/12/2016 17:04, Peter Meerwald-Stadler wrote:
[...]
>> +	case IIO_CHAN_INFO_SCALE:
>> +		if (chan->type == IIO_VOLTAGE) {
>> +			/* 3000mV / 4096 * raw */
>> +			*val = 0;
>> +			*val2 = 732421875;
> 
> this looks more like INT_PLUS_NANO, beyond range of micro?
> 
>> +			return IIO_VAL_INT_PLUS_MICRO;

No, this is rather a mistake.

The scale to convert to mV is 0.732421875 (3000mV / 4096). The scale to
convert to uV is thus 732.421875.

The above code better is:

*val = 732;
*val2 = 421875;
return IIO_VAL_INT_PLUS_MICRO;

Thanks!

Quentin

-- 
Quentin Schulz, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
--
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