[Letux-kernel] [BUG] SPI broken for SPI based panel drivers

Sven Van Asbroeck thesven73 at gmail.com
Mon Nov 30 21:13:02 CET 2020


Hi Nikolaus, thank you for reaching out !

On Mon, Nov 30, 2020 at 2:06 PM H. Nikolaus Schaller <hns at goldelico.com> wrote:
>
> But reverting your patch brings back the display. So it appears as if it does not
> fix a breakage, rather breaks a previously working setup.

The patch in question fixes an important breakage: before the patch, literally
hundreds of SPI drivers no longer worked - only if the SPI bus master
driver was using gpio descriptors.

We knew that there was a chance that our fix would break something else.
But hopefully "it fixes more than it breaks"

>
> What should we do?
>

Can you try the following patch ?

diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
index 7ceb0ba27b75..c173d7de73b3 100644
--- a/drivers/spi/spi-gpio.c
+++ b/drivers/spi/spi-gpio.c
@@ -208,8 +208,8 @@ static void spi_gpio_chipselect(struct spi_device
*spi, int is_active)
        if (spi_gpio->cs_gpios) {
                struct gpio_desc *cs = spi_gpio->cs_gpios[spi->chip_select];

-               /* SPI chip selects are normally active-low */
-               gpiod_set_value_cansleep(cs, (spi->mode & SPI_CS_HIGH)
? is_active : !is_active);
+               /* SPI chip select polarity handled by gpiolib*/
+               gpiod_set_value_cansleep(cs, is_active);
        }
 }


More information about the Letux-kernel mailing list