[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1440441228-27113-3-git-send-email-stefan.wahren@i2se.com>
Date: Mon, 24 Aug 2015 18:33:48 +0000
From: Stefan Wahren <stefan.wahren@...e.com>
To: Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>,
Noralf Trønnes <noralf@...nnes.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Mark Brown <broonie@...nel.org>,
Henri Chain <henri.chain@...ves.ec-nantes.fr>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
Stefan Wahren <stefan.wahren@...e.com>
Subject: [PATCH RFC 2/2] staging: fbtft: fix 9-bit SPI support detection
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@...e.com>
---
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists