ASoC: da7219: Correct IRQ level in DT binding example
[linux-2.6-microblaze.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / camera / util / interface / ia_css_util.h
1 /*
2  * Support for Intel Camera Imaging ISP subsystem.
3  * Copyright (c) 2015, Intel Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  */
14
15 #ifndef __IA_CSS_UTIL_H__
16 #define __IA_CSS_UTIL_H__
17
18 #include <ia_css_err.h>
19 #include <error_support.h>
20 #include <type_support.h>
21 #include <ia_css_frame_public.h>
22 #include <ia_css_stream_public.h>
23 #include <ia_css_stream_format.h>
24
25 /** @brief convert "errno" error code to "ia_css_err" error code
26  *
27  * @param[in]   "errno" error code
28  * @return      "ia_css_err" error code
29  *
30  */
31 enum ia_css_err ia_css_convert_errno(
32         int in_err);
33
34 /** @brief check vf frame info.
35  *
36  * @param[in] info
37  * @return      IA_CSS_SUCCESS or error code upon error.
38  *
39  */
40 extern enum ia_css_err ia_css_util_check_vf_info(
41         const struct ia_css_frame_info * const info);
42
43 /** @brief check input configuration.
44  *
45  * @param[in] stream_config
46  * @param[in] must_be_raw
47  * @return      IA_CSS_SUCCESS or error code upon error.
48  *
49  */
50 extern enum ia_css_err ia_css_util_check_input(
51         const struct ia_css_stream_config * const stream_config,
52         bool must_be_raw,
53         bool must_be_yuv);
54
55 /** @brief check vf and out frame info.
56  *
57  * @param[in] out_info
58  * @param[in] vf_info
59  * @return      IA_CSS_SUCCESS or error code upon error.
60  *
61  */
62 extern enum ia_css_err ia_css_util_check_vf_out_info(
63         const struct ia_css_frame_info * const out_info,
64         const struct ia_css_frame_info * const vf_info);
65
66 /** @brief check width and height
67  *
68  * @param[in] width
69  * @param[in] height
70  * @return      IA_CSS_SUCCESS or error code upon error.
71  *
72  */
73 extern enum ia_css_err ia_css_util_check_res(
74         unsigned int width,
75         unsigned int height);
76
77 #ifdef ISP2401
78 /** @brief compare resolutions (less or equal)
79  *
80  * @param[in] a resolution
81  * @param[in] b resolution
82  * @return    true if both dimensions of a are less or
83  *            equal than those of b, false otherwise
84  *
85  */
86 extern bool ia_css_util_res_leq(
87         struct ia_css_resolution a,
88         struct ia_css_resolution b);
89
90 /**
91  * @brief Check if resolution is zero
92  *
93  * @param[in] resolution The resolution to check
94  *
95  * @returns true if resolution is zero
96  */
97 extern bool ia_css_util_resolution_is_zero(
98                 const struct ia_css_resolution resolution);
99
100 /**
101  * @brief Check if resolution is even
102  *
103  * @param[in] resolution The resolution to check
104  *
105  * @returns true if resolution is even
106  */
107 extern bool ia_css_util_resolution_is_even(
108                 const struct ia_css_resolution resolution);
109
110 #endif
111 /** @brief check width and height
112  *
113  * @param[in] stream_format
114  * @param[in] two_ppc
115  * @return bits per pixel based on given parameters.
116  *
117  */
118 extern unsigned int ia_css_util_input_format_bpp(
119         enum ia_css_stream_format stream_format,
120         bool two_ppc);
121
122 /** @brief check if input format it raw
123  *
124  * @param[in] stream_format
125  * @return true if the input format is raw or false otherwise
126  *
127  */
128 extern bool ia_css_util_is_input_format_raw(
129         enum ia_css_stream_format stream_format);
130
131 /** @brief check if input format it yuv
132  *
133  * @param[in] stream_format
134  * @return true if the input format is yuv or false otherwise
135  *
136  */
137 extern bool ia_css_util_is_input_format_yuv(
138         enum ia_css_stream_format stream_format);
139
140 #endif /* __IA_CSS_UTIL_H__ */
141