1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26#ifndef STV06XX_VV6410_H_
27#define STV06XX_VV6410_H_
28
29#include "stv06xx_sensor.h"
30
31#define VV6410_COLS 416
32#define VV6410_ROWS 320
33
34
35
36#define VV6410_DEVICEH 0x00
37#define VV6410_DEVICEL 0x01
38
39
40
41#define VV6410_STATUS0 0x02
42
43
44#define VV6410_LINECOUNTH 0x03
45#define VV6410_LINECOUNTL 0x04
46
47
48#define VV6410_XENDH 0x05
49#define VV6410_XENDL 0x06
50
51
52#define VV6410_YENDH 0x07
53#define VV6410_YENDL 0x08
54
55
56
57#define VV6410_DARKAVGH 0x09
58#define VV6410_DARKAVGL 0x0a
59
60
61
62#define VV6410_BLACKAVGH 0x0b
63#define VV6410_BLACKAVGL 0x0c
64
65
66#define VV6410_STATUS1 0x0d
67
68
69
70
71#define VV6410_SETUP0 0x10
72
73
74#define VV6410_SETUP1 0x11
75
76
77#define VV6410_SYNCVALUE 0x12
78
79
80#define VV6410_FGMODES 0x14
81
82
83#define VV6410_PINMAPPING 0x15
84
85
86#define VV6410_DATAFORMAT 0x16
87
88
89#define VV6410_OPFORMAT 0x17
90
91
92#define VV6410_MODESELECT 0x18
93
94
95
96#define VV6410_FINEH 0x20
97#define VV6410_FINEL 0x21
98
99
100#define VV6410_COARSEH 0x22
101#define VV6410_COARSEL 0x23
102
103
104#define VV6410_ANALOGGAIN 0x24
105
106
107#define VV6410_CLKDIV 0x25
108
109
110#define VV6410_DARKOFFSETH 0x2c
111#define VV6410_DARKOFFSETL 0x2d
112
113
114#define VV6410_DARKOFFSETSETUP 0x2e
115
116
117
118#define VV6410_LINELENGTHH 0x52
119#define VV6410_LINELENGTHL 0x53
120
121
122#define VV6410_XOFFSETH 0x57
123#define VV6410_XOFFSETL 0x58
124
125
126#define VV6410_YOFFSETH 0x59
127#define VV6410_YOFFSETL 0x5a
128
129
130#define VV6410_FIELDLENGTHH 0x61
131#define VV6410_FIELDLENGTHL 0x62
132
133
134
135#define VV6410_BLACKOFFSETH 0x70
136#define VV6410_BLACKOFFSETL 0x71
137
138
139#define VV6410_BLACKOFFSETSETUP 0x72
140
141
142#define VV6410_CR0 0x75
143
144
145#define VV6410_CR1 0x76
146
147
148#define VV6410_AS0 0x77
149
150
151#define VV6410_AT0 0x78
152
153
154#define VV6410_AT1 0x79
155
156#define VV6410_HFLIP (1 << 3)
157#define VV6410_VFLIP (1 << 4)
158
159#define VV6410_LOW_POWER_MODE (1 << 0)
160#define VV6410_SOFT_RESET (1 << 2)
161#define VV6410_PAL_25_FPS (0 << 3)
162
163#define VV6410_CLK_DIV_2 (1 << 1)
164
165#define VV6410_FINE_EXPOSURE 320
166#define VV6410_COARSE_EXPOSURE 192
167#define VV6410_DEFAULT_GAIN 5
168
169#define VV6410_SUBSAMPLE 0x01
170#define VV6410_CROP_TO_QVGA 0x02
171
172#define VV6410_CIF_LINELENGTH 415
173
174static int vv6410_probe(struct sd *sd);
175static int vv6410_start(struct sd *sd);
176static int vv6410_init(struct sd *sd);
177static int vv6410_init_controls(struct sd *sd);
178static int vv6410_stop(struct sd *sd);
179static int vv6410_dump(struct sd *sd);
180
181
182static int vv6410_set_hflip(struct gspca_dev *gspca_dev, __s32 val);
183static int vv6410_set_vflip(struct gspca_dev *gspca_dev, __s32 val);
184static int vv6410_set_analog_gain(struct gspca_dev *gspca_dev, __s32 val);
185static int vv6410_set_exposure(struct gspca_dev *gspca_dev, __s32 val);
186
187const struct stv06xx_sensor stv06xx_sensor_vv6410 = {
188 .name = "ST VV6410",
189 .i2c_flush = 5,
190 .i2c_addr = 0x20,
191 .i2c_len = 1,
192
193
194 .min_packet_size = { 1023 },
195 .max_packet_size = { 1023 },
196 .init = vv6410_init,
197 .init_controls = vv6410_init_controls,
198 .probe = vv6410_probe,
199 .start = vv6410_start,
200 .stop = vv6410_stop,
201 .dump = vv6410_dump,
202};
203
204
205struct stv_init {
206 u16 addr;
207 u8 data;
208};
209
210static const struct stv_init stv_bridge_init[] = {
211
212 {STV_RESET, 0x80},
213 {STV_RESET, 0x00},
214 {STV_SCAN_RATE, 0x00},
215 {STV_I2C_FLUSH, 0x04},
216 {STV_REG00, 0x0b},
217 {STV_REG01, 0xa7},
218 {STV_REG02, 0xb7},
219 {STV_REG03, 0x00},
220 {STV_REG04, 0x00},
221 {0x1536, 0x02},
222 {0x1537, 0x00},
223 {0x1538, 0x60},
224 {0x1539, 0x01},
225 {0x153a, 0x20},
226 {0x153b, 0x01},
227};
228
229static const u8 vv6410_sensor_init[][2] = {
230
231 {VV6410_SETUP0, VV6410_SOFT_RESET},
232 {VV6410_SETUP0, VV6410_LOW_POWER_MODE},
233
234 {VV6410_SETUP1, BIT(6)},
235
236 {VV6410_FGMODES, BIT(6) | BIT(4) | BIT(2) | BIT(0)},
237 {VV6410_PINMAPPING, 0x00},
238
239 {VV6410_DATAFORMAT, BIT(7) | BIT(0)},
240
241 {VV6410_CLKDIV, VV6410_CLK_DIV_2},
242
243
244
245 {VV6410_AS0, BIT(6) | BIT(4) | BIT(3) | BIT(2) | BIT(1)},
246 {VV6410_AT0, 0x00},
247
248 {VV6410_AT1, BIT(4) | BIT(0)},
249};
250
251#endif
252