GNU Linux-libre 4.14.251-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / atomisp_dfs_tables.h
1 /*
2  * Support for Intel Camera Imaging ISP subsystem.
3  *
4  * Copyright (c) 2013 Intel Corporation. All Rights Reserved.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License version
8  * 2 as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18  * 02110-1301, USA.
19  *
20  */
21 #ifndef __ATOMISP_DFS_TABLES_H__
22 #define __ATOMISP_DFS_TABLES_H__
23
24 #include <linux/kernel.h>
25
26 struct atomisp_freq_scaling_rule {
27         unsigned int width;
28         unsigned int height;
29         unsigned short fps;
30         unsigned int isp_freq;
31         unsigned int run_mode;
32 };
33
34
35 struct atomisp_dfs_config {
36         unsigned int lowest_freq;
37         unsigned int max_freq_at_vmin;
38         unsigned int highest_freq;
39         const struct atomisp_freq_scaling_rule *dfs_table;
40         unsigned int dfs_table_size;
41 };
42
43 static const struct atomisp_freq_scaling_rule dfs_rules_merr[] = {
44         {
45                 .width = ISP_FREQ_RULE_ANY,
46                 .height = ISP_FREQ_RULE_ANY,
47                 .fps = ISP_FREQ_RULE_ANY,
48                 .isp_freq = ISP_FREQ_400MHZ,
49                 .run_mode = ATOMISP_RUN_MODE_VIDEO,
50         },
51         {
52                 .width = ISP_FREQ_RULE_ANY,
53                 .height = ISP_FREQ_RULE_ANY,
54                 .fps = ISP_FREQ_RULE_ANY,
55                 .isp_freq = ISP_FREQ_400MHZ,
56                 .run_mode = ATOMISP_RUN_MODE_STILL_CAPTURE,
57         },
58         {
59                 .width = ISP_FREQ_RULE_ANY,
60                 .height = ISP_FREQ_RULE_ANY,
61                 .fps = ISP_FREQ_RULE_ANY,
62                 .isp_freq = ISP_FREQ_400MHZ,
63                 .run_mode = ATOMISP_RUN_MODE_CONTINUOUS_CAPTURE,
64         },
65         {
66                 .width = ISP_FREQ_RULE_ANY,
67                 .height = ISP_FREQ_RULE_ANY,
68                 .fps = ISP_FREQ_RULE_ANY,
69                 .isp_freq = ISP_FREQ_400MHZ,
70                 .run_mode = ATOMISP_RUN_MODE_PREVIEW,
71         },
72         {
73                 .width = ISP_FREQ_RULE_ANY,
74                 .height = ISP_FREQ_RULE_ANY,
75                 .fps = ISP_FREQ_RULE_ANY,
76                 .isp_freq = ISP_FREQ_457MHZ,
77                 .run_mode = ATOMISP_RUN_MODE_SDV,
78         },
79 };
80
81 /* Merrifield and Moorefield DFS rules */
82 static const struct atomisp_dfs_config dfs_config_merr = {
83         .lowest_freq = ISP_FREQ_200MHZ,
84         .max_freq_at_vmin = ISP_FREQ_400MHZ,
85         .highest_freq = ISP_FREQ_457MHZ,
86         .dfs_table = dfs_rules_merr,
87         .dfs_table_size = ARRAY_SIZE(dfs_rules_merr),
88 };
89
90 static const struct atomisp_freq_scaling_rule dfs_rules_merr_1179[] = {
91         {
92                 .width = ISP_FREQ_RULE_ANY,
93                 .height = ISP_FREQ_RULE_ANY,
94                 .fps = ISP_FREQ_RULE_ANY,
95                 .isp_freq = ISP_FREQ_400MHZ,
96                 .run_mode = ATOMISP_RUN_MODE_VIDEO,
97         },
98         {
99                 .width = ISP_FREQ_RULE_ANY,
100                 .height = ISP_FREQ_RULE_ANY,
101                 .fps = ISP_FREQ_RULE_ANY,
102                 .isp_freq = ISP_FREQ_400MHZ,
103                 .run_mode = ATOMISP_RUN_MODE_STILL_CAPTURE,
104         },
105         {
106                 .width = ISP_FREQ_RULE_ANY,
107                 .height = ISP_FREQ_RULE_ANY,
108                 .fps = ISP_FREQ_RULE_ANY,
109                 .isp_freq = ISP_FREQ_400MHZ,
110                 .run_mode = ATOMISP_RUN_MODE_CONTINUOUS_CAPTURE,
111         },
112         {
113                 .width = ISP_FREQ_RULE_ANY,
114                 .height = ISP_FREQ_RULE_ANY,
115                 .fps = ISP_FREQ_RULE_ANY,
116                 .isp_freq = ISP_FREQ_400MHZ,
117                 .run_mode = ATOMISP_RUN_MODE_PREVIEW,
118         },
119         {
120                 .width = ISP_FREQ_RULE_ANY,
121                 .height = ISP_FREQ_RULE_ANY,
122                 .fps = ISP_FREQ_RULE_ANY,
123                 .isp_freq = ISP_FREQ_400MHZ,
124                 .run_mode = ATOMISP_RUN_MODE_SDV,
125         },
126 };
127
128 static const struct atomisp_dfs_config dfs_config_merr_1179 = {
129         .lowest_freq = ISP_FREQ_200MHZ,
130         .max_freq_at_vmin = ISP_FREQ_400MHZ,
131         .highest_freq = ISP_FREQ_400MHZ,
132         .dfs_table = dfs_rules_merr_1179,
133         .dfs_table_size = ARRAY_SIZE(dfs_rules_merr_1179),
134 };
135
136 static const struct atomisp_freq_scaling_rule dfs_rules_merr_117a[] = {
137         {
138                 .width = 1920,
139                 .height = 1080,
140                 .fps = 30,
141                 .isp_freq = ISP_FREQ_266MHZ,
142                 .run_mode = ATOMISP_RUN_MODE_VIDEO,
143         },
144         {
145                 .width = 1080,
146                 .height = 1920,
147                 .fps = 30,
148 #ifndef ISP2401
149                 .isp_freq = ISP_FREQ_266MHZ,
150 #else
151                 .isp_freq = ISP_FREQ_400MHZ,
152 #endif
153                 .run_mode = ATOMISP_RUN_MODE_VIDEO,
154         },
155         {
156                 .width = 1920,
157                 .height = 1080,
158                 .fps = 45,
159                 .isp_freq = ISP_FREQ_320MHZ,
160                 .run_mode = ATOMISP_RUN_MODE_VIDEO,
161         },
162         {
163                 .width = 1080,
164                 .height = 1920,
165                 .fps = 45,
166                 .isp_freq = ISP_FREQ_320MHZ,
167                 .run_mode = ATOMISP_RUN_MODE_VIDEO,
168         },
169         {
170                 .width = ISP_FREQ_RULE_ANY,
171                 .height = ISP_FREQ_RULE_ANY,
172                 .fps = 60,
173                 .isp_freq = ISP_FREQ_356MHZ,
174                 .run_mode = ATOMISP_RUN_MODE_VIDEO,
175         },
176         {
177                 .width = ISP_FREQ_RULE_ANY,
178                 .height = ISP_FREQ_RULE_ANY,
179                 .fps = ISP_FREQ_RULE_ANY,
180                 .isp_freq = ISP_FREQ_200MHZ,
181                 .run_mode = ATOMISP_RUN_MODE_VIDEO,
182         },
183         {
184                 .width = ISP_FREQ_RULE_ANY,
185                 .height = ISP_FREQ_RULE_ANY,
186                 .fps = ISP_FREQ_RULE_ANY,
187                 .isp_freq = ISP_FREQ_400MHZ,
188                 .run_mode = ATOMISP_RUN_MODE_STILL_CAPTURE,
189         },
190         {
191                 .width = ISP_FREQ_RULE_ANY,
192                 .height = ISP_FREQ_RULE_ANY,
193                 .fps = ISP_FREQ_RULE_ANY,
194                 .isp_freq = ISP_FREQ_400MHZ,
195                 .run_mode = ATOMISP_RUN_MODE_CONTINUOUS_CAPTURE,
196         },
197         {
198                 .width = ISP_FREQ_RULE_ANY,
199                 .height = ISP_FREQ_RULE_ANY,
200                 .fps = ISP_FREQ_RULE_ANY,
201                 .isp_freq = ISP_FREQ_200MHZ,
202                 .run_mode = ATOMISP_RUN_MODE_PREVIEW,
203         },
204         {
205                 .width = ISP_FREQ_RULE_ANY,
206                 .height = ISP_FREQ_RULE_ANY,
207                 .fps = ISP_FREQ_RULE_ANY,
208                 .isp_freq = ISP_FREQ_400MHZ,
209                 .run_mode = ATOMISP_RUN_MODE_SDV,
210         },
211 };
212
213 static const struct atomisp_dfs_config dfs_config_merr_117a = {
214         .lowest_freq = ISP_FREQ_200MHZ,
215         .max_freq_at_vmin = ISP_FREQ_200MHZ,
216         .highest_freq = ISP_FREQ_400MHZ,
217         .dfs_table = dfs_rules_merr_117a,
218         .dfs_table_size = ARRAY_SIZE(dfs_rules_merr_117a),
219 };
220
221 static const struct atomisp_freq_scaling_rule dfs_rules_byt[] = {
222         {
223                 .width = ISP_FREQ_RULE_ANY,
224                 .height = ISP_FREQ_RULE_ANY,
225                 .fps = ISP_FREQ_RULE_ANY,
226                 .isp_freq = ISP_FREQ_400MHZ,
227                 .run_mode = ATOMISP_RUN_MODE_VIDEO,
228         },
229         {
230                 .width = ISP_FREQ_RULE_ANY,
231                 .height = ISP_FREQ_RULE_ANY,
232                 .fps = ISP_FREQ_RULE_ANY,
233                 .isp_freq = ISP_FREQ_400MHZ,
234                 .run_mode = ATOMISP_RUN_MODE_STILL_CAPTURE,
235         },
236         {
237                 .width = ISP_FREQ_RULE_ANY,
238                 .height = ISP_FREQ_RULE_ANY,
239                 .fps = ISP_FREQ_RULE_ANY,
240                 .isp_freq = ISP_FREQ_400MHZ,
241                 .run_mode = ATOMISP_RUN_MODE_CONTINUOUS_CAPTURE,
242         },
243         {
244                 .width = ISP_FREQ_RULE_ANY,
245                 .height = ISP_FREQ_RULE_ANY,
246                 .fps = ISP_FREQ_RULE_ANY,
247                 .isp_freq = ISP_FREQ_400MHZ,
248                 .run_mode = ATOMISP_RUN_MODE_PREVIEW,
249         },
250         {
251                 .width = ISP_FREQ_RULE_ANY,
252                 .height = ISP_FREQ_RULE_ANY,
253                 .fps = ISP_FREQ_RULE_ANY,
254                 .isp_freq = ISP_FREQ_400MHZ,
255                 .run_mode = ATOMISP_RUN_MODE_SDV,
256         },
257 };
258
259 static const struct atomisp_dfs_config dfs_config_byt = {
260         .lowest_freq = ISP_FREQ_200MHZ,
261         .max_freq_at_vmin = ISP_FREQ_400MHZ,
262         .highest_freq = ISP_FREQ_400MHZ,
263         .dfs_table = dfs_rules_byt,
264         .dfs_table_size = ARRAY_SIZE(dfs_rules_byt),
265 };
266
267 static const struct atomisp_freq_scaling_rule dfs_rules_byt_cr[] = {
268         {
269                 .width = ISP_FREQ_RULE_ANY,
270                 .height = ISP_FREQ_RULE_ANY,
271                 .fps = ISP_FREQ_RULE_ANY,
272                 .isp_freq = ISP_FREQ_320MHZ,
273                 .run_mode = ATOMISP_RUN_MODE_VIDEO,
274         },
275         {
276                 .width = ISP_FREQ_RULE_ANY,
277                 .height = ISP_FREQ_RULE_ANY,
278                 .fps = ISP_FREQ_RULE_ANY,
279                 .isp_freq = ISP_FREQ_320MHZ,
280                 .run_mode = ATOMISP_RUN_MODE_STILL_CAPTURE,
281         },
282         {
283                 .width = ISP_FREQ_RULE_ANY,
284                 .height = ISP_FREQ_RULE_ANY,
285                 .fps = ISP_FREQ_RULE_ANY,
286                 .isp_freq = ISP_FREQ_320MHZ,
287                 .run_mode = ATOMISP_RUN_MODE_CONTINUOUS_CAPTURE,
288         },
289         {
290                 .width = ISP_FREQ_RULE_ANY,
291                 .height = ISP_FREQ_RULE_ANY,
292                 .fps = ISP_FREQ_RULE_ANY,
293                 .isp_freq = ISP_FREQ_320MHZ,
294                 .run_mode = ATOMISP_RUN_MODE_PREVIEW,
295         },
296         {
297                 .width = ISP_FREQ_RULE_ANY,
298                 .height = ISP_FREQ_RULE_ANY,
299                 .fps = ISP_FREQ_RULE_ANY,
300                 .isp_freq = ISP_FREQ_320MHZ,
301                 .run_mode = ATOMISP_RUN_MODE_SDV,
302         },
303 };
304
305 static const struct atomisp_dfs_config dfs_config_byt_cr = {
306         .lowest_freq = ISP_FREQ_200MHZ,
307         .max_freq_at_vmin = ISP_FREQ_320MHZ,
308         .highest_freq = ISP_FREQ_320MHZ,
309         .dfs_table = dfs_rules_byt_cr,
310         .dfs_table_size = ARRAY_SIZE(dfs_rules_byt_cr),
311 };
312
313 static const struct atomisp_freq_scaling_rule dfs_rules_cht[] = {
314         {
315                 .width = ISP_FREQ_RULE_ANY,
316                 .height = ISP_FREQ_RULE_ANY,
317                 .fps = ISP_FREQ_RULE_ANY,
318                 .isp_freq = ISP_FREQ_320MHZ,
319                 .run_mode = ATOMISP_RUN_MODE_VIDEO,
320         },
321         {
322                 .width = ISP_FREQ_RULE_ANY,
323                 .height = ISP_FREQ_RULE_ANY,
324                 .fps = ISP_FREQ_RULE_ANY,
325                 .isp_freq = ISP_FREQ_356MHZ,
326                 .run_mode = ATOMISP_RUN_MODE_STILL_CAPTURE,
327         },
328         {
329                 .width = ISP_FREQ_RULE_ANY,
330                 .height = ISP_FREQ_RULE_ANY,
331                 .fps = ISP_FREQ_RULE_ANY,
332                 .isp_freq = ISP_FREQ_320MHZ,
333                 .run_mode = ATOMISP_RUN_MODE_CONTINUOUS_CAPTURE,
334         },
335         {
336                 .width = ISP_FREQ_RULE_ANY,
337                 .height = ISP_FREQ_RULE_ANY,
338                 .fps = ISP_FREQ_RULE_ANY,
339                 .isp_freq = ISP_FREQ_320MHZ,
340                 .run_mode = ATOMISP_RUN_MODE_PREVIEW,
341         },
342         {
343                 .width = 1280,
344                 .height = 720,
345                 .fps = ISP_FREQ_RULE_ANY,
346                 .isp_freq = ISP_FREQ_320MHZ,
347                 .run_mode = ATOMISP_RUN_MODE_SDV,
348         },
349         {
350                 .width = ISP_FREQ_RULE_ANY,
351                 .height = ISP_FREQ_RULE_ANY,
352                 .fps = ISP_FREQ_RULE_ANY,
353                 .isp_freq = ISP_FREQ_356MHZ,
354                 .run_mode = ATOMISP_RUN_MODE_SDV,
355         },
356 };
357
358 static const struct atomisp_freq_scaling_rule dfs_rules_cht_soc[] = {
359         {
360                 .width = ISP_FREQ_RULE_ANY,
361                 .height = ISP_FREQ_RULE_ANY,
362                 .fps = ISP_FREQ_RULE_ANY,
363                 .isp_freq = ISP_FREQ_356MHZ,
364                 .run_mode = ATOMISP_RUN_MODE_VIDEO,
365         },
366         {
367                 .width = ISP_FREQ_RULE_ANY,
368                 .height = ISP_FREQ_RULE_ANY,
369                 .fps = ISP_FREQ_RULE_ANY,
370                 .isp_freq = ISP_FREQ_356MHZ,
371                 .run_mode = ATOMISP_RUN_MODE_STILL_CAPTURE,
372         },
373         {
374                 .width = ISP_FREQ_RULE_ANY,
375                 .height = ISP_FREQ_RULE_ANY,
376                 .fps = ISP_FREQ_RULE_ANY,
377                 .isp_freq = ISP_FREQ_320MHZ,
378                 .run_mode = ATOMISP_RUN_MODE_CONTINUOUS_CAPTURE,
379         },
380         {
381                 .width = ISP_FREQ_RULE_ANY,
382                 .height = ISP_FREQ_RULE_ANY,
383                 .fps = ISP_FREQ_RULE_ANY,
384                 .isp_freq = ISP_FREQ_320MHZ,
385                 .run_mode = ATOMISP_RUN_MODE_PREVIEW,
386         },
387         {
388                 .width = ISP_FREQ_RULE_ANY,
389                 .height = ISP_FREQ_RULE_ANY,
390                 .fps = ISP_FREQ_RULE_ANY,
391                 .isp_freq = ISP_FREQ_356MHZ,
392                 .run_mode = ATOMISP_RUN_MODE_SDV,
393         },
394 };
395
396 static const struct atomisp_dfs_config dfs_config_cht = {
397         .lowest_freq = ISP_FREQ_100MHZ,
398         .max_freq_at_vmin = ISP_FREQ_356MHZ,
399         .highest_freq = ISP_FREQ_356MHZ,
400         .dfs_table = dfs_rules_cht,
401         .dfs_table_size = ARRAY_SIZE(dfs_rules_cht),
402 };
403
404 static const struct atomisp_dfs_config dfs_config_cht_soc = {
405         .lowest_freq = ISP_FREQ_100MHZ,
406         .max_freq_at_vmin = ISP_FREQ_356MHZ,
407         .highest_freq = ISP_FREQ_356MHZ,
408         .dfs_table = dfs_rules_cht_soc,
409         .dfs_table_size = ARRAY_SIZE(dfs_rules_cht_soc),
410 };
411
412 #endif /* __ATOMISP_DFS_TABLES_H__ */