On 13/02/16 09:25, Ivaylo Dimitrov wrote: > 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 > #include > #include > +#include > > #include > > @@ -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 > #include > #include > +#include > > #include