mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
osd: add cma heap for ion
PD#146107: osd: add cma heap for ion on Android 8.0 Change-Id: Idf4371fd0dceecc883fd8402a656ed7724be1efd Signed-off-by: binqi.zhang <binqi.zhang@amlogic.com>
This commit is contained in:
@@ -62,13 +62,6 @@
|
||||
reg = <0x0 0x05300000 0x0 0x2000000>;
|
||||
no-map;
|
||||
};
|
||||
fb_reserved:linux,meson-fb {
|
||||
compatible = "shared-dma-pool";
|
||||
reusable;
|
||||
size = <0x0 0x2000000>;
|
||||
alignment = <0x0 0x400000>;
|
||||
alloc-ranges = <0x0 0x3e000000 0x0 0x2000000>;
|
||||
};
|
||||
|
||||
//di_reserved:linux,di {
|
||||
// compatible = "amlogic, di-mem";
|
||||
@@ -85,8 +78,11 @@
|
||||
};
|
||||
|
||||
ion_reserved:linux,ion-dev {
|
||||
compatible = "amlogic, idev-mem";
|
||||
size = <0x0 0x0>;
|
||||
compatible = "shared-dma-pool";
|
||||
reusable;
|
||||
size = <0x0 0x2000000>;
|
||||
alignment = <0x0 0x400000>;
|
||||
alloc-ranges = <0x0 0x3e000000 0x0 0x2000000>;
|
||||
};
|
||||
|
||||
/* vdin0 CMA pool */
|
||||
@@ -681,7 +677,6 @@
|
||||
|
||||
meson-fb {
|
||||
compatible = "amlogic, meson-fb";
|
||||
memory-region = <&fb_reserved>;
|
||||
dev_name = "meson-fb";
|
||||
status = "okay";
|
||||
interrupts = <0 3 1
|
||||
|
||||
@@ -63,13 +63,6 @@
|
||||
reg = <0x0 0x05300000 0x0 0x2000000>;
|
||||
no-map;
|
||||
};
|
||||
fb_reserved:linux,meson-fb {
|
||||
compatible = "shared-dma-pool";
|
||||
reusable;
|
||||
size = <0x0 0x2000000>;
|
||||
alignment = <0x0 0x400000>;
|
||||
alloc-ranges = <0x0 0x7e000000 0x0 0x2000000>;
|
||||
};
|
||||
|
||||
//di_reserved:linux,di {
|
||||
// compatible = "amlogic, di-mem";
|
||||
@@ -86,8 +79,11 @@
|
||||
};
|
||||
|
||||
ion_reserved:linux,ion-dev {
|
||||
compatible = "amlogic, idev-mem";
|
||||
size = <0x0 0x0>;
|
||||
compatible = "shared-dma-pool";
|
||||
reusable;
|
||||
size = <0x0 0x2000000>;
|
||||
alignment = <0x0 0x400000>;
|
||||
alloc-ranges = <0x0 0x7e000000 0x0 0x2000000>;
|
||||
};
|
||||
|
||||
/* vdin0 CMA pool */
|
||||
@@ -682,7 +678,6 @@
|
||||
|
||||
meson-fb {
|
||||
compatible = "amlogic, meson-fb";
|
||||
memory-region = <&fb_reserved>;
|
||||
dev_name = "meson-fb";
|
||||
status = "okay";
|
||||
interrupts = <0 3 1
|
||||
|
||||
@@ -62,13 +62,6 @@
|
||||
reg = <0x0 0x05300000 0x0 0x2000000>;
|
||||
no-map;
|
||||
};
|
||||
fb_reserved:linux,meson-fb {
|
||||
compatible = "shared-dma-pool";
|
||||
reusable;
|
||||
size = <0x0 0x2000000>;
|
||||
alignment = <0x0 0x400000>;
|
||||
alloc-ranges = <0x0 0x7e000000 0x0 0x2000000>;
|
||||
};
|
||||
|
||||
//di_reserved:linux,di {
|
||||
// compatible = "amlogic, di-mem";
|
||||
@@ -85,8 +78,11 @@
|
||||
};
|
||||
|
||||
ion_reserved:linux,ion-dev {
|
||||
compatible = "amlogic, idev-mem";
|
||||
size = <0x0 0x0>;
|
||||
compatible = "shared-dma-pool";
|
||||
reusable;
|
||||
size = <0x0 0x2000000>;
|
||||
alignment = <0x0 0x400000>;
|
||||
alloc-ranges = <0x0 0x7e000000 0x0 0x2000000>;
|
||||
};
|
||||
|
||||
/* vdin0 CMA pool */
|
||||
@@ -674,7 +670,6 @@
|
||||
|
||||
meson-fb {
|
||||
compatible = "amlogic, meson-fb";
|
||||
memory-region = <&fb_reserved>;
|
||||
dev_name = "meson-fb";
|
||||
status = "okay";
|
||||
interrupts = <0 3 1
|
||||
|
||||
@@ -62,13 +62,6 @@
|
||||
reg = <0x0 0x05300000 0x0 0x2000000>;
|
||||
no-map;
|
||||
};
|
||||
fb_reserved:linux,meson-fb {
|
||||
compatible = "shared-dma-pool";
|
||||
reusable;
|
||||
size = <0x0 0x2000000>;
|
||||
alignment = <0x0 0x400000>;
|
||||
alloc-ranges = <0x0 0x7e000000 0x0 0x2000000>;
|
||||
};
|
||||
|
||||
//di_reserved:linux,di {
|
||||
// compatible = "amlogic, di-mem";
|
||||
@@ -85,8 +78,11 @@
|
||||
};
|
||||
|
||||
ion_reserved:linux,ion-dev {
|
||||
compatible = "amlogic, idev-mem";
|
||||
size = <0x0 0x0>;
|
||||
compatible = "shared-dma-pool";
|
||||
reusable;
|
||||
size = <0x0 0x2000000>;
|
||||
alignment = <0x0 0x400000>;
|
||||
alloc-ranges = <0x0 0x7e000000 0x0 0x2000000>;
|
||||
};
|
||||
|
||||
/* vdin0 CMA pool */
|
||||
@@ -706,7 +702,6 @@
|
||||
|
||||
meson-fb {
|
||||
compatible = "amlogic, meson-fb";
|
||||
memory-region = <&fb_reserved>;
|
||||
dev_name = "meson-fb";
|
||||
status = "okay";
|
||||
interrupts = <0 3 1
|
||||
|
||||
@@ -63,13 +63,6 @@
|
||||
reg = <0x0 0x05300000 0x0 0x2000000>;
|
||||
no-map;
|
||||
};
|
||||
fb_reserved:linux,meson-fb {
|
||||
compatible = "shared-dma-pool";
|
||||
reusable;
|
||||
size = <0x0 0x2000000>;
|
||||
alignment = <0x0 0x400000>;
|
||||
alloc-ranges = <0x0 0x3e000000 0x0 0x2000000>;
|
||||
};
|
||||
|
||||
//di_reserved:linux,di {
|
||||
// compatible = "amlogic, di-mem";
|
||||
@@ -86,8 +79,11 @@
|
||||
};
|
||||
|
||||
ion_reserved:linux,ion-dev {
|
||||
compatible = "amlogic, idev-mem";
|
||||
size = <0x0 0x0>;
|
||||
compatible = "shared-dma-pool";
|
||||
reusable;
|
||||
size = <0x0 0x2000000>;
|
||||
alignment = <0x0 0x400000>;
|
||||
alloc-ranges = <0x0 0x3e000000 0x0 0x2000000>;
|
||||
};
|
||||
|
||||
/* vdin0 CMA pool */
|
||||
@@ -608,7 +604,6 @@
|
||||
|
||||
meson-fb {
|
||||
compatible = "amlogic, meson-fb";
|
||||
/* memory-region = <&fb_reserved>; */
|
||||
dev_name = "meson-fb";
|
||||
status = "okay";
|
||||
interrupts = <0 3 1
|
||||
|
||||
@@ -169,6 +169,7 @@ static long meson_custom_ioctl(
|
||||
int dev_ion_probe(struct platform_device *pdev)
|
||||
{
|
||||
int err = 0;
|
||||
int i;
|
||||
|
||||
my_ion_heap[num_heaps].type = ION_HEAP_TYPE_SYSTEM;
|
||||
my_ion_heap[num_heaps].id = ION_HEAP_TYPE_SYSTEM;
|
||||
@@ -183,20 +184,57 @@ int dev_ion_probe(struct platform_device *pdev)
|
||||
my_ion_heap[num_heaps].size = 32 * 1024 * 1024;
|
||||
num_heaps++;
|
||||
#endif
|
||||
/*add CMA ion heap*/
|
||||
my_ion_heap[num_heaps].type = ION_HEAP_TYPE_DMA;
|
||||
my_ion_heap[num_heaps].id = ION_HEAP_TYPE_DMA;
|
||||
my_ion_heap[num_heaps].name = "cma_ion";
|
||||
my_ion_heap[num_heaps].priv = &pdev->dev;
|
||||
num_heaps++;
|
||||
|
||||
|
||||
/* init reserved memory */
|
||||
err = of_reserved_mem_device_init(&pdev->dev);
|
||||
if (err != 0)
|
||||
dprintk(1, "failed get reserved memory\n");
|
||||
heaps = kcalloc(num_heaps, sizeof(struct ion_heap *), GFP_KERNEL);
|
||||
if (!heaps)
|
||||
return -ENOMEM;
|
||||
/* idev = ion_device_create(NULL); */
|
||||
idev = ion_device_create(meson_custom_ioctl);
|
||||
if (IS_ERR_OR_NULL(idev)) {
|
||||
kfree(heaps);
|
||||
panic(0);
|
||||
return PTR_ERR(idev);
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, idev);
|
||||
|
||||
/* create the heaps as specified in the board file */
|
||||
for (i = 0; i < num_heaps; i++) {
|
||||
heaps[i] = ion_heap_create(&my_ion_heap[i]);
|
||||
if (IS_ERR_OR_NULL(heaps[i])) {
|
||||
err = PTR_ERR(heaps[i]);
|
||||
goto failed;
|
||||
}
|
||||
ion_device_add_heap(idev, heaps[i]);
|
||||
dprintk(2, "add heap type:%d id:%d\n",
|
||||
my_ion_heap[i].type, my_ion_heap[i].id);
|
||||
}
|
||||
|
||||
dprintk(1, "%s, create %d heaps\n", __func__, num_heaps);
|
||||
return 0;
|
||||
failed:
|
||||
dprintk(0, "ion heap create failed\n");
|
||||
kfree(heaps);
|
||||
heaps = NULL;
|
||||
panic(0);
|
||||
return err;
|
||||
}
|
||||
|
||||
int dev_ion_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct ion_device *idev = platform_get_drvdata(pdev);
|
||||
int i;
|
||||
|
||||
ion_device_destroy(idev);
|
||||
for (i = 0; i < num_heaps; i++)
|
||||
ion_heap_destroy(heaps[i]);
|
||||
@@ -224,9 +262,6 @@ static struct platform_driver ion_driver = {
|
||||
*/
|
||||
static int ion_dev_mem_init(struct reserved_mem *rmem, struct device *dev)
|
||||
{
|
||||
int i = 0;
|
||||
int err;
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
|
||||
my_ion_heap[num_heaps].type = ION_HEAP_TYPE_CARVEOUT;
|
||||
my_ion_heap[num_heaps].id = ION_HEAP_TYPE_CARVEOUT;
|
||||
@@ -235,41 +270,10 @@ static int ion_dev_mem_init(struct reserved_mem *rmem, struct device *dev)
|
||||
my_ion_heap[num_heaps].size = rmem->size;
|
||||
|
||||
pr_info("ion_dev_mem_init size=0x%llx\n", rmem->size);
|
||||
|
||||
num_heaps++;
|
||||
heaps = kcalloc(num_heaps, sizeof(struct ion_heap *), GFP_KERNEL);
|
||||
/* idev = ion_device_create(NULL); */
|
||||
idev = ion_device_create(meson_custom_ioctl);
|
||||
if (IS_ERR_OR_NULL(idev)) {
|
||||
kfree(heaps);
|
||||
panic(0);
|
||||
return PTR_ERR(idev);
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, idev);
|
||||
|
||||
/* create the heaps as specified in the board file */
|
||||
for (i = 0; i < num_heaps; i++) {
|
||||
heaps[i] = ion_heap_create(&my_ion_heap[i]);
|
||||
if (IS_ERR_OR_NULL(heaps[i])) {
|
||||
err = PTR_ERR(heaps[i]);
|
||||
goto failed;
|
||||
}
|
||||
ion_device_add_heap(idev, heaps[i]);
|
||||
dprintk(2, "add heap type:%d id:%d\n",
|
||||
my_ion_heap[i].type, my_ion_heap[i].id);
|
||||
}
|
||||
|
||||
dprintk(1, "%s, create %d heaps\n", __func__, num_heaps);
|
||||
|
||||
return 0;
|
||||
|
||||
failed:
|
||||
dprintk(0, "ion heap create failed\n");
|
||||
kfree(heaps);
|
||||
heaps = NULL;
|
||||
panic(0);
|
||||
return err;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1157,7 +1157,7 @@ static int osd_open(struct fb_info *info, int arg)
|
||||
PAGE_ALIGN(fb_memsize[fb_index + 1]/
|
||||
OSD_MAX_BUF_NUM),
|
||||
0,
|
||||
(1 << ION_HEAP_TYPE_CARVEOUT),
|
||||
(1 << ION_HEAP_TYPE_DMA),
|
||||
0);
|
||||
ret = ion_phys(fb_ion_client,
|
||||
fb_ion_handle[fb_index][j],
|
||||
@@ -1206,7 +1206,7 @@ static int osd_open(struct fb_info *info, int arg)
|
||||
ion_alloc(fb_ion_client,
|
||||
fb_memsize[fb_index + 1],
|
||||
0,
|
||||
(1 << ION_HEAP_TYPE_CARVEOUT),
|
||||
(1 << ION_HEAP_TYPE_DMA),
|
||||
0);
|
||||
ret = ion_phys(fb_ion_client,
|
||||
fb_ion_handle[fb_index][0],
|
||||
|
||||
Reference in New Issue
Block a user