Re: [PATCH 22/22] staging:iio:adc: Add AD7791 driver

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

 



On 08/10/2012 06:36 PM, Lars-Peter Clausen wrote:
> This patch adds support for the Analog Devices AD7787, AD7788, AD7789, AD7790
> and AD7791 Sigma Delta Analog-to-Digital converters.
> 
> Signed-off-by: Lars-Peter Clausen <lars@xxxxxxxxxx>
> ---
> [...]
> +	case IIO_CHAN_INFO_SCALE:
> +		/* The monitor channel uses an internal reference. */
> +		if (chan->address == AD7791_CH_AVDD_MONITOR) {
> +			scale_nv = 5850000000ULL;
> +		} else {
> +			int voltage_uv;
> +
> +			voltage_uv = regulator_get_voltage(st->reg);
> +			if (voltage_uv < 0)
> +				return voltage_uv;
> +			scale_nv = voltage_uv * 1000;
> +		}
> +		if (unipolar)
> +			scale_nv >>= chan->scan_type.realbits;
> +		else
> +			scale_nv >>= chan->scan_type.realbits - 1;
> +		*val2 = do_div(scale_nv, 1000000);
> +		*val = scale_nv;
> +

Just noticed that the scale is off by a factor of 1000. It reports volts
while we want milli volts.

> +		return IIO_VAL_INT_PLUS_NANO;
> +	}


--
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