Skip to contentSkip to conversation

iio: adis16480: fix buffering for devices with no burst mode

PATCH Applied Nuno Sá 2 participants 2 messages Jan 14, 2022 – Jan 16, 2022

Subsystems (2)
lore
Share & tools
lore

Nuno Sá

author maintainer
#0 lore raw

PATCH 1/1 iio: adis16480: fix buffering for devices with no burst mode

The trigger handler defined in the driver assumes that burst mode is being used. Hence, for devices that do not support it, we have to use the adis library default trigger implementation.

Fixes 941f130881fa9 ("iio: adis16480: support burst read function")
---
 drivers/iio/imu/adis16480.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/iio/imu/adis16480.c +6 -1
index ed129321a14d..f9b4540db1f4 100644
@@ -1403,6 +1403,7 @@ static int adis16480_probe(struct spi_device *spi)
 {
 	const struct spi_device_id *id = spi_get_device_id(spi);
 	const struct adis_data *adis16480_data;
+	irq_handler_t trigger_handler = NULL;
 	struct iio_dev *indio_dev;
 	struct adis16480 *st;
 	int ret;
@@ -1474,8 +1475,12 @@ static int adis16480_probe(struct spi_device *spi)
 		st->clk_freq = st->chip_info->int_clk;
 	}
 
+	/* Only use our trigger handler if burst mode is supported */
+	if (adis16480_data->burst_len)
+		trigger_handler = adis16480_trigger_handler;
+
 	ret = devm_adis_setup_buffer_and_trigger(&st->adis, indio_dev,
-						 adis16480_trigger_handler);
+						 trigger_handler);
 	if (ret)
 		return ret;
 
Signature · 1 line
2.33.1
maintainer Applied
#1 lore raw
Quoted 7 lines · On Fri, 14 Jan 2022 14:26:08 +0100 Nuno Sá <[email protected]> wrote:

The trigger handler defined in the driver assumes that burst mode is being used. Hence, for devices that do not support it, we have to use the adis library default trigger implementation.

Fixes 941f130881fa9 ("iio: adis16480: support burst read function")

Applied to the fixes-togreg branch of iio.git and marked for stable.

Note I'll probably rebase that branch after rc1 before sending a pull request.

Thanks,

Jonathan

Quoted 30 lines
---
 drivers/iio/imu/adis16480.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/iio/imu/adis16480.c +6 -1
index ed129321a14d..f9b4540db1f4 100644
@@ -1403,6 +1403,7 @@ static int adis16480_probe(struct spi_device *spi)
 {
 	const struct spi_device_id *id = spi_get_device_id(spi);
 	const struct adis_data *adis16480_data;
+	irq_handler_t trigger_handler = NULL;
 	struct iio_dev *indio_dev;
 	struct adis16480 *st;
 	int ret;
@@ -1474,8 +1475,12 @@ static int adis16480_probe(struct spi_device *spi)
 		st->clk_freq = st->chip_info->int_clk;
 	}
 
+	/* Only use our trigger handler if burst mode is supported */
+	if (adis16480_data->burst_len)
+		trigger_handler = adis16480_trigger_handler;
+
 	ret = devm_adis_setup_buffer_and_trigger(&st->adis, indio_dev,
-						 adis16480_trigger_handler);
+						 trigger_handler);
 	if (ret)
 		return ret;