mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Gregory CLEMENT <gregory.clement@free-electrons.com>
Cc: barebox <barebox@lists.infradead.org>
Subject: [PATCH 1/4] ARM STM/i.MX: Allocate memory for framebuffer during probe
Date: Tue, 04 Jan 2011 15:35:19 +0100	[thread overview]
Message-ID: <4D233027.9030701@free-electrons.com> (raw)

With current code when the framebuffer is register, screen_base is not
set yet. So when we want to access framebuffer from mmap we get a
pointer to 0x0 instead of getting the pointer to the framebuffer
address. This patch fix this bug by allocating memory for framebuffer
during probe just before registering framebuffer driver.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
---
 drivers/video/stm.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/video/stm.c b/drivers/video/stm.c
index f0abe4c..8a9acff 100644
--- a/drivers/video/stm.c
+++ b/drivers/video/stm.c
@@ -480,6 +480,7 @@ static int stmfb_probe(struct device_d *hw_dev)
 {
 	struct imx_fb_videomode *pdata = hw_dev->platform_data;
 	int ret;
+	unsigned size;
 
 	/* just init */
 	fbi.info.priv = &fbi;
@@ -497,6 +498,15 @@ static int stmfb_probe(struct device_d *hw_dev)
 	fbi.info.yres = fbi.info.mode->yres;
 	fbi.info.bits_per_pixel = 16;
 
+	size = calc_line_length(fbi.info.mode->xres, fbi.info.bits_per_pixel) *
+		fbi.info.mode->yres;
+
+	ret = stmfb_memory_mmgt(&fbi.info, size);
+	if (ret != 0) {
+		dev_err(hw_dev, "Cannot allocate framebuffer memory\n");
+		return ret;
+	}
+
 	ret = register_framebuffer(&fbi.info);
 	if (ret != 0) {
 		dev_err(hw_dev, "Failed to register framebuffer\n");
-- 
1.7.0.4




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

             reply	other threads:[~2011-01-04 14:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-04 14:35 Gregory CLEMENT [this message]
2011-01-04 14:46 ` Juergen Beisert
2011-01-04 15:04   ` Gregory CLEMENT
2011-01-04 16:16     ` Juergen Beisert
2011-01-04 16:49       ` Gregory CLEMENT
2011-01-13 15:10         ` Gregory CLEMENT
2011-01-13 15:21           ` Juergen Beisert

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=4D233027.9030701@free-electrons.com \
    --to=gregory.clement@free-electrons.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