All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liguang Zhang <zhangliguang@linux.alibaba.com>
To: Mark Brown <broonie@kernel.org>
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Liguang Zhang <zhangliguang@linux.alibaba.com>
Subject: [PATCH] spi: set right CS polarity depend on gpiolib
Date: Fri,  7 May 2021 22:51:17 +0800	[thread overview]
Message-ID: <20210507145117.43221-1-zhangliguang@linux.alibaba.com> (raw)

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


             reply	other threads:[~2021-05-07 14:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-07 14:51 Liguang Zhang [this message]
2021-05-07 15:30 ` [PATCH] spi: set right CS polarity depend on gpiolib Mark Brown
2021-05-08  1:01   ` 乱石

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210507145117.43221-1-zhangliguang@linux.alibaba.com \
    --to=zhangliguang@linux.alibaba.com \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.