diff options
author | Frank Schäfer <fschaefer.oss@googlemail.com> | 2012-09-23 14:28:45 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-11-22 08:34:12 -0500 |
commit | d1a49eacd944308401ae0417692357dd181b665e (patch) | |
tree | abe905c533b682ed638b29204fb912ad4d509aa5 /drivers/media/i2c | |
parent | 1438be56ade16653584f70a2e2a1c11197291271 (diff) |
[media] ov2640: add support for V4L2_MBUS_FMT_YUYV8_2X8, V4L2_MBUS_FMT_RGB565_2X8_BE
This is the result of experimenting with the SpeedLink VAD Laplace webcam.
The register sequence for V4L2_MBUS_FMT_YUYV8_2X8 has been identified by
analyzing USB-logs of this device running on MS Windows.
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.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')
-rw-r--r-- | drivers/media/i2c/soc_camera/ov2640.c | 49 |
1 files changed, 42 insertions, 7 deletions
diff --git a/drivers/media/i2c/soc_camera/ov2640.c b/drivers/media/i2c/soc_camera/ov2640.c index 30cf6d8b7b8b..66698a83bda2 100644 --- a/drivers/media/i2c/soc_camera/ov2640.c +++ b/drivers/media/i2c/soc_camera/ov2640.c | |||
@@ -586,9 +586,20 @@ static const struct regval_list ov2640_format_change_preamble_regs[] = { | |||
586 | ENDMARKER, | 586 | ENDMARKER, |
587 | }; | 587 | }; |
588 | 588 | ||
589 | static const struct regval_list ov2640_yuv422_regs[] = { | 589 | static const struct regval_list ov2640_yuyv_regs[] = { |
590 | { IMAGE_MODE, IMAGE_MODE_YUV422 }, | ||
591 | { 0xd7, 0x03 }, | ||
592 | { 0x33, 0xa0 }, | ||
593 | { 0xe5, 0x1f }, | ||
594 | { 0xe1, 0x67 }, | ||
595 | { RESET, 0x00 }, | ||
596 | { R_BYPASS, R_BYPASS_USE_DSP }, | ||
597 | ENDMARKER, | ||
598 | }; | ||
599 | |||
600 | static const struct regval_list ov2640_uyvy_regs[] = { | ||
590 | { IMAGE_MODE, IMAGE_MODE_LBYTE_FIRST | IMAGE_MODE_YUV422 }, | 601 | { IMAGE_MODE, IMAGE_MODE_LBYTE_FIRST | IMAGE_MODE_YUV422 }, |
591 | { 0xD7, 0x01 }, | 602 | { 0xd7, 0x01 }, |
592 | { 0x33, 0xa0 }, | 603 | { 0x33, 0xa0 }, |
593 | { 0xe1, 0x67 }, | 604 | { 0xe1, 0x67 }, |
594 | { RESET, 0x00 }, | 605 | { RESET, 0x00 }, |
@@ -596,7 +607,15 @@ static const struct regval_list ov2640_yuv422_regs[] = { | |||
596 | ENDMARKER, | 607 | ENDMARKER, |
597 | }; | 608 | }; |
598 | 609 | ||
599 | static const struct regval_list ov2640_rgb565_regs[] = { | 610 | static const struct regval_list ov2640_rgb565_be_regs[] = { |
611 | { IMAGE_MODE, IMAGE_MODE_RGB565 }, | ||
612 | { 0xd7, 0x03 }, | ||
613 | { RESET, 0x00 }, | ||
614 | { R_BYPASS, R_BYPASS_USE_DSP }, | ||
615 | ENDMARKER, | ||
616 | }; | ||
617 | |||
618 | static const struct regval_list ov2640_rgb565_le_regs[] = { | ||
600 | { IMAGE_MODE, IMAGE_MODE_LBYTE_FIRST | IMAGE_MODE_RGB565 }, | 619 | { IMAGE_MODE, IMAGE_MODE_LBYTE_FIRST | IMAGE_MODE_RGB565 }, |
601 | { 0xd7, 0x03 }, | 620 | { 0xd7, 0x03 }, |
602 | { RESET, 0x00 }, | 621 | { RESET, 0x00 }, |
@@ -605,7 +624,9 @@ static const struct regval_list ov2640_rgb565_regs[] = { | |||
605 | }; | 624 | }; |
606 | 625 | ||
607 | static enum v4l2_mbus_pixelcode ov2640_codes[] = { | 626 | static enum v4l2_mbus_pixelcode ov2640_codes[] = { |
627 | V4L2_MBUS_FMT_YUYV8_2X8, | ||
608 | V4L2_MBUS_FMT_UYVY8_2X8, | 628 | V4L2_MBUS_FMT_UYVY8_2X8, |
629 | V4L2_MBUS_FMT_RGB565_2X8_BE, | ||
609 | V4L2_MBUS_FMT_RGB565_2X8_LE, | 630 | V4L2_MBUS_FMT_RGB565_2X8_LE, |
610 | }; | 631 | }; |
611 | 632 | ||
@@ -787,14 +808,22 @@ static int ov2640_set_params(struct i2c_client *client, u32 *width, u32 *height, | |||
787 | /* select format */ | 808 | /* select format */ |
788 | priv->cfmt_code = 0; | 809 | priv->cfmt_code = 0; |
789 | switch (code) { | 810 | switch (code) { |
811 | case V4L2_MBUS_FMT_RGB565_2X8_BE: | ||
812 | dev_dbg(&client->dev, "%s: Selected cfmt RGB565 BE", __func__); | ||
813 | selected_cfmt_regs = ov2640_rgb565_be_regs; | ||
814 | break; | ||
790 | case V4L2_MBUS_FMT_RGB565_2X8_LE: | 815 | case V4L2_MBUS_FMT_RGB565_2X8_LE: |
791 | dev_dbg(&client->dev, "%s: Selected cfmt RGB565", __func__); | 816 | dev_dbg(&client->dev, "%s: Selected cfmt RGB565 LE", __func__); |
792 | selected_cfmt_regs = ov2640_rgb565_regs; | 817 | selected_cfmt_regs = ov2640_rgb565_le_regs; |
818 | break; | ||
819 | case V4L2_MBUS_FMT_YUYV8_2X8: | ||
820 | dev_dbg(&client->dev, "%s: Selected cfmt YUYV (YUV422)", __func__); | ||
821 | selected_cfmt_regs = ov2640_yuyv_regs; | ||
793 | break; | 822 | break; |
794 | default: | 823 | default: |
795 | case V4L2_MBUS_FMT_UYVY8_2X8: | 824 | case V4L2_MBUS_FMT_UYVY8_2X8: |
796 | dev_dbg(&client->dev, "%s: Selected cfmt YUV422", __func__); | 825 | dev_dbg(&client->dev, "%s: Selected cfmt UYVY", __func__); |
797 | selected_cfmt_regs = ov2640_yuv422_regs; | 826 | selected_cfmt_regs = ov2640_uyvy_regs; |
798 | } | 827 | } |
799 | 828 | ||
800 | /* reset hardware */ | 829 | /* reset hardware */ |
@@ -859,10 +888,12 @@ static int ov2640_g_fmt(struct v4l2_subdev *sd, | |||
859 | mf->code = priv->cfmt_code; | 888 | mf->code = priv->cfmt_code; |
860 | 889 | ||
861 | switch (mf->code) { | 890 | switch (mf->code) { |
891 | case V4L2_MBUS_FMT_RGB565_2X8_BE: | ||
862 | case V4L2_MBUS_FMT_RGB565_2X8_LE: | 892 | case V4L2_MBUS_FMT_RGB565_2X8_LE: |
863 | mf->colorspace = V4L2_COLORSPACE_SRGB; | 893 | mf->colorspace = V4L2_COLORSPACE_SRGB; |
864 | break; | 894 | break; |
865 | default: | 895 | default: |
896 | case V4L2_MBUS_FMT_YUYV8_2X8: | ||
866 | case V4L2_MBUS_FMT_UYVY8_2X8: | 897 | case V4L2_MBUS_FMT_UYVY8_2X8: |
867 | mf->colorspace = V4L2_COLORSPACE_JPEG; | 898 | mf->colorspace = V4L2_COLORSPACE_JPEG; |
868 | } | 899 | } |
@@ -879,11 +910,13 @@ static int ov2640_s_fmt(struct v4l2_subdev *sd, | |||
879 | 910 | ||
880 | 911 | ||
881 | switch (mf->code) { | 912 | switch (mf->code) { |
913 | case V4L2_MBUS_FMT_RGB565_2X8_BE: | ||
882 | case V4L2_MBUS_FMT_RGB565_2X8_LE: | 914 | case V4L2_MBUS_FMT_RGB565_2X8_LE: |
883 | mf->colorspace = V4L2_COLORSPACE_SRGB; | 915 | mf->colorspace = V4L2_COLORSPACE_SRGB; |
884 | break; | 916 | break; |
885 | default: | 917 | default: |
886 | mf->code = V4L2_MBUS_FMT_UYVY8_2X8; | 918 | mf->code = V4L2_MBUS_FMT_UYVY8_2X8; |
919 | case V4L2_MBUS_FMT_YUYV8_2X8: | ||
887 | case V4L2_MBUS_FMT_UYVY8_2X8: | 920 | case V4L2_MBUS_FMT_UYVY8_2X8: |
888 | mf->colorspace = V4L2_COLORSPACE_JPEG; | 921 | mf->colorspace = V4L2_COLORSPACE_JPEG; |
889 | } | 922 | } |
@@ -904,11 +937,13 @@ static int ov2640_try_fmt(struct v4l2_subdev *sd, | |||
904 | mf->field = V4L2_FIELD_NONE; | 937 | mf->field = V4L2_FIELD_NONE; |
905 | 938 | ||
906 | switch (mf->code) { | 939 | switch (mf->code) { |
940 | case V4L2_MBUS_FMT_RGB565_2X8_BE: | ||
907 | case V4L2_MBUS_FMT_RGB565_2X8_LE: | 941 | case V4L2_MBUS_FMT_RGB565_2X8_LE: |
908 | mf->colorspace = V4L2_COLORSPACE_SRGB; | 942 | mf->colorspace = V4L2_COLORSPACE_SRGB; |
909 | break; | 943 | break; |
910 | default: | 944 | default: |
911 | mf->code = V4L2_MBUS_FMT_UYVY8_2X8; | 945 | mf->code = V4L2_MBUS_FMT_UYVY8_2X8; |
946 | case V4L2_MBUS_FMT_YUYV8_2X8: | ||
912 | case V4L2_MBUS_FMT_UYVY8_2X8: | 947 | case V4L2_MBUS_FMT_UYVY8_2X8: |
913 | mf->colorspace = V4L2_COLORSPACE_JPEG; | 948 | mf->colorspace = V4L2_COLORSPACE_JPEG; |
914 | } | 949 | } |