diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2012-07-18 09:58:24 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-08-15 16:11:54 -0400 |
commit | f223d5b7184a743bf2b724698f7a84a963638bb6 (patch) | |
tree | 2456421db57d7b59c494d3efad8c0b3ec0786e69 /drivers/media/i2c/soc_camera | |
parent | 4a7b76f0725d1325334ae0063134544315b3bf6c (diff) |
[media] ov772x: Add support for SBGGR10 format
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/i2c/soc_camera')
-rw-r--r-- | drivers/media/i2c/soc_camera/ov772x.c | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/drivers/media/i2c/soc_camera/ov772x.c b/drivers/media/i2c/soc_camera/ov772x.c index 4cd9b1c2f35d..a19769a8142b 100644 --- a/drivers/media/i2c/soc_camera/ov772x.c +++ b/drivers/media/i2c/soc_camera/ov772x.c | |||
@@ -275,6 +275,7 @@ | |||
275 | #define SLCT_VGA 0x00 /* 0 : VGA */ | 275 | #define SLCT_VGA 0x00 /* 0 : VGA */ |
276 | #define SLCT_QVGA 0x40 /* 1 : QVGA */ | 276 | #define SLCT_QVGA 0x40 /* 1 : QVGA */ |
277 | #define ITU656_ON_OFF 0x20 /* ITU656 protocol ON/OFF selection */ | 277 | #define ITU656_ON_OFF 0x20 /* ITU656 protocol ON/OFF selection */ |
278 | #define SENSOR_RAW 0x10 /* Sensor RAW */ | ||
278 | /* RGB output format control */ | 279 | /* RGB output format control */ |
279 | #define FMT_MASK 0x0c /* Mask of color format */ | 280 | #define FMT_MASK 0x0c /* Mask of color format */ |
280 | #define FMT_GBR422 0x00 /* 00 : GBR 4:2:2 */ | 281 | #define FMT_GBR422 0x00 /* 00 : GBR 4:2:2 */ |
@@ -338,6 +339,12 @@ | |||
338 | #define CBAR_ON 0x20 /* ON */ | 339 | #define CBAR_ON 0x20 /* ON */ |
339 | #define CBAR_OFF 0x00 /* OFF */ | 340 | #define CBAR_OFF 0x00 /* OFF */ |
340 | 341 | ||
342 | /* DSP_CTRL4 */ | ||
343 | #define DSP_OFMT_YUV 0x00 | ||
344 | #define DSP_OFMT_RGB 0x00 | ||
345 | #define DSP_OFMT_RAW8 0x02 | ||
346 | #define DSP_OFMT_RAW10 0x03 | ||
347 | |||
341 | /* HSTART */ | 348 | /* HSTART */ |
342 | #define HST_VGA 0x23 | 349 | #define HST_VGA 0x23 |
343 | #define HST_QVGA 0x3F | 350 | #define HST_QVGA 0x3F |
@@ -389,6 +396,7 @@ struct ov772x_color_format { | |||
389 | enum v4l2_mbus_pixelcode code; | 396 | enum v4l2_mbus_pixelcode code; |
390 | enum v4l2_colorspace colorspace; | 397 | enum v4l2_colorspace colorspace; |
391 | u8 dsp3; | 398 | u8 dsp3; |
399 | u8 dsp4; | ||
392 | u8 com3; | 400 | u8 com3; |
393 | u8 com7; | 401 | u8 com7; |
394 | }; | 402 | }; |
@@ -447,6 +455,7 @@ static const struct ov772x_color_format ov772x_cfmts[] = { | |||
447 | .code = V4L2_MBUS_FMT_YUYV8_2X8, | 455 | .code = V4L2_MBUS_FMT_YUYV8_2X8, |
448 | .colorspace = V4L2_COLORSPACE_JPEG, | 456 | .colorspace = V4L2_COLORSPACE_JPEG, |
449 | .dsp3 = 0x0, | 457 | .dsp3 = 0x0, |
458 | .dsp4 = DSP_OFMT_YUV, | ||
450 | .com3 = SWAP_YUV, | 459 | .com3 = SWAP_YUV, |
451 | .com7 = OFMT_YUV, | 460 | .com7 = OFMT_YUV, |
452 | }, | 461 | }, |
@@ -454,6 +463,7 @@ static const struct ov772x_color_format ov772x_cfmts[] = { | |||
454 | .code = V4L2_MBUS_FMT_YVYU8_2X8, | 463 | .code = V4L2_MBUS_FMT_YVYU8_2X8, |
455 | .colorspace = V4L2_COLORSPACE_JPEG, | 464 | .colorspace = V4L2_COLORSPACE_JPEG, |
456 | .dsp3 = UV_ON, | 465 | .dsp3 = UV_ON, |
466 | .dsp4 = DSP_OFMT_YUV, | ||
457 | .com3 = SWAP_YUV, | 467 | .com3 = SWAP_YUV, |
458 | .com7 = OFMT_YUV, | 468 | .com7 = OFMT_YUV, |
459 | }, | 469 | }, |
@@ -461,6 +471,7 @@ static const struct ov772x_color_format ov772x_cfmts[] = { | |||
461 | .code = V4L2_MBUS_FMT_UYVY8_2X8, | 471 | .code = V4L2_MBUS_FMT_UYVY8_2X8, |
462 | .colorspace = V4L2_COLORSPACE_JPEG, | 472 | .colorspace = V4L2_COLORSPACE_JPEG, |
463 | .dsp3 = 0x0, | 473 | .dsp3 = 0x0, |
474 | .dsp4 = DSP_OFMT_YUV, | ||
464 | .com3 = 0x0, | 475 | .com3 = 0x0, |
465 | .com7 = OFMT_YUV, | 476 | .com7 = OFMT_YUV, |
466 | }, | 477 | }, |
@@ -468,6 +479,7 @@ static const struct ov772x_color_format ov772x_cfmts[] = { | |||
468 | .code = V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE, | 479 | .code = V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE, |
469 | .colorspace = V4L2_COLORSPACE_SRGB, | 480 | .colorspace = V4L2_COLORSPACE_SRGB, |
470 | .dsp3 = 0x0, | 481 | .dsp3 = 0x0, |
482 | .dsp4 = DSP_OFMT_YUV, | ||
471 | .com3 = SWAP_RGB, | 483 | .com3 = SWAP_RGB, |
472 | .com7 = FMT_RGB555 | OFMT_RGB, | 484 | .com7 = FMT_RGB555 | OFMT_RGB, |
473 | }, | 485 | }, |
@@ -475,6 +487,7 @@ static const struct ov772x_color_format ov772x_cfmts[] = { | |||
475 | .code = V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE, | 487 | .code = V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE, |
476 | .colorspace = V4L2_COLORSPACE_SRGB, | 488 | .colorspace = V4L2_COLORSPACE_SRGB, |
477 | .dsp3 = 0x0, | 489 | .dsp3 = 0x0, |
490 | .dsp4 = DSP_OFMT_YUV, | ||
478 | .com3 = 0x0, | 491 | .com3 = 0x0, |
479 | .com7 = FMT_RGB555 | OFMT_RGB, | 492 | .com7 = FMT_RGB555 | OFMT_RGB, |
480 | }, | 493 | }, |
@@ -482,6 +495,7 @@ static const struct ov772x_color_format ov772x_cfmts[] = { | |||
482 | .code = V4L2_MBUS_FMT_RGB565_2X8_LE, | 495 | .code = V4L2_MBUS_FMT_RGB565_2X8_LE, |
483 | .colorspace = V4L2_COLORSPACE_SRGB, | 496 | .colorspace = V4L2_COLORSPACE_SRGB, |
484 | .dsp3 = 0x0, | 497 | .dsp3 = 0x0, |
498 | .dsp4 = DSP_OFMT_YUV, | ||
485 | .com3 = SWAP_RGB, | 499 | .com3 = SWAP_RGB, |
486 | .com7 = FMT_RGB565 | OFMT_RGB, | 500 | .com7 = FMT_RGB565 | OFMT_RGB, |
487 | }, | 501 | }, |
@@ -489,9 +503,22 @@ static const struct ov772x_color_format ov772x_cfmts[] = { | |||
489 | .code = V4L2_MBUS_FMT_RGB565_2X8_BE, | 503 | .code = V4L2_MBUS_FMT_RGB565_2X8_BE, |
490 | .colorspace = V4L2_COLORSPACE_SRGB, | 504 | .colorspace = V4L2_COLORSPACE_SRGB, |
491 | .dsp3 = 0x0, | 505 | .dsp3 = 0x0, |
506 | .dsp4 = DSP_OFMT_YUV, | ||
492 | .com3 = 0x0, | 507 | .com3 = 0x0, |
493 | .com7 = FMT_RGB565 | OFMT_RGB, | 508 | .com7 = FMT_RGB565 | OFMT_RGB, |
494 | }, | 509 | }, |
510 | { | ||
511 | /* Setting DSP4 to DSP_OFMT_RAW8 still gives 10-bit output, | ||
512 | * regardless of the COM7 value. We can thus only support 10-bit | ||
513 | * Bayer until someone figures it out. | ||
514 | */ | ||
515 | .code = V4L2_MBUS_FMT_SBGGR10_1X10, | ||
516 | .colorspace = V4L2_COLORSPACE_SRGB, | ||
517 | .dsp3 = 0x0, | ||
518 | .dsp4 = DSP_OFMT_RAW10, | ||
519 | .com3 = 0x0, | ||
520 | .com7 = SENSOR_RAW | OFMT_BRAW, | ||
521 | }, | ||
495 | }; | 522 | }; |
496 | 523 | ||
497 | 524 | ||
@@ -808,6 +835,13 @@ static int ov772x_set_params(struct ov772x_priv *priv, | |||
808 | goto ov772x_set_fmt_error; | 835 | goto ov772x_set_fmt_error; |
809 | } | 836 | } |
810 | 837 | ||
838 | /* DSP_CTRL4: AEC reference point and DSP output format. */ | ||
839 | if (cfmt->dsp4) { | ||
840 | ret = ov772x_write(client, DSP_CTRL4, cfmt->dsp4); | ||
841 | if (ret < 0) | ||
842 | goto ov772x_set_fmt_error; | ||
843 | } | ||
844 | |||
811 | /* | 845 | /* |
812 | * set COM3 | 846 | * set COM3 |
813 | */ | 847 | */ |
@@ -826,13 +860,8 @@ static int ov772x_set_params(struct ov772x_priv *priv, | |||
826 | if (ret < 0) | 860 | if (ret < 0) |
827 | goto ov772x_set_fmt_error; | 861 | goto ov772x_set_fmt_error; |
828 | 862 | ||
829 | /* | 863 | /* COM7: Sensor resolution and output format control. */ |
830 | * set COM7 | 864 | ret = ov772x_write(client, COM7, win->com7_bit | cfmt->com7); |
831 | */ | ||
832 | val = win->com7_bit | cfmt->com7; | ||
833 | ret = ov772x_mask_set(client, | ||
834 | COM7, SLCT_MASK | FMT_MASK | OFMT_MASK, | ||
835 | val); | ||
836 | if (ret < 0) | 865 | if (ret < 0) |
837 | goto ov772x_set_fmt_error; | 866 | goto ov772x_set_fmt_error; |
838 | 867 | ||