GNU Linux-libre 4.14.266-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / hrt / hive_isp_css_mm_hrt.h
1 /*
2  * Support for Medfield PNW Camera Imaging ISP subsystem.
3  *
4  * Copyright (c) 2010 Intel Corporation. All Rights Reserved.
5  *
6  * Copyright (c) 2010 Silicon Hive www.siliconhive.com.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License version
10  * 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20  * 02110-1301, USA.
21  *
22  */
23
24 #ifndef _hive_isp_css_mm_hrt_h_
25 #define _hive_isp_css_mm_hrt_h_
26
27 #include <hmm/hmm.h>
28 #include <hrt/hive_isp_css_custom_host_hrt.h>
29
30 #define HRT_BUF_FLAG_CACHED (1 << 0)
31
32 enum hrt_userptr_type {
33         HRT_USR_PTR = 0,
34 #ifdef CONFIG_ION
35         HRT_USR_ION,
36 #endif
37 };
38
39 struct hrt_userbuffer_attr {
40         enum hrt_userptr_type   type;
41         unsigned int            pgnr;
42 };
43
44 void hrt_isp_css_mm_set_user_ptr(void *userptr,
45                                 unsigned int num_pages, enum hrt_userptr_type);
46
47 /* Allocate memory, returns a virtual address */
48 ia_css_ptr hrt_isp_css_mm_alloc(size_t bytes);
49 ia_css_ptr hrt_isp_css_mm_alloc_user_ptr(size_t bytes, void *userptr,
50                                     unsigned int num_pages,
51                                     enum hrt_userptr_type,
52                                     bool cached);
53 ia_css_ptr hrt_isp_css_mm_alloc_cached(size_t bytes);
54
55 /* allocate memory and initialize with zeros,
56    returns a virtual address */
57 ia_css_ptr hrt_isp_css_mm_calloc(size_t bytes);
58 ia_css_ptr hrt_isp_css_mm_calloc_cached(size_t bytes);
59
60 #endif /* _hive_isp_css_mm_hrt_h_ */