Skip to content

Commit 3641b8f

Browse files
gstolssmb49
authored andcommitted
iio: adc: ad7606: move the software mode configuration
BugLink: https://bugs.launchpad.net/bugs/2115266 [ Upstream commit f2a62931b39478c98f977caf299df5bc072f38e0 ] This is a preparation for the intoduction of the sofware functions in the iio backend version of the driver. The software mode configuration must be executed once the channels are configured, and the number of channels is known. This is not the case before iio-backend's configuration is called, and iio backend version of the driver does not have a timestamp channel. Also the sw_mode_config callback is configured during the iio-backend configuration. For clarity purpose, I moved the entire block instead of just the concerned function calls. Signed-off-by: Guillaume Stols <gstols@baylibre.com> Link: https://patch.msgid.link/20250210-wip-bl-ad7606_add_backend_sw_mode-v4-2-160df18b1da7@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Stable-dep-of: 5257d80e22bf ("iio: adc: ad7606: check for NULL before calling sw_mode_config()") Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 4032f58 commit 3641b8f

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

drivers/iio/adc/ad7606.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,17 +1246,6 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
12461246
return -ERESTARTSYS;
12471247
}
12481248

1249-
st->write_scale = ad7606_write_scale_hw;
1250-
st->write_os = ad7606_write_os_hw;
1251-
1252-
ret = ad7606_sw_mode_setup(indio_dev);
1253-
if (ret)
1254-
return ret;
1255-
1256-
ret = ad7606_chan_scales_setup(indio_dev);
1257-
if (ret)
1258-
return ret;
1259-
12601249
/* If convst pin is not defined, setup PWM. */
12611250
if (!st->gpio_convst) {
12621251
st->cnvst_pwm = devm_pwm_get(dev, NULL);
@@ -1334,6 +1323,17 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
13341323
return ret;
13351324
}
13361325

1326+
st->write_scale = ad7606_write_scale_hw;
1327+
st->write_os = ad7606_write_os_hw;
1328+
1329+
ret = ad7606_sw_mode_setup(indio_dev);
1330+
if (ret)
1331+
return ret;
1332+
1333+
ret = ad7606_chan_scales_setup(indio_dev);
1334+
if (ret)
1335+
return ret;
1336+
13371337
return devm_iio_device_register(dev, indio_dev);
13381338
}
13391339
EXPORT_SYMBOL_NS_GPL(ad7606_probe, "IIO_AD7606");

0 commit comments

Comments
 (0)