aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/m5602
diff options
context:
space:
mode:
authorErik Andrén <erik.andren@gmail.com>2008-11-26 02:08:10 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-30 06:39:51 -0500
commit6dc4cff0c391c691dae56486f854534658fdfea8 (patch)
treefa1a60e2ba27f2b23d0e9d0bc15bcca880fb83af /drivers/media/video/gspca/m5602
parent4b8f393391c0492ebec1277d073203392c90677d (diff)
V4L/DVB (10013): Convert all sensors to use the unified write sensor function
Signed-off-by: Erik Andrén <erik.andren@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/m5602')
-rw-r--r--drivers/media/video/gspca/m5602/m5602_bridge.h3
-rw-r--r--drivers/media/video/gspca/m5602/m5602_mt9m111.c22
-rw-r--r--drivers/media/video/gspca/m5602/m5602_ov9650.c38
-rw-r--r--drivers/media/video/gspca/m5602/m5602_po1030.c24
-rw-r--r--drivers/media/video/gspca/m5602/m5602_s5k4aa.c64
-rw-r--r--drivers/media/video/gspca/m5602/m5602_s5k83a.c42
6 files changed, 98 insertions, 95 deletions
diff --git a/drivers/media/video/gspca/m5602/m5602_bridge.h b/drivers/media/video/gspca/m5602/m5602_bridge.h
index 35db1bb9d576..51376e2a902d 100644
--- a/drivers/media/video/gspca/m5602/m5602_bridge.h
+++ b/drivers/media/video/gspca/m5602/m5602_bridge.h
@@ -133,4 +133,7 @@ int m5602_read_bridge(
133int m5602_write_bridge( 133int m5602_write_bridge(
134 struct sd *sd, u8 address, u8 i2c_data); 134 struct sd *sd, u8 address, u8 i2c_data);
135 135
136int m5602_write_sensor(struct sd *sd, const u8 address,
137 u8 *i2c_data, const u8 len);
138
136#endif 139#endif
diff --git a/drivers/media/video/gspca/m5602/m5602_mt9m111.c b/drivers/media/video/gspca/m5602/m5602_mt9m111.c
index e026e245fb52..0dedd3102a5c 100644
--- a/drivers/media/video/gspca/m5602/m5602_mt9m111.c
+++ b/drivers/media/video/gspca/m5602/m5602_mt9m111.c
@@ -46,7 +46,7 @@ int mt9m111_probe(struct sd *sd)
46 } else { 46 } else {
47 data[0] = preinit_mt9m111[i][2]; 47 data[0] = preinit_mt9m111[i][2];
48 data[1] = preinit_mt9m111[i][3]; 48 data[1] = preinit_mt9m111[i][3];
49 mt9m111_write_sensor(sd, 49 m5602_write_sensor(sd,
50 preinit_mt9m111[i][1], data, 2); 50 preinit_mt9m111[i][1], data, 2);
51 } 51 }
52 } 52 }
@@ -84,7 +84,7 @@ int mt9m111_init(struct sd *sd)
84 } else { 84 } else {
85 data[0] = init_mt9m111[i][2]; 85 data[0] = init_mt9m111[i][2];
86 data[1] = init_mt9m111[i][3]; 86 data[1] = init_mt9m111[i][3];
87 err = mt9m111_write_sensor(sd, 87 err = m5602_write_sensor(sd,
88 init_mt9m111[i][1], data, 2); 88 init_mt9m111[i][1], data, 2);
89 } 89 }
90 } 90 }
@@ -123,7 +123,7 @@ int mt9m111_set_vflip(struct gspca_dev *gspca_dev, __s32 val)
123 PDEBUG(D_V4L2, "Set vertical flip to %d", val); 123 PDEBUG(D_V4L2, "Set vertical flip to %d", val);
124 124
125 /* Set the correct page map */ 125 /* Set the correct page map */
126 err = mt9m111_write_sensor(sd, MT9M111_PAGE_MAP, data, 2); 126 err = m5602_write_sensor(sd, MT9M111_PAGE_MAP, data, 2);
127 if (err < 0) 127 if (err < 0)
128 goto out; 128 goto out;
129 129
@@ -132,7 +132,7 @@ int mt9m111_set_vflip(struct gspca_dev *gspca_dev, __s32 val)
132 goto out; 132 goto out;
133 133
134 data[0] = (data[0] & 0xfe) | val; 134 data[0] = (data[0] & 0xfe) | val;
135 err = mt9m111_write_sensor(sd, MT9M111_SC_R_MODE_CONTEXT_B, 135 err = m5602_write_sensor(sd, MT9M111_SC_R_MODE_CONTEXT_B,
136 data, 2); 136 data, 2);
137out: 137out:
138 return err; 138 return err;
@@ -161,7 +161,7 @@ int mt9m111_set_hflip(struct gspca_dev *gspca_dev, __s32 val)
161 PDEBUG(D_V4L2, "Set horizontal flip to %d", val); 161 PDEBUG(D_V4L2, "Set horizontal flip to %d", val);
162 162
163 /* Set the correct page map */ 163 /* Set the correct page map */
164 err = mt9m111_write_sensor(sd, MT9M111_PAGE_MAP, data, 2); 164 err = m5602_write_sensor(sd, MT9M111_PAGE_MAP, data, 2);
165 if (err < 0) 165 if (err < 0)
166 goto out; 166 goto out;
167 167
@@ -170,7 +170,7 @@ int mt9m111_set_hflip(struct gspca_dev *gspca_dev, __s32 val)
170 goto out; 170 goto out;
171 171
172 data[0] = (data[0] & 0xfd) | ((val << 1) & 0x02); 172 data[0] = (data[0] & 0xfd) | ((val << 1) & 0x02);
173 err = mt9m111_write_sensor(sd, MT9M111_SC_R_MODE_CONTEXT_B, 173 err = m5602_write_sensor(sd, MT9M111_SC_R_MODE_CONTEXT_B,
174 data, 2); 174 data, 2);
175out: 175out:
176 return err; 176 return err;
@@ -202,7 +202,7 @@ int mt9m111_set_gain(struct gspca_dev *gspca_dev, __s32 val)
202 struct sd *sd = (struct sd *) gspca_dev; 202 struct sd *sd = (struct sd *) gspca_dev;
203 203
204 /* Set the correct page map */ 204 /* Set the correct page map */
205 err = mt9m111_write_sensor(sd, MT9M111_PAGE_MAP, data, 2); 205 err = m5602_write_sensor(sd, MT9M111_PAGE_MAP, data, 2);
206 if (err < 0) 206 if (err < 0)
207 goto out; 207 goto out;
208 208
@@ -227,7 +227,7 @@ int mt9m111_set_gain(struct gspca_dev *gspca_dev, __s32 val)
227 PDEBUG(D_V4L2, "tmp=%d, data[1]=%d, data[0]=%d", tmp, 227 PDEBUG(D_V4L2, "tmp=%d, data[1]=%d, data[0]=%d", tmp,
228 data[1], data[0]); 228 data[1], data[0]);
229 229
230 err = mt9m111_write_sensor(sd, MT9M111_SC_GLOBAL_GAIN, 230 err = m5602_write_sensor(sd, MT9M111_SC_GLOBAL_GAIN,
231 data, 2); 231 data, 2);
232out: 232out:
233 return err; 233 return err;
@@ -318,7 +318,7 @@ static void mt9m111_dump_registers(struct sd *sd)
318 318
319 info("Dumping the mt9m111 sensor core registers"); 319 info("Dumping the mt9m111 sensor core registers");
320 value[1] = MT9M111_SENSOR_CORE; 320 value[1] = MT9M111_SENSOR_CORE;
321 mt9m111_write_sensor(sd, MT9M111_PAGE_MAP, value, 2); 321 m5602_write_sensor(sd, MT9M111_PAGE_MAP, value, 2);
322 for (address = 0; address < 0xff; address++) { 322 for (address = 0; address < 0xff; address++) {
323 mt9m111_read_sensor(sd, address, value, 2); 323 mt9m111_read_sensor(sd, address, value, 2);
324 info("register 0x%x contains 0x%x%x", 324 info("register 0x%x contains 0x%x%x",
@@ -327,7 +327,7 @@ static void mt9m111_dump_registers(struct sd *sd)
327 327
328 info("Dumping the mt9m111 color pipeline registers"); 328 info("Dumping the mt9m111 color pipeline registers");
329 value[1] = MT9M111_COLORPIPE; 329 value[1] = MT9M111_COLORPIPE;
330 mt9m111_write_sensor(sd, MT9M111_PAGE_MAP, value, 2); 330 m5602_write_sensor(sd, MT9M111_PAGE_MAP, value, 2);
331 for (address = 0; address < 0xff; address++) { 331 for (address = 0; address < 0xff; address++) {
332 mt9m111_read_sensor(sd, address, value, 2); 332 mt9m111_read_sensor(sd, address, value, 2);
333 info("register 0x%x contains 0x%x%x", 333 info("register 0x%x contains 0x%x%x",
@@ -336,7 +336,7 @@ static void mt9m111_dump_registers(struct sd *sd)
336 336
337 info("Dumping the mt9m111 camera control registers"); 337 info("Dumping the mt9m111 camera control registers");
338 value[1] = MT9M111_CAMERA_CONTROL; 338 value[1] = MT9M111_CAMERA_CONTROL;
339 mt9m111_write_sensor(sd, MT9M111_PAGE_MAP, value, 2); 339 m5602_write_sensor(sd, MT9M111_PAGE_MAP, value, 2);
340 for (address = 0; address < 0xff; address++) { 340 for (address = 0; address < 0xff; address++) {
341 mt9m111_read_sensor(sd, address, value, 2); 341 mt9m111_read_sensor(sd, address, value, 2);
342 info("register 0x%x contains 0x%x%x", 342 info("register 0x%x contains 0x%x%x",
diff --git a/drivers/media/video/gspca/m5602/m5602_ov9650.c b/drivers/media/video/gspca/m5602/m5602_ov9650.c
index cefe108b620e..5324397daf81 100644
--- a/drivers/media/video/gspca/m5602/m5602_ov9650.c
+++ b/drivers/media/video/gspca/m5602/m5602_ov9650.c
@@ -166,7 +166,7 @@ int ov9650_probe(struct sd *sd)
166 for (i = 0; i < ARRAY_SIZE(preinit_ov9650); i++) { 166 for (i = 0; i < ARRAY_SIZE(preinit_ov9650); i++) {
167 u8 data = preinit_ov9650[i][2]; 167 u8 data = preinit_ov9650[i][2];
168 if (preinit_ov9650[i][0] == SENSOR) 168 if (preinit_ov9650[i][0] == SENSOR)
169 ov9650_write_sensor(sd, 169 m5602_write_sensor(sd,
170 preinit_ov9650[i][1], &data, 1); 170 preinit_ov9650[i][1], &data, 1);
171 else 171 else
172 m5602_write_bridge(sd, preinit_ov9650[i][1], data); 172 m5602_write_bridge(sd, preinit_ov9650[i][1], data);
@@ -204,7 +204,7 @@ int ov9650_init(struct sd *sd)
204 for (i = 0; i < ARRAY_SIZE(init_ov9650) && !err; i++) { 204 for (i = 0; i < ARRAY_SIZE(init_ov9650) && !err; i++) {
205 data = init_ov9650[i][2]; 205 data = init_ov9650[i][2];
206 if (init_ov9650[i][0] == SENSOR) 206 if (init_ov9650[i][0] == SENSOR)
207 err = ov9650_write_sensor(sd, init_ov9650[i][1], 207 err = m5602_write_sensor(sd, init_ov9650[i][1],
208 &data, 1); 208 &data, 1);
209 else 209 else
210 err = m5602_write_bridge(sd, init_ov9650[i][1], data); 210 err = m5602_write_bridge(sd, init_ov9650[i][1], data);
@@ -213,7 +213,7 @@ int ov9650_init(struct sd *sd)
213 if (dmi_check_system(ov9650_flip_dmi_table) && !err) { 213 if (dmi_check_system(ov9650_flip_dmi_table) && !err) {
214 info("vflip quirk active"); 214 info("vflip quirk active");
215 data = 0x30; 215 data = 0x30;
216 err = ov9650_write_sensor(sd, OV9650_MVFP, &data, 1); 216 err = m5602_write_sensor(sd, OV9650_MVFP, &data, 1);
217 } 217 }
218 218
219 return err; 219 return err;
@@ -225,7 +225,7 @@ int ov9650_power_down(struct sd *sd)
225 for (i = 0; i < ARRAY_SIZE(power_down_ov9650) && !err; i++) { 225 for (i = 0; i < ARRAY_SIZE(power_down_ov9650) && !err; i++) {
226 u8 data = power_down_ov9650[i][2]; 226 u8 data = power_down_ov9650[i][2];
227 if (power_down_ov9650[i][0] == SENSOR) 227 if (power_down_ov9650[i][0] == SENSOR)
228 err = ov9650_write_sensor(sd, 228 err = m5602_write_sensor(sd,
229 power_down_ov9650[i][1], &data, 1); 229 power_down_ov9650[i][1], &data, 1);
230 else 230 else
231 err = m5602_write_bridge(sd, power_down_ov9650[i][1], 231 err = m5602_write_bridge(sd, power_down_ov9650[i][1],
@@ -272,21 +272,21 @@ int ov9650_set_exposure(struct gspca_dev *gspca_dev, __s32 val)
272 272
273 /* The 6 MSBs */ 273 /* The 6 MSBs */
274 i2c_data = (val >> 10) & 0x3f; 274 i2c_data = (val >> 10) & 0x3f;
275 err = ov9650_write_sensor(sd, OV9650_AECHM, 275 err = m5602_write_sensor(sd, OV9650_AECHM,
276 &i2c_data, 1); 276 &i2c_data, 1);
277 if (err < 0) 277 if (err < 0)
278 goto out; 278 goto out;
279 279
280 /* The 8 middle bits */ 280 /* The 8 middle bits */
281 i2c_data = (val >> 2) & 0xff; 281 i2c_data = (val >> 2) & 0xff;
282 err = ov9650_write_sensor(sd, OV9650_AECH, 282 err = m5602_write_sensor(sd, OV9650_AECH,
283 &i2c_data, 1); 283 &i2c_data, 1);
284 if (err < 0) 284 if (err < 0)
285 goto out; 285 goto out;
286 286
287 /* The 2 LSBs */ 287 /* The 2 LSBs */
288 i2c_data = val & 0x03; 288 i2c_data = val & 0x03;
289 err = ov9650_write_sensor(sd, OV9650_COM1, &i2c_data, 1); 289 err = m5602_write_sensor(sd, OV9650_COM1, &i2c_data, 1);
290 290
291out: 291out:
292 return err; 292 return err;
@@ -320,11 +320,11 @@ int ov9650_set_gain(struct gspca_dev *gspca_dev, __s32 val)
320 /* Mask away all uninteresting bits */ 320 /* Mask away all uninteresting bits */
321 i2c_data = ((val & 0x0300) >> 2) | 321 i2c_data = ((val & 0x0300) >> 2) |
322 (i2c_data & 0x3F); 322 (i2c_data & 0x3F);
323 err = ov9650_write_sensor(sd, OV9650_VREF, &i2c_data, 1); 323 err = m5602_write_sensor(sd, OV9650_VREF, &i2c_data, 1);
324 324
325 /* The 8 LSBs */ 325 /* The 8 LSBs */
326 i2c_data = val & 0xff; 326 i2c_data = val & 0xff;
327 err = ov9650_write_sensor(sd, OV9650_GAIN, &i2c_data, 1); 327 err = m5602_write_sensor(sd, OV9650_GAIN, &i2c_data, 1);
328 return err; 328 return err;
329} 329}
330 330
@@ -352,7 +352,7 @@ int ov9650_set_red_balance(struct gspca_dev *gspca_dev, __s32 val)
352 val & 0xff); 352 val & 0xff);
353 353
354 i2c_data = val & 0xff; 354 i2c_data = val & 0xff;
355 err = ov9650_write_sensor(sd, OV9650_RED, &i2c_data, 1); 355 err = m5602_write_sensor(sd, OV9650_RED, &i2c_data, 1);
356 356
357 return err; 357 return err;
358} 358}
@@ -381,7 +381,7 @@ int ov9650_set_blue_balance(struct gspca_dev *gspca_dev, __s32 val)
381 val & 0xff); 381 val & 0xff);
382 382
383 i2c_data = val & 0xff; 383 i2c_data = val & 0xff;
384 err = ov9650_write_sensor(sd, OV9650_BLUE, &i2c_data, 1); 384 err = m5602_write_sensor(sd, OV9650_BLUE, &i2c_data, 1);
385 385
386 return err; 386 return err;
387} 387}
@@ -420,7 +420,7 @@ int ov9650_set_hflip(struct gspca_dev *gspca_dev, __s32 val)
420 i2c_data = ((i2c_data & 0xdf) | 420 i2c_data = ((i2c_data & 0xdf) |
421 ((val & 0x01) << 5)); 421 ((val & 0x01) << 5));
422 422
423 err = ov9650_write_sensor(sd, OV9650_MVFP, &i2c_data, 1); 423 err = m5602_write_sensor(sd, OV9650_MVFP, &i2c_data, 1);
424out: 424out:
425 return err; 425 return err;
426} 426}
@@ -459,7 +459,7 @@ int ov9650_set_vflip(struct gspca_dev *gspca_dev, __s32 val)
459 i2c_data = ((i2c_data & 0xef) | 459 i2c_data = ((i2c_data & 0xef) |
460 ((val & 0x01) << 4)); 460 ((val & 0x01) << 4));
461 461
462 err = ov9650_write_sensor(sd, OV9650_MVFP, &i2c_data, 1); 462 err = m5602_write_sensor(sd, OV9650_MVFP, &i2c_data, 1);
463out: 463out:
464 return err; 464 return err;
465} 465}
@@ -498,13 +498,13 @@ int ov9650_set_brightness(struct gspca_dev *gspca_dev, __s32 val)
498 498
499 /* Mask away all uninteresting bits */ 499 /* Mask away all uninteresting bits */
500 i2c_data = ((val & 0x0300) >> 2) | (i2c_data & 0x3F); 500 i2c_data = ((val & 0x0300) >> 2) | (i2c_data & 0x3F);
501 err = ov9650_write_sensor(sd, OV9650_VREF, &i2c_data, 1); 501 err = m5602_write_sensor(sd, OV9650_VREF, &i2c_data, 1);
502 if (err < 0) 502 if (err < 0)
503 goto out; 503 goto out;
504 504
505 /* The 8 LSBs */ 505 /* The 8 LSBs */
506 i2c_data = val & 0xff; 506 i2c_data = val & 0xff;
507 err = ov9650_write_sensor(sd, OV9650_GAIN, &i2c_data, 1); 507 err = m5602_write_sensor(sd, OV9650_GAIN, &i2c_data, 1);
508 508
509out: 509out:
510 return err; 510 return err;
@@ -535,7 +535,7 @@ int ov9650_set_auto_white_balance(struct gspca_dev *gspca_dev, __s32 val)
535 goto out; 535 goto out;
536 536
537 i2c_data = ((i2c_data & 0xfd) | ((val & 0x01) << 1)); 537 i2c_data = ((i2c_data & 0xfd) | ((val & 0x01) << 1));
538 err = ov9650_write_sensor(sd, OV9650_COM8, &i2c_data, 1); 538 err = m5602_write_sensor(sd, OV9650_COM8, &i2c_data, 1);
539out: 539out:
540 return err; 540 return err;
541} 541}
@@ -565,7 +565,7 @@ int ov9650_set_auto_gain(struct gspca_dev *gspca_dev, __s32 val)
565 goto out; 565 goto out;
566 566
567 i2c_data = ((i2c_data & 0xfb) | ((val & 0x01) << 2)); 567 i2c_data = ((i2c_data & 0xfb) | ((val & 0x01) << 2));
568 err = ov9650_write_sensor(sd, OV9650_COM8, &i2c_data, 1); 568 err = m5602_write_sensor(sd, OV9650_COM8, &i2c_data, 1);
569out: 569out:
570 return err; 570 return err;
571} 571}
@@ -589,7 +589,7 @@ static void ov9650_dump_registers(struct sd *sd)
589 u8 test_value[2] = {0xff, 0xff}; 589 u8 test_value[2] = {0xff, 0xff};
590 590
591 ov9650_read_sensor(sd, address, &old_value, 1); 591 ov9650_read_sensor(sd, address, &old_value, 1);
592 ov9650_write_sensor(sd, address, test_value, 1); 592 m5602_write_sensor(sd, address, test_value, 1);
593 ov9650_read_sensor(sd, address, &ctrl_value, 1); 593 ov9650_read_sensor(sd, address, &ctrl_value, 1);
594 594
595 if (ctrl_value == test_value[0]) 595 if (ctrl_value == test_value[0])
@@ -598,6 +598,6 @@ static void ov9650_dump_registers(struct sd *sd)
598 info("register 0x%x is read only", address); 598 info("register 0x%x is read only", address);
599 599
600 /* Restore original value */ 600 /* Restore original value */
601 ov9650_write_sensor(sd, address, &old_value, 1); 601 m5602_write_sensor(sd, address, &old_value, 1);
602 } 602 }
603} 603}
diff --git a/drivers/media/video/gspca/m5602/m5602_po1030.c b/drivers/media/video/gspca/m5602/m5602_po1030.c
index 655cc1732ada..2c65f0c37ff1 100644
--- a/drivers/media/video/gspca/m5602/m5602_po1030.c
+++ b/drivers/media/video/gspca/m5602/m5602_po1030.c
@@ -40,7 +40,7 @@ int po1030_probe(struct sd *sd)
40 for (i = 0; i < ARRAY_SIZE(preinit_po1030); i++) { 40 for (i = 0; i < ARRAY_SIZE(preinit_po1030); i++) {
41 u8 data = preinit_po1030[i][2]; 41 u8 data = preinit_po1030[i][2];
42 if (preinit_po1030[i][0] == SENSOR) 42 if (preinit_po1030[i][0] == SENSOR)
43 po1030_write_sensor(sd, 43 m5602_write_sensor(sd,
44 preinit_po1030[i][1], &data, 1); 44 preinit_po1030[i][1], &data, 1);
45 else 45 else
46 m5602_write_bridge(sd, preinit_po1030[i][1], data); 46 m5602_write_bridge(sd, preinit_po1030[i][1], data);
@@ -158,14 +158,14 @@ int po1030_init(struct sd *sd)
158 158
159 case SENSOR: 159 case SENSOR:
160 data[0] = init_po1030[i][2]; 160 data[0] = init_po1030[i][2];
161 err = po1030_write_sensor(sd, 161 err = m5602_write_sensor(sd,
162 init_po1030[i][1], data, 1); 162 init_po1030[i][1], data, 1);
163 break; 163 break;
164 164
165 case SENSOR_LONG: 165 case SENSOR_LONG:
166 data[0] = init_po1030[i][2]; 166 data[0] = init_po1030[i][2];
167 data[1] = init_po1030[i][3]; 167 data[1] = init_po1030[i][3];
168 err = po1030_write_sensor(sd, 168 err = m5602_write_sensor(sd,
169 init_po1030[i][1], data, 2); 169 init_po1030[i][1], data, 2);
170 break; 170 break;
171 default: 171 default:
@@ -213,7 +213,7 @@ int po1030_set_exposure(struct gspca_dev *gspca_dev, __s32 val)
213 PDEBUG(D_V4L2, "Set exposure to high byte to 0x%x", 213 PDEBUG(D_V4L2, "Set exposure to high byte to 0x%x",
214 i2c_data); 214 i2c_data);
215 215
216 err = po1030_write_sensor(sd, PO1030_REG_INTEGLINES_H, 216 err = m5602_write_sensor(sd, PO1030_REG_INTEGLINES_H,
217 &i2c_data, 1); 217 &i2c_data, 1);
218 if (err < 0) 218 if (err < 0)
219 goto out; 219 goto out;
@@ -221,7 +221,7 @@ int po1030_set_exposure(struct gspca_dev *gspca_dev, __s32 val)
221 i2c_data = (val & 0xff); 221 i2c_data = (val & 0xff);
222 PDEBUG(D_V4L2, "Set exposure to low byte to 0x%x", 222 PDEBUG(D_V4L2, "Set exposure to low byte to 0x%x",
223 i2c_data); 223 i2c_data);
224 err = po1030_write_sensor(sd, PO1030_REG_INTEGLINES_M, 224 err = m5602_write_sensor(sd, PO1030_REG_INTEGLINES_M,
225 &i2c_data, 1); 225 &i2c_data, 1);
226 226
227out: 227out:
@@ -268,7 +268,7 @@ int po1030_set_hflip(struct gspca_dev *gspca_dev, __s32 val)
268 268
269 i2c_data = (val & 0x01) << 7; 269 i2c_data = (val & 0x01) << 7;
270 270
271 err = po1030_write_sensor(sd, PO1030_REG_CONTROL2, 271 err = m5602_write_sensor(sd, PO1030_REG_CONTROL2,
272 &i2c_data, 1); 272 &i2c_data, 1);
273 273
274 return err; 274 return err;
@@ -300,7 +300,7 @@ int po1030_set_vflip(struct gspca_dev *gspca_dev, __s32 val)
300 300
301 i2c_data = (val & 0x01) << 6; 301 i2c_data = (val & 0x01) << 6;
302 302
303 err = po1030_write_sensor(sd, PO1030_REG_CONTROL2, 303 err = m5602_write_sensor(sd, PO1030_REG_CONTROL2,
304 &i2c_data, 1); 304 &i2c_data, 1);
305 305
306 return err; 306 return err;
@@ -314,7 +314,7 @@ int po1030_set_gain(struct gspca_dev *gspca_dev, __s32 val)
314 314
315 i2c_data = val & 0xff; 315 i2c_data = val & 0xff;
316 PDEBUG(D_V4L2, "Set global gain to %d", i2c_data); 316 PDEBUG(D_V4L2, "Set global gain to %d", i2c_data);
317 err = po1030_write_sensor(sd, PO1030_REG_GLOBALGAIN, 317 err = m5602_write_sensor(sd, PO1030_REG_GLOBALGAIN,
318 &i2c_data, 1); 318 &i2c_data, 1);
319 return err; 319 return err;
320} 320}
@@ -340,7 +340,7 @@ int po1030_set_red_balance(struct gspca_dev *gspca_dev, __s32 val)
340 340
341 i2c_data = val & 0xff; 341 i2c_data = val & 0xff;
342 PDEBUG(D_V4L2, "Set red gain to %d", i2c_data); 342 PDEBUG(D_V4L2, "Set red gain to %d", i2c_data);
343 err = po1030_write_sensor(sd, PO1030_REG_RED_GAIN, 343 err = m5602_write_sensor(sd, PO1030_REG_RED_GAIN,
344 &i2c_data, 1); 344 &i2c_data, 1);
345 return err; 345 return err;
346} 346}
@@ -366,7 +366,7 @@ int po1030_set_blue_balance(struct gspca_dev *gspca_dev, __s32 val)
366 int err; 366 int err;
367 i2c_data = val & 0xff; 367 i2c_data = val & 0xff;
368 PDEBUG(D_V4L2, "Set blue gain to %d", i2c_data); 368 PDEBUG(D_V4L2, "Set blue gain to %d", i2c_data);
369 err = po1030_write_sensor(sd, PO1030_REG_BLUE_GAIN, 369 err = m5602_write_sensor(sd, PO1030_REG_BLUE_GAIN,
370 &i2c_data, 1); 370 &i2c_data, 1);
371 371
372 return err; 372 return err;
@@ -397,7 +397,7 @@ static void po1030_dump_registers(struct sd *sd)
397 u8 test_value[2] = {0xff, 0xff}; 397 u8 test_value[2] = {0xff, 0xff};
398 398
399 po1030_read_sensor(sd, address, &old_value, 1); 399 po1030_read_sensor(sd, address, &old_value, 1);
400 po1030_write_sensor(sd, address, test_value, 1); 400 m5602_write_sensor(sd, address, test_value, 1);
401 po1030_read_sensor(sd, address, &ctrl_value, 1); 401 po1030_read_sensor(sd, address, &ctrl_value, 1);
402 402
403 if (ctrl_value == test_value[0]) 403 if (ctrl_value == test_value[0])
@@ -406,6 +406,6 @@ static void po1030_dump_registers(struct sd *sd)
406 info("register 0x%x is read only", address); 406 info("register 0x%x is read only", address);
407 407
408 /* Restore original value */ 408 /* Restore original value */
409 po1030_write_sensor(sd, address, &old_value, 1); 409 m5602_write_sensor(sd, address, &old_value, 1);
410 } 410 }
411} 411}
diff --git a/drivers/media/video/gspca/m5602/m5602_s5k4aa.c b/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
index 4824afe67ff2..1c85453463cd 100644
--- a/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
+++ b/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
@@ -83,7 +83,7 @@ int s5k4aa_probe(struct sd *sd)
83 83
84 case SENSOR: 84 case SENSOR:
85 data[0] = preinit_s5k4aa[i][2]; 85 data[0] = preinit_s5k4aa[i][2];
86 err = s5k4aa_write_sensor(sd, 86 err = m5602_write_sensor(sd,
87 preinit_s5k4aa[i][1], 87 preinit_s5k4aa[i][1],
88 data, 1); 88 data, 1);
89 break; 89 break;
@@ -91,7 +91,7 @@ int s5k4aa_probe(struct sd *sd)
91 case SENSOR_LONG: 91 case SENSOR_LONG:
92 data[0] = preinit_s5k4aa[i][2]; 92 data[0] = preinit_s5k4aa[i][2];
93 data[1] = preinit_s5k4aa[i][3]; 93 data[1] = preinit_s5k4aa[i][3];
94 err = s5k4aa_write_sensor(sd, 94 err = m5602_write_sensor(sd,
95 preinit_s5k4aa[i][1], 95 preinit_s5k4aa[i][1],
96 data, 2); 96 data, 2);
97 break; 97 break;
@@ -219,14 +219,14 @@ int s5k4aa_init(struct sd *sd)
219 219
220 case SENSOR: 220 case SENSOR:
221 data[0] = init_s5k4aa[i][2]; 221 data[0] = init_s5k4aa[i][2];
222 err = s5k4aa_write_sensor(sd, 222 err = m5602_write_sensor(sd,
223 init_s5k4aa[i][1], data, 1); 223 init_s5k4aa[i][1], data, 1);
224 break; 224 break;
225 225
226 case SENSOR_LONG: 226 case SENSOR_LONG:
227 data[0] = init_s5k4aa[i][2]; 227 data[0] = init_s5k4aa[i][2];
228 data[1] = init_s5k4aa[i][3]; 228 data[1] = init_s5k4aa[i][3];
229 err = s5k4aa_write_sensor(sd, 229 err = m5602_write_sensor(sd,
230 init_s5k4aa[i][1], data, 2); 230 init_s5k4aa[i][1], data, 2);
231 break; 231 break;
232 default: 232 default:
@@ -241,21 +241,21 @@ int s5k4aa_init(struct sd *sd)
241 if (!err && dmi_check_system(s5k4aa_vflip_dmi_table)) { 241 if (!err && dmi_check_system(s5k4aa_vflip_dmi_table)) {
242 u8 data = 0x02; 242 u8 data = 0x02;
243 info("vertical flip quirk active"); 243 info("vertical flip quirk active");
244 s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1); 244 m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
245 s5k4aa_read_sensor(sd, S5K4AA_READ_MODE, &data, 1); 245 s5k4aa_read_sensor(sd, S5K4AA_READ_MODE, &data, 1);
246 data |= S5K4AA_RM_V_FLIP; 246 data |= S5K4AA_RM_V_FLIP;
247 data &= ~S5K4AA_RM_H_FLIP; 247 data &= ~S5K4AA_RM_H_FLIP;
248 s5k4aa_write_sensor(sd, S5K4AA_READ_MODE, &data, 1); 248 m5602_write_sensor(sd, S5K4AA_READ_MODE, &data, 1);
249 249
250 /* Decrement COLSTART to preserve color order (BGGR) */ 250 /* Decrement COLSTART to preserve color order (BGGR) */
251 s5k4aa_read_sensor(sd, S5K4AA_COLSTART_LO, &data, 1); 251 s5k4aa_read_sensor(sd, S5K4AA_COLSTART_LO, &data, 1);
252 data--; 252 data--;
253 s5k4aa_write_sensor(sd, S5K4AA_COLSTART_LO, &data, 1); 253 m5602_write_sensor(sd, S5K4AA_COLSTART_LO, &data, 1);
254 254
255 /* Increment ROWSTART to preserve color order (BGGR) */ 255 /* Increment ROWSTART to preserve color order (BGGR) */
256 s5k4aa_read_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1); 256 s5k4aa_read_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
257 data++; 257 data++;
258 s5k4aa_write_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1); 258 m5602_write_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
259 } 259 }
260 260
261 return (err < 0) ? err : 0; 261 return (err < 0) ? err : 0;
@@ -272,7 +272,7 @@ int s5k4aa_get_exposure(struct gspca_dev *gspca_dev, __s32 *val)
272 u8 data = S5K4AA_PAGE_MAP_2; 272 u8 data = S5K4AA_PAGE_MAP_2;
273 int err; 273 int err;
274 274
275 err = s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1); 275 err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
276 if (err < 0) 276 if (err < 0)
277 goto out; 277 goto out;
278 278
@@ -295,15 +295,15 @@ int s5k4aa_set_exposure(struct gspca_dev *gspca_dev, __s32 val)
295 int err; 295 int err;
296 296
297 PDEBUG(D_V4L2, "Set exposure to %d", val); 297 PDEBUG(D_V4L2, "Set exposure to %d", val);
298 err = s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1); 298 err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
299 if (err < 0) 299 if (err < 0)
300 goto out; 300 goto out;
301 data = (val >> 8) & 0xff; 301 data = (val >> 8) & 0xff;
302 err = s5k4aa_write_sensor(sd, S5K4AA_EXPOSURE_HI, &data, 1); 302 err = m5602_write_sensor(sd, S5K4AA_EXPOSURE_HI, &data, 1);
303 if (err < 0) 303 if (err < 0)
304 goto out; 304 goto out;
305 data = val & 0xff; 305 data = val & 0xff;
306 err = s5k4aa_write_sensor(sd, S5K4AA_EXPOSURE_LO, &data, 1); 306 err = m5602_write_sensor(sd, S5K4AA_EXPOSURE_LO, &data, 1);
307out: 307out:
308 return err; 308 return err;
309} 309}
@@ -314,7 +314,7 @@ int s5k4aa_get_vflip(struct gspca_dev *gspca_dev, __s32 *val)
314 u8 data = S5K4AA_PAGE_MAP_2; 314 u8 data = S5K4AA_PAGE_MAP_2;
315 int err; 315 int err;
316 316
317 err = s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1); 317 err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
318 if (err < 0) 318 if (err < 0)
319 goto out; 319 goto out;
320 320
@@ -333,15 +333,15 @@ int s5k4aa_set_vflip(struct gspca_dev *gspca_dev, __s32 val)
333 int err; 333 int err;
334 334
335 PDEBUG(D_V4L2, "Set vertical flip to %d", val); 335 PDEBUG(D_V4L2, "Set vertical flip to %d", val);
336 err = s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1); 336 err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
337 if (err < 0) 337 if (err < 0)
338 goto out; 338 goto out;
339 err = s5k4aa_write_sensor(sd, S5K4AA_READ_MODE, &data, 1); 339 err = m5602_write_sensor(sd, S5K4AA_READ_MODE, &data, 1);
340 if (err < 0) 340 if (err < 0)
341 goto out; 341 goto out;
342 data = ((data & ~S5K4AA_RM_V_FLIP) 342 data = ((data & ~S5K4AA_RM_V_FLIP)
343 | ((val & 0x01) << 7)); 343 | ((val & 0x01) << 7));
344 err = s5k4aa_write_sensor(sd, S5K4AA_READ_MODE, &data, 1); 344 err = m5602_write_sensor(sd, S5K4AA_READ_MODE, &data, 1);
345 if (err < 0) 345 if (err < 0)
346 goto out; 346 goto out;
347 347
@@ -351,14 +351,14 @@ int s5k4aa_set_vflip(struct gspca_dev *gspca_dev, __s32 val)
351 goto out; 351 goto out;
352 352
353 data++; 353 data++;
354 err = s5k4aa_write_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1); 354 err = m5602_write_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
355 } else { 355 } else {
356 err = s5k4aa_read_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1); 356 err = s5k4aa_read_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
357 if (err < 0) 357 if (err < 0)
358 goto out; 358 goto out;
359 359
360 data--; 360 data--;
361 err = s5k4aa_write_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1); 361 err = m5602_write_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
362 } 362 }
363out: 363out:
364 return err; 364 return err;
@@ -370,7 +370,7 @@ int s5k4aa_get_hflip(struct gspca_dev *gspca_dev, __s32 *val)
370 u8 data = S5K4AA_PAGE_MAP_2; 370 u8 data = S5K4AA_PAGE_MAP_2;
371 int err; 371 int err;
372 372
373 err = s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1); 373 err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
374 if (err < 0) 374 if (err < 0)
375 goto out; 375 goto out;
376 376
@@ -389,15 +389,15 @@ int s5k4aa_set_hflip(struct gspca_dev *gspca_dev, __s32 val)
389 389
390 PDEBUG(D_V4L2, "Set horizontal flip to %d", 390 PDEBUG(D_V4L2, "Set horizontal flip to %d",
391 val); 391 val);
392 err = s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1); 392 err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
393 if (err < 0) 393 if (err < 0)
394 goto out; 394 goto out;
395 err = s5k4aa_write_sensor(sd, S5K4AA_READ_MODE, &data, 1); 395 err = m5602_write_sensor(sd, S5K4AA_READ_MODE, &data, 1);
396 if (err < 0) 396 if (err < 0)
397 goto out; 397 goto out;
398 398
399 data = ((data & ~S5K4AA_RM_H_FLIP) | ((val & 0x01) << 6)); 399 data = ((data & ~S5K4AA_RM_H_FLIP) | ((val & 0x01) << 6));
400 err = s5k4aa_write_sensor(sd, S5K4AA_READ_MODE, &data, 1); 400 err = m5602_write_sensor(sd, S5K4AA_READ_MODE, &data, 1);
401 if (err < 0) 401 if (err < 0)
402 goto out; 402 goto out;
403 403
@@ -406,7 +406,7 @@ int s5k4aa_set_hflip(struct gspca_dev *gspca_dev, __s32 val)
406 if (err < 0) 406 if (err < 0)
407 goto out; 407 goto out;
408 data++; 408 data++;
409 err = s5k4aa_write_sensor(sd, S5K4AA_COLSTART_LO, &data, 1); 409 err = m5602_write_sensor(sd, S5K4AA_COLSTART_LO, &data, 1);
410 if (err < 0) 410 if (err < 0)
411 goto out; 411 goto out;
412 } else { 412 } else {
@@ -414,7 +414,7 @@ int s5k4aa_set_hflip(struct gspca_dev *gspca_dev, __s32 val)
414 if (err < 0) 414 if (err < 0)
415 goto out; 415 goto out;
416 data--; 416 data--;
417 err = s5k4aa_write_sensor(sd, S5K4AA_COLSTART_LO, &data, 1); 417 err = m5602_write_sensor(sd, S5K4AA_COLSTART_LO, &data, 1);
418 } 418 }
419out: 419out:
420 return err; 420 return err;
@@ -426,7 +426,7 @@ int s5k4aa_get_gain(struct gspca_dev *gspca_dev, __s32 *val)
426 u8 data = S5K4AA_PAGE_MAP_2; 426 u8 data = S5K4AA_PAGE_MAP_2;
427 int err; 427 int err;
428 428
429 err = s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1); 429 err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
430 if (err < 0) 430 if (err < 0)
431 goto out; 431 goto out;
432 432
@@ -445,12 +445,12 @@ int s5k4aa_set_gain(struct gspca_dev *gspca_dev, __s32 val)
445 int err; 445 int err;
446 446
447 PDEBUG(D_V4L2, "Set gain to %d", val); 447 PDEBUG(D_V4L2, "Set gain to %d", val);
448 err = s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1); 448 err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
449 if (err < 0) 449 if (err < 0)
450 goto out; 450 goto out;
451 451
452 data = val & 0xff; 452 data = val & 0xff;
453 err = s5k4aa_write_sensor(sd, S5K4AA_GAIN_2, &data, 1); 453 err = m5602_write_sensor(sd, S5K4AA_GAIN_2, &data, 1);
454 454
455out: 455out:
456 return err; 456 return err;
@@ -462,7 +462,7 @@ static void s5k4aa_dump_registers(struct sd *sd)
462 u8 page, old_page; 462 u8 page, old_page;
463 s5k4aa_read_sensor(sd, S5K4AA_PAGE_MAP, &old_page, 1); 463 s5k4aa_read_sensor(sd, S5K4AA_PAGE_MAP, &old_page, 1);
464 for (page = 0; page < 16; page++) { 464 for (page = 0; page < 16; page++) {
465 s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &page, 1); 465 m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &page, 1);
466 info("Dumping the s5k4aa register state for page 0x%x", page); 466 info("Dumping the s5k4aa register state for page 0x%x", page);
467 for (address = 0; address <= 0xff; address++) { 467 for (address = 0; address <= 0xff; address++) {
468 u8 value = 0; 468 u8 value = 0;
@@ -474,14 +474,14 @@ static void s5k4aa_dump_registers(struct sd *sd)
474 info("s5k4aa register state dump complete"); 474 info("s5k4aa register state dump complete");
475 475
476 for (page = 0; page < 16; page++) { 476 for (page = 0; page < 16; page++) {
477 s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &page, 1); 477 m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &page, 1);
478 info("Probing for which registers that are " 478 info("Probing for which registers that are "
479 "read/write for page 0x%x", page); 479 "read/write for page 0x%x", page);
480 for (address = 0; address <= 0xff; address++) { 480 for (address = 0; address <= 0xff; address++) {
481 u8 old_value, ctrl_value, test_value = 0xff; 481 u8 old_value, ctrl_value, test_value = 0xff;
482 482
483 s5k4aa_read_sensor(sd, address, &old_value, 1); 483 s5k4aa_read_sensor(sd, address, &old_value, 1);
484 s5k4aa_write_sensor(sd, address, &test_value, 1); 484 m5602_write_sensor(sd, address, &test_value, 1);
485 s5k4aa_read_sensor(sd, address, &ctrl_value, 1); 485 s5k4aa_read_sensor(sd, address, &ctrl_value, 1);
486 486
487 if (ctrl_value == test_value) 487 if (ctrl_value == test_value)
@@ -490,9 +490,9 @@ static void s5k4aa_dump_registers(struct sd *sd)
490 info("register 0x%x is read only", address); 490 info("register 0x%x is read only", address);
491 491
492 /* Restore original value */ 492 /* Restore original value */
493 s5k4aa_write_sensor(sd, address, &old_value, 1); 493 m5602_write_sensor(sd, address, &old_value, 1);
494 } 494 }
495 } 495 }
496 info("Read/write register probing complete"); 496 info("Read/write register probing complete");
497 s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &old_page, 1); 497 m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &old_page, 1);
498} 498}
diff --git a/drivers/media/video/gspca/m5602/m5602_s5k83a.c b/drivers/media/video/gspca/m5602/m5602_s5k83a.c
index 34b99c000c61..84a648d707c8 100644
--- a/drivers/media/video/gspca/m5602/m5602_s5k83a.c
+++ b/drivers/media/video/gspca/m5602/m5602_s5k83a.c
@@ -41,7 +41,7 @@ int s5k83a_probe(struct sd *sd)
41 for (i = 0; i < ARRAY_SIZE(preinit_s5k83a) && !err; i++) { 41 for (i = 0; i < ARRAY_SIZE(preinit_s5k83a) && !err; i++) {
42 u8 data[2] = {preinit_s5k83a[i][2], preinit_s5k83a[i][3]}; 42 u8 data[2] = {preinit_s5k83a[i][2], preinit_s5k83a[i][3]};
43 if (preinit_s5k83a[i][0] == SENSOR) 43 if (preinit_s5k83a[i][0] == SENSOR)
44 err = s5k83a_write_sensor(sd, preinit_s5k83a[i][1], 44 err = m5602_write_sensor(sd, preinit_s5k83a[i][1],
45 data, 2); 45 data, 2);
46 else 46 else
47 err = m5602_write_bridge(sd, preinit_s5k83a[i][1], 47 err = m5602_write_bridge(sd, preinit_s5k83a[i][1],
@@ -167,14 +167,14 @@ int s5k83a_init(struct sd *sd)
167 167
168 case SENSOR: 168 case SENSOR:
169 data[0] = init_s5k83a[i][2]; 169 data[0] = init_s5k83a[i][2];
170 err = s5k83a_write_sensor(sd, 170 err = m5602_write_sensor(sd,
171 init_s5k83a[i][1], data, 1); 171 init_s5k83a[i][1], data, 1);
172 break; 172 break;
173 173
174 case SENSOR_LONG: 174 case SENSOR_LONG:
175 data[0] = init_s5k83a[i][2]; 175 data[0] = init_s5k83a[i][2];
176 data[1] = init_s5k83a[i][3]; 176 data[1] = init_s5k83a[i][3];
177 err = s5k83a_write_sensor(sd, 177 err = m5602_write_sensor(sd,
178 init_s5k83a[i][1], data, 2); 178 init_s5k83a[i][1], data, 2);
179 break; 179 break;
180 default: 180 default:
@@ -201,7 +201,7 @@ void s5k83a_dump_registers(struct sd *sd)
201 s5k83a_read_sensor(sd, S5K83A_PAGE_MAP, &old_page, 1); 201 s5k83a_read_sensor(sd, S5K83A_PAGE_MAP, &old_page, 1);
202 202
203 for (page = 0; page < 16; page++) { 203 for (page = 0; page < 16; page++) {
204 s5k83a_write_sensor(sd, S5K83A_PAGE_MAP, &page, 1); 204 m5602_write_sensor(sd, S5K83A_PAGE_MAP, &page, 1);
205 info("Dumping the s5k83a register state for page 0x%x", page); 205 info("Dumping the s5k83a register state for page 0x%x", page);
206 for (address = 0; address <= 0xff; address++) { 206 for (address = 0; address <= 0xff; address++) {
207 u8 val = 0; 207 u8 val = 0;
@@ -213,14 +213,14 @@ void s5k83a_dump_registers(struct sd *sd)
213 info("s5k83a register state dump complete"); 213 info("s5k83a register state dump complete");
214 214
215 for (page = 0; page < 16; page++) { 215 for (page = 0; page < 16; page++) {
216 s5k83a_write_sensor(sd, S5K83A_PAGE_MAP, &page, 1); 216 m5602_write_sensor(sd, S5K83A_PAGE_MAP, &page, 1);
217 info("Probing for which registers that are read/write " 217 info("Probing for which registers that are read/write "
218 "for page 0x%x", page); 218 "for page 0x%x", page);
219 for (address = 0; address <= 0xff; address++) { 219 for (address = 0; address <= 0xff; address++) {
220 u8 old_val, ctrl_val, test_val = 0xff; 220 u8 old_val, ctrl_val, test_val = 0xff;
221 221
222 s5k83a_read_sensor(sd, address, &old_val, 1); 222 s5k83a_read_sensor(sd, address, &old_val, 1);
223 s5k83a_write_sensor(sd, address, &test_val, 1); 223 m5602_write_sensor(sd, address, &test_val, 1);
224 s5k83a_read_sensor(sd, address, &ctrl_val, 1); 224 s5k83a_read_sensor(sd, address, &ctrl_val, 1);
225 225
226 if (ctrl_val == test_val) 226 if (ctrl_val == test_val)
@@ -229,11 +229,11 @@ void s5k83a_dump_registers(struct sd *sd)
229 info("register 0x%x is read only", address); 229 info("register 0x%x is read only", address);
230 230
231 /* Restore original val */ 231 /* Restore original val */
232 s5k83a_write_sensor(sd, address, &old_val, 1); 232 m5602_write_sensor(sd, address, &old_val, 1);
233 } 233 }
234 } 234 }
235 info("Read/write register probing complete"); 235 info("Read/write register probing complete");
236 s5k83a_write_sensor(sd, S5K83A_PAGE_MAP, &old_page, 1); 236 m5602_write_sensor(sd, S5K83A_PAGE_MAP, &old_page, 1);
237} 237}
238 238
239int s5k83a_get_brightness(struct gspca_dev *gspca_dev, __s32 *val) 239int s5k83a_get_brightness(struct gspca_dev *gspca_dev, __s32 *val)
@@ -261,13 +261,13 @@ int s5k83a_set_brightness(struct gspca_dev *gspca_dev, __s32 val)
261 261
262 data[0] = 0x00; 262 data[0] = 0x00;
263 data[1] = 0x20; 263 data[1] = 0x20;
264 err = s5k83a_write_sensor(sd, 0x14, data, 2); 264 err = m5602_write_sensor(sd, 0x14, data, 2);
265 if (err < 0) 265 if (err < 0)
266 goto out; 266 goto out;
267 267
268 data[0] = 0x01; 268 data[0] = 0x01;
269 data[1] = 0x00; 269 data[1] = 0x00;
270 err = s5k83a_write_sensor(sd, 0x0d, data, 2); 270 err = m5602_write_sensor(sd, 0x0d, data, 2);
271 if (err < 0) 271 if (err < 0)
272 goto out; 272 goto out;
273 273
@@ -275,7 +275,7 @@ int s5k83a_set_brightness(struct gspca_dev *gspca_dev, __s32 val)
275 of these registers */ 275 of these registers */
276 data[0] = val >> 3; /* brightness, high 5 bits */ 276 data[0] = val >> 3; /* brightness, high 5 bits */
277 data[1] = val >> 1; /* brightness, high 7 bits */ 277 data[1] = val >> 1; /* brightness, high 7 bits */
278 err = s5k83a_write_sensor(sd, S5K83A_BRIGHTNESS, data, 2); 278 err = m5602_write_sensor(sd, S5K83A_BRIGHTNESS, data, 2);
279 279
280out: 280out:
281 return err; 281 return err;
@@ -304,7 +304,7 @@ int s5k83a_set_whiteness(struct gspca_dev *gspca_dev, __s32 val)
304 struct sd *sd = (struct sd *) gspca_dev; 304 struct sd *sd = (struct sd *) gspca_dev;
305 305
306 data[0] = val; 306 data[0] = val;
307 err = s5k83a_write_sensor(sd, S5K83A_WHITENESS, data, 1); 307 err = m5602_write_sensor(sd, S5K83A_WHITENESS, data, 1);
308 308
309 return err; 309 return err;
310} 310}
@@ -337,7 +337,7 @@ int s5k83a_set_gain(struct gspca_dev *gspca_dev, __s32 val)
337 337
338 data[0] = 0; 338 data[0] = 0;
339 data[1] = val; 339 data[1] = val;
340 err = s5k83a_write_sensor(sd, S5K83A_GAIN, data, 2); 340 err = m5602_write_sensor(sd, S5K83A_GAIN, data, 2);
341 return err; 341 return err;
342} 342}
343 343
@@ -348,7 +348,7 @@ int s5k83a_get_vflip(struct gspca_dev *gspca_dev, __s32 *val)
348 struct sd *sd = (struct sd *) gspca_dev; 348 struct sd *sd = (struct sd *) gspca_dev;
349 349
350 data[0] = 0x05; 350 data[0] = 0x05;
351 err = s5k83a_write_sensor(sd, S5K83A_PAGE_MAP, data, 1); 351 err = m5602_write_sensor(sd, S5K83A_PAGE_MAP, data, 1);
352 if (err < 0) 352 if (err < 0)
353 goto out; 353 goto out;
354 354
@@ -366,7 +366,7 @@ int s5k83a_set_vflip(struct gspca_dev *gspca_dev, __s32 val)
366 struct sd *sd = (struct sd *) gspca_dev; 366 struct sd *sd = (struct sd *) gspca_dev;
367 367
368 data[0] = 0x05; 368 data[0] = 0x05;
369 err = s5k83a_write_sensor(sd, S5K83A_PAGE_MAP, data, 1); 369 err = m5602_write_sensor(sd, S5K83A_PAGE_MAP, data, 1);
370 if (err < 0) 370 if (err < 0)
371 goto out; 371 goto out;
372 372
@@ -377,12 +377,12 @@ int s5k83a_set_vflip(struct gspca_dev *gspca_dev, __s32 val)
377 /* set or zero six bit, seven is hflip */ 377 /* set or zero six bit, seven is hflip */
378 data[0] = (val) ? (data[0] & 0x80) | 0x40 | S5K83A_FLIP_MASK 378 data[0] = (val) ? (data[0] & 0x80) | 0x40 | S5K83A_FLIP_MASK
379 : (data[0] & 0x80) | S5K83A_FLIP_MASK; 379 : (data[0] & 0x80) | S5K83A_FLIP_MASK;
380 err = s5k83a_write_sensor(sd, S5K83A_FLIP, data, 1); 380 err = m5602_write_sensor(sd, S5K83A_FLIP, data, 1);
381 if (err < 0) 381 if (err < 0)
382 goto out; 382 goto out;
383 383
384 data[0] = (val) ? 0x0b : 0x0a; 384 data[0] = (val) ? 0x0b : 0x0a;
385 err = s5k83a_write_sensor(sd, S5K83A_VFLIP_TUNE, data, 1); 385 err = m5602_write_sensor(sd, S5K83A_VFLIP_TUNE, data, 1);
386 386
387out: 387out:
388 return err; 388 return err;
@@ -395,7 +395,7 @@ int s5k83a_get_hflip(struct gspca_dev *gspca_dev, __s32 *val)
395 struct sd *sd = (struct sd *) gspca_dev; 395 struct sd *sd = (struct sd *) gspca_dev;
396 396
397 data[0] = 0x05; 397 data[0] = 0x05;
398 err = s5k83a_write_sensor(sd, S5K83A_PAGE_MAP, data, 1); 398 err = m5602_write_sensor(sd, S5K83A_PAGE_MAP, data, 1);
399 if (err < 0) 399 if (err < 0)
400 goto out; 400 goto out;
401 401
@@ -413,7 +413,7 @@ int s5k83a_set_hflip(struct gspca_dev *gspca_dev, __s32 val)
413 struct sd *sd = (struct sd *) gspca_dev; 413 struct sd *sd = (struct sd *) gspca_dev;
414 414
415 data[0] = 0x05; 415 data[0] = 0x05;
416 err = s5k83a_write_sensor(sd, S5K83A_PAGE_MAP, data, 1); 416 err = m5602_write_sensor(sd, S5K83A_PAGE_MAP, data, 1);
417 if (err < 0) 417 if (err < 0)
418 goto out; 418 goto out;
419 419
@@ -424,12 +424,12 @@ int s5k83a_set_hflip(struct gspca_dev *gspca_dev, __s32 val)
424 /* set or zero seven bit, six is vflip */ 424 /* set or zero seven bit, six is vflip */
425 data[0] = (val) ? (data[0] & 0x40) | 0x80 | S5K83A_FLIP_MASK 425 data[0] = (val) ? (data[0] & 0x40) | 0x80 | S5K83A_FLIP_MASK
426 : (data[0] & 0x40) | S5K83A_FLIP_MASK; 426 : (data[0] & 0x40) | S5K83A_FLIP_MASK;
427 err = s5k83a_write_sensor(sd, S5K83A_FLIP, data, 1); 427 err = m5602_write_sensor(sd, S5K83A_FLIP, data, 1);
428 if (err < 0) 428 if (err < 0)
429 goto out; 429 goto out;
430 430
431 data[0] = (val) ? 0x0a : 0x0b; 431 data[0] = (val) ? 0x0a : 0x0b;
432 err = s5k83a_write_sensor(sd, S5K83A_HFLIP_TUNE, data, 1); 432 err = m5602_write_sensor(sd, S5K83A_HFLIP_TUNE, data, 1);
433out: 433out:
434 return err; 434 return err;
435} 435}