diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-11 15:57:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-11 15:57:16 -0400 |
commit | 57a44415beee38d1afcd8e1b5fad66f3414d2dac (patch) | |
tree | 365eada15165e37e153b6d304142db16f251438b /drivers/media/video/sn9c102/sn9c102_ov7660.c | |
parent | 2a383c63ff933a496f19d6559ab54ac14871b7f3 (diff) | |
parent | bbe2486fe3bd6c7cffaf4123b7e86a55c209ed44 (diff) |
Merge branch 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb
* 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb: (44 commits)
V4L/DVB (5571): V4l1-compat: Make VIDIOCSPICT return errors in a useful way
V4L/DVB (5624): Radio-maestro.c cleanup
V4L/DVB (5623): Dsbr100.c Replace usb_dsbr100_do_ioctl to use video_ioctl2
V4L/DVB (5622): Radio-zoltrix.c cleanup
V4L/DVB (5621): Radio-cadet.c Replace cadet_do_ioctl to use video_ioctl2
V4L/DVB (5619): Dvb-usb: fix typo
V4L/DVB (5618): Cx88: Drop the generic i2c client from cx88-vp3054-i2c
V4L/DVB (5617): V4L2: videodev, allow debugging
V4L/DVB (5614): M920x: Disable second adapter on LifeView TV Walker Twin
V4L/DVB (5613): M920x: loosen up 80-col limit
V4L/DVB (5612): M920x: rename function prefixes from m9206_foo to m920x_foo
V4L/DVB (5611): M920x: replace deb_rc with deb
V4L/DVB (5610): M920x: remove duplicated code
V4L/DVB (5609): M920x: group like functions together
V4L/DVB (5608): M920x: various whitespace cleanups
V4L/DVB (5607): M920x: Initial support for devices likely manufactured by Dposh
V4L/DVB (5606): M920x: add "c-basic-offset: 8" to help emacs to enforce tabbing
V4L/DVB (5605): M920x: Add support for LifeView TV Walker Twin
V4L/DVB (5603): V4L: Prevent queueing queued buffers.
V4L/DVB (5602): Enable DiSEqC in Starbox II (vp7021a)
...
Diffstat (limited to 'drivers/media/video/sn9c102/sn9c102_ov7660.c')
-rw-r--r-- | drivers/media/video/sn9c102/sn9c102_ov7660.c | 63 |
1 files changed, 43 insertions, 20 deletions
diff --git a/drivers/media/video/sn9c102/sn9c102_ov7660.c b/drivers/media/video/sn9c102/sn9c102_ov7660.c index c898e948fe8..4b6474048a7 100644 --- a/drivers/media/video/sn9c102/sn9c102_ov7660.c +++ b/drivers/media/video/sn9c102/sn9c102_ov7660.c | |||
@@ -104,8 +104,8 @@ static int ov7660_init(struct sn9c102_device* cam) | |||
104 | err += sn9c102_i2c_write(cam, 0x12, 0x80); | 104 | err += sn9c102_i2c_write(cam, 0x12, 0x80); |
105 | err += sn9c102_i2c_write(cam, 0x11, 0x09); | 105 | err += sn9c102_i2c_write(cam, 0x11, 0x09); |
106 | err += sn9c102_i2c_write(cam, 0x00, 0x0A); | 106 | err += sn9c102_i2c_write(cam, 0x00, 0x0A); |
107 | err += sn9c102_i2c_write(cam, 0x01, 0x78); | 107 | err += sn9c102_i2c_write(cam, 0x01, 0x80); |
108 | err += sn9c102_i2c_write(cam, 0x02, 0x90); | 108 | err += sn9c102_i2c_write(cam, 0x02, 0x80); |
109 | err += sn9c102_i2c_write(cam, 0x03, 0x00); | 109 | err += sn9c102_i2c_write(cam, 0x03, 0x00); |
110 | err += sn9c102_i2c_write(cam, 0x04, 0x00); | 110 | err += sn9c102_i2c_write(cam, 0x04, 0x00); |
111 | err += sn9c102_i2c_write(cam, 0x05, 0x08); | 111 | err += sn9c102_i2c_write(cam, 0x05, 0x08); |
@@ -122,7 +122,7 @@ static int ov7660_init(struct sn9c102_device* cam) | |||
122 | err += sn9c102_i2c_write(cam, 0x10, 0x20); | 122 | err += sn9c102_i2c_write(cam, 0x10, 0x20); |
123 | err += sn9c102_i2c_write(cam, 0x11, 0x03); | 123 | err += sn9c102_i2c_write(cam, 0x11, 0x03); |
124 | err += sn9c102_i2c_write(cam, 0x12, 0x05); | 124 | err += sn9c102_i2c_write(cam, 0x12, 0x05); |
125 | err += sn9c102_i2c_write(cam, 0x13, 0xF8); | 125 | err += sn9c102_i2c_write(cam, 0x13, 0xC7); |
126 | err += sn9c102_i2c_write(cam, 0x14, 0x2C); | 126 | err += sn9c102_i2c_write(cam, 0x14, 0x2C); |
127 | err += sn9c102_i2c_write(cam, 0x15, 0x00); | 127 | err += sn9c102_i2c_write(cam, 0x15, 0x00); |
128 | err += sn9c102_i2c_write(cam, 0x16, 0x02); | 128 | err += sn9c102_i2c_write(cam, 0x16, 0x02); |
@@ -162,7 +162,7 @@ static int ov7660_init(struct sn9c102_device* cam) | |||
162 | err += sn9c102_i2c_write(cam, 0x38, 0x02); | 162 | err += sn9c102_i2c_write(cam, 0x38, 0x02); |
163 | err += sn9c102_i2c_write(cam, 0x39, 0x43); | 163 | err += sn9c102_i2c_write(cam, 0x39, 0x43); |
164 | err += sn9c102_i2c_write(cam, 0x3A, 0x00); | 164 | err += sn9c102_i2c_write(cam, 0x3A, 0x00); |
165 | err += sn9c102_i2c_write(cam, 0x3B, 0x02); | 165 | err += sn9c102_i2c_write(cam, 0x3B, 0x0A); |
166 | err += sn9c102_i2c_write(cam, 0x3C, 0x6C); | 166 | err += sn9c102_i2c_write(cam, 0x3C, 0x6C); |
167 | err += sn9c102_i2c_write(cam, 0x3D, 0x99); | 167 | err += sn9c102_i2c_write(cam, 0x3D, 0x99); |
168 | err += sn9c102_i2c_write(cam, 0x3E, 0x0E); | 168 | err += sn9c102_i2c_write(cam, 0x3E, 0x0E); |
@@ -281,25 +281,34 @@ static int ov7660_get_ctrl(struct sn9c102_device* cam, | |||
281 | return -EIO; | 281 | return -EIO; |
282 | break; | 282 | break; |
283 | case V4L2_CID_DO_WHITE_BALANCE: | 283 | case V4L2_CID_DO_WHITE_BALANCE: |
284 | ctrl->value = sn9c102_pread_reg(cam, 0x02); | 284 | if ((ctrl->value = sn9c102_read_reg(cam, 0x02)) < 0) |
285 | return -EIO; | ||
285 | ctrl->value = (ctrl->value & 0x04) ? 1 : 0; | 286 | ctrl->value = (ctrl->value & 0x04) ? 1 : 0; |
286 | break; | 287 | break; |
287 | case V4L2_CID_RED_BALANCE: | 288 | case V4L2_CID_RED_BALANCE: |
288 | ctrl->value = sn9c102_pread_reg(cam, 0x05); | 289 | if ((ctrl->value = sn9c102_read_reg(cam, 0x05)) < 0) |
290 | return -EIO; | ||
289 | ctrl->value &= 0x7f; | 291 | ctrl->value &= 0x7f; |
290 | break; | 292 | break; |
291 | case V4L2_CID_BLUE_BALANCE: | 293 | case V4L2_CID_BLUE_BALANCE: |
292 | ctrl->value = sn9c102_pread_reg(cam, 0x06); | 294 | if ((ctrl->value = sn9c102_read_reg(cam, 0x06)) < 0) |
295 | return -EIO; | ||
293 | ctrl->value &= 0x7f; | 296 | ctrl->value &= 0x7f; |
294 | break; | 297 | break; |
295 | case SN9C102_V4L2_CID_GREEN_BALANCE: | 298 | case SN9C102_V4L2_CID_GREEN_BALANCE: |
296 | ctrl->value = sn9c102_pread_reg(cam, 0x07); | 299 | if ((ctrl->value = sn9c102_read_reg(cam, 0x07)) < 0) |
300 | return -EIO; | ||
297 | ctrl->value &= 0x7f; | 301 | ctrl->value &= 0x7f; |
298 | break; | 302 | break; |
303 | case SN9C102_V4L2_CID_BAND_FILTER: | ||
304 | if ((ctrl->value = sn9c102_i2c_read(cam, 0x3b)) < 0) | ||
305 | return -EIO; | ||
306 | ctrl->value &= 0x08; | ||
307 | break; | ||
299 | case V4L2_CID_GAIN: | 308 | case V4L2_CID_GAIN: |
300 | if ((ctrl->value = sn9c102_i2c_read(cam, 0x00)) < 0) | 309 | if ((ctrl->value = sn9c102_i2c_read(cam, 0x00)) < 0) |
301 | return -EIO; | 310 | return -EIO; |
302 | ctrl->value &= 0x7f; | 311 | ctrl->value &= 0x1f; |
303 | break; | 312 | break; |
304 | case V4L2_CID_AUTOGAIN: | 313 | case V4L2_CID_AUTOGAIN: |
305 | if ((ctrl->value = sn9c102_i2c_read(cam, 0x13)) < 0) | 314 | if ((ctrl->value = sn9c102_i2c_read(cam, 0x13)) < 0) |
@@ -335,12 +344,15 @@ static int ov7660_set_ctrl(struct sn9c102_device* cam, | |||
335 | case SN9C102_V4L2_CID_GREEN_BALANCE: | 344 | case SN9C102_V4L2_CID_GREEN_BALANCE: |
336 | err += sn9c102_write_reg(cam, ctrl->value, 0x07); | 345 | err += sn9c102_write_reg(cam, ctrl->value, 0x07); |
337 | break; | 346 | break; |
347 | case SN9C102_V4L2_CID_BAND_FILTER: | ||
348 | err += sn9c102_i2c_write(cam, ctrl->value << 3, 0x3b); | ||
349 | break; | ||
338 | case V4L2_CID_GAIN: | 350 | case V4L2_CID_GAIN: |
339 | err += sn9c102_i2c_write(cam, 0x00, ctrl->value); | 351 | err += sn9c102_i2c_write(cam, 0x00, 0x60 + ctrl->value); |
340 | break; | 352 | break; |
341 | case V4L2_CID_AUTOGAIN: | 353 | case V4L2_CID_AUTOGAIN: |
342 | err += sn9c102_i2c_write(cam, 0x13, 0xf0 | ctrl->value | | 354 | err += sn9c102_i2c_write(cam, 0x13, 0xc0 | |
343 | (ctrl->value << 1)); | 355 | (ctrl->value * 0x07)); |
344 | break; | 356 | break; |
345 | default: | 357 | default: |
346 | return -EINVAL; | 358 | return -EINVAL; |
@@ -386,7 +398,7 @@ static int ov7660_set_pix_format(struct sn9c102_device* cam, | |||
386 | } | 398 | } |
387 | 399 | ||
388 | 400 | ||
389 | static struct sn9c102_sensor ov7660 = { | 401 | static const struct sn9c102_sensor ov7660 = { |
390 | .name = "OV7660", | 402 | .name = "OV7660", |
391 | .maintainer = "Luca Risolia <luca.risolia@studio.unibo.it>", | 403 | .maintainer = "Luca Risolia <luca.risolia@studio.unibo.it>", |
392 | .supported_bridge = BRIDGE_SN9C105 | BRIDGE_SN9C120, | 404 | .supported_bridge = BRIDGE_SN9C105 | BRIDGE_SN9C120, |
@@ -401,9 +413,9 @@ static struct sn9c102_sensor ov7660 = { | |||
401 | .type = V4L2_CTRL_TYPE_INTEGER, | 413 | .type = V4L2_CTRL_TYPE_INTEGER, |
402 | .name = "global gain", | 414 | .name = "global gain", |
403 | .minimum = 0x00, | 415 | .minimum = 0x00, |
404 | .maximum = 0x7f, | 416 | .maximum = 0x1f, |
405 | .step = 0x01, | 417 | .step = 0x01, |
406 | .default_value = 0x0a, | 418 | .default_value = 0x09, |
407 | .flags = 0, | 419 | .flags = 0, |
408 | }, | 420 | }, |
409 | { | 421 | { |
@@ -413,7 +425,7 @@ static struct sn9c102_sensor ov7660 = { | |||
413 | .minimum = 0x00, | 425 | .minimum = 0x00, |
414 | .maximum = 0xff, | 426 | .maximum = 0xff, |
415 | .step = 0x01, | 427 | .step = 0x01, |
416 | .default_value = 0x50, | 428 | .default_value = 0x27, |
417 | .flags = 0, | 429 | .flags = 0, |
418 | }, | 430 | }, |
419 | { | 431 | { |
@@ -433,7 +445,7 @@ static struct sn9c102_sensor ov7660 = { | |||
433 | .minimum = 0x00, | 445 | .minimum = 0x00, |
434 | .maximum = 0x7f, | 446 | .maximum = 0x7f, |
435 | .step = 0x01, | 447 | .step = 0x01, |
436 | .default_value = 0x1f, | 448 | .default_value = 0x14, |
437 | .flags = 0, | 449 | .flags = 0, |
438 | }, | 450 | }, |
439 | { | 451 | { |
@@ -443,7 +455,7 @@ static struct sn9c102_sensor ov7660 = { | |||
443 | .minimum = 0x00, | 455 | .minimum = 0x00, |
444 | .maximum = 0x7f, | 456 | .maximum = 0x7f, |
445 | .step = 0x01, | 457 | .step = 0x01, |
446 | .default_value = 0x1e, | 458 | .default_value = 0x14, |
447 | .flags = 0, | 459 | .flags = 0, |
448 | }, | 460 | }, |
449 | { | 461 | { |
@@ -453,7 +465,7 @@ static struct sn9c102_sensor ov7660 = { | |||
453 | .minimum = 0x00, | 465 | .minimum = 0x00, |
454 | .maximum = 0x01, | 466 | .maximum = 0x01, |
455 | .step = 0x01, | 467 | .step = 0x01, |
456 | .default_value = 0x00, | 468 | .default_value = 0x01, |
457 | .flags = 0, | 469 | .flags = 0, |
458 | }, | 470 | }, |
459 | { | 471 | { |
@@ -463,7 +475,17 @@ static struct sn9c102_sensor ov7660 = { | |||
463 | .minimum = 0x00, | 475 | .minimum = 0x00, |
464 | .maximum = 0x7f, | 476 | .maximum = 0x7f, |
465 | .step = 0x01, | 477 | .step = 0x01, |
466 | .default_value = 0x20, | 478 | .default_value = 0x14, |
479 | .flags = 0, | ||
480 | }, | ||
481 | { | ||
482 | .id = SN9C102_V4L2_CID_BAND_FILTER, | ||
483 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
484 | .name = "band filter", | ||
485 | .minimum = 0x00, | ||
486 | .maximum = 0x01, | ||
487 | .step = 0x01, | ||
488 | .default_value = 0x00, | ||
467 | .flags = 0, | 489 | .flags = 0, |
468 | }, | 490 | }, |
469 | }, | 491 | }, |
@@ -508,6 +530,7 @@ int sn9c102_probe_ov7660(struct sn9c102_device* cam) | |||
508 | return -EIO; | 530 | return -EIO; |
509 | if (pid != 0x76 || ver != 0x60) | 531 | if (pid != 0x76 || ver != 0x60) |
510 | return -ENODEV; | 532 | return -ENODEV; |
533 | |||
511 | sn9c102_attach_sensor(cam, &ov7660); | 534 | sn9c102_attach_sensor(cam, &ov7660); |
512 | 535 | ||
513 | return 0; | 536 | return 0; |