]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iio: adc: ad4695: Fix call ordering in offload buffer postenable
authorRadu Sabau <radu.sabau@analog.com>
Wed, 8 Apr 2026 10:32:13 +0000 (13:32 +0300)
committerJonathan Cameron <jic23@kernel.org>
Tue, 28 Apr 2026 15:36:09 +0000 (16:36 +0100)
commit1a772719318c11e146f6fbe621fffd230a6f456a
tree57d28779a392aaba4cb2faa07e199ce407d02649
parentb66f922f6a4fa92840f662fbcfeb4f8a0f774bcc
iio: adc: ad4695: Fix call ordering in offload buffer postenable

ad4695_enter_advanced_sequencer_mode() was called after
spi_offload_trigger_enable(). That is wrong because
ad4695_enter_advanced_sequencer_mode() issues regular SPI transfers to
put the ADC into advanced sequencer mode, and not all SPI offload capable
controllers support regular SPI transfers while offloading is enabled.

Fix this by calling ad4695_enter_advanced_sequencer_mode() before
spi_offload_trigger_enable(), so the ADC is fully configured before the
first CNV pulse can occur. This is consistent with the same constraint
that already applies to the BUSY_GP_EN write above it.

Update the error unwind labels accordingly: add err_exit_conversion_mode
so that a failure of spi_offload_trigger_enable() correctly exits
conversion mode before clearing BUSY_GP_EN.

Fixes: f09f140e3ea8 ("iio: adc: ad4695: Add support for SPI offload")
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Radu Sabau <radu.sabau@analog.com>
Cc: Stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ad4695.c