[PATCH RFC 2/2] staging: fbtft: fix 9-bit SPI support detection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since bits_per_word isn't usually checked during SPI setup the 9-bit
support must be checked manually.

Signed-off-by: Stefan Wahren <stefan.wahren@xxxxxxxx>
---
 drivers/staging/fbtft/fbtft-core.c |    7 +++++++
 drivers/staging/fbtft/flexfb.c     |    7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index 3638554..bd71487 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -1438,6 +1438,13 @@ int fbtft_probe_common(struct fbtft_display *display,
 	if (par->spi && display->buswidth == 9) {
 		par->spi->bits_per_word = 9;
 		ret = spi_setup(par->spi);
+		if (!ret) {
+			struct spi_master *ma = par->spi->master;
+
+			if (!(ma->bits_per_word_mask & SPI_BPW_MASK(9)))
+				ret = -EINVAL;
+		}
+
 		if (ret) {
 			dev_warn(&par->spi->dev,
 				"9-bit SPI not available, emulating using 8-bit.\n");
diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c
index 09fd15d..a54a8d9 100644
--- a/drivers/staging/fbtft/flexfb.c
+++ b/drivers/staging/fbtft/flexfb.c
@@ -465,6 +465,13 @@ static int flexfb_probe_common(struct spi_device *sdev,
 			par->fbtftops.write_vmem = fbtft_write_vmem16_bus9;
 			sdev->bits_per_word = 9;
 			ret = spi_setup(sdev);
+			if (!ret) {
+				struct spi_master *ma = par->spi->master;
+
+				if (!(ma->bits_per_word_mask & SPI_BPW_MASK(9)))
+					ret = -EINVAL;
+			}
+
 			if (ret) {
 				dev_warn(dev,
 					"9-bit SPI not available, emulating using 8-bit.\n");
-- 
1.7.9.5

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux