summaryrefslogtreecommitdiff
path: root/drivers/staging/udlfb
diff options
context:
space:
mode:
authorBernie Thompson <bernie@plugable.com>2010-09-05 23:35:04 (GMT)
committerGreg Kroah-Hartman <gregkh@suse.de>2010-09-05 23:50:15 (GMT)
commitd46ecb9f79db82ce6bef4baafbcae29ac809ea67 (patch)
treeb6107a22737edd83838ea5f6f48baf053382cb4b /drivers/staging/udlfb
parentdf9be302a2d2c3c89959cc428c555b2827298106 (diff)
downloadlinux-fsl-qoriq-d46ecb9f79db82ce6bef4baafbcae29ac809ea67.tar.xz
staging: udlfb: fbdev character read and write support
Restore fbdev character read and write support Enables access to the framebuffer from simple reads and writes to /dev/fb0 (or fb1, ...). Low performance, because of extra copy and because udlfb must scan every pixel for changes. But very useful for testing and simple image display, etc. Signed-off-by: Bernie Thompson <bernie@plugable.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/udlfb')
-rw-r--r--drivers/staging/udlfb/udlfb.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/drivers/staging/udlfb/udlfb.c b/drivers/staging/udlfb/udlfb.c
index c7e061e..a2bd5f7 100644
--- a/drivers/staging/udlfb/udlfb.c
+++ b/drivers/staging/udlfb/udlfb.c
@@ -602,6 +602,48 @@ int dlfb_handle_damage(struct dlfb_data *dev, int x, int y,
return 0;
}
+static ssize_t dlfb_ops_read(struct fb_info *info, char __user *buf,
+ size_t count, loff_t *ppos)
+{
+ ssize_t result = -ENOSYS;
+
+#if defined CONFIG_FB_SYS_FOPS || defined CONFIG_FB_SYS_FOPS_MODULE
+ result = fb_sys_read(info, buf, count, ppos);
+#endif
+
+ return result;
+}
+
+/*
+ * Path triggered by usermode clients who write to filesystem
+ * e.g. cat filename > /dev/fb1
+ * Not used by X Windows or text-mode console. But useful for testing.
+ * Slow because of extra copy and we must assume all pixels dirty.
+ */
+static ssize_t dlfb_ops_write(struct fb_info *info, const char __user *buf,
+ size_t count, loff_t *ppos)
+{
+ ssize_t result = -ENOSYS;
+ struct dlfb_data *dev = info->par;
+ u32 offset = (u32) *ppos;
+
+#if defined CONFIG_FB_SYS_FOPS || defined CONFIG_FB_SYS_FOPS_MODULE
+
+ result = fb_sys_write(info, buf, count, ppos);
+
+ if (result > 0) {
+ int start = max((int)(offset / info->fix.line_length) - 1, 0);
+ int lines = min((u32)((result / info->fix.line_length) + 1),
+ (u32)info->var.yres);
+
+ dlfb_handle_damage(dev, 0, start, info->var.xres,
+ lines, info->screen_base);
+ }
+#endif
+
+ return result;
+}
+
/* hardware has native COPY command (see libdlo), but not worth it for fbcon */
static void dlfb_ops_copyarea(struct fb_info *info,
const struct fb_copyarea *area)
@@ -924,6 +966,8 @@ static int dlfb_ops_blank(int blank_mode, struct fb_info *info)
static struct fb_ops dlfb_ops = {
.owner = THIS_MODULE,
+ .fb_read = dlfb_ops_read,
+ .fb_write = dlfb_ops_write,
.fb_setcolreg = dlfb_ops_setcolreg,
.fb_fillrect = dlfb_ops_fillrect,
.fb_copyarea = dlfb_ops_copyarea,