3 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
\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
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
16 #ifndef _LINUX_ROCKCHIP_ION_H
\r
17 #define _LINUX_ROCKCHIP_ION_H
\r
19 #include "../../drivers/staging/android/ion/ion.h"
\r
22 INVALID_HEAP_ID = -1,
\r
23 ION_VIDEO_HEAP_ID = 1,
\r
29 ION_HEAP_ID_RESERVED = 31
\r
32 #define ION_HEAP(bit) (1 << (bit))
\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
40 #define ION_SET_CACHED(__cache) (__cache | ION_FLAG_CACHED)
\r
41 #define ION_SET_UNCACHED(__cache) (__cache & ~ION_FLAG_CACHED)
\r
43 #define ION_IS_CACHED(__flags) ((__flags) & ION_FLAG_CACHED)
\r
45 /* struct ion_flush_data - data passed to ion for flushing caches
\r
47 * @handle: handle with data 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
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
57 struct ion_flush_data {
\r
58 struct ion_handle *handle;
\r
61 unsigned int offset;
\r
62 unsigned int length;
\r
65 #define ION_IOC_ROCKCHIP_MAGIC 'R'
\r
68 * DOC: ION_IOC_CLEAN_CACHES - clean the caches
\r
70 * Clean the caches of the handle specified.
\r
72 #define ION_IOC_CLEAN_CACHES _IOWR(ION_IOC_ROCKCHIP_MAGIC, 0, \
\r
73 struct ion_flush_data)
\r
75 * DOC: ION_IOC_INV_CACHES - invalidate the caches
\r
77 * Invalidate the caches of the handle specified.
\r
79 #define ION_IOC_INV_CACHES _IOWR(ION_IOC_ROCKCHIP_MAGIC, 1, \
\r
80 struct ion_flush_data)
\r
82 * DOC: ION_IOC_CLEAN_INV_CACHES - clean and invalidate the caches
\r
84 * Clean and invalidate the caches of the handle specified.
\r
86 #define ION_IOC_CLEAN_INV_CACHES _IOWR(ION_IOC_ROCKCHIP_MAGIC, 2, \
\r
87 struct ion_flush_data)
\r