move rockchip_ion.h file to include/linux/
[firefly-linux-kernel-4.4.55.git] / include / linux / rockchip_ion.h
1 /*\r
2  *\r
3  * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.\r
4  *\r
5  * This software is licensed under the terms of the GNU General Public\r
6  * License version 2, as published by the Free Software Foundation, and\r
7  * may be copied, distributed, and modified under those terms.\r
8  *\r
9  * This program is distributed in the hope that it will be useful,\r
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
12  * GNU General Public License for more details.\r
13  *\r
14  */\r
15 \r
16 #ifndef _LINUX_ROCKCHIP_ION_H\r
17 #define _LINUX_ROCKCHIP_ION_H\r
18 \r
19 #include "../../drivers/staging/android/ion/ion.h"\r
20 \r
21 enum ion_heap_ids {\r
22         INVALID_HEAP_ID = -1,\r
23         ION_VIDEO_HEAP_ID = 1,\r
24         ION_CAMERA_HEAP_ID,\r
25         ION_IOMMU_HEAP_ID,\r
26         ION_AUDIO_HEAP_ID,\r
27         ION_SYSTEM_HEAP_ID,\r
28 \r
29         ION_HEAP_ID_RESERVED = 31\r
30 };\r
31 \r
32 #define ION_HEAP(bit) (1 << (bit))\r
33 \r
34 #define ION_VIDEO_HEAP_NAME     "video"\r
35 #define ION_AUDIO_HEAP_NAME     "audio"\r
36 #define ION_CAMERA_HEAP_NAME    "camera_preview"\r
37 #define ION_IOMMU_HEAP_NAME     "iommu"\r
38 #define ION_VMALLOC_HEAP_NAME   "vmalloc"\r
39 \r
40 #define ION_SET_CACHED(__cache)         (__cache | ION_FLAG_CACHED)\r
41 #define ION_SET_UNCACHED(__cache)       (__cache & ~ION_FLAG_CACHED)\r
42 \r
43 #define ION_IS_CACHED(__flags)  ((__flags) & ION_FLAG_CACHED)\r
44 \r
45 /* struct ion_flush_data - data passed to ion for flushing caches\r
46  *\r
47  * @handle:     handle with data to flush\r
48  * @fd:         fd to flush\r
49  * @vaddr:      userspace virtual address mapped with mmap\r
50  * @offset:     offset into the handle to flush\r
51  * @length:     length of handle to flush\r
52  *\r
53  * Performs cache operations on the handle. If p is the start address\r
54  * of the handle, p + offset through p + offset + length will have\r
55  * the cache operations performed\r
56  */\r
57 struct ion_flush_data {\r
58         struct ion_handle *handle;\r
59         int fd;\r
60         void *vaddr;\r
61         unsigned int offset;\r
62         unsigned int length;\r
63 };\r
64 \r
65 #define ION_IOC_ROCKCHIP_MAGIC 'R'\r
66 \r
67 /**\r
68  * DOC: ION_IOC_CLEAN_CACHES - clean the caches\r
69  *\r
70  * Clean the caches of the handle specified.\r
71  */\r
72 #define ION_IOC_CLEAN_CACHES    _IOWR(ION_IOC_ROCKCHIP_MAGIC, 0, \\r
73                                                 struct ion_flush_data)\r
74 /**\r
75  * DOC: ION_IOC_INV_CACHES - invalidate the caches\r
76  *\r
77  * Invalidate the caches of the handle specified.\r
78  */\r
79 #define ION_IOC_INV_CACHES      _IOWR(ION_IOC_ROCKCHIP_MAGIC, 1, \\r
80                                                 struct ion_flush_data)\r
81 /**\r
82  * DOC: ION_IOC_CLEAN_INV_CACHES - clean and invalidate the caches\r
83  *\r
84  * Clean and invalidate the caches of the handle specified.\r
85  */\r
86 #define ION_IOC_CLEAN_INV_CACHES        _IOWR(ION_IOC_ROCKCHIP_MAGIC, 2, \\r
87                                                 struct ion_flush_data)\r
88 \r
89 #endif\r