linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: Make GPIO CSs honour the SPI_NO_CS flag
@ 2018-10-12  9:23 Phil Elwell
  2018-10-12 17:03 ` Applied "spi: Make GPIO CSs honour the SPI_NO_CS flag" to the spi tree Mark Brown
  2018-10-15 18:34 ` [PATCH] spi: Make GPIO CSs honour the SPI_NO_CS flag Trent Piepho
  0 siblings, 2 replies; 6+ messages in thread
From: Phil Elwell @ 2018-10-12  9:23 UTC (permalink / raw)
  To: Mark Brown, linux-spi, linux-kernel; +Cc: Phil Elwell

The SPI configuration state includes an SPI_NO_CS flag that disables
all CS line manipulation, for applications that want to manage their
own chip selects. However, this flag is ignored by the GPIO CS code
in the SPI framework.

Correct this omission with a trivial patch.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
 drivers/spi/spi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 84dfef4..b1d88fe 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -729,7 +729,9 @@ static void spi_set_cs(struct spi_device *spi, bool enable)
 		enable = !enable;
 
 	if (gpio_is_valid(spi->cs_gpio)) {
-		gpio_set_value(spi->cs_gpio, !enable);
+		/* Honour the SPI_NO_CS flag */
+		if (!(spi->mode & SPI_NO_CS))
+			gpio_set_value(spi->cs_gpio, !enable);
 		/* Some SPI masters need both GPIO CS & slave_select */
 		if ((spi->controller->flags & SPI_MASTER_GPIO_SS) &&
 		    spi->controller->set_cs)
-- 
2.7.4


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

end of thread, other threads:[~2018-10-17  9:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-12  9:23 [PATCH] spi: Make GPIO CSs honour the SPI_NO_CS flag Phil Elwell
2018-10-12 17:03 ` Applied "spi: Make GPIO CSs honour the SPI_NO_CS flag" to the spi tree Mark Brown
2018-10-15 18:34 ` [PATCH] spi: Make GPIO CSs honour the SPI_NO_CS flag Trent Piepho
2018-10-16  9:03   ` Mark Brown
2018-10-16 19:29     ` Trent Piepho
2018-10-17  9:42       ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).