1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Support for Intel Camera Imaging ISP subsystem. 4 * Copyright (c) 2015, Intel Corporation. 5 */ 6 7 #ifndef __IA_CSS_UTIL_H__ 8 #define __IA_CSS_UTIL_H__ 9 10 #include <linux/errno.h> 11 12 #include <ia_css_err.h> 13 #include <type_support.h> 14 #include <ia_css_frame_public.h> 15 #include <ia_css_stream_public.h> 16 #include <ia_css_stream_format.h> 17 18 /* @brief convert "errno" error code to "ia_css_err" error code 19 * 20 * @param[in] "errno" error code 21 * @return "ia_css_err" error code 22 * 23 */ 24 int ia_css_convert_errno( 25 int in_err); 26 27 /* @brief check vf frame info. 28 * 29 * @param[in] info 30 * @return 0 or error code upon error. 31 * 32 */ 33 int ia_css_util_check_vf_info( 34 const struct ia_css_frame_info *const info); 35 36 /* @brief check input configuration. 37 * 38 * @param[in] stream_config 39 * @param[in] must_be_raw 40 * @return 0 or error code upon error. 41 * 42 */ 43 int ia_css_util_check_input( 44 const struct ia_css_stream_config *const stream_config, 45 bool must_be_raw, 46 bool must_be_yuv); 47 48 /* @brief check vf and out frame info. 49 * 50 * @param[in] out_info 51 * @param[in] vf_info 52 * @return 0 or error code upon error. 53 * 54 */ 55 int ia_css_util_check_vf_out_info( 56 const struct ia_css_frame_info *const out_info, 57 const struct ia_css_frame_info *const vf_info); 58 59 /* @brief check width and height 60 * 61 * @param[in] width 62 * @param[in] height 63 * @return 0 or error code upon error. 64 * 65 */ 66 int ia_css_util_check_res( 67 unsigned int width, 68 unsigned int height); 69 70 /* ISP2401 */ 71 /* @brief compare resolutions (less or equal) 72 * 73 * @param[in] a resolution 74 * @param[in] b resolution 75 * @return true if both dimensions of a are less or 76 * equal than those of b, false otherwise 77 * 78 */ 79 bool ia_css_util_res_leq( 80 struct ia_css_resolution a, 81 struct ia_css_resolution b); 82 83 /* ISP2401 */ 84 /** 85 * @brief Check if resolution is zero 86 * 87 * @param[in] resolution The resolution to check 88 * 89 * @returns true if resolution is zero 90 */ 91 bool ia_css_util_resolution_is_zero( 92 const struct ia_css_resolution resolution); 93 94 /* @brief check width and height 95 * 96 * @param[in] stream_format 97 * @param[in] two_ppc 98 * @return bits per pixel based on given parameters. 99 * 100 */ 101 unsigned int ia_css_util_input_format_bpp( 102 enum atomisp_input_format stream_format, 103 bool two_ppc); 104 105 /* @brief check if input format it raw 106 * 107 * @param[in] stream_format 108 * @return true if the input format is raw or false otherwise 109 * 110 */ 111 bool ia_css_util_is_input_format_raw( 112 enum atomisp_input_format stream_format); 113 114 /* @brief check if input format it yuv 115 * 116 * @param[in] stream_format 117 * @return true if the input format is yuv or false otherwise 118 * 119 */ 120 bool ia_css_util_is_input_format_yuv( 121 enum atomisp_input_format stream_format); 122 123 #endif /* __IA_CSS_UTIL_H__ */ 124