[PATCH 09/12] fb: Add fb_enable/disable functions

Sascha Hauer s.hauer at pengutronix.de
Thu Jul 16 00:31:49 PDT 2015


Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/video/fb.c | 29 ++++++++++++++++++++++++-----
 include/fb.h       |  3 +++
 2 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index e30ab59..25f089a 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -29,6 +29,30 @@ static int fb_ioctl(struct cdev* cdev, int req, void *data)
 	return 0;
 }
 
+int fb_enable(struct fb_info *info)
+{
+	if (info->enabled)
+		return 0;
+
+	info->fbops->fb_enable(info);
+
+	info->enabled = true;
+
+	return 0;
+}
+
+int fb_disable(struct fb_info *info)
+{
+	if (!info->enabled)
+		return 0;
+
+	info->fbops->fb_disable(info);
+
+	info->enabled = false;
+
+	return 0;
+}
+
 static int fb_enable_set(struct param_d *param, void *priv)
 {
 	struct fb_info *info = priv;
@@ -36,16 +60,11 @@ static int fb_enable_set(struct param_d *param, void *priv)
 
 	enable = info->p_enable;
 
-	if (enable == info->enabled)
-		return 0;
-
 	if (enable)
 		info->fbops->fb_enable(info);
 	else
 		info->fbops->fb_disable(info);
 
-	info->enabled = enable;
-
 	return 0;
 }
 
diff --git a/include/fb.h b/include/fb.h
index 2db6ad6..9221618 100644
--- a/include/fb.h
+++ b/include/fb.h
@@ -146,6 +146,9 @@ struct display_timings *of_get_display_timings(struct device_node *np);
 
 int register_framebuffer(struct fb_info *info);
 
+int fb_enable(struct fb_info *info);
+int fb_disable(struct fb_info *info);
+
 #define FBIOGET_SCREENINFO	_IOR('F', 1, loff_t)
 #define	FBIO_ENABLE		_IO('F', 2)
 #define	FBIO_DISABLE		_IO('F', 3)
-- 
2.1.4




More information about the barebox mailing list