diff options
author | Jean-François Moine <moinejf@free.fr> | 2010-10-02 03:35:25 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-10-20 23:18:29 -0400 |
commit | 72b667ebc1e7ed655ddaa8ff9abf84f8b0925d79 (patch) | |
tree | b848811db02620f4d6f428296bfb49c0c2683747 | |
parent | 62833acd7d3328d17d18f595b4b074865bf1b7f2 (diff) |
[media] gspca - sonixj: Use the new video control mechanism
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/gspca/sonixj.c | 583 |
1 files changed, 172 insertions, 411 deletions
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index 85e4e6a360cc..ba6e9662ffc5 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c | |||
@@ -31,24 +31,31 @@ MODULE_AUTHOR("Jean-François Moine <http://moinejf.free.fr>"); | |||
31 | MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver"); | 31 | MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver"); |
32 | MODULE_LICENSE("GPL"); | 32 | MODULE_LICENSE("GPL"); |
33 | 33 | ||
34 | /* controls */ | ||
35 | enum e_ctrl { | ||
36 | BRIGHTNESS, | ||
37 | CONTRAST, | ||
38 | COLORS, | ||
39 | BLUE, | ||
40 | RED, | ||
41 | GAMMA, | ||
42 | AUTOGAIN, | ||
43 | VFLIP, | ||
44 | SHARPNESS, | ||
45 | INFRARED, | ||
46 | FREQ, | ||
47 | NCTRLS /* number of controls */ | ||
48 | }; | ||
49 | |||
34 | /* specific webcam descriptor */ | 50 | /* specific webcam descriptor */ |
35 | struct sd { | 51 | struct sd { |
36 | struct gspca_dev gspca_dev; /* !! must be the first item */ | 52 | struct gspca_dev gspca_dev; /* !! must be the first item */ |
37 | 53 | ||
54 | struct gspca_ctrl ctrls[NCTRLS]; | ||
55 | |||
38 | atomic_t avg_lum; | 56 | atomic_t avg_lum; |
39 | u32 exposure; | 57 | u32 exposure; |
40 | 58 | ||
41 | u16 brightness; | ||
42 | u8 contrast; | ||
43 | u8 colors; | ||
44 | u8 autogain; | ||
45 | u8 blue; | ||
46 | u8 red; | ||
47 | u8 gamma; | ||
48 | u8 vflip; /* ov7630/ov7648 only */ | ||
49 | u8 sharpness; | ||
50 | u8 infrared; /* mt9v111 only */ | ||
51 | u8 freq; /* ov76xx only */ | ||
52 | u8 quality; /* image quality */ | 59 | u8 quality; /* image quality */ |
53 | #define QUALITY_MIN 60 | 60 | #define QUALITY_MIN 60 |
54 | #define QUALITY_MAX 95 | 61 | #define QUALITY_MAX 95 |
@@ -89,48 +96,31 @@ enum sensors { | |||
89 | }; | 96 | }; |
90 | 97 | ||
91 | /* V4L2 controls supported by the driver */ | 98 | /* V4L2 controls supported by the driver */ |
92 | static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val); | 99 | static void setbrightness(struct gspca_dev *gspca_dev); |
93 | static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val); | 100 | static void setcontrast(struct gspca_dev *gspca_dev); |
94 | static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val); | 101 | static void setcolors(struct gspca_dev *gspca_dev); |
95 | static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val); | 102 | static void setredblue(struct gspca_dev *gspca_dev); |
96 | static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val); | 103 | static void setgamma(struct gspca_dev *gspca_dev); |
97 | static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val); | 104 | static void setautogain(struct gspca_dev *gspca_dev); |
98 | static int sd_setblue_balance(struct gspca_dev *gspca_dev, __s32 val); | 105 | static void setvflip(struct gspca_dev *gspca_dev); |
99 | static int sd_getblue_balance(struct gspca_dev *gspca_dev, __s32 *val); | 106 | static void setsharpness(struct gspca_dev *gspca_dev); |
100 | static int sd_setred_balance(struct gspca_dev *gspca_dev, __s32 val); | 107 | static void setinfrared(struct gspca_dev *gspca_dev); |
101 | static int sd_getred_balance(struct gspca_dev *gspca_dev, __s32 *val); | 108 | static void setfreq(struct gspca_dev *gspca_dev); |
102 | static int sd_setgamma(struct gspca_dev *gspca_dev, __s32 val); | 109 | |
103 | static int sd_getgamma(struct gspca_dev *gspca_dev, __s32 *val); | 110 | static const struct ctrl sd_ctrls[NCTRLS] = { |
104 | static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val); | 111 | [BRIGHTNESS] = { |
105 | static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val); | ||
106 | static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val); | ||
107 | static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val); | ||
108 | static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val); | ||
109 | static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val); | ||
110 | static int sd_setinfrared(struct gspca_dev *gspca_dev, __s32 val); | ||
111 | static int sd_getinfrared(struct gspca_dev *gspca_dev, __s32 *val); | ||
112 | static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val); | ||
113 | static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val); | ||
114 | |||
115 | static const struct ctrl sd_ctrls[] = { | ||
116 | #define BRIGHTNESS_IDX 0 | ||
117 | { | ||
118 | { | 112 | { |
119 | .id = V4L2_CID_BRIGHTNESS, | 113 | .id = V4L2_CID_BRIGHTNESS, |
120 | .type = V4L2_CTRL_TYPE_INTEGER, | 114 | .type = V4L2_CTRL_TYPE_INTEGER, |
121 | .name = "Brightness", | 115 | .name = "Brightness", |
122 | .minimum = 0, | 116 | .minimum = 0, |
123 | #define BRIGHTNESS_MAX 0xffff | 117 | .maximum = 0xff, |
124 | .maximum = BRIGHTNESS_MAX, | ||
125 | .step = 1, | 118 | .step = 1, |
126 | #define BRIGHTNESS_DEF 0x8000 | 119 | .default_value = 0x80, |
127 | .default_value = BRIGHTNESS_DEF, | ||
128 | }, | 120 | }, |
129 | .set = sd_setbrightness, | 121 | .set_control = setbrightness |
130 | .get = sd_getbrightness, | ||
131 | }, | 122 | }, |
132 | #define CONTRAST_IDX 1 | 123 | [CONTRAST] = { |
133 | { | ||
134 | { | 124 | { |
135 | .id = V4L2_CID_CONTRAST, | 125 | .id = V4L2_CID_CONTRAST, |
136 | .type = V4L2_CTRL_TYPE_INTEGER, | 126 | .type = V4L2_CTRL_TYPE_INTEGER, |
@@ -139,14 +129,11 @@ static const struct ctrl sd_ctrls[] = { | |||
139 | #define CONTRAST_MAX 127 | 129 | #define CONTRAST_MAX 127 |
140 | .maximum = CONTRAST_MAX, | 130 | .maximum = CONTRAST_MAX, |
141 | .step = 1, | 131 | .step = 1, |
142 | #define CONTRAST_DEF 63 | 132 | .default_value = 63, |
143 | .default_value = CONTRAST_DEF, | ||
144 | }, | 133 | }, |
145 | .set = sd_setcontrast, | 134 | .set_control = setcontrast |
146 | .get = sd_getcontrast, | ||
147 | }, | 135 | }, |
148 | #define COLOR_IDX 2 | 136 | [COLORS] = { |
149 | { | ||
150 | { | 137 | { |
151 | .id = V4L2_CID_SATURATION, | 138 | .id = V4L2_CID_SATURATION, |
152 | .type = V4L2_CTRL_TYPE_INTEGER, | 139 | .type = V4L2_CTRL_TYPE_INTEGER, |
@@ -154,14 +141,12 @@ static const struct ctrl sd_ctrls[] = { | |||
154 | .minimum = 0, | 141 | .minimum = 0, |
155 | .maximum = 40, | 142 | .maximum = 40, |
156 | .step = 1, | 143 | .step = 1, |
157 | #define COLOR_DEF 25 | 144 | #define COLORS_DEF 25 |
158 | .default_value = COLOR_DEF, | 145 | .default_value = COLORS_DEF, |
159 | }, | 146 | }, |
160 | .set = sd_setcolors, | 147 | .set_control = setcolors |
161 | .get = sd_getcolors, | ||
162 | }, | 148 | }, |
163 | #define BLUE_BALANCE_IDX 3 | 149 | [BLUE] = { |
164 | { | ||
165 | { | 150 | { |
166 | .id = V4L2_CID_BLUE_BALANCE, | 151 | .id = V4L2_CID_BLUE_BALANCE, |
167 | .type = V4L2_CTRL_TYPE_INTEGER, | 152 | .type = V4L2_CTRL_TYPE_INTEGER, |
@@ -169,14 +154,11 @@ static const struct ctrl sd_ctrls[] = { | |||
169 | .minimum = 24, | 154 | .minimum = 24, |
170 | .maximum = 40, | 155 | .maximum = 40, |
171 | .step = 1, | 156 | .step = 1, |
172 | #define BLUE_BALANCE_DEF 32 | 157 | .default_value = 32, |
173 | .default_value = BLUE_BALANCE_DEF, | ||
174 | }, | 158 | }, |
175 | .set = sd_setblue_balance, | 159 | .set_control = setredblue |
176 | .get = sd_getblue_balance, | ||
177 | }, | 160 | }, |
178 | #define RED_BALANCE_IDX 4 | 161 | [RED] = { |
179 | { | ||
180 | { | 162 | { |
181 | .id = V4L2_CID_RED_BALANCE, | 163 | .id = V4L2_CID_RED_BALANCE, |
182 | .type = V4L2_CTRL_TYPE_INTEGER, | 164 | .type = V4L2_CTRL_TYPE_INTEGER, |
@@ -184,14 +166,11 @@ static const struct ctrl sd_ctrls[] = { | |||
184 | .minimum = 24, | 166 | .minimum = 24, |
185 | .maximum = 40, | 167 | .maximum = 40, |
186 | .step = 1, | 168 | .step = 1, |
187 | #define RED_BALANCE_DEF 32 | 169 | .default_value = 32, |
188 | .default_value = RED_BALANCE_DEF, | ||
189 | }, | 170 | }, |
190 | .set = sd_setred_balance, | 171 | .set_control = setredblue |
191 | .get = sd_getred_balance, | ||
192 | }, | 172 | }, |
193 | #define GAMMA_IDX 5 | 173 | [GAMMA] = { |
194 | { | ||
195 | { | 174 | { |
196 | .id = V4L2_CID_GAMMA, | 175 | .id = V4L2_CID_GAMMA, |
197 | .type = V4L2_CTRL_TYPE_INTEGER, | 176 | .type = V4L2_CTRL_TYPE_INTEGER, |
@@ -202,11 +181,9 @@ static const struct ctrl sd_ctrls[] = { | |||
202 | #define GAMMA_DEF 20 | 181 | #define GAMMA_DEF 20 |
203 | .default_value = GAMMA_DEF, | 182 | .default_value = GAMMA_DEF, |
204 | }, | 183 | }, |
205 | .set = sd_setgamma, | 184 | .set_control = setgamma |
206 | .get = sd_getgamma, | ||
207 | }, | 185 | }, |
208 | #define AUTOGAIN_IDX 6 | 186 | [AUTOGAIN] = { |
209 | { | ||
210 | { | 187 | { |
211 | .id = V4L2_CID_AUTOGAIN, | 188 | .id = V4L2_CID_AUTOGAIN, |
212 | .type = V4L2_CTRL_TYPE_BOOLEAN, | 189 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
@@ -214,15 +191,12 @@ static const struct ctrl sd_ctrls[] = { | |||
214 | .minimum = 0, | 191 | .minimum = 0, |
215 | .maximum = 1, | 192 | .maximum = 1, |
216 | .step = 1, | 193 | .step = 1, |
217 | #define AUTOGAIN_DEF 1 | 194 | .default_value = 1 |
218 | .default_value = AUTOGAIN_DEF, | ||
219 | }, | 195 | }, |
220 | .set = sd_setautogain, | 196 | .set_control = setautogain |
221 | .get = sd_getautogain, | ||
222 | }, | 197 | }, |
223 | /* ov7630/ov7648 only */ | 198 | /* ov7630/ov7648 only */ |
224 | #define VFLIP_IDX 7 | 199 | [VFLIP] = { |
225 | { | ||
226 | { | 200 | { |
227 | .id = V4L2_CID_VFLIP, | 201 | .id = V4L2_CID_VFLIP, |
228 | .type = V4L2_CTRL_TYPE_BOOLEAN, | 202 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
@@ -230,14 +204,11 @@ static const struct ctrl sd_ctrls[] = { | |||
230 | .minimum = 0, | 204 | .minimum = 0, |
231 | .maximum = 1, | 205 | .maximum = 1, |
232 | .step = 1, | 206 | .step = 1, |
233 | #define VFLIP_DEF 0 | 207 | .default_value = 0, |
234 | .default_value = VFLIP_DEF, | ||
235 | }, | 208 | }, |
236 | .set = sd_setvflip, | 209 | .set_control = setvflip |
237 | .get = sd_getvflip, | ||
238 | }, | 210 | }, |
239 | #define SHARPNESS_IDX 8 | 211 | [SHARPNESS] = { |
240 | { | ||
241 | { | 212 | { |
242 | .id = V4L2_CID_SHARPNESS, | 213 | .id = V4L2_CID_SHARPNESS, |
243 | .type = V4L2_CTRL_TYPE_INTEGER, | 214 | .type = V4L2_CTRL_TYPE_INTEGER, |
@@ -245,15 +216,12 @@ static const struct ctrl sd_ctrls[] = { | |||
245 | .minimum = 0, | 216 | .minimum = 0, |
246 | .maximum = 255, | 217 | .maximum = 255, |
247 | .step = 1, | 218 | .step = 1, |
248 | #define SHARPNESS_DEF 90 | 219 | .default_value = 90, |
249 | .default_value = SHARPNESS_DEF, | ||
250 | }, | 220 | }, |
251 | .set = sd_setsharpness, | 221 | .set_control = setsharpness |
252 | .get = sd_getsharpness, | ||
253 | }, | 222 | }, |
254 | /* mt9v111 only */ | 223 | /* mt9v111 only */ |
255 | #define INFRARED_IDX 9 | 224 | [INFRARED] = { |
256 | { | ||
257 | { | 225 | { |
258 | .id = V4L2_CID_INFRARED, | 226 | .id = V4L2_CID_INFRARED, |
259 | .type = V4L2_CTRL_TYPE_BOOLEAN, | 227 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
@@ -261,15 +229,12 @@ static const struct ctrl sd_ctrls[] = { | |||
261 | .minimum = 0, | 229 | .minimum = 0, |
262 | .maximum = 1, | 230 | .maximum = 1, |
263 | .step = 1, | 231 | .step = 1, |
264 | #define INFRARED_DEF 0 | 232 | .default_value = 0, |
265 | .default_value = INFRARED_DEF, | ||
266 | }, | 233 | }, |
267 | .set = sd_setinfrared, | 234 | .set_control = setinfrared |
268 | .get = sd_getinfrared, | ||
269 | }, | 235 | }, |
270 | /* ov7630/ov7648/ov7660 only */ | 236 | /* ov7630/ov7648/ov7660 only */ |
271 | #define FREQ_IDX 10 | 237 | [FREQ] = { |
272 | { | ||
273 | { | 238 | { |
274 | .id = V4L2_CID_POWER_LINE_FREQUENCY, | 239 | .id = V4L2_CID_POWER_LINE_FREQUENCY, |
275 | .type = V4L2_CTRL_TYPE_MENU, | 240 | .type = V4L2_CTRL_TYPE_MENU, |
@@ -277,73 +242,71 @@ static const struct ctrl sd_ctrls[] = { | |||
277 | .minimum = 0, | 242 | .minimum = 0, |
278 | .maximum = 2, /* 0: 0, 1: 50Hz, 2:60Hz */ | 243 | .maximum = 2, /* 0: 0, 1: 50Hz, 2:60Hz */ |
279 | .step = 1, | 244 | .step = 1, |
280 | #define FREQ_DEF 1 | 245 | .default_value = 1, |
281 | .default_value = FREQ_DEF, | ||
282 | }, | 246 | }, |
283 | .set = sd_setfreq, | 247 | .set_control = setfreq |
284 | .get = sd_getfreq, | ||
285 | }, | 248 | }, |
286 | }; | 249 | }; |
287 | 250 | ||
288 | /* table of the disabled controls */ | 251 | /* table of the disabled controls */ |
289 | static const __u32 ctrl_dis[] = { | 252 | static const __u32 ctrl_dis[] = { |
290 | [SENSOR_ADCM1700] = (1 << AUTOGAIN_IDX) | | 253 | [SENSOR_ADCM1700] = (1 << AUTOGAIN) | |
291 | (1 << INFRARED_IDX) | | 254 | (1 << INFRARED) | |
292 | (1 << VFLIP_IDX) | | 255 | (1 << VFLIP) | |
293 | (1 << FREQ_IDX), | 256 | (1 << FREQ), |
294 | 257 | ||
295 | [SENSOR_GC0307] = (1 << INFRARED_IDX) | | 258 | [SENSOR_GC0307] = (1 << INFRARED) | |
296 | (1 << VFLIP_IDX) | | 259 | (1 << VFLIP) | |
297 | (1 << FREQ_IDX), | 260 | (1 << FREQ), |
298 | 261 | ||
299 | [SENSOR_HV7131R] = (1 << INFRARED_IDX) | | 262 | [SENSOR_HV7131R] = (1 << INFRARED) | |
300 | (1 << FREQ_IDX), | 263 | (1 << FREQ), |
301 | 264 | ||
302 | [SENSOR_MI0360] = (1 << INFRARED_IDX) | | 265 | [SENSOR_MI0360] = (1 << INFRARED) | |
303 | (1 << VFLIP_IDX) | | 266 | (1 << VFLIP) | |
304 | (1 << FREQ_IDX), | 267 | (1 << FREQ), |
305 | 268 | ||
306 | [SENSOR_MI0360B] = (1 << INFRARED_IDX) | | 269 | [SENSOR_MI0360B] = (1 << INFRARED) | |
307 | (1 << VFLIP_IDX) | | 270 | (1 << VFLIP) | |
308 | (1 << FREQ_IDX), | 271 | (1 << FREQ), |
309 | 272 | ||
310 | [SENSOR_MO4000] = (1 << INFRARED_IDX) | | 273 | [SENSOR_MO4000] = (1 << INFRARED) | |
311 | (1 << VFLIP_IDX) | | 274 | (1 << VFLIP) | |
312 | (1 << FREQ_IDX), | 275 | (1 << FREQ), |
313 | 276 | ||
314 | [SENSOR_MT9V111] = (1 << VFLIP_IDX) | | 277 | [SENSOR_MT9V111] = (1 << VFLIP) | |
315 | (1 << FREQ_IDX), | 278 | (1 << FREQ), |
316 | 279 | ||
317 | [SENSOR_OM6802] = (1 << INFRARED_IDX) | | 280 | [SENSOR_OM6802] = (1 << INFRARED) | |
318 | (1 << VFLIP_IDX) | | 281 | (1 << VFLIP) | |
319 | (1 << FREQ_IDX), | 282 | (1 << FREQ), |
320 | 283 | ||
321 | [SENSOR_OV7630] = (1 << INFRARED_IDX), | 284 | [SENSOR_OV7630] = (1 << INFRARED), |
322 | 285 | ||
323 | [SENSOR_OV7648] = (1 << INFRARED_IDX), | 286 | [SENSOR_OV7648] = (1 << INFRARED), |
324 | 287 | ||
325 | [SENSOR_OV7660] = (1 << AUTOGAIN_IDX) | | 288 | [SENSOR_OV7660] = (1 << AUTOGAIN) | |
326 | (1 << INFRARED_IDX) | | 289 | (1 << INFRARED) | |
327 | (1 << VFLIP_IDX), | 290 | (1 << VFLIP), |
328 | 291 | ||
329 | [SENSOR_PO1030] = (1 << AUTOGAIN_IDX) | | 292 | [SENSOR_PO1030] = (1 << AUTOGAIN) | |
330 | (1 << INFRARED_IDX) | | 293 | (1 << INFRARED) | |
331 | (1 << VFLIP_IDX) | | 294 | (1 << VFLIP) | |
332 | (1 << FREQ_IDX), | 295 | (1 << FREQ), |
333 | 296 | ||
334 | [SENSOR_PO2030N] = (1 << AUTOGAIN_IDX) | | 297 | [SENSOR_PO2030N] = (1 << AUTOGAIN) | |
335 | (1 << INFRARED_IDX) | | 298 | (1 << INFRARED) | |
336 | (1 << VFLIP_IDX) | | 299 | (1 << VFLIP) | |
337 | (1 << FREQ_IDX), | 300 | (1 << FREQ), |
338 | [SENSOR_SOI768] = (1 << AUTOGAIN_IDX) | | 301 | [SENSOR_SOI768] = (1 << AUTOGAIN) | |
339 | (1 << INFRARED_IDX) | | 302 | (1 << INFRARED) | |
340 | (1 << VFLIP_IDX) | | 303 | (1 << VFLIP) | |
341 | (1 << FREQ_IDX), | 304 | (1 << FREQ), |
342 | 305 | ||
343 | [SENSOR_SP80708] = (1 << AUTOGAIN_IDX) | | 306 | [SENSOR_SP80708] = (1 << AUTOGAIN) | |
344 | (1 << INFRARED_IDX) | | 307 | (1 << INFRARED) | |
345 | (1 << VFLIP_IDX) | | 308 | (1 << VFLIP) | |
346 | (1 << FREQ_IDX), | 309 | (1 << FREQ), |
347 | }; | 310 | }; |
348 | 311 | ||
349 | static const struct v4l2_pix_format cif_mode[] = { | 312 | static const struct v4l2_pix_format cif_mode[] = { |
@@ -1919,26 +1882,9 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
1919 | cam->nmodes = ARRAY_SIZE(vga_mode); | 1882 | cam->nmodes = ARRAY_SIZE(vga_mode); |
1920 | } | 1883 | } |
1921 | cam->npkt = 24; /* 24 packets per ISOC message */ | 1884 | cam->npkt = 24; /* 24 packets per ISOC message */ |
1885 | cam->ctrls = sd->ctrls; | ||
1922 | 1886 | ||
1923 | sd->brightness = BRIGHTNESS_DEF; | ||
1924 | sd->contrast = CONTRAST_DEF; | ||
1925 | sd->colors = COLOR_DEF; | ||
1926 | sd->blue = BLUE_BALANCE_DEF; | ||
1927 | sd->red = RED_BALANCE_DEF; | ||
1928 | sd->gamma = GAMMA_DEF; | ||
1929 | sd->autogain = AUTOGAIN_DEF; | ||
1930 | sd->ag_cnt = -1; | 1887 | sd->ag_cnt = -1; |
1931 | sd->vflip = VFLIP_DEF; | ||
1932 | switch (sd->sensor) { | ||
1933 | case SENSOR_OM6802: | ||
1934 | sd->sharpness = 0x10; | ||
1935 | break; | ||
1936 | default: | ||
1937 | sd->sharpness = SHARPNESS_DEF; | ||
1938 | break; | ||
1939 | } | ||
1940 | sd->infrared = INFRARED_DEF; | ||
1941 | sd->freq = FREQ_DEF; | ||
1942 | sd->quality = QUALITY_DEF; | 1888 | sd->quality = QUALITY_DEF; |
1943 | sd->jpegqual = 80; | 1889 | sd->jpegqual = 80; |
1944 | 1890 | ||
@@ -2004,6 +1950,9 @@ static int sd_init(struct gspca_dev *gspca_dev) | |||
2004 | break; | 1950 | break; |
2005 | } | 1951 | } |
2006 | 1952 | ||
1953 | if (sd->sensor == SENSOR_OM6802) | ||
1954 | sd->ctrls[SHARPNESS].def = 0x10; | ||
1955 | |||
2007 | /* Note we do not disable the sensor clock here (power saving mode), | 1956 | /* Note we do not disable the sensor clock here (power saving mode), |
2008 | as that also disables the button on the cam. */ | 1957 | as that also disables the button on the cam. */ |
2009 | reg_w1(gspca_dev, 0xf1, 0x00); | 1958 | reg_w1(gspca_dev, 0xf1, 0x00); |
@@ -2125,16 +2074,18 @@ static void setbrightness(struct gspca_dev *gspca_dev) | |||
2125 | { | 2074 | { |
2126 | struct sd *sd = (struct sd *) gspca_dev; | 2075 | struct sd *sd = (struct sd *) gspca_dev; |
2127 | unsigned int expo; | 2076 | unsigned int expo; |
2077 | int brightness; | ||
2128 | u8 k2; | 2078 | u8 k2; |
2129 | 2079 | ||
2130 | k2 = ((int) sd->brightness - 0x8000) >> 10; | 2080 | brightness = sd->ctrls[BRIGHTNESS].val; |
2081 | k2 = (brightness - 0x80) >> 2; | ||
2131 | switch (sd->sensor) { | 2082 | switch (sd->sensor) { |
2132 | case SENSOR_ADCM1700: | 2083 | case SENSOR_ADCM1700: |
2133 | if (k2 > 0x1f) | 2084 | if (k2 > 0x1f) |
2134 | k2 = 0; /* only positive Y offset */ | 2085 | k2 = 0; /* only positive Y offset */ |
2135 | break; | 2086 | break; |
2136 | case SENSOR_HV7131R: | 2087 | case SENSOR_HV7131R: |
2137 | expo = sd->brightness << 4; | 2088 | expo = brightness << 12; |
2138 | if (expo > 0x002dc6c0) | 2089 | if (expo > 0x002dc6c0) |
2139 | expo = 0x002dc6c0; | 2090 | expo = 0x002dc6c0; |
2140 | else if (expo < 0x02a0) | 2091 | else if (expo < 0x02a0) |
@@ -2143,22 +2094,22 @@ static void setbrightness(struct gspca_dev *gspca_dev) | |||
2143 | break; | 2094 | break; |
2144 | case SENSOR_MI0360: | 2095 | case SENSOR_MI0360: |
2145 | case SENSOR_MO4000: | 2096 | case SENSOR_MO4000: |
2146 | expo = sd->brightness >> 4; | 2097 | expo = brightness << 4; |
2147 | sd->exposure = setexposure(gspca_dev, expo); | 2098 | sd->exposure = setexposure(gspca_dev, expo); |
2148 | break; | 2099 | break; |
2149 | case SENSOR_MI0360B: | 2100 | case SENSOR_MI0360B: |
2150 | expo = sd->brightness >> 6; | 2101 | expo = brightness << 2; |
2151 | sd->exposure = setexposure(gspca_dev, expo); | 2102 | sd->exposure = setexposure(gspca_dev, expo); |
2152 | break; | 2103 | break; |
2153 | case SENSOR_GC0307: | 2104 | case SENSOR_GC0307: |
2154 | case SENSOR_MT9V111: | 2105 | case SENSOR_MT9V111: |
2155 | expo = sd->brightness >> 8; | 2106 | expo = brightness; |
2156 | sd->exposure = setexposure(gspca_dev, expo); | 2107 | sd->exposure = setexposure(gspca_dev, expo); |
2157 | return; /* don't set the Y offset */ | 2108 | return; /* don't set the Y offset */ |
2158 | case SENSOR_OM6802: | 2109 | case SENSOR_OM6802: |
2159 | expo = sd->brightness >> 6; | 2110 | expo = brightness << 2; |
2160 | sd->exposure = setexposure(gspca_dev, expo); | 2111 | sd->exposure = setexposure(gspca_dev, expo); |
2161 | k2 = sd->brightness >> 11; | 2112 | k2 = brightness >> 3; |
2162 | break; | 2113 | break; |
2163 | } | 2114 | } |
2164 | 2115 | ||
@@ -2171,7 +2122,8 @@ static void setcontrast(struct gspca_dev *gspca_dev) | |||
2171 | u8 k2; | 2122 | u8 k2; |
2172 | u8 contrast[6]; | 2123 | u8 contrast[6]; |
2173 | 2124 | ||
2174 | k2 = sd->contrast * 0x30 / (CONTRAST_MAX + 1) + 0x10; /* 10..40 */ | 2125 | k2 = sd->ctrls[CONTRAST].val * 0x30 / (CONTRAST_MAX + 1) |
2126 | + 0x10; /* 10..40 */ | ||
2175 | contrast[0] = (k2 + 1) / 2; /* red */ | 2127 | contrast[0] = (k2 + 1) / 2; /* red */ |
2176 | contrast[1] = 0; | 2128 | contrast[1] = 0; |
2177 | contrast[2] = k2; /* green */ | 2129 | contrast[2] = k2; /* green */ |
@@ -2184,7 +2136,7 @@ static void setcontrast(struct gspca_dev *gspca_dev) | |||
2184 | static void setcolors(struct gspca_dev *gspca_dev) | 2136 | static void setcolors(struct gspca_dev *gspca_dev) |
2185 | { | 2137 | { |
2186 | struct sd *sd = (struct sd *) gspca_dev; | 2138 | struct sd *sd = (struct sd *) gspca_dev; |
2187 | int i, v; | 2139 | int i, v, colors; |
2188 | const s16 *uv; | 2140 | const s16 *uv; |
2189 | u8 reg8a[12]; /* U & V gains */ | 2141 | u8 reg8a[12]; /* U & V gains */ |
2190 | static const s16 uv_com[6] = { /* same as reg84 in signed decimal */ | 2142 | static const s16 uv_com[6] = { /* same as reg84 in signed decimal */ |
@@ -2196,12 +2148,13 @@ static void setcolors(struct gspca_dev *gspca_dev) | |||
2196 | 60, -51, -9 /* VR VG VB */ | 2148 | 60, -51, -9 /* VR VG VB */ |
2197 | }; | 2149 | }; |
2198 | 2150 | ||
2151 | colors = sd->ctrls[COLORS].val; | ||
2199 | if (sd->sensor == SENSOR_MI0360B) | 2152 | if (sd->sensor == SENSOR_MI0360B) |
2200 | uv = uv_mi0360b; | 2153 | uv = uv_mi0360b; |
2201 | else | 2154 | else |
2202 | uv = uv_com; | 2155 | uv = uv_com; |
2203 | for (i = 0; i < 6; i++) { | 2156 | for (i = 0; i < 6; i++) { |
2204 | v = uv[i] * sd->colors / COLOR_DEF; | 2157 | v = uv[i] * colors / COLORS_DEF; |
2205 | reg8a[i * 2] = v; | 2158 | reg8a[i * 2] = v; |
2206 | reg8a[i * 2 + 1] = (v >> 8) & 0x0f; | 2159 | reg8a[i * 2 + 1] = (v >> 8) & 0x0f; |
2207 | } | 2160 | } |
@@ -2212,15 +2165,15 @@ static void setredblue(struct gspca_dev *gspca_dev) | |||
2212 | { | 2165 | { |
2213 | struct sd *sd = (struct sd *) gspca_dev; | 2166 | struct sd *sd = (struct sd *) gspca_dev; |
2214 | 2167 | ||
2215 | reg_w1(gspca_dev, 0x05, sd->red); | 2168 | reg_w1(gspca_dev, 0x05, sd->ctrls[RED].val); |
2216 | /* reg_w1(gspca_dev, 0x07, 32); */ | 2169 | /* reg_w1(gspca_dev, 0x07, 32); */ |
2217 | reg_w1(gspca_dev, 0x06, sd->blue); | 2170 | reg_w1(gspca_dev, 0x06, sd->ctrls[BLUE].val); |
2218 | } | 2171 | } |
2219 | 2172 | ||
2220 | static void setgamma(struct gspca_dev *gspca_dev) | 2173 | static void setgamma(struct gspca_dev *gspca_dev) |
2221 | { | 2174 | { |
2222 | struct sd *sd = (struct sd *) gspca_dev; | 2175 | struct sd *sd = (struct sd *) gspca_dev; |
2223 | int i; | 2176 | int i, val; |
2224 | u8 gamma[17]; | 2177 | u8 gamma[17]; |
2225 | const u8 *gamma_base; | 2178 | const u8 *gamma_base; |
2226 | static const u8 delta[17] = { | 2179 | static const u8 delta[17] = { |
@@ -2248,9 +2201,10 @@ static void setgamma(struct gspca_dev *gspca_dev) | |||
2248 | break; | 2201 | break; |
2249 | } | 2202 | } |
2250 | 2203 | ||
2204 | val = sd->ctrls[GAMMA].val; | ||
2251 | for (i = 0; i < sizeof gamma; i++) | 2205 | for (i = 0; i < sizeof gamma; i++) |
2252 | gamma[i] = gamma_base[i] | 2206 | gamma[i] = gamma_base[i] |
2253 | + delta[i] * (sd->gamma - GAMMA_DEF) / 32; | 2207 | + delta[i] * (val - GAMMA_DEF) / 32; |
2254 | reg_w(gspca_dev, 0x20, gamma, sizeof gamma); | 2208 | reg_w(gspca_dev, 0x20, gamma, sizeof gamma); |
2255 | } | 2209 | } |
2256 | 2210 | ||
@@ -2258,7 +2212,7 @@ static void setautogain(struct gspca_dev *gspca_dev) | |||
2258 | { | 2212 | { |
2259 | struct sd *sd = (struct sd *) gspca_dev; | 2213 | struct sd *sd = (struct sd *) gspca_dev; |
2260 | 2214 | ||
2261 | if (gspca_dev->ctrl_dis & (1 << AUTOGAIN_IDX)) | 2215 | if (gspca_dev->ctrl_dis & (1 << AUTOGAIN)) |
2262 | return; | 2216 | return; |
2263 | switch (sd->sensor) { | 2217 | switch (sd->sensor) { |
2264 | case SENSOR_OV7630: | 2218 | case SENSOR_OV7630: |
@@ -2269,74 +2223,79 @@ static void setautogain(struct gspca_dev *gspca_dev) | |||
2269 | comb = 0xc0; | 2223 | comb = 0xc0; |
2270 | else | 2224 | else |
2271 | comb = 0xa0; | 2225 | comb = 0xa0; |
2272 | if (sd->autogain) | 2226 | if (sd->ctrls[AUTOGAIN].val) |
2273 | comb |= 0x03; | 2227 | comb |= 0x03; |
2274 | i2c_w1(&sd->gspca_dev, 0x13, comb); | 2228 | i2c_w1(&sd->gspca_dev, 0x13, comb); |
2275 | return; | 2229 | return; |
2276 | } | 2230 | } |
2277 | } | 2231 | } |
2278 | if (sd->autogain) | 2232 | if (sd->ctrls[AUTOGAIN].val) |
2279 | sd->ag_cnt = AG_CNT_START; | 2233 | sd->ag_cnt = AG_CNT_START; |
2280 | else | 2234 | else |
2281 | sd->ag_cnt = -1; | 2235 | sd->ag_cnt = -1; |
2282 | } | 2236 | } |
2283 | 2237 | ||
2284 | /* hv7131r/ov7630/ov7648 only */ | 2238 | /* hv7131r/ov7630/ov7648 only */ |
2285 | static void setvflip(struct sd *sd) | 2239 | static void setvflip(struct gspca_dev *gspca_dev) |
2286 | { | 2240 | { |
2241 | struct sd *sd = (struct sd *) gspca_dev; | ||
2287 | u8 comn; | 2242 | u8 comn; |
2288 | 2243 | ||
2289 | if (sd->gspca_dev.ctrl_dis & (1 << VFLIP_IDX)) | 2244 | if (gspca_dev->ctrl_dis & (1 << VFLIP)) |
2290 | return; | 2245 | return; |
2291 | switch (sd->sensor) { | 2246 | switch (sd->sensor) { |
2292 | case SENSOR_HV7131R: | 2247 | case SENSOR_HV7131R: |
2293 | comn = 0x18; /* clkdiv = 1, ablcen = 1 */ | 2248 | comn = 0x18; /* clkdiv = 1, ablcen = 1 */ |
2294 | if (sd->vflip) | 2249 | if (sd->ctrls[VFLIP].val) |
2295 | comn |= 0x01; | 2250 | comn |= 0x01; |
2296 | i2c_w1(&sd->gspca_dev, 0x01, comn); /* sctra */ | 2251 | i2c_w1(gspca_dev, 0x01, comn); /* sctra */ |
2297 | break; | 2252 | break; |
2298 | case SENSOR_OV7630: | 2253 | case SENSOR_OV7630: |
2299 | comn = 0x02; | 2254 | comn = 0x02; |
2300 | if (!sd->vflip) | 2255 | if (!sd->ctrls[VFLIP].val) |
2301 | comn |= 0x80; | 2256 | comn |= 0x80; |
2302 | i2c_w1(&sd->gspca_dev, 0x75, comn); | 2257 | i2c_w1(gspca_dev, 0x75, comn); |
2303 | break; | 2258 | break; |
2304 | default: | 2259 | default: |
2305 | /* case SENSOR_OV7648: */ | 2260 | /* case SENSOR_OV7648: */ |
2306 | comn = 0x06; | 2261 | comn = 0x06; |
2307 | if (sd->vflip) | 2262 | if (sd->ctrls[VFLIP].val) |
2308 | comn |= 0x80; | 2263 | comn |= 0x80; |
2309 | i2c_w1(&sd->gspca_dev, 0x75, comn); | 2264 | i2c_w1(gspca_dev, 0x75, comn); |
2310 | break; | 2265 | break; |
2311 | } | 2266 | } |
2312 | } | 2267 | } |
2313 | 2268 | ||
2314 | static void setsharpness(struct sd *sd) | 2269 | static void setsharpness(struct gspca_dev *gspca_dev) |
2315 | { | 2270 | { |
2316 | reg_w1(&sd->gspca_dev, 0x99, sd->sharpness); | 2271 | struct sd *sd = (struct sd *) gspca_dev; |
2272 | |||
2273 | reg_w1(gspca_dev, 0x99, sd->ctrls[SHARPNESS].val); | ||
2317 | } | 2274 | } |
2318 | 2275 | ||
2319 | static void setinfrared(struct sd *sd) | 2276 | static void setinfrared(struct gspca_dev *gspca_dev) |
2320 | { | 2277 | { |
2321 | if (sd->gspca_dev.ctrl_dis & (1 << INFRARED_IDX)) | 2278 | struct sd *sd = (struct sd *) gspca_dev; |
2279 | |||
2280 | if (gspca_dev->ctrl_dis & (1 << INFRARED)) | ||
2322 | return; | 2281 | return; |
2323 | /*fixme: different sequence for StarCam Clip and StarCam 370i */ | 2282 | /*fixme: different sequence for StarCam Clip and StarCam 370i */ |
2324 | /* Clip */ | 2283 | /* Clip */ |
2325 | i2c_w1(&sd->gspca_dev, 0x02, /* gpio */ | 2284 | i2c_w1(gspca_dev, 0x02, /* gpio */ |
2326 | sd->infrared ? 0x66 : 0x64); | 2285 | sd->ctrls[INFRARED].val ? 0x66 : 0x64); |
2327 | } | 2286 | } |
2328 | 2287 | ||
2329 | static void setfreq(struct gspca_dev *gspca_dev) | 2288 | static void setfreq(struct gspca_dev *gspca_dev) |
2330 | { | 2289 | { |
2331 | struct sd *sd = (struct sd *) gspca_dev; | 2290 | struct sd *sd = (struct sd *) gspca_dev; |
2332 | 2291 | ||
2333 | if (gspca_dev->ctrl_dis & (1 << FREQ_IDX)) | 2292 | if (gspca_dev->ctrl_dis & (1 << FREQ)) |
2334 | return; | 2293 | return; |
2335 | if (sd->sensor == SENSOR_OV7660) { | 2294 | if (sd->sensor == SENSOR_OV7660) { |
2336 | u8 com8; | 2295 | u8 com8; |
2337 | 2296 | ||
2338 | com8 = 0xdf; /* auto gain/wb/expo */ | 2297 | com8 = 0xdf; /* auto gain/wb/expo */ |
2339 | switch (sd->freq) { | 2298 | switch (sd->ctrls[FREQ].val) { |
2340 | case 0: /* Banding filter disabled */ | 2299 | case 0: /* Banding filter disabled */ |
2341 | i2c_w1(gspca_dev, 0x13, com8 | 0x20); | 2300 | i2c_w1(gspca_dev, 0x13, com8 | 0x20); |
2342 | break; | 2301 | break; |
@@ -2364,7 +2323,7 @@ static void setfreq(struct gspca_dev *gspca_dev) | |||
2364 | break; | 2323 | break; |
2365 | } | 2324 | } |
2366 | 2325 | ||
2367 | switch (sd->freq) { | 2326 | switch (sd->ctrls[FREQ].val) { |
2368 | case 0: /* Banding filter disabled */ | 2327 | case 0: /* Banding filter disabled */ |
2369 | break; | 2328 | break; |
2370 | case 1: /* 50 hz (filter on and framerate adj) */ | 2329 | case 1: /* 50 hz (filter on and framerate adj) */ |
@@ -2539,7 +2498,7 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
2539 | reg_w1(gspca_dev, 0x9a, 0x08); | 2498 | reg_w1(gspca_dev, 0x9a, 0x08); |
2540 | break; | 2499 | break; |
2541 | } | 2500 | } |
2542 | setsharpness(sd); | 2501 | setsharpness(gspca_dev); |
2543 | 2502 | ||
2544 | reg_w(gspca_dev, 0x84, reg84, sizeof reg84); | 2503 | reg_w(gspca_dev, 0x84, reg84, sizeof reg84); |
2545 | reg_w1(gspca_dev, 0x05, 0x20); /* red */ | 2504 | reg_w1(gspca_dev, 0x05, 0x20); /* red */ |
@@ -2690,7 +2649,7 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
2690 | reg_w1(gspca_dev, 0x17, reg17); | 2649 | reg_w1(gspca_dev, 0x17, reg17); |
2691 | reg_w1(gspca_dev, 0x01, reg1); | 2650 | reg_w1(gspca_dev, 0x01, reg1); |
2692 | 2651 | ||
2693 | setvflip(sd); | 2652 | setvflip(gspca_dev); |
2694 | setbrightness(gspca_dev); | 2653 | setbrightness(gspca_dev); |
2695 | setcontrast(gspca_dev); | 2654 | setcontrast(gspca_dev); |
2696 | setcolors(gspca_dev); | 2655 | setcolors(gspca_dev); |
@@ -2868,204 +2827,6 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
2868 | atomic_set(&sd->avg_lum, avg_lum); | 2827 | atomic_set(&sd->avg_lum, avg_lum); |
2869 | } | 2828 | } |
2870 | 2829 | ||
2871 | static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) | ||
2872 | { | ||
2873 | struct sd *sd = (struct sd *) gspca_dev; | ||
2874 | |||
2875 | sd->brightness = val; | ||
2876 | if (gspca_dev->streaming) | ||
2877 | setbrightness(gspca_dev); | ||
2878 | return gspca_dev->usb_err; | ||
2879 | } | ||
2880 | |||
2881 | static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val) | ||
2882 | { | ||
2883 | struct sd *sd = (struct sd *) gspca_dev; | ||
2884 | |||
2885 | *val = sd->brightness; | ||
2886 | return 0; | ||
2887 | } | ||
2888 | |||
2889 | static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val) | ||
2890 | { | ||
2891 | struct sd *sd = (struct sd *) gspca_dev; | ||
2892 | |||
2893 | sd->contrast = val; | ||
2894 | if (gspca_dev->streaming) | ||
2895 | setcontrast(gspca_dev); | ||
2896 | return gspca_dev->usb_err; | ||
2897 | } | ||
2898 | |||
2899 | static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val) | ||
2900 | { | ||
2901 | struct sd *sd = (struct sd *) gspca_dev; | ||
2902 | |||
2903 | *val = sd->contrast; | ||
2904 | return 0; | ||
2905 | } | ||
2906 | |||
2907 | static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val) | ||
2908 | { | ||
2909 | struct sd *sd = (struct sd *) gspca_dev; | ||
2910 | |||
2911 | sd->colors = val; | ||
2912 | if (gspca_dev->streaming) | ||
2913 | setcolors(gspca_dev); | ||
2914 | return gspca_dev->usb_err; | ||
2915 | } | ||
2916 | |||
2917 | static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val) | ||
2918 | { | ||
2919 | struct sd *sd = (struct sd *) gspca_dev; | ||
2920 | |||
2921 | *val = sd->colors; | ||
2922 | return 0; | ||
2923 | } | ||
2924 | |||
2925 | static int sd_setblue_balance(struct gspca_dev *gspca_dev, __s32 val) | ||
2926 | { | ||
2927 | struct sd *sd = (struct sd *) gspca_dev; | ||
2928 | |||
2929 | sd->blue = val; | ||
2930 | if (gspca_dev->streaming) | ||
2931 | setredblue(gspca_dev); | ||
2932 | return gspca_dev->usb_err; | ||
2933 | } | ||
2934 | |||
2935 | static int sd_getblue_balance(struct gspca_dev *gspca_dev, __s32 *val) | ||
2936 | { | ||
2937 | struct sd *sd = (struct sd *) gspca_dev; | ||
2938 | |||
2939 | *val = sd->blue; | ||
2940 | return 0; | ||
2941 | } | ||
2942 | |||
2943 | static int sd_setred_balance(struct gspca_dev *gspca_dev, __s32 val) | ||
2944 | { | ||
2945 | struct sd *sd = (struct sd *) gspca_dev; | ||
2946 | |||
2947 | sd->red = val; | ||
2948 | if (gspca_dev->streaming) | ||
2949 | setredblue(gspca_dev); | ||
2950 | return gspca_dev->usb_err; | ||
2951 | } | ||
2952 | |||
2953 | static int sd_getred_balance(struct gspca_dev *gspca_dev, __s32 *val) | ||
2954 | { | ||
2955 | struct sd *sd = (struct sd *) gspca_dev; | ||
2956 | |||
2957 | *val = sd->red; | ||
2958 | return 0; | ||
2959 | } | ||
2960 | |||
2961 | static int sd_setgamma(struct gspca_dev *gspca_dev, __s32 val) | ||
2962 | { | ||
2963 | struct sd *sd = (struct sd *) gspca_dev; | ||
2964 | |||
2965 | sd->gamma = val; | ||
2966 | if (gspca_dev->streaming) | ||
2967 | setgamma(gspca_dev); | ||
2968 | return gspca_dev->usb_err; | ||
2969 | } | ||
2970 | |||
2971 | static int sd_getgamma(struct gspca_dev *gspca_dev, __s32 *val) | ||
2972 | { | ||
2973 | struct sd *sd = (struct sd *) gspca_dev; | ||
2974 | |||
2975 | *val = sd->gamma; | ||
2976 | return 0; | ||
2977 | } | ||
2978 | |||
2979 | static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val) | ||
2980 | { | ||
2981 | struct sd *sd = (struct sd *) gspca_dev; | ||
2982 | |||
2983 | sd->autogain = val; | ||
2984 | if (gspca_dev->streaming) | ||
2985 | setautogain(gspca_dev); | ||
2986 | return gspca_dev->usb_err; | ||
2987 | } | ||
2988 | |||
2989 | static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val) | ||
2990 | { | ||
2991 | struct sd *sd = (struct sd *) gspca_dev; | ||
2992 | |||
2993 | *val = sd->autogain; | ||
2994 | return 0; | ||
2995 | } | ||
2996 | |||
2997 | static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val) | ||
2998 | { | ||
2999 | struct sd *sd = (struct sd *) gspca_dev; | ||
3000 | |||
3001 | sd->sharpness = val; | ||
3002 | if (gspca_dev->streaming) | ||
3003 | setsharpness(sd); | ||
3004 | return gspca_dev->usb_err; | ||
3005 | } | ||
3006 | |||
3007 | static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val) | ||
3008 | { | ||
3009 | struct sd *sd = (struct sd *) gspca_dev; | ||
3010 | |||
3011 | *val = sd->sharpness; | ||
3012 | return 0; | ||
3013 | } | ||
3014 | |||
3015 | static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val) | ||
3016 | { | ||
3017 | struct sd *sd = (struct sd *) gspca_dev; | ||
3018 | |||
3019 | sd->vflip = val; | ||
3020 | if (gspca_dev->streaming) | ||
3021 | setvflip(sd); | ||
3022 | return gspca_dev->usb_err; | ||
3023 | } | ||
3024 | |||
3025 | static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val) | ||
3026 | { | ||
3027 | struct sd *sd = (struct sd *) gspca_dev; | ||
3028 | |||
3029 | *val = sd->vflip; | ||
3030 | return 0; | ||
3031 | } | ||
3032 | |||
3033 | static int sd_setinfrared(struct gspca_dev *gspca_dev, __s32 val) | ||
3034 | { | ||
3035 | struct sd *sd = (struct sd *) gspca_dev; | ||
3036 | |||
3037 | sd->infrared = val; | ||
3038 | if (gspca_dev->streaming) | ||
3039 | setinfrared(sd); | ||
3040 | return gspca_dev->usb_err; | ||
3041 | } | ||
3042 | |||
3043 | static int sd_getinfrared(struct gspca_dev *gspca_dev, __s32 *val) | ||
3044 | { | ||
3045 | struct sd *sd = (struct sd *) gspca_dev; | ||
3046 | |||
3047 | *val = sd->infrared; | ||
3048 | return 0; | ||
3049 | } | ||
3050 | |||
3051 | static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val) | ||
3052 | { | ||
3053 | struct sd *sd = (struct sd *) gspca_dev; | ||
3054 | |||
3055 | sd->freq = val; | ||
3056 | if (gspca_dev->streaming) | ||
3057 | setfreq(gspca_dev); | ||
3058 | return gspca_dev->usb_err; | ||
3059 | } | ||
3060 | |||
3061 | static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val) | ||
3062 | { | ||
3063 | struct sd *sd = (struct sd *) gspca_dev; | ||
3064 | |||
3065 | *val = sd->freq; | ||
3066 | return 0; | ||
3067 | } | ||
3068 | |||
3069 | static int sd_set_jcomp(struct gspca_dev *gspca_dev, | 2830 | static int sd_set_jcomp(struct gspca_dev *gspca_dev, |
3070 | struct v4l2_jpegcompression *jcomp) | 2831 | struct v4l2_jpegcompression *jcomp) |
3071 | { | 2832 | { |
@@ -3138,7 +2899,7 @@ static int sd_int_pkt_scan(struct gspca_dev *gspca_dev, | |||
3138 | static const struct sd_desc sd_desc = { | 2899 | static const struct sd_desc sd_desc = { |
3139 | .name = MODULE_NAME, | 2900 | .name = MODULE_NAME, |
3140 | .ctrls = sd_ctrls, | 2901 | .ctrls = sd_ctrls, |
3141 | .nctrls = ARRAY_SIZE(sd_ctrls), | 2902 | .nctrls = NCTRLS, |
3142 | .config = sd_config, | 2903 | .config = sd_config, |
3143 | .init = sd_init, | 2904 | .init = sd_init, |
3144 | .start = sd_start, | 2905 | .start = sd_start, |