summaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2019-02-10 02:38:25 +0300
committerMark Brown <broonie@kernel.org>2019-02-12 19:41:11 +0300
commit28f7604f48c1cbb69e9c45bc53c84b6ad1f7fa77 (patch)
tree4f80c719e99aeeb9dc43ecac36f8026001b8521d /drivers/spi
parent9b4f84212f04d015b7ff12e9e425ad9ac7e517da (diff)
downloadlinux-28f7604f48c1cbb69e9c45bc53c84b6ad1f7fa77.tar.xz
spi: use gpio[d]_set_value_cansleep for setting chipselect GPIO
Sleeping is safe inside spi_transfer_one_message, and some GPIO chips are running on slow busses (such as I2C GPIO expanders) and need to sleep for setting values. Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 2f7176f07591..93986f879b09 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -786,9 +786,10 @@ static void spi_set_cs(struct spi_device *spi, bool enable)
*/
if (!(spi->mode & SPI_NO_CS)) {
if (spi->cs_gpiod)
- gpiod_set_value(spi->cs_gpiod, !enable);
+ gpiod_set_value_cansleep(spi->cs_gpiod,
+ !enable);
else
- gpio_set_value(spi->cs_gpio, !enable);
+ gpio_set_value_cansleep(spi->cs_gpio, !enable);
}
/* Some SPI masters need both GPIO CS & slave_select */
if ((spi->controller->flags & SPI_MASTER_GPIO_SS) &&