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]

 



> [...]
> >> +	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

correct

> convert to uV is thus 732.421875.

yes, but we want millivolt in IIO (ABI/testing/see sysfs-bus-iio)

I think you should change _PLUS_MICRO to _PLUS_NANO

> The above code better is:
> 
> *val = 732;
> *val2 = 421875;
> return IIO_VAL_INT_PLUS_MICRO;

regards, p.

-- 

Peter Meerwald-Stadler
+43-664-2444418 (mobile)
--
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