1 /* @file gl860-mi1320.c
2 * @author Olivier LORIN from my logs
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
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.
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/>.
23 static struct validx tbl_common
[] = {
24 {0xba00, 0x00f0}, {0xba00, 0x00f1}, {0xba51, 0x0066}, {0xba02, 0x00f1},
25 {0xba05, 0x0067}, {0xba05, 0x00f1}, {0xbaa0, 0x0065}, {0xba00, 0x00f1},
27 {0xba00, 0x00f0}, {0xba02, 0x00f1}, {0xbafa, 0x0028}, {0xba02, 0x00f1},
28 {0xba00, 0x00f0}, {0xba01, 0x00f1}, {0xbaf0, 0x0006}, {0xba0e, 0x00f1},
29 {0xba70, 0x0006}, {0xba0e, 0x00f1},
31 {0xba74, 0x0006}, {0xba0e, 0x00f1},
33 {0x0061, 0x0000}, {0x0068, 0x000d},
36 static struct validx tbl_init_at_startup
[] = {
37 {0x0000, 0x0000}, {0x0010, 0x0010},
39 {0x0008, 0x00c0}, {0x0001, 0x00c1}, {0x0001, 0x00c2}, {0x0020, 0x0006},
43 static struct validx tbl_sensor_settings_common
[] = {
44 {0x0010, 0x0010}, {0x0003, 0x00c1}, {0x0042, 0x00c2}, {0x0040, 0x0000},
45 {0x006a, 0x0007}, {0x006a, 0x000d}, {0x0063, 0x0006},
47 static struct validx tbl_sensor_settings_1280
[] = {
48 {0xba00, 0x00f0}, {0xba00, 0x00f1}, {0xba5a, 0x0066}, {0xba02, 0x00f1},
49 {0xba05, 0x0067}, {0xba05, 0x00f1}, {0xba20, 0x0065}, {0xba00, 0x00f1},
51 static struct validx tbl_sensor_settings_800
[] = {
52 {0xba00, 0x00f0}, {0xba00, 0x00f1}, {0xba5a, 0x0066}, {0xba02, 0x00f1},
53 {0xba05, 0x0067}, {0xba05, 0x00f1}, {0xba20, 0x0065}, {0xba00, 0x00f1},
55 static struct validx tbl_sensor_settings_640
[] = {
56 {0xba00, 0x00f0}, {0xba00, 0x00f1}, {0xbaa0, 0x0065}, {0xba00, 0x00f1},
57 {0xba51, 0x0066}, {0xba02, 0x00f1}, {0xba05, 0x0067}, {0xba05, 0x00f1},
58 {0xba20, 0x0065}, {0xba00, 0x00f1},
60 static struct validx tbl_post_unset_alt
[] = {
61 {0xba00, 0x00f0}, {0xba00, 0x00f1}, {0xbaa0, 0x0065}, {0xba00, 0x00f1},
62 {0x0061, 0x0000}, {0x0068, 0x000d},
65 static u8
*tbl_1280
[] = {
66 "\x0d\x80\xf1\x08\x03\x04\xf1\x00" "\x04\x05\xf1\x02\x05\x00\xf1\xf1"
67 "\x06\x00\xf1\x0d\x20\x01\xf1\x00" "\x21\x84\xf1\x00\x0d\x00\xf1\x08"
68 "\xf0\x00\xf1\x01\x34\x00\xf1\x00" "\x9b\x43\xf1\x00\xa6\x05\xf1\x00"
69 "\xa9\x04\xf1\x00\xa1\x05\xf1\x00" "\xa4\x04\xf1\x00\xae\x0a\xf1\x08"
71 "\xf0\x00\xf1\x02\x3a\x05\xf1\xf1" "\x3c\x05\xf1\xf1\x59\x01\xf1\x47"
72 "\x5a\x01\xf1\x88\x5c\x0a\xf1\x06" "\x5d\x0e\xf1\x0a\x64\x5e\xf1\x1c"
73 "\xd2\x00\xf1\xcf\xcb\x00\xf1\x01"
75 "\xd3\x02\xd4\x28\xd5\x01\xd0\x02" "\xd1\x18\xd2\xc1"
78 static u8
*tbl_800
[] = {
79 "\x0d\x80\xf1\x08\x03\x03\xf1\xc0" "\x04\x05\xf1\x02\x05\x00\xf1\xf1"
80 "\x06\x00\xf1\x0d\x20\x01\xf1\x00" "\x21\x84\xf1\x00\x0d\x00\xf1\x08"
81 "\xf0\x00\xf1\x01\x34\x00\xf1\x00" "\x9b\x43\xf1\x00\xa6\x05\xf1\x00"
82 "\xa9\x03\xf1\xc0\xa1\x03\xf1\x20" "\xa4\x02\xf1\x5a\xae\x0a\xf1\x08"
84 "\xf0\x00\xf1\x02\x3a\x05\xf1\xf1" "\x3c\x05\xf1\xf1\x59\x01\xf1\x47"
85 "\x5a\x01\xf1\x88\x5c\x0a\xf1\x06" "\x5d\x0e\xf1\x0a\x64\x5e\xf1\x1c"
86 "\xd2\x00\xf1\xcf\xcb\x00\xf1\x01"
88 "\xd3\x02\xd4\x18\xd5\x21\xd0\x02" "\xd1\x10\xd2\x59"
91 static u8
*tbl_640
[] = {
92 "\x0d\x80\xf1\x08\x03\x04\xf1\x04" "\x04\x05\xf1\x02\x07\x01\xf1\x7c"
93 "\x08\x00\xf1\x0e\x21\x80\xf1\x00" "\x0d\x00\xf1\x08\xf0\x00\xf1\x01"
94 "\x34\x10\xf1\x10\x3a\x43\xf1\x00" "\xa6\x05\xf1\x02\xa9\x04\xf1\x04"
95 "\xa7\x02\xf1\x81\xaa\x01\xf1\xe2" "\xae\x0c\xf1\x09"
97 "\xf0\x00\xf1\x02\x39\x03\xf1\xfc" "\x3b\x04\xf1\x04\x57\x01\xf1\xb6"
98 "\x58\x02\xf1\x0d\x5c\x1f\xf1\x19" "\x5d\x24\xf1\x1e\x64\x5e\xf1\x1c"
99 "\xd2\x00\xf1\x00\xcb\x00\xf1\x01"
101 "\xd3\x02\xd4\x10\xd5\x81\xd0\x02" "\xd1\x08\xd2\xe1"
104 static s32 tbl_sat
[] = {0x25, 0x1d, 0x15, 0x0d, 0x05, 0x4d, 0x55, 0x5d, 0x2d};
105 static s32 tbl_bright
[] = {0, 8, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70};
106 static s32 tbl_backlight
[] = {0x0e, 0x06, 0x02};
108 static s32 tbl_cntr1
[] = {
109 0x90, 0x98, 0xa0, 0xa8, 0xb0, 0xb8, 0xc0, 0xc8, 0xd0, 0xe0, 0xf0};
110 static s32 tbl_cntr2
[] = {
111 0x70, 0x68, 0x60, 0x58, 0x50, 0x48, 0x40, 0x38, 0x30, 0x20, 0x10};
113 static u8 dat_wbalNL
[] =
114 "\xf0\x00\xf1\x01\x05\x00\xf1\x06" "\x3b\x04\xf1\x2a\x47\x10\xf1\x10"
115 "\x9d\x3c\xf1\xae\xaf\x10\xf1\x00" "\xf0\x00\xf1\x02\x2f\x91\xf1\x20"
116 "\x9c\x91\xf1\x20\x37\x03\xf1\x00" "\x9d\xc5\xf1\x0f\xf0\x00\xf1\x00";
118 static u8 dat_wbalLL
[] =
119 "\xf0\x00\xf1\x01\x05\x00\xf1\x0c" "\x3b\x04\xf1\x2a\x47\x40\xf1\x40"
120 "\x9d\x20\xf1\xae\xaf\x10\xf1\x00" "\xf0\x00\xf1\x02\x2f\xd1\xf1\x00"
121 "\x9c\xd1\xf1\x00\x37\x03\xf1\x00" "\x9d\xc5\xf1\x3f\xf0\x00\xf1\x00";
123 static u8 dat_wbalBL
[] =
124 "\xf0\x00\xf1\x01\x05\x00\xf1\x06" "\x47\x10\xf1\x30\x9d\x3c\xf1\xae"
125 "\xaf\x10\xf1\x00\xf0\x00\xf1\x02" "\x2f\x91\xf1\x20\x9c\x91\xf1\x20"
126 "\x37\x03\xf1\x00\x9d\xc5\xf1\x2f" "\xf0\x00\xf1\x00";
128 static u8 dat_hvflip1
[] = {0xf0, 0x00, 0xf1, 0x00};
131 "\x00\x01\x07\x6a\x06\x63\x0d\x6a" "\xc0\x00\x10\x10\xc1\x03\xc2\x42"
132 "\xd8\x04\x58\x00\x04\x02";
134 "\x0d\x00\xf1\x0b\x0d\x00\xf1\x08" "\x35\x00\xf1\x22\x68\x00\xf1\x5d"
135 "\xf0\x00\xf1\x01\x06\x70\xf1\x0e" "\xf0\x00\xf1\x02\xdd\x18\xf1\xe0";
137 "\x05\x01\xf1\x84\x06\x00\xf1\x44" "\x07\x00\xf1\xbe\x08\x00\xf1\x1e"
138 "\x20\x01\xf1\x03\x21\x84\xf1\x00" "\x22\x0d\xf1\x0f\x24\x80\xf1\x00"
139 "\x34\x18\xf1\x2d\x35\x00\xf1\x22" "\x43\x83\xf1\x83\x59\x00\xf1\xff";
141 "\xf0\x00\xf1\x02\x39\x06\xf1\x8c" "\x3a\x06\xf1\x8c\x3b\x03\xf1\xda"
142 "\x3c\x05\xf1\x30\x57\x01\xf1\x0c" "\x58\x01\xf1\x42\x59\x01\xf1\x0c"
143 "\x5a\x01\xf1\x42\x5c\x13\xf1\x0e" "\x5d\x17\xf1\x12\x64\x1e\xf1\x1c";
145 "\xf0\x00\xf1\x02\x24\x5f\xf1\x20" "\x28\xea\xf1\x02\x5f\x41\xf1\x43";
147 "\x02\x00\xf1\xee\x03\x29\xf1\x1a" "\x04\x02\xf1\xa4\x09\x00\xf1\x68"
148 "\x0a\x00\xf1\x2a\x0b\x00\xf1\x04" "\x0c\x00\xf1\x93\x0d\x00\xf1\x82"
149 "\x0e\x00\xf1\x40\x0f\x00\xf1\x5f" "\x10\x00\xf1\x4e\x11\x00\xf1\x5b";
151 "\x15\x00\xf1\xc9\x16\x00\xf1\x5e" "\x17\x00\xf1\x9d\x18\x00\xf1\x06"
152 "\x19\x00\xf1\x89\x1a\x00\xf1\x12" "\x1b\x00\xf1\xa1\x1c\x00\xf1\xe4"
153 "\x1d\x00\xf1\x7a\x1e\x00\xf1\x64" "\xf6\x00\xf1\x5f";
155 "\xf0\x00\xf1\x01\x53\x09\xf1\x03" "\x54\x3d\xf1\x1c\x55\x99\xf1\x72"
156 "\x56\xc1\xf1\xb1\x57\xd8\xf1\xce" "\x58\xe0\xf1\x00\xdc\x0a\xf1\x03"
157 "\xdd\x45\xf1\x20\xde\xae\xf1\x82" "\xdf\xdc\xf1\xc9\xe0\xf6\xf1\xea"
160 "\xf0\x00\xf1\x01\x80\x00\xf1\x06" "\x81\xf6\xf1\x08\x82\xfb\xf1\xf7"
161 "\x83\x00\xf1\xfe\xb6\x07\xf1\x03" "\xb7\x18\xf1\x0c\x84\xfb\xf1\x06"
162 "\x85\xfb\xf1\xf9\x86\x00\xf1\xff" "\xb8\x07\xf1\x04\xb9\x16\xf1\x0a";
164 "\x87\xfa\xf1\x05\x88\xfc\xf1\xf9" "\x89\x00\xf1\xff\xba\x06\xf1\x03"
165 "\xbb\x17\xf1\x09\x8a\xe8\xf1\x14" "\x8b\xf7\xf1\xf0\x8c\xfd\xf1\xfa"
166 "\x8d\x00\xf1\x00\xbc\x05\xf1\x01" "\xbd\x0c\xf1\x08\xbe\x00\xf1\x14";
168 "\x8e\xea\xf1\x13\x8f\xf7\xf1\xf2" "\x90\xfd\xf1\xfa\x91\x00\xf1\x00"
169 "\xbf\x05\xf1\x01\xc0\x0a\xf1\x08" "\xc1\x00\xf1\x0c\x92\xed\xf1\x0f"
170 "\x93\xf9\xf1\xf4\x94\xfe\xf1\xfb" "\x95\x00\xf1\x00\xc2\x04\xf1\x01"
171 "\xc3\x0a\xf1\x07\xc4\x00\xf1\x10";
173 "\xf0\x00\xf1\x01\x05\x00\xf1\x06" "\x25\x00\xf1\x55\x34\x10\xf1\x10"
174 "\x35\xf0\xf1\x10\x3a\x02\xf1\x03" "\x3b\x04\xf1\x2a\x9b\x43\xf1\x00"
175 "\xa4\x03\xf1\xc0\xa7\x02\xf1\x81";
177 static int mi1320_init_at_startup(struct gspca_dev
*gspca_dev
);
178 static int mi1320_configure_alt(struct gspca_dev
*gspca_dev
);
179 static int mi1320_init_pre_alt(struct gspca_dev
*gspca_dev
);
180 static int mi1320_init_post_alt(struct gspca_dev
*gspca_dev
);
181 static void mi1320_post_unset_alt(struct gspca_dev
*gspca_dev
);
182 static int mi1320_sensor_settings(struct gspca_dev
*gspca_dev
);
183 static int mi1320_camera_settings(struct gspca_dev
*gspca_dev
);
184 /*==========================================================================*/
186 void mi1320_init_settings(struct gspca_dev
*gspca_dev
)
188 struct sd
*sd
= (struct sd
*) gspca_dev
;
190 sd
->vcur
.backlight
= 0;
191 sd
->vcur
.brightness
= 0;
192 sd
->vcur
.sharpness
= 6;
193 sd
->vcur
.contrast
= 10;
196 sd
->vcur
.saturation
= 6;
197 sd
->vcur
.whitebal
= 0;
202 sd
->vmax
.backlight
= 2;
203 sd
->vmax
.brightness
= 8;
204 sd
->vmax
.sharpness
= 7;
205 sd
->vmax
.contrast
= 0; /* 10 but not working with tihs driver */
207 sd
->vmax
.hue
= 5 + 1;
208 sd
->vmax
.saturation
= 8;
209 sd
->vmax
.whitebal
= 2;
214 sd
->dev_camera_settings
= mi1320_camera_settings
;
215 sd
->dev_init_at_startup
= mi1320_init_at_startup
;
216 sd
->dev_configure_alt
= mi1320_configure_alt
;
217 sd
->dev_init_pre_alt
= mi1320_init_pre_alt
;
218 sd
->dev_post_unset_alt
= mi1320_post_unset_alt
;
221 /*==========================================================================*/
223 static void common(struct gspca_dev
*gspca_dev
)
225 s32 n
; /* reserved for FETCH macros */
227 ctrl_out(gspca_dev
, 0x40, 3, 0x0000, 0x0200, 22, s000
);
228 ctrl_out(gspca_dev
, 0x40, 1, 0x0041, 0x0000, 0, NULL
);
229 ctrl_out(gspca_dev
, 0x40, 3, 0xba00, 0x0200, 32, s001
);
230 n
= fetch_validx(gspca_dev
, tbl_common
, ARRAY_SIZE(tbl_common
));
231 ctrl_out(gspca_dev
, 0x40, 3, 0xba00, 0x0200, 48, s002
);
232 ctrl_out(gspca_dev
, 0x40, 3, 0xba00, 0x0200, 48, s003
);
233 ctrl_out(gspca_dev
, 0x40, 3, 0xba00, 0x0200, 16, s004
);
234 ctrl_out(gspca_dev
, 0x40, 3, 0xba00, 0x0200, 48, s005
);
235 ctrl_out(gspca_dev
, 0x40, 3, 0xba00, 0x0200, 44, s006
);
236 keep_on_fetching_validx(gspca_dev
, tbl_common
,
237 ARRAY_SIZE(tbl_common
), n
);
238 ctrl_out(gspca_dev
, 0x40, 3, 0xba00, 0x0200, 52, s007
);
239 ctrl_out(gspca_dev
, 0x40, 3, 0xba00, 0x0200, 48, s008
);
240 ctrl_out(gspca_dev
, 0x40, 3, 0xba00, 0x0200, 48, s009
);
241 ctrl_out(gspca_dev
, 0x40, 3, 0xba00, 0x0200, 56, s010
);
242 keep_on_fetching_validx(gspca_dev
, tbl_common
,
243 ARRAY_SIZE(tbl_common
), n
);
244 ctrl_out(gspca_dev
, 0x40, 3, 0xba00, 0x0200, 40, s011
);
245 keep_on_fetching_validx(gspca_dev
, tbl_common
,
246 ARRAY_SIZE(tbl_common
), n
);
249 static int mi1320_init_at_startup(struct gspca_dev
*gspca_dev
)
251 fetch_validx(gspca_dev
, tbl_init_at_startup
,
252 ARRAY_SIZE(tbl_init_at_startup
));
256 /* ctrl_out(gspca_dev, 0x40, 11, 0x0000, 0x0000, 0, NULL); */
261 static int mi1320_init_pre_alt(struct gspca_dev
*gspca_dev
)
263 struct sd
*sd
= (struct sd
*) gspca_dev
;
267 sd
->vold
.backlight
= -1;
268 sd
->vold
.brightness
= -1;
269 sd
->vold
.sharpness
= -1;
270 sd
->vold
.contrast
= -1;
271 sd
->vold
.saturation
= -1;
274 sd
->vold
.whitebal
= -1;
275 sd
->vold
.mirror
= -1;
277 sd
->vold
.AC50Hz
= -1;
281 mi1320_sensor_settings(gspca_dev
);
283 mi1320_init_post_alt(gspca_dev
);
288 static int mi1320_init_post_alt(struct gspca_dev
*gspca_dev
)
290 mi1320_camera_settings(gspca_dev
);
295 static int mi1320_sensor_settings(struct gspca_dev
*gspca_dev
)
297 s32 reso
= gspca_dev
->cam
.cam_mode
[(s32
) gspca_dev
->curr_mode
].priv
;
299 ctrl_out(gspca_dev
, 0x40, 5, 0x0001, 0x0000, 0, NULL
);
301 fetch_validx(gspca_dev
, tbl_sensor_settings_common
,
302 ARRAY_SIZE(tbl_sensor_settings_common
));
306 fetch_validx(gspca_dev
, tbl_sensor_settings_1280
,
307 ARRAY_SIZE(tbl_sensor_settings_1280
));
308 ctrl_out(gspca_dev
, 0x40, 3, 0xba00, 0x0200, 64, tbl_1280
[0]);
309 ctrl_out(gspca_dev
, 0x40, 3, 0xba00, 0x0200, 40, tbl_1280
[1]);
310 ctrl_out(gspca_dev
, 0x40, 3, 0x0000, 0x0200, 12, tbl_1280
[2]);
314 fetch_validx(gspca_dev
, tbl_sensor_settings_800
,
315 ARRAY_SIZE(tbl_sensor_settings_800
));
316 ctrl_out(gspca_dev
, 0x40, 3, 0xba00, 0x0200, 64, tbl_800
[0]);
317 ctrl_out(gspca_dev
, 0x40, 3, 0xba00, 0x0200, 40, tbl_800
[1]);
318 ctrl_out(gspca_dev
, 0x40, 3, 0x0000, 0x0200, 12, tbl_800
[2]);
322 fetch_validx(gspca_dev
, tbl_sensor_settings_640
,
323 ARRAY_SIZE(tbl_sensor_settings_640
));
324 ctrl_out(gspca_dev
, 0x40, 3, 0xba00, 0x0200, 60, tbl_640
[0]);
325 ctrl_out(gspca_dev
, 0x40, 3, 0xba00, 0x0200, 40, tbl_640
[1]);
326 ctrl_out(gspca_dev
, 0x40, 3, 0x0000, 0x0200, 12, tbl_640
[2]);
332 static int mi1320_configure_alt(struct gspca_dev
*gspca_dev
)
334 s32 reso
= gspca_dev
->cam
.cam_mode
[(s32
) gspca_dev
->curr_mode
].priv
;
338 gspca_dev
->alt
= 3 + 1;
343 gspca_dev
->alt
= 1 + 1;
349 int mi1320_camera_settings(struct gspca_dev
*gspca_dev
)
351 struct sd
*sd
= (struct sd
*) gspca_dev
;
353 s32 backlight
= sd
->vcur
.backlight
;
354 s32 bright
= sd
->vcur
.brightness
;
355 s32 sharp
= sd
->vcur
.sharpness
;
356 s32 cntr
= sd
->vcur
.contrast
;
357 s32 gam
= sd
->vcur
.gamma
;
358 s32 hue
= sd
->vcur
.hue
;
359 s32 sat
= sd
->vcur
.saturation
;
360 s32 wbal
= sd
->vcur
.whitebal
;
361 s32 mirror
= (((sd
->vcur
.mirror
> 0) ^ sd
->mirrorMask
) > 0);
362 s32 flip
= (((sd
->vcur
.flip
> 0) ^ sd
->mirrorMask
) > 0);
363 s32 freq
= (sd
->vcur
.AC50Hz
> 0);
366 if (freq
!= sd
->vold
.AC50Hz
) {
367 sd
->vold
.AC50Hz
= freq
;
369 freq
= 2 * (freq
== 0);
370 ctrl_out(gspca_dev
, 0x40, 1, 0xba00, 0x00f0, 0, NULL
);
371 ctrl_out(gspca_dev
, 0x40, 1, 0xba02, 0x00f1, 0, NULL
);
372 ctrl_out(gspca_dev
, 0x40, 1, 0xba00 , 0x005b, 0, NULL
);
373 ctrl_out(gspca_dev
, 0x40, 1, 0xba01 + freq
, 0x00f1, 0, NULL
);
376 if (wbal
!= sd
->vold
.whitebal
) {
377 sd
->vold
.whitebal
= wbal
;
378 if (wbal
< 0 || wbal
> sd
->vmax
.whitebal
)
381 for (i
= 0; i
< 2; i
++) {
382 if (wbal
== 0) { /* Normal light */
383 ctrl_out(gspca_dev
, 0x40, 1,
384 0x0010, 0x0010, 0, NULL
);
385 ctrl_out(gspca_dev
, 0x40, 1,
386 0x0003, 0x00c1, 0, NULL
);
387 ctrl_out(gspca_dev
, 0x40, 1,
388 0x0042, 0x00c2, 0, NULL
);
389 ctrl_out(gspca_dev
, 0x40, 3,
390 0xba00, 0x0200, 48, dat_wbalNL
);
393 if (wbal
== 1) { /* Low light */
394 ctrl_out(gspca_dev
, 0x40, 1,
395 0x0010, 0x0010, 0, NULL
);
396 ctrl_out(gspca_dev
, 0x40, 1,
397 0x0004, 0x00c1, 0, NULL
);
398 ctrl_out(gspca_dev
, 0x40, 1,
399 0x0043, 0x00c2, 0, NULL
);
400 ctrl_out(gspca_dev
, 0x40, 3,
401 0xba00, 0x0200, 48, dat_wbalLL
);
404 if (wbal
== 2) { /* Back light */
405 ctrl_out(gspca_dev
, 0x40, 1,
406 0x0010, 0x0010, 0, NULL
);
407 ctrl_out(gspca_dev
, 0x40, 1,
408 0x0003, 0x00c1, 0, NULL
);
409 ctrl_out(gspca_dev
, 0x40, 1,
410 0x0042, 0x00c2, 0, NULL
);
411 ctrl_out(gspca_dev
, 0x40, 3,
412 0xba00, 0x0200, 44, dat_wbalBL
);
417 if (bright
!= sd
->vold
.brightness
) {
418 sd
->vold
.brightness
= bright
;
419 if (bright
< 0 || bright
> sd
->vmax
.brightness
)
422 bright
= tbl_bright
[bright
];
423 ctrl_out(gspca_dev
, 0x40, 1, 0xba00, 0x00f0, 0, NULL
);
424 ctrl_out(gspca_dev
, 0x40, 1, 0xba01, 0x00f1, 0, NULL
);
425 ctrl_out(gspca_dev
, 0x40, 1, 0xba00 + bright
, 0x0034, 0, NULL
);
426 ctrl_out(gspca_dev
, 0x40, 1, 0xba00 + bright
, 0x00f1, 0, NULL
);
429 if (sat
!= sd
->vold
.saturation
) {
430 sd
->vold
.saturation
= sat
;
431 if (sat
< 0 || sat
> sd
->vmax
.saturation
)
435 ctrl_out(gspca_dev
, 0x40, 1, 0xba00, 0x00f0, 0, NULL
);
436 ctrl_out(gspca_dev
, 0x40, 1, 0xba01, 0x00f1, 0, NULL
);
437 ctrl_out(gspca_dev
, 0x40, 1, 0xba00 , 0x0025, 0, NULL
);
438 ctrl_out(gspca_dev
, 0x40, 1, 0xba00 + sat
, 0x00f1, 0, NULL
);
441 if (sharp
!= sd
->vold
.sharpness
) {
442 sd
->vold
.sharpness
= sharp
;
443 if (sharp
< 0 || sharp
> sd
->vmax
.sharpness
)
446 ctrl_out(gspca_dev
, 0x40, 1, 0xba00, 0x00f0, 0, NULL
);
447 ctrl_out(gspca_dev
, 0x40, 1, 0xba01, 0x00f1, 0, NULL
);
448 ctrl_out(gspca_dev
, 0x40, 1, 0xba00 , 0x0005, 0, NULL
);
449 ctrl_out(gspca_dev
, 0x40, 1, 0xba00 + sharp
, 0x00f1, 0, NULL
);
452 if (hue
!= sd
->vold
.hue
) {
453 /* 0=normal 1=NB 2="sepia" 3=negative 4=other 5=other2 */
454 if (hue
< 0 || hue
> sd
->vmax
.hue
)
456 if (hue
== sd
->vmax
.hue
)
461 ctrl_out(gspca_dev
, 0x40, 1, 0xba00, 0x00f0, 0, NULL
);
462 ctrl_out(gspca_dev
, 0x40, 1, 0xba01, 0x00f1, 0, NULL
);
463 ctrl_out(gspca_dev
, 0x40, 1, 0xba70, 0x00e2, 0, NULL
);
464 ctrl_out(gspca_dev
, 0x40, 1, 0xba00 + hue
* (hue
< 6), 0x00f1,
468 if (backlight
!= sd
->vold
.backlight
) {
469 sd
->vold
.backlight
= backlight
;
470 if (backlight
< 0 || backlight
> sd
->vmax
.backlight
)
473 backlight
= tbl_backlight
[backlight
];
474 for (i
= 0; i
< 2; i
++) {
475 ctrl_out(gspca_dev
, 0x40, 1, 0xba00, 0x00f0, 0, NULL
);
476 ctrl_out(gspca_dev
, 0x40, 1, 0xba01, 0x00f1, 0, NULL
);
477 ctrl_out(gspca_dev
, 0x40, 1, 0xba74, 0x0006, 0, NULL
);
478 ctrl_out(gspca_dev
, 0x40, 1, 0xba80 + backlight
, 0x00f1,
483 if (hue
!= sd
->vold
.hue
) {
486 ctrl_out(gspca_dev
, 0x40, 1, 0xba00, 0x00f0, 0, NULL
);
487 ctrl_out(gspca_dev
, 0x40, 1, 0xba01, 0x00f1, 0, NULL
);
488 ctrl_out(gspca_dev
, 0x40, 1, 0xba70, 0x00e2, 0, NULL
);
489 ctrl_out(gspca_dev
, 0x40, 1, 0xba00 + hue
* (hue
< 6), 0x00f1,
493 if (mirror
!= sd
->vold
.mirror
|| flip
!= sd
->vold
.flip
) {
494 u8 dat_hvflip2
[4] = {0x20, 0x01, 0xf1, 0x00};
495 sd
->vold
.mirror
= mirror
;
496 sd
->vold
.flip
= flip
;
498 dat_hvflip2
[3] = flip
+ 2 * mirror
;
499 ctrl_out(gspca_dev
, 0x40, 3, 0xba00, 0x0200, 4, dat_hvflip1
);
500 ctrl_out(gspca_dev
, 0x40, 3, 0xba00, 0x0200, 4, dat_hvflip2
);
503 if (gam
!= sd
->vold
.gamma
) {
504 sd
->vold
.gamma
= gam
;
505 if (gam
< 0 || gam
> sd
->vmax
.gamma
)
509 ctrl_out(gspca_dev
, 0x40, 1, 0xba00, 0x00f0, 0, NULL
);
510 ctrl_out(gspca_dev
, 0x40, 1, 0xba01, 0x00f1, 0, NULL
);
511 ctrl_out(gspca_dev
, 0x40, 1, 0xba04 , 0x003b, 0, NULL
);
512 ctrl_out(gspca_dev
, 0x40, 1, 0xba02 + gam
, 0x00f1, 0, NULL
);
515 if (cntr
!= sd
->vold
.contrast
) {
516 sd
->vold
.contrast
= cntr
;
517 if (cntr
< 0 || cntr
> sd
->vmax
.contrast
)
520 ctrl_out(gspca_dev
, 0x40, 1, 0xba00, 0x00f0, 0, NULL
);
521 ctrl_out(gspca_dev
, 0x40, 1, 0xba01, 0x00f1, 0, NULL
);
522 ctrl_out(gspca_dev
, 0x40, 1, 0xba00 + tbl_cntr1
[cntr
], 0x0035,
524 ctrl_out(gspca_dev
, 0x40, 1, 0xba00 + tbl_cntr2
[cntr
], 0x00f1,
531 static void mi1320_post_unset_alt(struct gspca_dev
*gspca_dev
)
533 ctrl_out(gspca_dev
, 0x40, 5, 0x0000, 0x0000, 0, NULL
);
535 fetch_validx(gspca_dev
, tbl_post_unset_alt
,
536 ARRAY_SIZE(tbl_post_unset_alt
));