mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
rk: ion: change heap id
This commit is contained in:
@@ -541,7 +541,7 @@
|
||||
compatible = "rockchip,ion";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
rockchip,ion-heap@1 { /* VIDEO HEAP */
|
||||
rockchip,ion-heap@1 { /* CMA HEAP */
|
||||
reg = <1>;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -42,29 +42,24 @@ extern struct ion_handle *ion_handle_get_by_id(struct ion_client *client,
|
||||
|
||||
static struct ion_heap_desc ion_heap_meta[] = {
|
||||
{
|
||||
.id = ION_SYSTEM_HEAP_ID,
|
||||
.id = ION_SYSTEM_HEAP_ID,
|
||||
.type = ION_HEAP_TYPE_SYSTEM,
|
||||
.name = ION_VMALLOC_HEAP_NAME,
|
||||
.name = ION_SYSTEM_HEAP_NAME,
|
||||
},
|
||||
{
|
||||
.id = ION_VIDEO_HEAP_ID,
|
||||
.id = ION_CMA_HEAP_ID,
|
||||
.type = ION_HEAP_TYPE_DMA,
|
||||
.name = ION_VIDEO_HEAP_NAME,
|
||||
.name = ION_CMA_HEAP_NAME,
|
||||
},
|
||||
{
|
||||
.id = ION_AUDIO_HEAP_ID,
|
||||
.type = ION_HEAP_TYPE_DMA,
|
||||
.name = ION_AUDIO_HEAP_NAME,
|
||||
},
|
||||
{
|
||||
.id = ION_IOMMU_HEAP_ID,
|
||||
.id = ION_IOMMU_HEAP_ID,
|
||||
.type = ION_HEAP_TYPE_DMA,//ION_HEAP_TYPE_IOMMU,
|
||||
.name = ION_IOMMU_HEAP_NAME,
|
||||
},
|
||||
{
|
||||
.id = ION_CAMERA_HEAP_ID,
|
||||
.id = ION_DRM_HEAP_ID,
|
||||
.type = ION_HEAP_TYPE_DMA,
|
||||
.name = ION_CAMERA_HEAP_NAME,
|
||||
.name = ION_DRM_HEAP_NAME,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -116,7 +111,7 @@ static struct ion_platform_data *rockchip_ion_parse_dt(
|
||||
for_each_child_of_node(dt_node, node)
|
||||
num_heaps++;
|
||||
|
||||
pr_info("%s: num_heaps = %d\n", __func__, num_heaps);
|
||||
pr_info("%s: num_heaps = %d\n", __func__, num_heaps);
|
||||
|
||||
if (!num_heaps)
|
||||
return ERR_PTR(-EINVAL);
|
||||
@@ -125,7 +120,7 @@ static struct ion_platform_data *rockchip_ion_parse_dt(
|
||||
num_heaps*sizeof(struct ion_platform_heap), GFP_KERNEL);
|
||||
if (!pdata)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
pdata->heaps = (struct ion_platform_heap*)((void*)pdata+sizeof(struct ion_platform_data));
|
||||
pdata->heaps = (struct ion_platform_heap*)((void*)pdata+sizeof(struct ion_platform_data));
|
||||
pdata->nr = num_heaps;
|
||||
|
||||
for_each_child_of_node(dt_node, node) {
|
||||
@@ -146,8 +141,8 @@ static struct ion_platform_data *rockchip_ion_parse_dt(
|
||||
goto free_heaps;
|
||||
|
||||
// rockchip_ion_get_heap_adjacent(node, &pdata->heaps[idx]);
|
||||
pdata->heaps[idx].priv = dev;
|
||||
pr_info("%d: %d %d %s 0x%08X\n", idx, pdata->heaps[idx].type, pdata->heaps[idx].id, pdata->heaps[idx].name, pdata->heaps[idx].size);
|
||||
pdata->heaps[idx].priv = dev;
|
||||
pr_info("%d: %d %d %s 0x%08X\n", idx, pdata->heaps[idx].type, pdata->heaps[idx].id, pdata->heaps[idx].name, pdata->heaps[idx].size);
|
||||
|
||||
++idx;
|
||||
}
|
||||
@@ -207,12 +202,10 @@ static long rockchip_custom_ioctl (struct ion_client *client, unsigned int cmd,
|
||||
static int rockchip_ion_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct ion_platform_data *pdata;
|
||||
unsigned int pdata_needs_to_be_freed;
|
||||
unsigned int pdata_needs_to_be_freed;
|
||||
int err;
|
||||
int i;
|
||||
|
||||
printk("%s\n", __func__);
|
||||
|
||||
if (pdev->dev.of_node) {
|
||||
pdata = rockchip_ion_parse_dt(&pdev->dev);
|
||||
if (IS_ERR(pdata)) {
|
||||
@@ -247,12 +240,12 @@ static int rockchip_ion_probe(struct platform_device *pdev)
|
||||
if (pdata_needs_to_be_freed)
|
||||
kfree(pdata);
|
||||
|
||||
pr_info("Rockchip ion module is successfully loaded\n");
|
||||
pr_info("Rockchip ion module is successfully loaded\n");
|
||||
return 0;
|
||||
err:
|
||||
for (i = 0; i < num_heaps; i++) {
|
||||
if (heaps[i])
|
||||
ion_heap_destroy(heaps[i]);
|
||||
if (heaps[i])
|
||||
ion_heap_destroy(heaps[i]);
|
||||
}
|
||||
if (pdata_needs_to_be_freed)
|
||||
kfree(pdata);
|
||||
@@ -262,39 +255,39 @@ err:
|
||||
|
||||
static int rockchip_ion_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct ion_device *idev = platform_get_drvdata(pdev);
|
||||
int i;
|
||||
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]);
|
||||
kfree(heaps);
|
||||
return 0;
|
||||
ion_device_destroy(idev);
|
||||
for (i = 0; i < num_heaps; i++)
|
||||
ion_heap_destroy(heaps[i]);
|
||||
kfree(heaps);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id rockchip_ion_dt_ids[] = {
|
||||
{ .compatible = "rockchip,ion", },
|
||||
{}
|
||||
{ .compatible = "rockchip,ion", },
|
||||
{}
|
||||
};
|
||||
|
||||
static struct platform_driver ion_driver = {
|
||||
.probe = rockchip_ion_probe,
|
||||
.remove = rockchip_ion_remove,
|
||||
.driver = {
|
||||
.name = "ion-rockchip",
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = of_match_ptr(rockchip_ion_dt_ids),
|
||||
},
|
||||
.probe = rockchip_ion_probe,
|
||||
.remove = rockchip_ion_remove,
|
||||
.driver = {
|
||||
.name = "ion-rockchip",
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = of_match_ptr(rockchip_ion_dt_ids),
|
||||
},
|
||||
};
|
||||
|
||||
static int __init ion_init(void)
|
||||
{
|
||||
return platform_driver_register(&ion_driver);
|
||||
return platform_driver_register(&ion_driver);
|
||||
}
|
||||
|
||||
static void __exit ion_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&ion_driver);
|
||||
platform_driver_unregister(&ion_driver);
|
||||
}
|
||||
|
||||
subsys_initcall(ion_init);
|
||||
|
||||
@@ -1583,7 +1583,7 @@ static int rk_fb_alloc_buffer(struct fb_info *fbi, int fb_id)
|
||||
fb_mem_size = 3 * (fbi->var.xres * fbi->var.yres) << 2;
|
||||
fb_mem_size = ALIGN(fb_mem_size, SZ_1M);
|
||||
#if defined(CONFIG_ION_ROCKCHIP)
|
||||
handle = ion_alloc(rk_fb->ion_client, (size_t)fb_mem_size, 0, ION_HEAP(ION_VIDEO_HEAP_ID), 0);
|
||||
handle = ion_alloc(rk_fb->ion_client, (size_t)fb_mem_size, 0, ION_HEAP(ION_CMA_HEAP_ID), 0);
|
||||
if (IS_ERR(handle)) {
|
||||
dev_err(fbi->device, "failed to ion_alloc:%ld\n",PTR_ERR(handle));
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -16,26 +16,28 @@
|
||||
#ifndef _LINUX_ROCKCHIP_ION_H
|
||||
#define _LINUX_ROCKCHIP_ION_H
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include "../../drivers/staging/android/ion/ion.h"
|
||||
#else
|
||||
#include <linux/ion.h>
|
||||
#endif
|
||||
|
||||
enum ion_heap_ids {
|
||||
INVALID_HEAP_ID = -1,
|
||||
ION_VIDEO_HEAP_ID = 1,
|
||||
ION_CAMERA_HEAP_ID,
|
||||
ION_CMA_HEAP_ID = 1,
|
||||
ION_IOMMU_HEAP_ID,
|
||||
ION_AUDIO_HEAP_ID,
|
||||
ION_SYSTEM_HEAP_ID,
|
||||
ION_DRM_HEAP_ID,
|
||||
|
||||
ION_HEAP_ID_RESERVED = 31
|
||||
};
|
||||
|
||||
#define ION_HEAP(bit) (1 << (bit))
|
||||
|
||||
#define ION_VIDEO_HEAP_NAME "video"
|
||||
#define ION_AUDIO_HEAP_NAME "audio"
|
||||
#define ION_CAMERA_HEAP_NAME "camera_preview"
|
||||
#define ION_CMA_HEAP_NAME "cma"
|
||||
#define ION_IOMMU_HEAP_NAME "iommu"
|
||||
#define ION_VMALLOC_HEAP_NAME "vmalloc"
|
||||
#define ION_SYSTEM_HEAP_NAME "vmalloc"
|
||||
#define ION_DRM_HEAP_NAME "drm"
|
||||
|
||||
#define ION_SET_CACHED(__cache) (__cache | ION_FLAG_CACHED)
|
||||
#define ION_SET_UNCACHED(__cache) (__cache & ~ION_FLAG_CACHED)
|
||||
@@ -55,7 +57,7 @@ enum ion_heap_ids {
|
||||
* the cache operations performed
|
||||
*/
|
||||
struct ion_flush_data {
|
||||
struct ion_handle *handle;
|
||||
ion_user_handle_t handle;
|
||||
int fd;
|
||||
void *vaddr;
|
||||
unsigned int offset;
|
||||
|
||||
Reference in New Issue
Block a user