Linux SPI subsystem development
 help / color / mirror / Atom feed
* [PATCH] spi: set right CS polarity depend on gpiolib
@ 2021-05-07 14:51 Liguang Zhang
  2021-05-07 15:30 ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Liguang Zhang @ 2021-05-07 14:51 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-spi, linux-kernel, Liguang Zhang

After a kernel upgrade from 4.19 to 5.10, we found that tpm flow control
always causes TIMEOUT which caused by wrong CS polarity setting depend
on gpiolib.

Signed-off-by: Liguang Zhang <zhangliguang@linux.alibaba.com>
---
 drivers/spi/spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index ba425b9c7700..9ee2b92b4506 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -816,7 +816,7 @@ static void spi_set_cs(struct spi_device *spi, bool enable, bool force)
 		if (!(spi->mode & SPI_NO_CS)) {
 			if (spi->cs_gpiod)
 				/* polarity handled by gpiolib */
-				gpiod_set_value_cansleep(spi->cs_gpiod, activate);
+				gpiod_set_value_cansleep(spi->cs_gpiod, !enable);
 			else
 				/*
 				 * invert the enable line, as active low is
-- 
2.19.1.6.gb485710b


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-08  1:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-07 14:51 [PATCH] spi: set right CS polarity depend on gpiolib Liguang Zhang
2021-05-07 15:30 ` Mark Brown
2021-05-08  1:01   ` 乱石

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox