From 3a95cf786b761cb9eae88cfd094857c823ced3f8 Mon Sep 17 00:00:00 2001 From: CMY Date: Mon, 10 Feb 2014 10:36:02 +0800 Subject: [PATCH] Add rockchip ion --- arch/arm/boot/dts/rk3188.dtsi | 8 + drivers/gpu/ion/rockchip/rockchip_ion.c | 99 ------- drivers/staging/android/ion/Kconfig | 5 + drivers/staging/android/ion/Makefile | 2 +- drivers/staging/android/ion/ion.c | 0 drivers/staging/android/ion/ion.h | 1 + drivers/staging/android/ion/ion_cma_heap.c | 0 drivers/staging/android/ion/ion_heap.c | 0 drivers/staging/android/ion/ion_system_heap.c | 0 .../android}/ion/rockchip/Makefile | 0 .../android/ion/rockchip/rockchip_ion.c | 273 ++++++++++++++++++ drivers/staging/android/uapi/ion.h | 0 drivers/staging/android/uapi/rockchip_ion.h | 87 ++++++ 13 files changed, 375 insertions(+), 100 deletions(-) delete mode 100755 drivers/gpu/ion/rockchip/rockchip_ion.c mode change 100644 => 100755 drivers/staging/android/ion/ion.c mode change 100644 => 100755 drivers/staging/android/ion/ion.h mode change 100644 => 100755 drivers/staging/android/ion/ion_cma_heap.c mode change 100644 => 100755 drivers/staging/android/ion/ion_heap.c mode change 100644 => 100755 drivers/staging/android/ion/ion_system_heap.c rename drivers/{gpu => staging/android}/ion/rockchip/Makefile (100%) create mode 100755 drivers/staging/android/ion/rockchip/rockchip_ion.c mode change 100644 => 100755 drivers/staging/android/uapi/ion.h create mode 100755 drivers/staging/android/uapi/rockchip_ion.h diff --git a/arch/arm/boot/dts/rk3188.dtsi b/arch/arm/boot/dts/rk3188.dtsi index b87da55bd2b6..e4863fe38da5 100644 --- a/arch/arm/boot/dts/rk3188.dtsi +++ b/arch/arm/boot/dts/rk3188.dtsi @@ -497,4 +497,12 @@ }; }; }; + ion: ion{ + compatible = "rockchip,ion"; + #address-cells = <1>; + #size-cells = <0>; + rockchip,ion-heap@1 { /* VIDEO HEAP */ + reg = <1>; + }; + }; }; diff --git a/drivers/gpu/ion/rockchip/rockchip_ion.c b/drivers/gpu/ion/rockchip/rockchip_ion.c deleted file mode 100755 index 1fa448688fde..000000000000 --- a/drivers/gpu/ion/rockchip/rockchip_ion.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * drivers/gpu/rockchip/rockchip_ion.c - * - * Copyright (C) 2011 Google, Inc. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include -#include -#include -#include -#include "../ion_priv.h" - -static int num_heaps; -static struct ion_heap **heaps; - -static long rockchip_custom_ioctl (struct ion_client *client, unsigned int cmd, - unsigned long arg) -{ - return 0; -} -static int rockchip_ion_probe(struct platform_device *pdev) -{ - struct ion_device *idev; - struct ion_platform_data *pdata = pdev->dev.platform_data; - int err; - int i; - - num_heaps = pdata->nr; - heaps = kzalloc(sizeof(struct ion_heap *) * pdata->nr, GFP_KERNEL); - - idev = ion_device_create(rockchip_custom_ioctl); - if (IS_ERR_OR_NULL(idev)) { - kfree(heaps); - return PTR_ERR(idev); - } - /* create the heaps as specified in the board file */ - for (i = 0; i < num_heaps; i++) { - struct ion_platform_heap *heap_data = &pdata->heaps[i]; - - heaps[i] = ion_heap_create(heap_data); - if (IS_ERR_OR_NULL(heaps[i])) { - err = PTR_ERR(heaps[i]); - goto err; - } - ion_device_add_heap(idev, heaps[i]); - } - platform_set_drvdata(pdev, idev); - pr_info("Rockchip ion module(version: %s) is successfully loaded\n", ION_VERSION); - return 0; -err: - for (i = 0; i < num_heaps; i++) { - if (heaps[i]) - ion_heap_destroy(heaps[i]); - } - kfree(heaps); - return err; -} - -static int rockchip_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]); - kfree(heaps); - return 0; -} - -static struct platform_driver ion_driver = { - .probe = rockchip_ion_probe, - .remove = rockchip_ion_remove, - .driver = { .name = "ion-rockchip" } -}; - -static int __init ion_init(void) -{ - return platform_driver_register(&ion_driver); -} - -static void __exit ion_exit(void) -{ - platform_driver_unregister(&ion_driver); -} - -module_init(ion_init); -module_exit(ion_exit); - diff --git a/drivers/staging/android/ion/Kconfig b/drivers/staging/android/ion/Kconfig index 0f8fec1f84e5..a8a23602e662 100644 --- a/drivers/staging/android/ion/Kconfig +++ b/drivers/staging/android/ion/Kconfig @@ -33,3 +33,8 @@ config ION_TEGRA help Choose this option if you wish to use ion on an nVidia Tegra. +config ION_ROCKCHIP + tristate "Ion for Rockchip" + depends on ARCH_ROCKCHIP && ION + help + Choose this option if you wish to use ion on an Rockchip. diff --git a/drivers/staging/android/ion/Makefile b/drivers/staging/android/ion/Makefile index b56fd2bf2b4f..5c8fc6915b77 100644 --- a/drivers/staging/android/ion/Makefile +++ b/drivers/staging/android/ion/Makefile @@ -7,4 +7,4 @@ endif obj-$(CONFIG_ION_DUMMY) += ion_dummy_driver.o obj-$(CONFIG_ION_TEGRA) += tegra/ - +obj-$(CONFIG_ION_ROCKCHIP) += rockchip/ diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c old mode 100644 new mode 100755 diff --git a/drivers/staging/android/ion/ion.h b/drivers/staging/android/ion/ion.h old mode 100644 new mode 100755 index dcd2a0cdb192..dbae7ae17561 --- a/drivers/staging/android/ion/ion.h +++ b/drivers/staging/android/ion/ion.h @@ -20,6 +20,7 @@ #include #include "../uapi/ion.h" +#include "../uapi/rockchip_ion.h" struct ion_handle; struct ion_device; diff --git a/drivers/staging/android/ion/ion_cma_heap.c b/drivers/staging/android/ion/ion_cma_heap.c old mode 100644 new mode 100755 diff --git a/drivers/staging/android/ion/ion_heap.c b/drivers/staging/android/ion/ion_heap.c old mode 100644 new mode 100755 diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c old mode 100644 new mode 100755 diff --git a/drivers/gpu/ion/rockchip/Makefile b/drivers/staging/android/ion/rockchip/Makefile similarity index 100% rename from drivers/gpu/ion/rockchip/Makefile rename to drivers/staging/android/ion/rockchip/Makefile diff --git a/drivers/staging/android/ion/rockchip/rockchip_ion.c b/drivers/staging/android/ion/rockchip/rockchip_ion.c new file mode 100755 index 000000000000..e82abcd7fc99 --- /dev/null +++ b/drivers/staging/android/ion/rockchip/rockchip_ion.c @@ -0,0 +1,273 @@ +/* + * drivers/gpu/rockchip/rockchip_ion.c + * + * Copyright (C) 2011 Google, Inc. + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include "../ion.h" +#include "../ion_priv.h" + +#ifdef CONFIG_OF +#include +#include +#include