* [PATCH] fbtft: limit transfer length by spi device limit
@ 2016-05-26 19:25 Michal Suchanek
2016-05-29 17:29 ` Noralf Trønnes
2016-08-21 15:52 ` Greg Kroah-Hartman
0 siblings, 2 replies; 3+ messages in thread
From: Michal Suchanek @ 2016-05-26 19:25 UTC (permalink / raw)
To: Thomas Petazzoni, Noralf Tronnes, Greg Kroah-Hartman, devel,
linux-kernel
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fbtft: limit transfer length by spi device limit
2016-05-26 19:25 [PATCH] fbtft: limit transfer length by spi device limit Michal Suchanek
@ 2016-05-29 17:29 ` Noralf Trønnes
2016-08-21 15:52 ` Greg Kroah-Hartman
1 sibling, 0 replies; 3+ messages in thread
From: Noralf Trønnes @ 2016-05-29 17:29 UTC (permalink / raw)
To: Michal Suchanek, Thomas Petazzoni, Greg Kroah-Hartman, devel,
linux-kernel
Den 26.05.2016 21:25, skrev Michal Suchanek:
> 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;
(Ugh, this code of mine looks worse each time I'm confronted with it.)
You have even taken care of the special txbuflen == -1 value I see,
so I guess this is as good as it gets without any major refactoring, so:
Acked-by: Noralf Trønnes <noralf@tronnes.org>
And there's no point in doing any refactoring since I'm working on a DRM
successor for fbtft. I have been working on it since the fbdev maintainer
issued the "No more new fbdev drivers, please" call in September and now
it has reached a tipping point where I can say that I will keep working
on it until it's done.
Some info: https://github.com/notro/tinydrm/wiki
Thanks,
Noralf.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fbtft: limit transfer length by spi device limit
2016-05-26 19:25 [PATCH] fbtft: limit transfer length by spi device limit Michal Suchanek
2016-05-29 17:29 ` Noralf Trønnes
@ 2016-08-21 15:52 ` Greg Kroah-Hartman
1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2016-08-21 15:52 UTC (permalink / raw)
To: Michal Suchanek; +Cc: Thomas Petazzoni, Noralf Tronnes, devel, linux-kernel
On Thu, May 26, 2016 at 07:25:22PM -0000, Michal Suchanek wrote:
> 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>
> Acked-by: Noralf Trønnes <noralf@tronnes.org>
> ---
>
> 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(+)
This patch adds a build warning to the tree, so I can't take it.
Please fix up and resend.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-08-21 21:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-26 19:25 [PATCH] fbtft: limit transfer length by spi device limit Michal Suchanek
2016-05-29 17:29 ` Noralf Trønnes
2016-08-21 15:52 ` Greg Kroah-Hartman
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).