Commit 28f7604f authored by Felix Fietkau's avatar Felix Fietkau Committed by Mark Brown

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: default avatarFelix Fietkau <nbd@nbd.name>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 9b4f8421
...@@ -786,9 +786,10 @@ static void spi_set_cs(struct spi_device *spi, bool enable) ...@@ -786,9 +786,10 @@ static void spi_set_cs(struct spi_device *spi, bool enable)
*/ */
if (!(spi->mode & SPI_NO_CS)) { if (!(spi->mode & SPI_NO_CS)) {
if (spi->cs_gpiod) if (spi->cs_gpiod)
gpiod_set_value(spi->cs_gpiod, !enable); gpiod_set_value_cansleep(spi->cs_gpiod,
!enable);
else 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 */ /* Some SPI masters need both GPIO CS & slave_select */
if ((spi->controller->flags & SPI_MASTER_GPIO_SS) && if ((spi->controller->flags & SPI_MASTER_GPIO_SS) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment