[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1a546e24f0fa4839deffd6e708ad10dd14219cb6.1464042565.git.hramrach@gmail.com>
Date: 26 May 2016 19:25:22 -0000
From: Michal Suchanek <hramrach@...il.com>
To: Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>,
"Noralf Tronnes" <noralf@...nnes.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH] fbtft: limit transfer length by spi device limit
Some SPI controllers can transfer only small piece of data at a time.
Since SPI core gained a function to get the maximum transfer length use
it.
Signed-off-by: Michal Suchanek <hramrach@...il.com>
---
Tested on sunxi spi with DMA enabled and disabled. Makes a visible speed
difference and display works in either case.
drivers/staging/fbtft/fbtft-core.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index 0c1a77c..f3bdc8f 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -1346,6 +1346,15 @@ int fbtft_probe_common(struct fbtft_display *display,
return PTR_ERR(pdata);
}
+ if (sdev && (spi_max_transfer_size(sdev) < SIZE_MAX))
+ if ((pdata->txbuflen <= 0) || (pdata->txbuflen > spi_max_transfer_size(sdev))) {
+ dev_warn(dev,
+ "Limiting used buffer size %i -> %i due to device %s transfer size limitation",
+ pdata->txbuflen, spi_max_transfer_size(sdev),
+ dev_name(&sdev->dev));
+ pdata->txbuflen = spi_max_transfer_size(sdev);
+ }
+
info = fbtft_framebuffer_alloc(display, dev, pdata);
if (!info)
return -ENOMEM;
--
2.8.1
Powered by blists - more mailing lists