From: Michal Suchanek <hramrach@gmail.com>
To: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
"Noralf Tronnes" <noralf@tronnes.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH] fbtft: limit transfer length by spi device limit
Date: 26 May 2016 19:25:22 -0000 [thread overview]
Message-ID: <1a546e24f0fa4839deffd6e708ad10dd14219cb6.1464042565.git.hramrach@gmail.com> (raw)
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@gmail.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
next reply other threads:[~2016-05-26 19:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-26 19:25 Michal Suchanek [this message]
2016-05-29 17:29 ` Noralf Trønnes
2016-08-21 15:52 ` Greg Kroah-Hartman
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=1a546e24f0fa4839deffd6e708ad10dd14219cb6.1464042565.git.hramrach@gmail.com \
--to=hramrach@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=noralf@tronnes.org \
--cc=thomas.petazzoni@free-electrons.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
all inboxes | Powered by JetHome®