Skip to content

Commit ab6f0ab

Browse files
dumitruceclanjic23
authored andcommitted
iio: adc: ad7173: fix buffers enablement for ad7176-2
AD7176-2 does not feature input buffers and marks corespondent register bits as read only. Enable buffers only on supported models. Fixes: 76a1e6a ("iio: adc: ad7173: add AD7173 driver") Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Dumitru Ceclan <dumitru.ceclan@analog.com> Link: https://lore.kernel.org/r/20240521-ad7173-fixes-v1-1-8161cc7f3ad1@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent a23c14b commit ab6f0ab

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

drivers/iio/adc/ad7173.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ struct ad7173_device_info {
145145
unsigned int id;
146146
char *name;
147147
bool has_temp;
148+
bool has_input_buf;
148149
bool has_int_ref;
149150
bool has_ref2;
150151
u8 num_gpios;
@@ -212,6 +213,7 @@ static const struct ad7173_device_info ad7173_device_info[] = {
212213
.num_configs = 4,
213214
.num_gpios = 2,
214215
.has_temp = true,
216+
.has_input_buf = true,
215217
.has_int_ref = true,
216218
.clock = 2 * HZ_PER_MHZ,
217219
.sinc5_data_rates = ad7173_sinc5_data_rates,
@@ -224,6 +226,7 @@ static const struct ad7173_device_info ad7173_device_info[] = {
224226
.num_configs = 8,
225227
.num_gpios = 4,
226228
.has_temp = false,
229+
.has_input_buf = true,
227230
.has_ref2 = true,
228231
.clock = 2 * HZ_PER_MHZ,
229232
.sinc5_data_rates = ad7173_sinc5_data_rates,
@@ -237,6 +240,7 @@ static const struct ad7173_device_info ad7173_device_info[] = {
237240
.num_configs = 8,
238241
.num_gpios = 4,
239242
.has_temp = true,
243+
.has_input_buf = true,
240244
.has_int_ref = true,
241245
.has_ref2 = true,
242246
.clock = 2 * HZ_PER_MHZ,
@@ -251,6 +255,7 @@ static const struct ad7173_device_info ad7173_device_info[] = {
251255
.num_configs = 4,
252256
.num_gpios = 2,
253257
.has_temp = true,
258+
.has_input_buf = true,
254259
.has_int_ref = true,
255260
.clock = 16 * HZ_PER_MHZ,
256261
.sinc5_data_rates = ad7175_sinc5_data_rates,
@@ -263,6 +268,7 @@ static const struct ad7173_device_info ad7173_device_info[] = {
263268
.num_configs = 8,
264269
.num_gpios = 4,
265270
.has_temp = true,
271+
.has_input_buf = true,
266272
.has_int_ref = true,
267273
.has_ref2 = true,
268274
.clock = 16 * HZ_PER_MHZ,
@@ -277,6 +283,7 @@ static const struct ad7173_device_info ad7173_device_info[] = {
277283
.num_configs = 4,
278284
.num_gpios = 2,
279285
.has_temp = false,
286+
.has_input_buf = false,
280287
.has_int_ref = true,
281288
.clock = 16 * HZ_PER_MHZ,
282289
.sinc5_data_rates = ad7175_sinc5_data_rates,
@@ -289,6 +296,7 @@ static const struct ad7173_device_info ad7173_device_info[] = {
289296
.num_configs = 4,
290297
.num_gpios = 2,
291298
.has_temp = true,
299+
.has_input_buf = true,
292300
.has_int_ref = true,
293301
.clock = 16 * HZ_PER_MHZ,
294302
.odr_start_value = AD7177_ODR_START_VALUE,
@@ -932,7 +940,7 @@ static int ad7173_fw_parse_channel_config(struct iio_dev *indio_dev)
932940
AD7173_CH_ADDRESS(chan_arr[chan_index].channel,
933941
chan_arr[chan_index].channel2);
934942
chan_st_priv->cfg.bipolar = false;
935-
chan_st_priv->cfg.input_buf = true;
943+
chan_st_priv->cfg.input_buf = st->info->has_input_buf;
936944
chan_st_priv->cfg.ref_sel = AD7173_SETUP_REF_SEL_INT_REF;
937945
st->adc_mode |= AD7173_ADC_MODE_REF_EN;
938946

@@ -989,7 +997,7 @@ static int ad7173_fw_parse_channel_config(struct iio_dev *indio_dev)
989997

990998
chan_st_priv->ain = AD7173_CH_ADDRESS(ain[0], ain[1]);
991999
chan_st_priv->chan_reg = chan_index;
992-
chan_st_priv->cfg.input_buf = true;
1000+
chan_st_priv->cfg.input_buf = st->info->has_input_buf;
9931001
chan_st_priv->cfg.odr = 0;
9941002

9951003
chan_st_priv->cfg.bipolar = fwnode_property_read_bool(child, "bipolar");

0 commit comments

Comments
 (0)