Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: adc: ad7476: use *_cansleep GPIO APIs

The ad7476 driver supports ADCs which require a GPIO pin to be used to
start conversion. The GPIO line status seems to be always toggled from
a process context, either from the user-initiated "raw-read conversion",
or from a threaded IRQ handler. Furthermore, these ICs are connected via
SPI bus, which is usually implemented in a way that the access to the
device can sleep. The GPIO here is toggled from the same context which
is reading the results over SPI.

Thus it seems very likely these GPIOs are toggled from a context which
can sleep.

Swap the gpiod_set_value() to gpiod_set_value_cansleep() accordinlgy.

Suggested-by: Nuno Sá <noname.nuno@gmail.com>
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://patch.msgid.link/a2d4b77e9739662797a1609f436b7f9807e1ac67.1754901948.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Matti Vaittinen and committed by
Jonathan Cameron
0be6a47e 5e6847a0

+2 -2
+2 -2
drivers/iio/adc/ad7476.c
··· 57 57 if (!st->convst_gpio) 58 58 return; 59 59 60 - gpiod_set_value(st->convst_gpio, 0); 60 + gpiod_set_value_cansleep(st->convst_gpio, 0); 61 61 udelay(1); /* CONVST pulse width: 10 ns min */ 62 - gpiod_set_value(st->convst_gpio, 1); 62 + gpiod_set_value_cansleep(st->convst_gpio, 1); 63 63 udelay(1); /* Conversion time: 650 ns max */ 64 64 } 65 65