Skip to content

Commit fb67be2

Browse files
dlechgregkh
authored andcommitted
iio: adc: ad7173: fix setting ODR in probe
commit 6fa908a upstream. Fix the setting of the ODR register value in the probe function for AD7177. The AD7177 chip has a different ODR value after reset than the other chips (0x7 vs. 0x0) and 0 is a reserved value on that chip. The driver already has this information available in odr_start_value and uses it when checking valid values when writing to the sampling_frequency attribute, but failed to set the correct initial value in the probe function. Fixes: 37ae838 ("iio: adc: ad7173: add support for additional models") Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250710-iio-adc-ad7173-fix-setting-odr-in-probe-v1-1-78a100fec998@baylibre.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5c6c645 commit fb67be2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/iio/adc/ad7173.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1595,6 +1595,7 @@ static int ad7173_fw_parse_channel_config(struct iio_dev *indio_dev)
15951595
chan_st_priv->cfg.bipolar = false;
15961596
chan_st_priv->cfg.input_buf = st->info->has_input_buf;
15971597
chan_st_priv->cfg.ref_sel = AD7173_SETUP_REF_SEL_INT_REF;
1598+
chan_st_priv->cfg.odr = st->info->odr_start_value;
15981599
chan_st_priv->cfg.openwire_comp_chan = -1;
15991600
st->adc_mode |= AD7173_ADC_MODE_REF_EN;
16001601
if (st->info->data_reg_only_16bit)
@@ -1661,7 +1662,7 @@ static int ad7173_fw_parse_channel_config(struct iio_dev *indio_dev)
16611662
chan->scan_index = chan_index;
16621663
chan->channel = ain[0];
16631664
chan_st_priv->cfg.input_buf = st->info->has_input_buf;
1664-
chan_st_priv->cfg.odr = 0;
1665+
chan_st_priv->cfg.odr = st->info->odr_start_value;
16651666
chan_st_priv->cfg.openwire_comp_chan = -1;
16661667

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

0 commit comments

Comments
 (0)