1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Samsung Exynos4 SoC series FIMC-IS slave interface driver
4  *
5  * Error log interface functions
6  *
7  * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd.
8  *
9  * Authors: Younghwan Joo <yhwan.joo@samsung.com>
10  *          Sylwester Nawrocki <s.nawrocki@samsung.com>
11  */
12 
13 #include "fimc-is-errno.h"
14 
fimc_is_param_strerr(unsigned int error)15 const char *fimc_is_param_strerr(unsigned int error)
16 {
17 	switch (error) {
18 	case ERROR_COMMON_CMD:
19 		return "ERROR_COMMON_CMD: Invalid Command";
20 	case ERROR_COMMON_PARAMETER:
21 		return "ERROR_COMMON_PARAMETER: Invalid Parameter";
22 	case ERROR_COMMON_SETFILE_LOAD:
23 		return "ERROR_COMMON_SETFILE_LOAD: Illegal Setfile Loading";
24 	case ERROR_COMMON_SETFILE_ADJUST:
25 		return "ERROR_COMMON_SETFILE_ADJUST: Setfile isn't adjusted";
26 	case ERROR_COMMON_SETFILE_INDEX:
27 		return "ERROR_COMMON_SETFILE_INDEX: Invalid setfile index";
28 	case ERROR_COMMON_INPUT_PATH:
29 		return "ERROR_COMMON_INPUT_PATH: Input path can be changed in ready state";
30 	case ERROR_COMMON_INPUT_INIT:
31 		return "ERROR_COMMON_INPUT_INIT: IP can not start if input path is not set";
32 	case ERROR_COMMON_OUTPUT_PATH:
33 		return "ERROR_COMMON_OUTPUT_PATH: Output path can be changed in ready state (stop)";
34 	case ERROR_COMMON_OUTPUT_INIT:
35 		return "ERROR_COMMON_OUTPUT_INIT: IP can not start if output path is not set";
36 	case ERROR_CONTROL_BYPASS:
37 		return "ERROR_CONTROL_BYPASS";
38 	case ERROR_OTF_INPUT_FORMAT:
39 		return "ERROR_OTF_INPUT_FORMAT: Invalid format  (DRC: YUV444, FD: YUV444, 422, 420)";
40 	case ERROR_OTF_INPUT_WIDTH:
41 		return "ERROR_OTF_INPUT_WIDTH: Invalid width (DRC: 128~8192, FD: 32~8190)";
42 	case ERROR_OTF_INPUT_HEIGHT:
43 		return "ERROR_OTF_INPUT_HEIGHT: Invalid bit-width (DRC: 8~12bits, FD: 8bit)";
44 	case ERROR_OTF_INPUT_BIT_WIDTH:
45 		return "ERROR_OTF_INPUT_BIT_WIDTH: Invalid bit-width (DRC: 8~12bits, FD: 8bit)";
46 	case ERROR_DMA_INPUT_WIDTH:
47 		return "ERROR_DMA_INPUT_WIDTH: Invalid width (DRC: 128~8192, FD: 32~8190)";
48 	case ERROR_DMA_INPUT_HEIGHT:
49 		return "ERROR_DMA_INPUT_HEIGHT: Invalid height (DRC: 64~8192, FD: 16~8190)";
50 	case ERROR_DMA_INPUT_FORMAT:
51 		return "ERROR_DMA_INPUT_FORMAT: Invalid format (DRC: YUV444 or YUV422, FD: YUV444,422,420)";
52 	case ERROR_DMA_INPUT_BIT_WIDTH:
53 		return "ERROR_DMA_INPUT_BIT_WIDTH: Invalid bit-width (DRC: 8~12bits, FD: 8bit)";
54 	case ERROR_DMA_INPUT_ORDER:
55 		return "ERROR_DMA_INPUT_ORDER: Invalid order(DRC: YYCbCr,YCbYCr,FD:NO,YYCbCr,YCbYCr,CbCr,CrCb)";
56 	case ERROR_DMA_INPUT_PLANE:
57 		return "ERROR_DMA_INPUT_PLANE: Invalid palne (DRC: 3, FD: 1, 2, 3)";
58 	case ERROR_OTF_OUTPUT_WIDTH:
59 		return "ERROR_OTF_OUTPUT_WIDTH: Invalid width (DRC: 128~8192)";
60 	case ERROR_OTF_OUTPUT_HEIGHT:
61 		return "ERROR_OTF_OUTPUT_HEIGHT: Invalid height (DRC: 64~8192)";
62 	case ERROR_OTF_OUTPUT_FORMAT:
63 		return "ERROR_OTF_OUTPUT_FORMAT: Invalid format (DRC: YUV444)";
64 	case ERROR_OTF_OUTPUT_BIT_WIDTH:
65 		return "ERROR_OTF_OUTPUT_BIT_WIDTH: Invalid bit-width (DRC: 8~12bits, FD: 8bit)";
66 	case ERROR_DMA_OUTPUT_WIDTH:
67 		return "ERROR_DMA_OUTPUT_WIDTH";
68 	case ERROR_DMA_OUTPUT_HEIGHT:
69 		return "ERROR_DMA_OUTPUT_HEIGHT";
70 	case ERROR_DMA_OUTPUT_FORMAT:
71 		return "ERROR_DMA_OUTPUT_FORMAT";
72 	case ERROR_DMA_OUTPUT_BIT_WIDTH:
73 		return "ERROR_DMA_OUTPUT_BIT_WIDTH";
74 	case ERROR_DMA_OUTPUT_PLANE:
75 		return "ERROR_DMA_OUTPUT_PLANE";
76 	case ERROR_DMA_OUTPUT_ORDER:
77 		return "ERROR_DMA_OUTPUT_ORDER";
78 
79 	/* Sensor Error(100~199) */
80 	case ERROR_SENSOR_I2C_FAIL:
81 		return "ERROR_SENSOR_I2C_FAIL";
82 	case ERROR_SENSOR_INVALID_FRAMERATE:
83 		return "ERROR_SENSOR_INVALID_FRAMERATE";
84 	case ERROR_SENSOR_INVALID_EXPOSURETIME:
85 		return "ERROR_SENSOR_INVALID_EXPOSURETIME";
86 	case ERROR_SENSOR_INVALID_SIZE:
87 		return "ERROR_SENSOR_INVALID_SIZE";
88 	case ERROR_SENSOR_INVALID_SETTING:
89 		return "ERROR_SENSOR_INVALID_SETTING";
90 	case ERROR_SENSOR_ACTUATOR_INIT_FAIL:
91 		return "ERROR_SENSOR_ACTUATOR_INIT_FAIL";
92 	case ERROR_SENSOR_INVALID_AF_POS:
93 		return "ERROR_SENSOR_INVALID_AF_POS";
94 	case ERROR_SENSOR_UNSUPPORT_FUNC:
95 		return "ERROR_SENSOR_UNSUPPORT_FUNC";
96 	case ERROR_SENSOR_UNSUPPORT_PERI:
97 		return "ERROR_SENSOR_UNSUPPORT_PERI";
98 	case ERROR_SENSOR_UNSUPPORT_AF:
99 		return "ERROR_SENSOR_UNSUPPORT_AF";
100 
101 	/* ISP Error (200~299) */
102 	case ERROR_ISP_AF_BUSY:
103 		return "ERROR_ISP_AF_BUSY";
104 	case ERROR_ISP_AF_INVALID_COMMAND:
105 		return "ERROR_ISP_AF_INVALID_COMMAND";
106 	case ERROR_ISP_AF_INVALID_MODE:
107 		return "ERROR_ISP_AF_INVALID_MODE";
108 
109 	/* DRC Error (300~399) */
110 	/* FD Error  (400~499) */
111 	case ERROR_FD_CONFIG_MAX_NUMBER_STATE:
112 		return "ERROR_FD_CONFIG_MAX_NUMBER_STATE";
113 	case ERROR_FD_CONFIG_MAX_NUMBER_INVALID:
114 		return "ERROR_FD_CONFIG_MAX_NUMBER_INVALID";
115 	case ERROR_FD_CONFIG_YAW_ANGLE_STATE:
116 		return "ERROR_FD_CONFIG_YAW_ANGLE_STATE";
117 	case ERROR_FD_CONFIG_YAW_ANGLE_INVALID:
118 		return "ERROR_FD_CONFIG_YAW_ANGLE_INVALID\n";
119 	case ERROR_FD_CONFIG_ROLL_ANGLE_STATE:
120 		return "ERROR_FD_CONFIG_ROLL_ANGLE_STATE";
121 	case ERROR_FD_CONFIG_ROLL_ANGLE_INVALID:
122 		return "ERROR_FD_CONFIG_ROLL_ANGLE_INVALID";
123 	case ERROR_FD_CONFIG_SMILE_MODE_INVALID:
124 		return "ERROR_FD_CONFIG_SMILE_MODE_INVALID";
125 	case ERROR_FD_CONFIG_BLINK_MODE_INVALID:
126 		return "ERROR_FD_CONFIG_BLINK_MODE_INVALID";
127 	case ERROR_FD_CONFIG_EYES_DETECT_INVALID:
128 		return "ERROR_FD_CONFIG_EYES_DETECT_INVALID";
129 	case ERROR_FD_CONFIG_MOUTH_DETECT_INVALID:
130 		return "ERROR_FD_CONFIG_MOUTH_DETECT_INVALID";
131 	case ERROR_FD_CONFIG_ORIENTATION_STATE:
132 		return "ERROR_FD_CONFIG_ORIENTATION_STATE";
133 	case ERROR_FD_CONFIG_ORIENTATION_INVALID:
134 		return "ERROR_FD_CONFIG_ORIENTATION_INVALID";
135 	case ERROR_FD_CONFIG_ORIENTATION_VALUE_INVALID:
136 		return "ERROR_FD_CONFIG_ORIENTATION_VALUE_INVALID";
137 	case ERROR_FD_RESULT:
138 		return "ERROR_FD_RESULT";
139 	case ERROR_FD_MODE:
140 		return "ERROR_FD_MODE";
141 	default:
142 		return "Unknown";
143 	}
144 }
145 
fimc_is_strerr(unsigned int error)146 const char *fimc_is_strerr(unsigned int error)
147 {
148 	error &= ~IS_ERROR_TIME_OUT_FLAG;
149 
150 	switch (error) {
151 	/* General */
152 	case IS_ERROR_INVALID_COMMAND:
153 		return "IS_ERROR_INVALID_COMMAND";
154 	case IS_ERROR_REQUEST_FAIL:
155 		return "IS_ERROR_REQUEST_FAIL";
156 	case IS_ERROR_INVALID_SCENARIO:
157 		return "IS_ERROR_INVALID_SCENARIO";
158 	case IS_ERROR_INVALID_SENSORID:
159 		return "IS_ERROR_INVALID_SENSORID";
160 	case IS_ERROR_INVALID_MODE_CHANGE:
161 		return "IS_ERROR_INVALID_MODE_CHANGE";
162 	case IS_ERROR_INVALID_MAGIC_NUMBER:
163 		return "IS_ERROR_INVALID_MAGIC_NUMBER";
164 	case IS_ERROR_INVALID_SETFILE_HDR:
165 		return "IS_ERROR_INVALID_SETFILE_HDR";
166 	case IS_ERROR_BUSY:
167 		return "IS_ERROR_BUSY";
168 	case IS_ERROR_SET_PARAMETER:
169 		return "IS_ERROR_SET_PARAMETER";
170 	case IS_ERROR_INVALID_PATH:
171 		return "IS_ERROR_INVALID_PATH";
172 	case IS_ERROR_OPEN_SENSOR_FAIL:
173 		return "IS_ERROR_OPEN_SENSOR_FAIL";
174 	case IS_ERROR_ENTRY_MSG_THREAD_DOWN:
175 		return "IS_ERROR_ENTRY_MSG_THREAD_DOWN";
176 	case IS_ERROR_ISP_FRAME_END_NOT_DONE:
177 		return "IS_ERROR_ISP_FRAME_END_NOT_DONE";
178 	case IS_ERROR_DRC_FRAME_END_NOT_DONE:
179 		return "IS_ERROR_DRC_FRAME_END_NOT_DONE";
180 	case IS_ERROR_SCALERC_FRAME_END_NOT_DONE:
181 		return "IS_ERROR_SCALERC_FRAME_END_NOT_DONE";
182 	case IS_ERROR_ODC_FRAME_END_NOT_DONE:
183 		return "IS_ERROR_ODC_FRAME_END_NOT_DONE";
184 	case IS_ERROR_DIS_FRAME_END_NOT_DONE:
185 		return "IS_ERROR_DIS_FRAME_END_NOT_DONE";
186 	case IS_ERROR_TDNR_FRAME_END_NOT_DONE:
187 		return "IS_ERROR_TDNR_FRAME_END_NOT_DONE";
188 	case IS_ERROR_SCALERP_FRAME_END_NOT_DONE:
189 		return "IS_ERROR_SCALERP_FRAME_END_NOT_DONE";
190 	case IS_ERROR_WAIT_STREAM_OFF_NOT_DONE:
191 		return "IS_ERROR_WAIT_STREAM_OFF_NOT_DONE";
192 	case IS_ERROR_NO_MSG_IS_RECEIVED:
193 		return "IS_ERROR_NO_MSG_IS_RECEIVED";
194 	case IS_ERROR_SENSOR_MSG_FAIL:
195 		return "IS_ERROR_SENSOR_MSG_FAIL";
196 	case IS_ERROR_ISP_MSG_FAIL:
197 		return "IS_ERROR_ISP_MSG_FAIL";
198 	case IS_ERROR_DRC_MSG_FAIL:
199 		return "IS_ERROR_DRC_MSG_FAIL";
200 	case IS_ERROR_LHFD_MSG_FAIL:
201 		return "IS_ERROR_LHFD_MSG_FAIL";
202 	case IS_ERROR_UNKNOWN:
203 		return "IS_ERROR_UNKNOWN";
204 
205 	/* Sensor */
206 	case IS_ERROR_SENSOR_PWRDN_FAIL:
207 		return "IS_ERROR_SENSOR_PWRDN_FAIL";
208 
209 	/* ISP */
210 	case IS_ERROR_ISP_PWRDN_FAIL:
211 		return "IS_ERROR_ISP_PWRDN_FAIL";
212 	case IS_ERROR_ISP_MULTIPLE_INPUT:
213 		return "IS_ERROR_ISP_MULTIPLE_INPUT";
214 	case IS_ERROR_ISP_ABSENT_INPUT:
215 		return "IS_ERROR_ISP_ABSENT_INPUT";
216 	case IS_ERROR_ISP_ABSENT_OUTPUT:
217 		return "IS_ERROR_ISP_ABSENT_OUTPUT";
218 	case IS_ERROR_ISP_NONADJACENT_OUTPUT:
219 		return "IS_ERROR_ISP_NONADJACENT_OUTPUT";
220 	case IS_ERROR_ISP_FORMAT_MISMATCH:
221 		return "IS_ERROR_ISP_FORMAT_MISMATCH";
222 	case IS_ERROR_ISP_WIDTH_MISMATCH:
223 		return "IS_ERROR_ISP_WIDTH_MISMATCH";
224 	case IS_ERROR_ISP_HEIGHT_MISMATCH:
225 		return "IS_ERROR_ISP_HEIGHT_MISMATCH";
226 	case IS_ERROR_ISP_BITWIDTH_MISMATCH:
227 		return "IS_ERROR_ISP_BITWIDTH_MISMATCH";
228 	case IS_ERROR_ISP_FRAME_END_TIME_OUT:
229 		return "IS_ERROR_ISP_FRAME_END_TIME_OUT";
230 
231 	/* DRC */
232 	case IS_ERROR_DRC_PWRDN_FAIL:
233 		return "IS_ERROR_DRC_PWRDN_FAIL";
234 	case IS_ERROR_DRC_MULTIPLE_INPUT:
235 		return "IS_ERROR_DRC_MULTIPLE_INPUT";
236 	case IS_ERROR_DRC_ABSENT_INPUT:
237 		return "IS_ERROR_DRC_ABSENT_INPUT";
238 	case IS_ERROR_DRC_NONADJACENT_INPUT:
239 		return "IS_ERROR_DRC_NONADJACENT_INPUT";
240 	case IS_ERROR_DRC_ABSENT_OUTPUT:
241 		return "IS_ERROR_DRC_ABSENT_OUTPUT";
242 	case IS_ERROR_DRC_NONADJACENT_OUTPUT:
243 		return "IS_ERROR_DRC_NONADJACENT_OUTPUT";
244 	case IS_ERROR_DRC_FORMAT_MISMATCH:
245 		return "IS_ERROR_DRC_FORMAT_MISMATCH";
246 	case IS_ERROR_DRC_WIDTH_MISMATCH:
247 		return "IS_ERROR_DRC_WIDTH_MISMATCH";
248 	case IS_ERROR_DRC_HEIGHT_MISMATCH:
249 		return "IS_ERROR_DRC_HEIGHT_MISMATCH";
250 	case IS_ERROR_DRC_BITWIDTH_MISMATCH:
251 		return "IS_ERROR_DRC_BITWIDTH_MISMATCH";
252 	case IS_ERROR_DRC_FRAME_END_TIME_OUT:
253 		return "IS_ERROR_DRC_FRAME_END_TIME_OUT";
254 
255 	/* FD */
256 	case IS_ERROR_FD_PWRDN_FAIL:
257 		return "IS_ERROR_FD_PWRDN_FAIL";
258 	case IS_ERROR_FD_MULTIPLE_INPUT:
259 		return "IS_ERROR_FD_MULTIPLE_INPUT";
260 	case IS_ERROR_FD_ABSENT_INPUT:
261 		return "IS_ERROR_FD_ABSENT_INPUT";
262 	case IS_ERROR_FD_NONADJACENT_INPUT:
263 		return "IS_ERROR_FD_NONADJACENT_INPUT";
264 	case IS_ERROR_LHFD_FRAME_END_TIME_OUT:
265 		return "IS_ERROR_LHFD_FRAME_END_TIME_OUT";
266 	default:
267 		return "Unknown";
268 	}
269 }
270