提交 73ad8868 编写于 作者: A Alexandru Ardelean 提交者: Greg Kroah-Hartman

staging:iio:ad7606: fix voltage scales

[ Upstream commit 4ee03330 ]

Fixes commit 17be2a29 ("staging: iio:
ad7606: replace range/range_available with corresponding scale").

The AD7606 devices don't have a 2.5V voltage range, they have 5V & 10V
voltage range, which is selectable via the `gpio_range` descriptor.

The scales also seem to have been miscomputed, because when they were
applied to the raw values, the results differ from the expected values.
After checking the ADC transfer function in the datasheet, these were
re-computed.
Signed-off-by: NAlexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 38672b57
无相关合并请求
......@@ -26,9 +26,12 @@
#include "ad7606.h"
/* Scales are computed as 2.5/2**16 and 5/2**16 respectively */
/*
* Scales are computed as 5000/32768 and 10000/32768 respectively,
* so that when applied to the raw values they provide mV values
*/
static const unsigned int scale_avail[2][2] = {
{0, 38147}, {0, 76294}
{0, 152588}, {0, 305176}
};
static int ad7606_reset(struct ad7606_state *st)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册