]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/blob - drivers/media/i2c/imx274_mode_tbls.h
d0d9aae479ed0524bda9e920add31e3ce21effe6
[sojka/nv-tegra/linux-3.10.git] / drivers / media / i2c / imx274_mode_tbls.h
1 /*
2  * imx274.c - imx274 sensor driver
3  *
4  * Copyright (c) 2016, NVIDIA CORPORATION, All Rights Reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU General Public License,
8  * version 2, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18
19 #ifndef __IMX274_I2C_TABLES__
20 #define __IMX274_I2C_TABLES__
21
22 #include <media/camera_common.h>
23
24
25 #define IMX274_TABLE_WAIT_MS 0
26 #define IMX274_TABLE_END 1
27 #define IMX274_WAIT_MS 1
28
29 #define imx274_reg struct reg_8
30
31 static const imx274_reg imx274_start[] = {
32         {0x3000, 0x00}, /* mode select streaming on */
33         {0x303E, 0x02},
34         {IMX274_TABLE_WAIT_MS, IMX274_WAIT_MS},
35         {0x30F4, 0x00},
36         {0x3018, 0xA2},
37         {IMX274_TABLE_WAIT_MS, IMX274_WAIT_MS},
38         {IMX274_TABLE_END, 0x00}
39 };
40
41 static const imx274_reg imx274_stop[] = {
42         {IMX274_TABLE_WAIT_MS, IMX274_WAIT_MS},
43         {0x3000, 0x12}, /* mode select streaming off */
44         {IMX274_TABLE_END, 0x00}
45 };
46
47 static const imx274_reg tp_colorbars[] = {
48         /* test pattern */
49         {0x303C, 0x11},
50         {0x303D, 0x0B},
51         {0x370B, 0x11},
52         {0x370E, 0x00},
53         {0x377F, 0x01},
54         {0x3781, 0x01},
55         {IMX274_TABLE_END, 0x00}
56 };
57
58
59 /* Mode 1 : 3840X2160 10 bits 30fps*/
60 static const imx274_reg mode_3840X2160[] = {
61         {IMX274_TABLE_WAIT_MS, IMX274_WAIT_MS},
62         /* input freq. 24M */
63         {0x3120, 0xF0},
64         {0x3122, 0x02},
65         {0x3129, 0x9c},
66         {0x312A, 0x02},
67         {0x312D, 0x02},
68
69         {0x310B, 0x00},
70         {0x304C, 0x00},
71         {0x304D, 0x03},
72         {0x331C, 0x1A},
73         {0x3502, 0x02},
74         {0x3529, 0x0E},
75         {0x352A, 0x0E},
76         {0x352B, 0x0E},
77         {0x3538, 0x0E},
78         {0x3539, 0x0E},
79         {0x3553, 0x00},
80         {0x357D, 0x05},
81         {0x357F, 0x05},
82         {0x3581, 0x04},
83         {0x3583, 0x76},
84         {0x3587, 0x01},
85         {0x35BB, 0x0E},
86         {0x35BC, 0x0E},
87         {0x35BD, 0x0E},
88         {0x35BE, 0x0E},
89         {0x35BF, 0x0E},
90         {0x366E, 0x00},
91         {0x366F, 0x00},
92         {0x3670, 0x00},
93         {0x3671, 0x00},
94         {0x30EE, 0x01},
95         {0x3304, 0x32},
96         {0x3306, 0x32},
97         {0x3590, 0x32},
98         {0x3686, 0x32},
99         /* resolution */
100         {0x30E2, 0x01},
101         {0x30F6, 0x07},
102         {0x30F7, 0x01},
103         {0x30F8, 0xC6},
104         {0x30F9, 0x11},
105         {0x3130, 0x86},
106         {0x3131, 0x08},
107         {0x3132, 0x7E},
108         {0x3133, 0x08},
109         /* mode setting */
110         {0x3004, 0x01},
111         {0x3005, 0x01},
112         {0x3006, 0x00},
113         {0x3007, 0x02},
114         {0x3A41, 0x08},
115         {0x3342, 0x0A},
116         {0x3343, 0x00},
117         {0x3344, 0x16},
118         {0x3345, 0x00},
119         {0x3528, 0x0E},
120         {0x3554, 0x1F},
121         {0x3555, 0x01},
122         {0x3556, 0x01},
123         {0x3557, 0x01},
124         {0x3558, 0x01},
125         {0x3559, 0x00},
126         {0x355A, 0x00},
127         {0x35BA, 0x0E},
128         {0x366A, 0x1B},
129         {0x366B, 0x1A},
130         {0x366C, 0x19},
131         {0x366D, 0x17},
132         {0x33A6, 0x01},
133         {0x306B, 0x05},
134
135         {0x300E, 0x01},
136
137         {IMX274_TABLE_WAIT_MS, IMX274_WAIT_MS},
138         {IMX274_TABLE_END, 0x0000}
139 };
140
141 /* Mode 1 : 3840X2160 10 bits 60fps*/
142 static const imx274_reg mode_3840X2160_60fps[] = {
143         {IMX274_TABLE_WAIT_MS, IMX274_WAIT_MS},
144         /* input freq. 24M */
145         {0x3120, 0xF0},
146         {0x3122, 0x02},
147         {0x3129, 0x9c},
148         {0x312A, 0x02},
149         {0x312D, 0x02},
150
151         {0x310B, 0x00},
152         {0x304C, 0x00},
153         {0x304D, 0x03},
154         {0x331C, 0x1A},
155         {0x3502, 0x02},
156         {0x3529, 0x0E},
157         {0x352A, 0x0E},
158         {0x352B, 0x0E},
159         {0x3538, 0x0E},
160         {0x3539, 0x0E},
161         {0x3553, 0x00},
162         {0x357D, 0x05},
163         {0x357F, 0x05},
164         {0x3581, 0x04},
165         {0x3583, 0x76},
166         {0x3587, 0x01},
167         {0x35BB, 0x0E},
168         {0x35BC, 0x0E},
169         {0x35BD, 0x0E},
170         {0x35BE, 0x0E},
171         {0x35BF, 0x0E},
172         {0x366E, 0x00},
173         {0x366F, 0x00},
174         {0x3670, 0x00},
175         {0x3671, 0x00},
176         {0x30EE, 0x01},
177         {0x3304, 0x32},
178         {0x3306, 0x32},
179         {0x3590, 0x32},
180         {0x3686, 0x32},
181         /* resolution */
182         {0x30E2, 0x01},
183         {0x30F6, 0x07},
184         {0x30F7, 0x01},
185         {0x30F8, 0xC6},
186         {0x30F9, 0x11},
187         {0x3130, 0x86},
188         {0x3131, 0x08},
189         {0x3132, 0x7E},
190         {0x3133, 0x08},
191         /* mode setting */
192         {0x3004, 0x01},
193         {0x3005, 0x01},
194         {0x3006, 0x00},
195         {0x3007, 0x02},
196         {0x3A41, 0x08},
197         {0x3342, 0x0A},
198         {0x3343, 0x00},
199         {0x3344, 0x16},
200         {0x3345, 0x00},
201         {0x3528, 0x0E},
202         {0x3554, 0x1F},
203         {0x3555, 0x01},
204         {0x3556, 0x01},
205         {0x3557, 0x01},
206         {0x3558, 0x01},
207         {0x3559, 0x00},
208         {0x355A, 0x00},
209         {0x35BA, 0x0E},
210         {0x366A, 0x1B},
211         {0x366B, 0x1A},
212         {0x366C, 0x19},
213         {0x366D, 0x17},
214         {0x33A6, 0x01},
215         {0x306B, 0x05},
216
217         {0x300E, 0x00},
218
219         {IMX274_TABLE_WAIT_MS, IMX274_WAIT_MS},
220         {IMX274_TABLE_END, 0x0000}
221 };
222
223 /* Mode 3 : 1920X1080 10 bits 60fps*/
224 static imx274_reg mode_1920X1080[] = {
225         {IMX274_TABLE_WAIT_MS, IMX274_WAIT_MS},
226         /* input freq. 24M */
227         {0x3120, 0xF0},
228         {0x3122, 0x02},
229         {0x3129, 0x9c},
230         {0x312A, 0x02},
231         {0x312D, 0x02},
232
233         {0x310B, 0x00},
234         {0x304C, 0x00},
235         {0x304D, 0x03},
236         {0x331C, 0x1A},
237         {0x3502, 0x02},
238         {0x3529, 0x0E},
239         {0x352A, 0x0E},
240         {0x352B, 0x0E},
241         {0x3538, 0x0E},
242         {0x3539, 0x0E},
243         {0x3553, 0x00},
244         {0x357D, 0x05},
245         {0x357F, 0x05},
246         {0x3581, 0x04},
247         {0x3583, 0x76},
248         {0x3587, 0x01},
249         {0x35BB, 0x0E},
250         {0x35BC, 0x0E},
251         {0x35BD, 0x0E},
252         {0x35BE, 0x0E},
253         {0x35BF, 0x0E},
254         {0x366E, 0x00},
255         {0x366F, 0x00},
256         {0x3670, 0x00},
257         {0x3671, 0x00},
258         {0x30EE, 0x01},
259         {0x3304, 0x32},
260         {0x3306, 0x32},
261         {0x3590, 0x32},
262         {0x3686, 0x32},
263         /* resolution */
264         {0x30E2, 0x02},
265         {0x30F6, 0x04},
266         {0x30F7, 0x01},
267         {0x30F8, 0x06},
268         {0x30F9, 0x09},
269         {0x3130, 0x4E},
270         {0x3131, 0x04},
271         {0x3132, 0x46},
272         {0x3133, 0x04},
273         /* mode setting */
274         {0x3004, 0x02},
275         {0x3005, 0x21},
276         {0x3006, 0x00},
277         {0x3007, 0x11},
278         {0x3A41, 0x08},
279         {0x3342, 0x0A},
280         {0x3343, 0x00},
281         {0x3344, 0x1A},
282         {0x3345, 0x00},
283         {0x3528, 0x0E},
284         {0x3554, 0x00},
285         {0x3555, 0x01},
286         {0x3556, 0x01},
287         {0x3557, 0x01},
288         {0x3558, 0x01},
289         {0x3559, 0x00},
290         {0x355A, 0x00},
291         {0x35BA, 0x0E},
292         {0x366A, 0x1B},
293         {0x366B, 0x1A},
294         {0x366C, 0x19},
295         {0x366D, 0x17},
296         {0x33A6, 0x01},
297         {0x306B, 0x05},
298
299         {0x300E, 0x01},
300
301         {IMX274_TABLE_WAIT_MS, IMX274_WAIT_MS},
302         {IMX274_TABLE_END, 0x0000}
303 };
304
305 /* Mode 5 : 1280X720 10 bits */
306 static imx274_reg mode_1280X720[] = {
307         {IMX274_TABLE_WAIT_MS, IMX274_WAIT_MS},
308         /* input freq. 24M */
309         {0x3120, 0xF0},
310         {0x3122, 0x02},
311         {0x3129, 0x9c},
312         {0x312A, 0x02},
313         {0x312D, 0x02},
314
315         {0x310B, 0x00},
316         {0x304C, 0x00},
317         {0x304D, 0x03},
318         {0x331C, 0x1A},
319         {0x3502, 0x02},
320         {0x3529, 0x0E},
321         {0x352A, 0x0E},
322         {0x352B, 0x0E},
323         {0x3538, 0x0E},
324         {0x3539, 0x0E},
325         {0x3553, 0x00},
326         {0x357D, 0x05},
327         {0x357F, 0x05},
328         {0x3581, 0x04},
329         {0x3583, 0x76},
330         {0x3587, 0x01},
331         {0x35BB, 0x0E},
332         {0x35BC, 0x0E},
333         {0x35BD, 0x0E},
334         {0x35BE, 0x0E},
335         {0x35BF, 0x0E},
336         {0x366E, 0x00},
337         {0x366F, 0x00},
338         {0x3670, 0x00},
339         {0x3671, 0x00},
340         {0x30EE, 0x01},
341         {0x3304, 0x32},
342         {0x3306, 0x32},
343         {0x3590, 0x32},
344         {0x3686, 0x32},
345         /* resolution */
346         {0x30E2, 0x03},
347         {0x30F6, 0x04},
348         {0x30F7, 0x01},
349         {0x30F8, 0x06},
350         {0x30F9, 0x09},
351         {0x3130, 0xE2},
352         {0x3131, 0x02},
353         {0x3132, 0xDE},
354         {0x3133, 0x02},
355         /* mode setting */
356         {0x3004, 0x03},
357         {0x3005, 0x31},
358         {0x3006, 0x00},
359         {0x3007, 0x09},
360         {0x3A41, 0x04},
361         {0x3342, 0x0A},
362         {0x3343, 0x00},
363         {0x3344, 0x1B},
364         {0x3345, 0x00},
365         {0x3528, 0x0E},
366         {0x3554, 0x00},
367         {0x3555, 0x01},
368         {0x3556, 0x01},
369         {0x3557, 0x01},
370         {0x3558, 0x01},
371         {0x3559, 0x00},
372         {0x355A, 0x00},
373         {0x35BA, 0x0E},
374         {0x366A, 0x1B},
375         {0x366B, 0x19},
376         {0x366C, 0x17},
377         {0x366D, 0x17},
378         {0x33A6, 0x01},
379         {0x306B, 0x05},
380
381         {IMX274_TABLE_WAIT_MS, IMX274_WAIT_MS},
382         {IMX274_TABLE_END, 0x0000}
383 };
384
385 enum {
386         IMX274_MODE_3840X2160,
387         IMX274_MODE_1920X1080,
388         IMX274_MODE_1280X720,
389         IMX274_MODE_START_STREAM,
390         IMX274_MODE_STOP_STREAM,
391         IMX274_MODE_TEST_PATTERN,
392 };
393
394 static const imx274_reg *mode_table[] = {
395         [IMX274_MODE_3840X2160] = mode_3840X2160_60fps,
396         [IMX274_MODE_1920X1080] = mode_1920X1080,
397         [IMX274_MODE_1280X720] = mode_1280X720,
398
399         [IMX274_MODE_START_STREAM]              = imx274_start,
400         [IMX274_MODE_STOP_STREAM]               = imx274_stop,
401         [IMX274_MODE_TEST_PATTERN]              = tp_colorbars,
402 };
403
404 static const int imx274_framerates[] = {
405         30,
406         60,
407 };
408
409 static const struct camera_common_frmfmt imx274_frmfmt[] = {
410         {{3840, 2160},  imx274_framerates, 2, 0, IMX274_MODE_3840X2160},
411         {{1920, 1080},  imx274_framerates, 2, 0, IMX274_MODE_1920X1080},
412         {{1280, 720},   imx274_framerates, 2, 0, IMX274_MODE_1280X720},
413 };
414 #endif  /* __IMX274_I2C_TABLES__ */