[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210507145117.43221-1-zhangliguang@linux.alibaba.com>
Date:   Fri,  7 May 2021 22:51:17 +0800
From:   Liguang Zhang <zhangliguang@...ux.alibaba.com>
To:     Mark Brown <broonie@...nel.org>
Cc:     linux-spi@...r.kernel.org, linux-kernel@...r.kernel.org,
        Liguang Zhang <zhangliguang@...ux.alibaba.com>
Subject: [PATCH] spi: set right CS polarity depend on gpiolib
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@...ux.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
Powered by blists - more mailing lists