]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_common.h
f1593aa38ce143f8d7bd61a6c5729d3b1aa7cf68
[mirror_ubuntu-bionic-kernel.git] / drivers / staging / media / atomisp / pci / atomisp2 / include / hmm / hmm_common.h
1 /*
2 * Support for Medifield 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 __HMM_BO_COMMON_H__
25 #define __HMM_BO_COMMON_H__
26
27 #define HMM_BO_NAME "HMM"
28
29 /*
30 * some common use micros
31 */
32 #define var_equal_return(var1, var2, exp, fmt, arg ...) \
33 do { \
34 if ((var1) == (var2)) { \
35 dev_err(atomisp_dev, \
36 fmt, ## arg); \
37 return exp;\
38 } \
39 } while (0)
40
41 #define var_equal_return_void(var1, var2, fmt, arg ...) \
42 do { \
43 if ((var1) == (var2)) { \
44 dev_err(atomisp_dev, \
45 fmt, ## arg); \
46 return;\
47 } \
48 } while (0)
49
50 #define var_equal_goto(var1, var2, label, fmt, arg ...) \
51 do { \
52 if ((var1) == (var2)) { \
53 dev_err(atomisp_dev, \
54 fmt, ## arg); \
55 goto label;\
56 } \
57 } while (0)
58
59 #define var_not_equal_goto(var1, var2, label, fmt, arg ...) \
60 do { \
61 if ((var1) != (var2)) { \
62 dev_err(atomisp_dev, \
63 fmt, ## arg); \
64 goto label;\
65 } \
66 } while (0)
67
68 #define check_null_return(ptr, exp, fmt, arg ...) \
69 var_equal_return(ptr, NULL, exp, fmt, ## arg)
70
71 #define check_null_return_void(ptr, fmt, arg ...) \
72 var_equal_return_void(ptr, NULL, fmt, ## arg)
73
74 /* hmm_mem_stat is used to trace the hmm mem used by ISP pipe. The unit is page
75 * number.
76 *
77 * res_size: reserved mem pool size, being allocated from system at system boot time.
78 * res_size >= res_cnt.
79 * sys_size: system mem pool size, being allocated from system at camera running time.
80 * dyc_size: dynamic mem pool size.
81 * dyc_thr: dynamic mem pool high watermark.
82 * dyc_size <= dyc_thr.
83 * usr_size: user ptr mem size.
84 *
85 * res_cnt: track the mem allocated from reserved pool at camera running time.
86 * tol_cnt: track the total mem used by ISP pipe at camera running time.
87 */
88 struct _hmm_mem_stat {
89 int res_size;
90 int sys_size;
91 int dyc_size;
92 int dyc_thr;
93 int usr_size;
94 int res_cnt;
95 int tol_cnt;
96 };
97
98 extern struct _hmm_mem_stat hmm_mem_stat;
99
100 #endif