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