mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 2/2] video: some framebuffer such as efi does support enable/disable
Date: Thu,  9 Mar 2017 10:57:21 +0100	[thread overview]
Message-ID: <1489053441-12772-2-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <1489053441-12772-1-git-send-email-plagnioj@jcrosoft.com>

so allow them to do not pass this function via fbops
and indicate they are always on.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 drivers/video/fb.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index 6b88f2df9..63a818eb2 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -19,10 +19,12 @@ static int fb_ioctl(struct cdev* cdev, int req, void *data)
 		*fb = info;
 		break;
 	case FBIO_ENABLE:
-		info->fbops->fb_enable(info);
+		if (info->fbops->fb_enable)
+			info->fbops->fb_enable(info);
 		break;
 	case FBIO_DISABLE:
-		info->fbops->fb_disable(info);
+		if (info->fbops->fb_disable)
+			info->fbops->fb_disable(info);
 		break;
 	default:
 		return -ENOSYS;
@@ -94,7 +96,8 @@ int fb_enable(struct fb_info *info)
 	if (ret)
 		return ret;
 
-	info->fbops->fb_enable(info);
+	if (info->fbops->fb_enable)
+		info->fbops->fb_enable(info);
 
 	info->enabled = true;
 
@@ -106,7 +109,8 @@ int fb_disable(struct fb_info *info)
 	if (!info->enabled)
 		return 0;
 
-	info->fbops->fb_disable(info);
+	if (info->fbops->fb_disable)
+		info->fbops->fb_disable(info);
 
 	fb_release_shadowfb(info);
 
@@ -266,6 +270,8 @@ static int fb_set_shadowfb(struct param_d *p, void *priv)
 	return fb_alloc_shadowfb(info);
 }
 
+struct fb_ops dummy_fbops;
+
 int register_framebuffer(struct fb_info *info)
 {
 	int id = get_free_deviceid("fb");
@@ -273,6 +279,16 @@ int register_framebuffer(struct fb_info *info)
 	int ret, num_modes, i;
 	const char **names;
 
+	if (!info->p_enable) {
+		if (!info->fbops)
+			return -EINVAL;
+		if (!info->fbops->fb_enable && !info->fbops->fb_disable)
+			return -EINVAL;
+	} else {
+		if (!info->fbops)
+			info->fbops = &dummy_fbops;
+	}
+
 	dev = &info->dev;
 
 	/*
@@ -308,7 +324,10 @@ int register_framebuffer(struct fb_info *info)
 	if (ret)
 		goto err_free;
 
-	dev_add_param_bool(dev, "enable", fb_enable_set, NULL,
+	if (info->p_enable)
+		dev_add_param_int_ro(dev, "enable", info->p_enable, "%d");
+	else
+		dev_add_param_bool(dev, "enable", fb_enable_set, NULL,
 			&info->p_enable, info);
 
 	if (IS_ENABLED(CONFIG_DRIVER_VIDEO_EDID))
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2017-03-09  9:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-09  9:57 [PATCH 1/2] parameter: fix read only int support Jean-Christophe PLAGNIOL-VILLARD
2017-03-09  9:57 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2017-03-10  7:26   ` [PATCH 2/2] video: some framebuffer such as efi does support enable/disable Sascha Hauer
2017-03-10  9:37     ` Jean-Christophe PLAGNIOL-VILLARD
2017-03-10  7:14 ` [PATCH 1/2] parameter: fix read only int support Sascha Hauer

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=1489053441-12772-2-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --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