Skip to content

Commit b2d2be7

Browse files
spectrum70gregkh
authored andcommitted
iio: dac: ad3552r-common: fix ad3541/2r ranges
[ Upstream commit 1e758b6 ] Fix ad3541/2r voltage ranges to be as per ad3542r datasheet, rev. C, table 38 (page 57). The wrong ad354xr ranges was generating erroneous Vpp output. In more details: - fix wrong number of ranges, they are 5 ranges, not 6, - remove non-existent 0-3V range, - adjust order, since ad3552r_find_range() get a wrong index, producing a wrong Vpp as output. Retested all the ranges on real hardware, EVALAD3542RFMCZ: adi,output-range-microvolt (fdt): <(000000) (2500000)>; ok (Rfbx1, switch 10) <(000000) (5000000)>; ok (Rfbx1, switch 10) <(000000) (10000000)>; ok (Rfbx1, switch 10) <(-5000000) (5000000)>; ok (Rfbx2, switch +/- 5) <(-2500000) (7500000)>; ok (Rfbx2, switch -2.5/7.5) Fixes: 8f2b548 ("drivers:iio:dac: Add AD3552R driver support") Signed-off-by: Angelo Dureghello <adureghello@baylibre.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250108-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v2-1-2dac02f04638@baylibre.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent c890a5b commit b2d2be7

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

drivers/iio/dac/ad3552r-common.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ EXPORT_SYMBOL_NS_GPL(ad3552r_ch_ranges, IIO_AD3552R);
2222

2323
const s32 ad3542r_ch_ranges[AD3542R_MAX_RANGES][2] = {
2424
[AD3542R_CH_OUTPUT_RANGE_0__2P5V] = { 0, 2500 },
25-
[AD3542R_CH_OUTPUT_RANGE_0__3V] = { 0, 3000 },
2625
[AD3542R_CH_OUTPUT_RANGE_0__5V] = { 0, 5000 },
2726
[AD3542R_CH_OUTPUT_RANGE_0__10V] = { 0, 10000 },
28-
[AD3542R_CH_OUTPUT_RANGE_NEG_2P5__7P5V] = { -2500, 7500 },
29-
[AD3542R_CH_OUTPUT_RANGE_NEG_5__5V] = { -5000, 5000 }
27+
[AD3542R_CH_OUTPUT_RANGE_NEG_5__5V] = { -5000, 5000 },
28+
[AD3542R_CH_OUTPUT_RANGE_NEG_2P5__7P5V] = { -2500, 7500 }
3029
};
3130
EXPORT_SYMBOL_NS_GPL(ad3542r_ch_ranges, IIO_AD3552R);
3231

drivers/iio/dac/ad3552r.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@
128128
#define AD3552R_LDAC_PULSE_US 100
129129

130130
#define AD3552R_MAX_RANGES 5
131-
#define AD3542R_MAX_RANGES 6
131+
#define AD3542R_MAX_RANGES 5
132+
#define AD3552R_QUAD_SPI 2
132133

133134
extern const s32 ad3552r_ch_ranges[AD3552R_MAX_RANGES][2];
134135
extern const s32 ad3542r_ch_ranges[AD3542R_MAX_RANGES][2];
@@ -185,16 +186,14 @@ enum ad3552r_ch_vref_select {
185186
enum ad3542r_ch_output_range {
186187
/* Range from 0 V to 2.5 V. Requires Rfb1x connection */
187188
AD3542R_CH_OUTPUT_RANGE_0__2P5V,
188-
/* Range from 0 V to 3 V. Requires Rfb1x connection */
189-
AD3542R_CH_OUTPUT_RANGE_0__3V,
190189
/* Range from 0 V to 5 V. Requires Rfb1x connection */
191190
AD3542R_CH_OUTPUT_RANGE_0__5V,
192191
/* Range from 0 V to 10 V. Requires Rfb2x connection */
193192
AD3542R_CH_OUTPUT_RANGE_0__10V,
194-
/* Range from -2.5 V to 7.5 V. Requires Rfb2x connection */
195-
AD3542R_CH_OUTPUT_RANGE_NEG_2P5__7P5V,
196193
/* Range from -5 V to 5 V. Requires Rfb2x connection */
197194
AD3542R_CH_OUTPUT_RANGE_NEG_5__5V,
195+
/* Range from -2.5 V to 7.5 V. Requires Rfb2x connection */
196+
AD3542R_CH_OUTPUT_RANGE_NEG_2P5__7P5V,
198197
};
199198

200199
enum ad3552r_ch_output_range {

0 commit comments

Comments
 (0)