From: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
To: "Tomi Valkeinen" <tomi.valkeinen@ti.com>,
"Pali Rohár" <pali.rohar@gmail.com>
Cc: tony@atomide.com, linux@arm.linux.org.uk, pavel@ucw.cz,
linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org,
Ivaylo Dimitrov <freemangordon@abv.bg>
Subject: Re: [PATCH] ARM: omapfb: Add early framebuffer memory allocator
Date: Sat, 13 Feb 2016 09:25:11 +0200 [thread overview]
Message-ID: <56BEDA57.4030300@gmail.com> (raw)
In-Reply-To: <5693F5B7.8040608@ti.com>
Hi Tomi,
On 11.01.2016 20:34, Tomi Valkeinen wrote:
>
> So, I'm not very enthusiastic about adding this feature as an omapfb
> specific boot parameter.
>
What about something like (not properly formatted, just want your
opinion on the idea):
diff --git a/arch/arm/mach-omap2/fb.c b/arch/arm/mach-omap2/fb.c
index 1f1ecf8..0d109d8 100644
--- a/arch/arm/mach-omap2/fb.c
+++ b/arch/arm/mach-omap2/fb.c
@@ -28,6 +28,7 @@
#include <linux/io.h>
#include <linux/omapfb.h>
#include <linux/dma-mapping.h>
+#include <linux/of_reserved_mem.h>
#include <asm/mach/map.h>
@@ -110,6 +111,49 @@ int __init omap_init_fb(void)
{
return platform_device_register(&omap_fb_device);
}
+
+static int rmem_omapfb_device_init(struct reserved_mem *rmem, struct
device *dev)
+{
+ int dma;
+
+ if (rmem->priv)
+ return 0;
+
+ dma = dma_declare_coherent_memory(&omap_fb_device.dev, rmem->base,
+ rmem->base, rmem->size,
+ DMA_MEMORY_MAP |
+ DMA_MEMORY_EXCLUSIVE);
+
+ if (!(dma & DMA_MEMORY_MAP)) {
+ pr_err("omapfb: dma_declare_coherent_memory failed\n");
+ return -ENOMEM;
+ }
+ else
+ rmem->priv = omap_fb_device.dev.dma_mem;
+
+ return 0;
+}
+
+static void rmem_omapfb_device_release(struct reserved_mem *rmem,
+ struct device *dev)
+{
+ dma_release_declared_memory(&omap_fb_device.dev);
+}
+
+static const struct reserved_mem_ops rmem_omapfb_ops = {
+ .device_init = rmem_omapfb_device_init,
+ .device_release = rmem_omapfb_device_release,
+};
+
+static int __init rmem_omapfb_setup(struct reserved_mem *rmem)
+{
+ rmem->ops = &rmem_omapfb_ops;
+ pr_info("omapfb: reserved %d bytes at %pa\n", rmem->size,
&rmem->base);
+
+ return 0;
+}
+
+RESERVEDMEM_OF_DECLARE(dss, "ti,omapfb-memsize", rmem_omapfb_setup);
#else
int __init omap_init_fb(void) { return 0; }
#endif
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 6ab13d1..6f0ba03 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -28,6 +28,7 @@
#include <linux/slab.h>
#include <linux/mfd/syscon.h>
#include <linux/regmap.h>
+#include <linux/of_reserved_mem.h>
#include <video/omapdss.h>
#include "omap_hwmod.h"
@@ -640,6 +641,7 @@ int __init omapdss_init_of(void)
omap_display_device.dev.platform_data = &board_data;
r = platform_device_register(&omap_display_device);
+
if (r < 0) {
pr_err("Unable to register omapdss device\n");
return r;
@@ -666,6 +668,9 @@ int __init omapdss_init_of(void)
return r;
}
+ /* Init fb reserved memory, there may be none so ignore the
result */
+ of_reserved_mem_device_init(&pdev->dev);
+
/* create V4L2 display device */
r = omap_init_vout();
if (r < 0) {
Regards,
Ivo
next prev parent reply other threads:[~2016-02-13 7:25 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1847426616.52843.1383681351015.JavaMail.apache@mail83.abv.bg>
2013-11-30 10:00 ` OMAPFB: CMA allocation failures Ivajlo Dimitrov
2013-11-30 10:00 ` Ivajlo Dimitrov
2013-12-05 11:25 ` Tomi Valkeinen
2013-12-05 11:25 ` Tomi Valkeinen
2013-12-06 8:31 ` Ivajlo Dimitrov
2013-12-06 8:31 ` Ivajlo Dimitrov
2013-12-25 23:12 ` [PATCH] ARM: omapfb: Add early framebuffer memory allocator Ivaylo Dimitrov
2013-12-27 9:48 ` Pavel Machek
2013-12-27 16:34 ` Ivaylo Dimitrov
2015-12-25 13:36 ` Ivaylo Dimitrov
2016-01-01 12:01 ` Pali Rohár
2016-01-04 11:37 ` Tomi Valkeinen
2016-01-04 11:37 ` Tomi Valkeinen
2016-01-04 13:04 ` Ivaylo Dimitrov
2016-01-11 18:34 ` Tomi Valkeinen
2016-01-11 18:34 ` Tomi Valkeinen
2016-02-13 7:25 ` Ivaylo Dimitrov [this message]
2016-02-16 13:51 ` Tomi Valkeinen
2016-02-16 13:51 ` Tomi Valkeinen
2016-02-16 14:05 ` Pali Rohár
2016-02-17 7:31 ` Ivaylo Dimitrov
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=56BEDA57.4030300@gmail.com \
--to=ivo.g.dimitrov.75@gmail.com \
--cc=freemangordon@abv.bg \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=pali.rohar@gmail.com \
--cc=pavel@ucw.cz \
--cc=tomi.valkeinen@ti.com \
--cc=tony@atomide.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.