From: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
To: barebox@lists.infradead.org
Cc: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Subject: [PATCH] fb: added flush() method to synchronize the used DMA buffer
Date: Tue, 6 Mar 2012 20:09:55 +0100 [thread overview]
Message-ID: <1331060995-17978-1-git-send-email-enrico.scholz@sigma-chemnitz.de> (raw)
Patch adds an fb_flush() method which drains DMA buffers allocated by
the framebuffer driver. This allows to use non-coherent memory which
can be flushed by tools like 'bmp' or 'mw' by calling flush().
Unfortunately, DMA stuff is very specific to the architecture so that
patch has an effect to ARM only.
Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
---
drivers/video/Kconfig | 8 ++++++++
drivers/video/fb.c | 24 ++++++++++++++++++++++++
2 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 509ba64..a38e472 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -5,6 +5,14 @@ menuconfig VIDEO
if VIDEO
+config DRIVER_FB_ENABLE_FLUSH
+ bool
+ depends on ARM
+ default y if MMU
+ help
+ Drain DMA buffers with flush(). For ARM, this is required
+ for setups with enabled MMU only
+
config DRIVER_VIDEO_IMX
bool "i.MX framebuffer driver"
depends on ARCH_IMX1 || ARCH_IMX21 || ARCH_IMX25 || ARCH_IMX27
diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index 338d182..235e2e3 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -7,6 +7,10 @@
#include <fs.h>
#include <init.h>
+#ifdef CONFIG_ARM
+# include <asm/mmu.h>
+#endif
+
static int fb_ioctl(struct cdev* cdev, int req, void *data)
{
struct fb_info *info = cdev->priv;
@@ -94,12 +98,32 @@ static int fb_setup_mode(struct device_d *dev, struct param_d *param,
return ret;
}
+#ifdef CONFIG_DRIVER_FB_ENABLE_FLUSH
+static int fb_flush(struct cdev *cdev)
+{
+ struct fb_info *info = cdev->priv;
+
+ if (info->dev.resource[0].size > 0) {
+#ifdef CONFIG_ARM
+ dma_flush_range(info->dev.resource[0].start,
+ info->dev.resource[0].start +
+ info->dev.resource[0].size);
+#endif
+ }
+
+ return 0;
+}
+#else
+# define fb_flush NULL
+#endif /* CONFIG_DRIVER_FB_ENABLE_FLUSH */
+
static struct file_operations fb_ops = {
.read = mem_read,
.write = mem_write,
.memmap = generic_memmap_rw,
.lseek = dev_lseek_default,
.ioctl = fb_ioctl,
+ .flush = fb_flush,
};
int register_framebuffer(struct fb_info *info)
--
1.7.7.6
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
reply other threads:[~2012-03-06 19:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1331060995-17978-1-git-send-email-enrico.scholz@sigma-chemnitz.de \
--to=enrico.scholz@sigma-chemnitz.de \
--cc=barebox@lists.infradead.org \
/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