Commit 7c3eaadd authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman

staging: fbtft: remove custom DMA mapped buffer

There is no need to duplicate what SPI core already does, i.e. mapping buffers
for DMA capable transfers.

Remove all related pices of code.

Note, that code, besides its redundancy, was buggy: DMA address potentially can
be 0, SPI slave device has nothing to do with DMA capable device properties and
DMA mask in particular.
Suggested-by: default avatarNoralf Trønnes <noralf@tronnes.org>
Acked-by: default avatarNoralf Trønnes <noralf@tronnes.org>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9ed2bfb3
...@@ -42,10 +42,6 @@ static int write_spi(struct fbtft_par *par, void *buf, size_t len) ...@@ -42,10 +42,6 @@ static int write_spi(struct fbtft_par *par, void *buf, size_t len)
} }
spi_message_init(&m); spi_message_init(&m);
if (par->txbuf.dma && buf == par->txbuf.buf) {
t.tx_dma = par->txbuf.dma;
m.is_dma_mapped = 1;
}
spi_message_add_tail(&t, &m); spi_message_add_tail(&t, &m);
return spi_sync(par->spi, &m); return spi_sync(par->spi, &m);
} }
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <linux/backlight.h> #include <linux/backlight.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/dma-mapping.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_gpio.h> #include <linux/of_gpio.h>
#include <video/mipi_display.h> #include <video/mipi_display.h>
...@@ -44,12 +43,6 @@ static unsigned long debug; ...@@ -44,12 +43,6 @@ static unsigned long debug;
module_param(debug, ulong, 0); module_param(debug, ulong, 0);
MODULE_PARM_DESC(debug, "override device debug level"); MODULE_PARM_DESC(debug, "override device debug level");
#ifdef CONFIG_HAS_DMA
static bool dma = true;
module_param(dma, bool, 0);
MODULE_PARM_DESC(dma, "Use DMA buffer");
#endif
void fbtft_dbg_hex(const struct device *dev, int groupsize, void fbtft_dbg_hex(const struct device *dev, int groupsize,
void *buf, size_t len, const char *fmt, ...) void *buf, size_t len, const char *fmt, ...)
{ {
...@@ -836,17 +829,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, ...@@ -836,17 +829,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
#endif #endif
if (txbuflen > 0) { if (txbuflen > 0) {
#ifdef CONFIG_HAS_DMA txbuf = devm_kzalloc(par->info->device, txbuflen, GFP_KERNEL);
if (dma) {
dev->coherent_dma_mask = ~0;
txbuf = dmam_alloc_coherent(dev, txbuflen,
&par->txbuf.dma, GFP_DMA);
} else
#endif
{
txbuf = devm_kzalloc(par->info->device,
txbuflen, GFP_KERNEL);
}
if (!txbuf) if (!txbuf)
goto alloc_fail; goto alloc_fail;
par->txbuf.buf = txbuf; par->txbuf.buf = txbuf;
...@@ -975,8 +958,7 @@ int fbtft_register_framebuffer(struct fb_info *fb_info) ...@@ -975,8 +958,7 @@ int fbtft_register_framebuffer(struct fb_info *fb_info)
fbtft_sysfs_init(par); fbtft_sysfs_init(par);
if (par->txbuf.buf) if (par->txbuf.buf)
sprintf(text1, ", %zu KiB %sbuffer memory", sprintf(text1, ", %zu KiB buffer memory", par->txbuf.len >> 10);
par->txbuf.len >> 10, par->txbuf.dma ? "DMA " : "");
if (spi) if (spi)
sprintf(text2, ", spi%d.%d at %d MHz", spi->master->bus_num, sprintf(text2, ", spi%d.%d at %d MHz", spi->master->bus_num,
spi->chip_select, spi->max_speed_hz / 1000000); spi->chip_select, spi->max_speed_hz / 1000000);
......
...@@ -22,10 +22,6 @@ int fbtft_write_spi(struct fbtft_par *par, void *buf, size_t len) ...@@ -22,10 +22,6 @@ int fbtft_write_spi(struct fbtft_par *par, void *buf, size_t len)
} }
spi_message_init(&m); spi_message_init(&m);
if (par->txbuf.dma && buf == par->txbuf.buf) {
t.tx_dma = par->txbuf.dma;
m.is_dma_mapped = 1;
}
spi_message_add_tail(&t, &m); spi_message_add_tail(&t, &m);
return spi_sync(par->spi, &m); return spi_sync(par->spi, &m);
} }
......
...@@ -209,7 +209,6 @@ struct fbtft_par { ...@@ -209,7 +209,6 @@ struct fbtft_par {
u32 pseudo_palette[16]; u32 pseudo_palette[16];
struct { struct {
void *buf; void *buf;
dma_addr_t dma;
size_t len; size_t len;
} txbuf; } txbuf;
u8 *buf; u8 *buf;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment