]> Gentwo Git Trees - linux/.git/commit
iio: adc: ad4695: fix buffered read, single sample timings
authorTrevor Gamblin <tgamblin@baylibre.com>
Wed, 13 Nov 2024 20:52:58 +0000 (15:52 -0500)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 7 Dec 2024 17:23:41 +0000 (17:23 +0000)
commitdddfd0c489e9a3fde98fedda8832cb9ecaae3abf
treeae68951a5778810fb683b7be030b1f3453f70e01
parent65a60a590142c54a3f3be11ff162db2d5b0e1e06
iio: adc: ad4695: fix buffered read, single sample timings

Modify ad4695_buffer_preenable() by adding an extra SPI transfer after
each data read to help ensure that the timing requirement between the
last SCLK rising edge and the next CNV rising edge is met. This requires
a restructure of the buf_read_xfer array in ad4695_state. Also define
AD4695_T_SCK_CNV_DELAY_NS to use for each added transfer. Without this
change it is possible for the data to become corrupted on sequential
buffered reads due to the device not properly exiting conversion mode.

Similarly, make adjustments to ad4695_read_one_sample() so that timings
are respected, and clean up the function slightly in the process.

Fixes: 6cc7e4bf2e08 ("iio: adc: ad4695: implement triggered buffer")
Co-developed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Tested-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241113-tgamblin-ad4695_improvements-v2-1-b6bb7c758fc4@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ad4695.c