]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: adc: ad7606: move the software mode configuration
authorGuillaume Stols <gstols@baylibre.com>
Mon, 10 Feb 2025 16:10:52 +0000 (17:10 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Tue, 11 Feb 2025 19:56:25 +0000 (19:56 +0000)
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>
drivers/iio/adc/ad7606.c

index d8e3c7a43678c57470a5118715637a68b39125c1..dde372ce7569a70c133c35595a57fe2c07141c15 100644 (file)
@@ -1246,17 +1246,6 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
                        return -ERESTARTSYS;
        }
 
-       st->write_scale = ad7606_write_scale_hw;
-       st->write_os = ad7606_write_os_hw;
-
-       ret = ad7606_sw_mode_setup(indio_dev);
-       if (ret)
-               return ret;
-
-       ret = ad7606_chan_scales_setup(indio_dev);
-       if (ret)
-               return ret;
-
        /* If convst pin is not defined, setup PWM. */
        if (!st->gpio_convst) {
                st->cnvst_pwm = devm_pwm_get(dev, NULL);
@@ -1334,6 +1323,17 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
                        return ret;
        }
 
+       st->write_scale = ad7606_write_scale_hw;
+       st->write_os = ad7606_write_os_hw;
+
+       ret = ad7606_sw_mode_setup(indio_dev);
+       if (ret)
+               return ret;
+
+       ret = ad7606_chan_scales_setup(indio_dev);
+       if (ret)
+               return ret;
+
        return devm_iio_device_register(dev, indio_dev);
 }
 EXPORT_SYMBOL_NS_GPL(ad7606_probe, "IIO_AD7606");