aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorErik Andrén <erik.andren@gmail.com>2008-11-27 11:51:11 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-30 06:39:56 -0500
commit4feb24fc2643dc612b3c598c5de062cfbb08e6ea (patch)
treefbe64c53d721190cc448402d37af64d2f71cba75 /drivers/media
parentf1c6171c4b7b2882a67db6a24c8699fa0efab42f (diff)
V4L/DVB (10025): m5602: convert the s5k4aa sensor to use the common function
Convert the s5k4aa sensor to use the common read_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')
-rw-r--r--drivers/media/video/gspca/m5602/m5602_s5k4aa.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/media/video/gspca/m5602/m5602_s5k4aa.c b/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
index acc0514f6ed6..f6fc108b4477 100644
--- a/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
+++ b/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
@@ -102,7 +102,7 @@ int s5k4aa_probe(struct sd *sd)
102 } 102 }
103 103
104 /* Test some registers, but we don't know their exact meaning yet */ 104 /* Test some registers, but we don't know their exact meaning yet */
105 if (s5k4aa_read_sensor(sd, 0x00, prod_id, sizeof(prod_id))) 105 if (m5602_read_sensor(sd, 0x00, prod_id, sizeof(prod_id)))
106 return -ENODEV; 106 return -ENODEV;
107 107
108 if (memcmp(prod_id, expected_prod_id, sizeof(prod_id))) 108 if (memcmp(prod_id, expected_prod_id, sizeof(prod_id)))
@@ -198,18 +198,18 @@ int s5k4aa_init(struct sd *sd)
198 u8 data = 0x02; 198 u8 data = 0x02;
199 info("vertical flip quirk active"); 199 info("vertical flip quirk active");
200 m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1); 200 m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
201 s5k4aa_read_sensor(sd, S5K4AA_READ_MODE, &data, 1); 201 m5602_read_sensor(sd, S5K4AA_READ_MODE, &data, 1);
202 data |= S5K4AA_RM_V_FLIP; 202 data |= S5K4AA_RM_V_FLIP;
203 data &= ~S5K4AA_RM_H_FLIP; 203 data &= ~S5K4AA_RM_H_FLIP;
204 m5602_write_sensor(sd, S5K4AA_READ_MODE, &data, 1); 204 m5602_write_sensor(sd, S5K4AA_READ_MODE, &data, 1);
205 205
206 /* Decrement COLSTART to preserve color order (BGGR) */ 206 /* Decrement COLSTART to preserve color order (BGGR) */
207 s5k4aa_read_sensor(sd, S5K4AA_COLSTART_LO, &data, 1); 207 m5602_read_sensor(sd, S5K4AA_COLSTART_LO, &data, 1);
208 data--; 208 data--;
209 m5602_write_sensor(sd, S5K4AA_COLSTART_LO, &data, 1); 209 m5602_write_sensor(sd, S5K4AA_COLSTART_LO, &data, 1);
210 210
211 /* Increment ROWSTART to preserve color order (BGGR) */ 211 /* Increment ROWSTART to preserve color order (BGGR) */
212 s5k4aa_read_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1); 212 m5602_read_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
213 data++; 213 data++;
214 m5602_write_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1); 214 m5602_write_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
215 } 215 }
@@ -232,12 +232,12 @@ int s5k4aa_get_exposure(struct gspca_dev *gspca_dev, __s32 *val)
232 if (err < 0) 232 if (err < 0)
233 goto out; 233 goto out;
234 234
235 err = s5k4aa_read_sensor(sd, S5K4AA_EXPOSURE_HI, &data, 1); 235 err = m5602_read_sensor(sd, S5K4AA_EXPOSURE_HI, &data, 1);
236 if (err < 0) 236 if (err < 0)
237 goto out; 237 goto out;
238 238
239 *val = data << 8; 239 *val = data << 8;
240 err = s5k4aa_read_sensor(sd, S5K4AA_EXPOSURE_LO, &data, 1); 240 err = m5602_read_sensor(sd, S5K4AA_EXPOSURE_LO, &data, 1);
241 *val |= data; 241 *val |= data;
242 PDEBUG(D_V4L2, "Read exposure %d", *val); 242 PDEBUG(D_V4L2, "Read exposure %d", *val);
243out: 243out:
@@ -274,7 +274,7 @@ int s5k4aa_get_vflip(struct gspca_dev *gspca_dev, __s32 *val)
274 if (err < 0) 274 if (err < 0)
275 goto out; 275 goto out;
276 276
277 err = s5k4aa_read_sensor(sd, S5K4AA_PAGE_MAP, &data, 1); 277 err = m5602_read_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
278 *val = (data & S5K4AA_RM_V_FLIP) >> 7; 278 *val = (data & S5K4AA_RM_V_FLIP) >> 7;
279 PDEBUG(D_V4L2, "Read vertical flip %d", *val); 279 PDEBUG(D_V4L2, "Read vertical flip %d", *val);
280 280
@@ -302,14 +302,14 @@ int s5k4aa_set_vflip(struct gspca_dev *gspca_dev, __s32 val)
302 goto out; 302 goto out;
303 303
304 if (val) { 304 if (val) {
305 err = s5k4aa_read_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1); 305 err = m5602_read_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
306 if (err < 0) 306 if (err < 0)
307 goto out; 307 goto out;
308 308
309 data++; 309 data++;
310 err = m5602_write_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1); 310 err = m5602_write_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
311 } else { 311 } else {
312 err = s5k4aa_read_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1); 312 err = m5602_read_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
313 if (err < 0) 313 if (err < 0)
314 goto out; 314 goto out;
315 315
@@ -330,7 +330,7 @@ int s5k4aa_get_hflip(struct gspca_dev *gspca_dev, __s32 *val)
330 if (err < 0) 330 if (err < 0)
331 goto out; 331 goto out;
332 332
333 err = s5k4aa_read_sensor(sd, S5K4AA_PAGE_MAP, &data, 1); 333 err = m5602_read_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
334 *val = (data & S5K4AA_RM_H_FLIP) >> 6; 334 *val = (data & S5K4AA_RM_H_FLIP) >> 6;
335 PDEBUG(D_V4L2, "Read horizontal flip %d", *val); 335 PDEBUG(D_V4L2, "Read horizontal flip %d", *val);
336out: 336out:
@@ -358,7 +358,7 @@ int s5k4aa_set_hflip(struct gspca_dev *gspca_dev, __s32 val)
358 goto out; 358 goto out;
359 359
360 if (val) { 360 if (val) {
361 err = s5k4aa_read_sensor(sd, S5K4AA_COLSTART_LO, &data, 1); 361 err = m5602_read_sensor(sd, S5K4AA_COLSTART_LO, &data, 1);
362 if (err < 0) 362 if (err < 0)
363 goto out; 363 goto out;
364 data++; 364 data++;
@@ -366,7 +366,7 @@ int s5k4aa_set_hflip(struct gspca_dev *gspca_dev, __s32 val)
366 if (err < 0) 366 if (err < 0)
367 goto out; 367 goto out;
368 } else { 368 } else {
369 err = s5k4aa_read_sensor(sd, S5K4AA_COLSTART_LO, &data, 1); 369 err = m5602_read_sensor(sd, S5K4AA_COLSTART_LO, &data, 1);
370 if (err < 0) 370 if (err < 0)
371 goto out; 371 goto out;
372 data--; 372 data--;
@@ -386,7 +386,7 @@ int s5k4aa_get_gain(struct gspca_dev *gspca_dev, __s32 *val)
386 if (err < 0) 386 if (err < 0)
387 goto out; 387 goto out;
388 388
389 err = s5k4aa_read_sensor(sd, S5K4AA_GAIN_2, &data, 1); 389 err = m5602_read_sensor(sd, S5K4AA_GAIN_2, &data, 1);
390 *val = data; 390 *val = data;
391 PDEBUG(D_V4L2, "Read gain %d", *val); 391 PDEBUG(D_V4L2, "Read gain %d", *val);
392 392
@@ -416,13 +416,13 @@ static void s5k4aa_dump_registers(struct sd *sd)
416{ 416{
417 int address; 417 int address;
418 u8 page, old_page; 418 u8 page, old_page;
419 s5k4aa_read_sensor(sd, S5K4AA_PAGE_MAP, &old_page, 1); 419 m5602_read_sensor(sd, S5K4AA_PAGE_MAP, &old_page, 1);
420 for (page = 0; page < 16; page++) { 420 for (page = 0; page < 16; page++) {
421 m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &page, 1); 421 m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &page, 1);
422 info("Dumping the s5k4aa register state for page 0x%x", page); 422 info("Dumping the s5k4aa register state for page 0x%x", page);
423 for (address = 0; address <= 0xff; address++) { 423 for (address = 0; address <= 0xff; address++) {
424 u8 value = 0; 424 u8 value = 0;
425 s5k4aa_read_sensor(sd, address, &value, 1); 425 m5602_read_sensor(sd, address, &value, 1);
426 info("register 0x%x contains 0x%x", 426 info("register 0x%x contains 0x%x",
427 address, value); 427 address, value);
428 } 428 }
@@ -436,9 +436,9 @@ static void s5k4aa_dump_registers(struct sd *sd)
436 for (address = 0; address <= 0xff; address++) { 436 for (address = 0; address <= 0xff; address++) {
437 u8 old_value, ctrl_value, test_value = 0xff; 437 u8 old_value, ctrl_value, test_value = 0xff;
438 438
439 s5k4aa_read_sensor(sd, address, &old_value, 1); 439 m5602_read_sensor(sd, address, &old_value, 1);
440 m5602_write_sensor(sd, address, &test_value, 1); 440 m5602_write_sensor(sd, address, &test_value, 1);
441 s5k4aa_read_sensor(sd, address, &ctrl_value, 1); 441 m5602_read_sensor(sd, address, &ctrl_value, 1);
442 442
443 if (ctrl_value == test_value) 443 if (ctrl_value == test_value)
444 info("register 0x%x is writeable", address); 444 info("register 0x%x is writeable", address);