diff options
author | Felix Fietkau <nbd@nbd.name> | 2019-02-10 00:38:25 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-02-12 17:41:11 +0100 |
commit | 28f7604f48c1cbb69e9c45bc53c84b6ad1f7fa77 (patch) | |
tree | 4f80c719e99aeeb9dc43ecac36f8026001b8521d /drivers/spi | |
parent | spi: gpio: Advertise support for SPI_CS_HIGH (diff) | |
download | linux-28f7604f48c1cbb69e9c45bc53c84b6ad1f7fa77.tar.xz linux-28f7604f48c1cbb69e9c45bc53c84b6ad1f7fa77.zip |
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.c | 5 |
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) && |