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