osd: free uboot logo memory when kernel loaded

PD#139665: free uboot logo memory when kernel loaded

Change-Id: I78c46946f3a06078a41491196a79f72e56cdc795
Signed-off-by: Pengcheng Chen <pengcheng.chen@amlogic.com>
This commit is contained in:
Pengcheng Chen
2017-04-20 15:29:21 +08:00
committed by Jianxin Pan
parent e5ca5f86b9
commit 518bb18904
7 changed files with 47 additions and 50 deletions

View File

@@ -67,8 +67,7 @@
};
fb_reserved:linux,meson-fb {
compatible = "amlogic, fb-memory";
size = <0x0 0x2000000>;
no-map;
reg = <0x0 0x3e000000 0x0 0x2000000>;
};
di_reserved:linux,di {
@@ -676,14 +675,14 @@
interrupts = <0 3 1
0 89 1>;
interrupt-names = "viu-vsync", "rdma";
mem_size = <0x01851000 0x00100000>; /* fb0/fb1 memory size */
mem_size = <0x006AF000 0x01851000 0x00100000>;
/* uboot logo,fb0/fb1 memory size */
display_mode_default = "1080p60hz";
scale_mode = <1>;
/** 0:VPU free scale 1:OSD free scale 2:OSD super scale */
display_size_default = <1920 1080 1920 3240 32>;
/*1920*1080*4*3 = 0x17BB000*/
logo_addr = "0x3d851000";
/*ion base + fb0 memory size for uboot logo osd1*/
logo_addr = "0x3e000000";
};
ge2d {
compatible = "amlogic, ge2d";

View File

@@ -68,8 +68,7 @@
};
fb_reserved:linux,meson-fb {
compatible = "amlogic, fb-memory";
size = <0x0 0x2000000>;
no-map;
reg = <0x0 0x7e000000 0x0 0x2000000>;
};
di_reserved:linux,di {
@@ -677,14 +676,14 @@
interrupts = <0 3 1
0 89 1>;
interrupt-names = "viu-vsync", "rdma";
mem_size = <0x01851000 0x00100000>; /* fb0/fb1 memory size */
mem_size = <0x006AF000 0x01851000 0x00100000>;
/* uboot logo,fb0/fb1 memory size */
display_mode_default = "1080p60hz";
scale_mode = <1>;
/** 0:VPU free scale 1:OSD free scale 2:OSD super scale */
display_size_default = <1920 1080 1920 3240 32>;
/*1920*1080*4*3 = 0x17BB000*/
logo_addr = "0x3d851000";
/*ion base + fb0 memory size for uboot logo osd1*/
logo_addr = "0x7e000000";
};
ge2d {
compatible = "amlogic, ge2d";

View File

@@ -64,8 +64,7 @@
};
fb_reserved:linux,meson-fb {
compatible = "amlogic, fb-memory";
size = <0x0 0x2000000>;
no-map;
reg = <0x0 0x7e000000 0x0 0x2000000>;
};
@@ -454,14 +453,14 @@
interrupts = <0 3 1
0 89 1>;
interrupt-names = "viu-vsync", "rdma";
mem_size = <0x01851000 0x00100000>; /* fb0/fb1 memory size */
mem_size = <0x006AF000 0x01851000 0x00100000>;
/* uboot logo,fb0/fb1 memory size */
display_mode_default = "1080p60hz";
scale_mode = <1>;
/** 0:VPU free scale 1:OSD free scale 2:OSD super scale */
display_size_default = <1920 1080 1920 3240 32>;
/*1920*1080*4*3 = 0x17BB000*/
logo_addr = "0x3d851000";
/*ion base + fb0 memory size for uboot logo osd1*/
logo_addr = "0x7e000000";
};
ge2d {

View File

@@ -64,8 +64,7 @@
};
fb_reserved:linux,meson-fb {
compatible = "amlogic, fb-memory";
size = <0x0 0x2000000>;
no-map;
reg = <0x0 0x7e000000 0x0 0x2000000>;
};
@@ -516,14 +515,14 @@
interrupts = <0 3 1
0 89 1>;
interrupt-names = "viu-vsync", "rdma";
mem_size = <0x01851000 0x00100000>; /* fb0/fb1 memory size */
mem_size = <0x006AF000 0x01851000 0x00100000>;
/* uboot logo,fb0/fb1 memory size */
display_mode_default = "1080p60hz";
scale_mode = <1>;
/** 0:VPU free scale 1:OSD free scale 2:OSD super scale */
display_size_default = <1920 1080 1920 3240 32>;
/*1920*1080*4*3 = 0x17BB000*/
logo_addr = "0x3d851000";
/*ion base + fb0 memory size for uboot logo osd1*/
logo_addr = "0x7e000000";
};
ge2d {

View File

@@ -65,12 +65,10 @@
reg = <0x0 0x07300000 0x0 0x100000>;
no-map;
};
/*fb_reserved:linux,meson-fb {
fb_reserved:linux,meson-fb {
compatible = "amlogic, fb-memory";
size = <0x0 0x2000000>;
no-map;
reg = <0x0 0x7e000000 0x0 0x006AF000>;
};
*/
di_reserved:linux,di {
compatible = "amlogic, di-mem";
@@ -81,7 +79,7 @@
ion_reserved:linux,ion-dev {
compatible = "amlogic, idev-mem";
size = <0x0 0x4000000>;
size = <0x0 0x3900000>;
};
/* vdin0 CMA pool */
@@ -691,20 +689,20 @@
meson-fb {
compatible = "amlogic, meson-fb";
//memory-region = <&fb_reserved>;
memory-region = <&fb_reserved>;
dev_name = "meson-fb";
status = "okay";
interrupts = <0 3 1
0 89 1>;
interrupt-names = "viu-vsync", "rdma";
mem_size = <0x01851000 0x00100000>; /* fb0/fb1 memory size */
mem_size = <0x006AF000 0x01851000 0x00100000>;
/* uboot logo,fb0/fb1 memory size */
display_mode_default = "1080p60hz";
scale_mode = <1>;
/** 0:VPU free scale 1:OSD free scale 2:OSD super scale */
display_size_default = <1920 1080 1920 3240 32>;
/*1920*1080*4*3 = 0x17BB000*/
logo_addr = "0x7f851000";
/*ion base + fb0 memory size for uboot logo osd1*/
logo_addr = "0x7e000000";
};
ge2d {
compatible = "amlogic, ge2d";

View File

@@ -68,8 +68,7 @@
};
fb_reserved:linux,meson-fb {
compatible = "amlogic, fb-memory";
size = <0x0 0x2000000>;
no-map;
reg = <0x0 0x3e000000 0x0 0x2000000>;
};
di_reserved:linux,di {
@@ -610,14 +609,14 @@
interrupts = <0 3 1
0 89 1>;
interrupt-names = "viu-vsync", "rdma";
mem_size = <0x01851000 0x00100000>; /* fb0/fb1 memory size */
mem_size = <0x006AF000 0x01851000 0x00100000>;
/* uboot logo,fb0/fb1 memory size */
display_mode_default = "1080p60hz";
scale_mode = <1>;
/** 0:VPU free scale 1:OSD free scale 2:OSD super scale */
display_size_default = <1920 1080 1920 3240 32>;
/*1920*1080*4*3 = 0x17BB000*/
logo_addr = "0x3d851000";
/*ion base + fb0 memory size for uboot logo osd1*/
logo_addr = "0x3e000000";
};
ge2d {
compatible = "amlogic, ge2d";

View File

@@ -299,7 +299,7 @@ int int_rdma = INT_RDMA;
#endif
struct osd_fb_dev_s *gp_fbdev_list[OSD_COUNT] = {};
static struct reserved_mem fb_rmem = {.base = 0, .size = 0};
static u32 fb_memsize[2];
static u32 fb_memsize[3];
static phys_addr_t fb_rmem_paddr[2];
static void __iomem *fb_rmem_vaddr[OSD_COUNT];
static size_t fb_rmem_size[OSD_COUNT];
@@ -975,17 +975,21 @@ static int osd_open(struct fb_info *info, int arg)
var = &info->var;
/* read fb-reserved memory first */
if (fb_rmem.base &&
(fb_memsize[0] + fb_memsize[1]) <= fb_rmem.size) {
(fb_memsize[0] + fb_memsize[1] +
fb_memsize[2]) <= fb_rmem.size) {
if (!fb_ion_client)
fb_ion_client = meson_ion_client_create(-1, "meson-fb");
fb_rmem_size[fb_index] = fb_memsize[fb_index];
fb_rmem_size[fb_index] = fb_memsize[fb_index + 1];
if (fb_index == DEV_OSD0)
fb_rmem_paddr[fb_index] = fb_rmem.base;
fb_rmem_paddr[fb_index] = fb_rmem.base +
fb_memsize[0];
else if (fb_index == DEV_OSD1) {
if ((OSD_COUNT == 2) &&
((fb_memsize[0] + fb_memsize[1]) <= fb_rmem.size)) {
((fb_memsize[0] + fb_memsize[1] +
fb_memsize[2]) <= fb_rmem.size)) {
fb_rmem_paddr[fb_index] =
fb_rmem.base + fb_memsize[0];
fb_rmem.base + fb_memsize[0] +
fb_memsize[1];
}
}
if ((fb_rmem_paddr[fb_index] > 0) &&
@@ -1011,7 +1015,7 @@ static int osd_open(struct fb_info *info, int arg)
for (j = 0; j < OSD_MAX_BUF_NUM; j++) {
fb_ion_handle[fb_index][j] =
ion_alloc(fb_ion_client,
PAGE_ALIGN(fb_memsize[fb_index]/
PAGE_ALIGN(fb_memsize[fb_index + 1]/
OSD_MAX_BUF_NUM),
0,
(1 << ION_HEAP_TYPE_CARVEOUT),
@@ -1061,7 +1065,7 @@ static int osd_open(struct fb_info *info, int arg)
} else {
fb_ion_handle[fb_index][0] =
ion_alloc(fb_ion_client,
fb_memsize[fb_index],
fb_memsize[fb_index + 1],
0,
(1 << ION_HEAP_TYPE_CARVEOUT),
0);
@@ -2377,11 +2381,11 @@ static void mem_free_work(struct work_struct *work)
unsigned long end_addr;
if (fb_rmem.base && fb_map_flag) {
if (fb_rmem.size >= (fb_memsize[0] + fb_memsize[1])) {
/* logo reserved memory after fb0/fb1 memory, free it*/
start_addr = fb_rmem.base
+ fb_memsize[0] + fb_memsize[1];
end_addr = fb_rmem.base + fb_rmem.size;
if (fb_rmem.size >= (fb_memsize[0] + fb_memsize[1]
+ fb_memsize[2])) {
/* logo reserved memory before fb0/fb1 memory, free it*/
start_addr = fb_rmem.base;
end_addr = fb_rmem.base + fb_memsize[0];
} else {
/* logo reserved only, free it*/
start_addr = fb_rmem.base;
@@ -2431,7 +2435,7 @@ static int osd_probe(struct platform_device *pdev)
/* get buffer size from dt */
ret = of_property_read_u32_array(pdev->dev.of_node,
"mem_size", fb_memsize, 2);
"mem_size", fb_memsize, 3);
if (ret) {
osd_log_err("not found mem_size from dtd\n");
goto failed1;
@@ -2442,8 +2446,8 @@ static int osd_probe(struct platform_device *pdev)
if ((ret != 0) && ((void *)fb_rmem.base == NULL))
osd_log_err("failed to init reserved memory\n");
osd_log_dbg("%d, mem_size: 0x%x, 0x%x\n",
__LINE__, fb_memsize[0], fb_memsize[1]);
osd_log_dbg("%d, mem_size: 0x%x, 0x%x, 0x%x\n",
__LINE__, fb_memsize[0], fb_memsize[1], fb_memsize[2]);
/* get meson-fb resource from dt */
prop = of_get_property(pdev->dev.of_node, "scale_mode", NULL);