[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <4AC29229-9542-4E77-B993-217E29C7E209@goldelico.com>
Date: Tue, 1 Dec 2020 09:59:43 +0100
From: "H. Nikolaus Schaller" <hns@...delico.com>
To: Sven Van Asbroeck <thesven73@...il.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Mark Brown <broonie@...nel.org>,
kernel list <linux-kernel@...r.kernel.org>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Discussions about the Letux Kernel
<letux-kernel@...nphoenux.org>
Subject: Re: [BUG] SPI broken for SPI based panel drivers
Hi Sven,
> Am 30.11.2020 um 21:13 schrieb Sven Van Asbroeck <thesven73@...il.com>:
>
> Hi Nikolaus, thank you for reaching out !
>
> On Mon, Nov 30, 2020 at 2:06 PM H. Nikolaus Schaller <hns@...delico.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)
Powered by blists - more mailing lists