Linux SPI subsystem development
 help / color / mirror / Atom feed
From: Xin Hao <xhao@linux.alibaba.com>
To: broonie@kernel.org
Cc: thesven73@gmail.com, linus.walleij@linaro.org, linux-spi@vger.kernel.org
Subject: [PATCH v1] spi: fix client driver can't register success when use GPIO as CS
Date: Thu,  6 May 2021 19:49:28 +0800	[thread overview]
Message-ID: <424d37007b7e298cf9bca5ac38d45a723e0976ee.1620301297.git.xhao@linux.alibaba.com> (raw)

When i was testing the TPM2 device, I found that the driver
always failed to register which used SPI bus and GPIO as CS
signal, i found that the reason for the error was that CS could
not be set correctly, so there fixed it.

Fixes: 766c6b63aa044e ("spi: fix client driver breakages when using
GPIO descriptors")
Signed-off-by: Xin Hao <xhao@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 b08efe88ccd6..d4342909c1c8 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -826,7 +826,7 @@ static void spi_set_cs(struct spi_device *spi, bool enable)
 			if (spi->cs_gpiod)
 				/* polarity handled by gpiolib */
 				gpiod_set_value_cansleep(spi->cs_gpiod,
-							 enable1);
+							 !enable);
 			else
 				/*
 				 * invert the enable line, as active low is
-- 
2.31.0


             reply	other threads:[~2021-05-06 11:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-06 11:49 Xin Hao [this message]
2021-05-06 12:30 ` [PATCH v1] spi: fix client driver can't register success when use GPIO as CS Linus Walleij
2021-05-06 14:16   ` Andy Shevchenko
2021-05-07  1:55     ` Xin Hao
     [not found]       ` <CAHp75Vev1D5+QWyGCm+HgpdAyT4Uq_OAp7dCemVf9Cdvoay=Og@mail.gmail.com>
     [not found]         ` <6bd8f178-51a2-3f45-8a16-80fdd4a3ed8e@linux.alibaba.com>
     [not found]           ` <CAHp75Vfh+jqNLLbwWDe8pi1dQafnNFHak1Hk=5Cw3J+kJX9r3Q@mail.gmail.com>
2021-05-07 21:33             ` Linus Walleij
2021-05-08  1:22               ` xhao
2021-05-08  2:36               ` Sven Van Asbroeck
2021-05-08 11:38                 ` Sven Van Asbroeck
     [not found]                 ` <CAHp75VfD5kEnjvvRWUJwpmFaWksnnTf_ewBNDsxz3W3kQMUv+w@mail.gmail.com>
2021-05-08 11:46                   ` Sven Van Asbroeck
2021-05-08 12:48                     ` Sven Van Asbroeck
2021-05-10 11:36                     ` Andy Shevchenko
2021-05-10 13:56                       ` Sven Van Asbroeck
2021-05-10 14:01                         ` Andy Shevchenko
2021-05-10 14:27                           ` Sven Van Asbroeck

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=424d37007b7e298cf9bca5ac38d45a723e0976ee.1620301297.git.xhao@linux.alibaba.com \
    --to=xhao@linux.alibaba.com \
    --cc=broonie@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=thesven73@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox