lkml.org 
[lkml]   [2020]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [BUG] SPI broken for SPI based panel drivers
From
Date
Hi Sven,

> Am 30.11.2020 um 21:13 schrieb Sven Van Asbroeck <thesven73@gmail.com>:
>
> Hi Nikolaus, thank you for reaching out !
>
> On Mon, Nov 30, 2020 at 2:06 PM H. Nikolaus Schaller <hns@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"

Then it should not have been applied to mainline but fully worked out and tested.

>
>>
>> What should we do?
>>
>
> Can you try the following patch ?

Unfortunately it doesn't seem to fix it. And combined with the second proposed fix also not.

BR and thanks,
Nikolaus

my combined change:

diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
index 7ceb0ba27b755c..ec2da62716a279 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);
}
}

@@ -226,8 +226,7 @@ static int spi_gpio_setup(struct spi_device *spi)
if (spi_gpio->cs_gpios) {
cs = spi_gpio->cs_gpios[spi->chip_select];
if (!spi->controller_state && cs)
- status = gpiod_direction_output(cs,
- !(spi->mode & SPI_CS_HIGH));
+ status = gpiod_direction_output(cs, false);
}

if (!status)
\
 
 \ /
  Last update: 2020-12-01 10:08    [W:0.160 / U:0.592 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site