aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMats Randgaard <matrandg@cisco.com>2013-12-05 08:05:58 -0500
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-01-07 02:54:15 -0500
commit9833239e13735dc318d1b76a6aec32b409d2653c (patch)
tree1e68ef84e2377d1fd4a4f00165752b7efe3fdc86
parent1577461be7c95bfc14084267cd74e2671310153c (diff)
[media] adv7604: Receive CEA formats as RGB on VGA (RGB) input
If the input is ADV7604_INPUT_VGA_RGB and RGB quantization range is set to V4L2_DV_RGB_RANGE_AUTO, video with CEA timings will be received as RGB. For ADV7604_INPUT_VGA_COMP, automatic CSC mode will be selected. See table 44 on page 205 in "ADV7604 Hardware Manual, Rev. F, August 2010" for details. Signed-off-by: Mats Randgaard <matrandg@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--drivers/media/i2c/adv7604.c50
1 files changed, 33 insertions, 17 deletions
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index ff8130fe3d4a..d4ac8dd51589 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -911,25 +911,41 @@ static void set_rgb_quantization_range(struct v4l2_subdev *sd)
911{ 911{
912 struct adv7604_state *state = to_state(sd); 912 struct adv7604_state *state = to_state(sd);
913 913
914 v4l2_dbg(2, debug, sd, "%s: rgb_quantization_range = %d\n",
915 __func__, state->rgb_quantization_range);
916
914 switch (state->rgb_quantization_range) { 917 switch (state->rgb_quantization_range) {
915 case V4L2_DV_RGB_RANGE_AUTO: 918 case V4L2_DV_RGB_RANGE_AUTO:
916 /* automatic */ 919 if (state->selected_input == ADV7604_INPUT_VGA_RGB) {
917 if (is_digital_input(sd) && !(hdmi_read(sd, 0x05) & 0x80)) { 920 /* Receiving analog RGB signal
918 /* receiving DVI-D signal */ 921 * Set RGB full range (0-255) */
919 922 io_write_and_or(sd, 0x02, 0x0f, 0x10);
920 /* ADV7604 selects RGB limited range regardless of 923 break;
921 input format (CE/IT) in automatic mode */ 924 }
922 if (state->timings.bt.standards & V4L2_DV_BT_STD_CEA861) { 925
923 /* RGB limited range (16-235) */ 926 if (state->selected_input == ADV7604_INPUT_VGA_COMP) {
924 io_write_and_or(sd, 0x02, 0x0f, 0x00); 927 /* Receiving analog YPbPr signal
925 928 * Set automode */
926 } else { 929 io_write_and_or(sd, 0x02, 0x0f, 0xf0);
927 /* RGB full range (0-255) */ 930 break;
928 io_write_and_or(sd, 0x02, 0x0f, 0x10); 931 }
929 } 932
930 } else { 933 if (hdmi_read(sd, 0x05) & 0x80) {
931 /* receiving HDMI or analog signal, set automode */ 934 /* Receiving HDMI signal
935 * Set automode */
932 io_write_and_or(sd, 0x02, 0x0f, 0xf0); 936 io_write_and_or(sd, 0x02, 0x0f, 0xf0);
937 break;
938 }
939
940 /* Receiving DVI-D signal
941 * ADV7604 selects RGB limited range regardless of
942 * input format (CE/IT) in automatic mode */
943 if (state->timings.bt.standards & V4L2_DV_BT_STD_CEA861) {
944 /* RGB limited range (16-235) */
945 io_write_and_or(sd, 0x02, 0x0f, 0x00);
946 } else {
947 /* RGB full range (0-255) */
948 io_write_and_or(sd, 0x02, 0x0f, 0x10);
933 } 949 }
934 break; 950 break;
935 case V4L2_DV_RGB_RANGE_LIMITED: 951 case V4L2_DV_RGB_RANGE_LIMITED:
@@ -1709,7 +1725,7 @@ static int adv7604_log_status(struct v4l2_subdev *sd)
1709 char *input_color_space_txt[16] = { 1725 char *input_color_space_txt[16] = {
1710 "RGB limited range (16-235)", "RGB full range (0-255)", 1726 "RGB limited range (16-235)", "RGB full range (0-255)",
1711 "YCbCr Bt.601 (16-235)", "YCbCr Bt.709 (16-235)", 1727 "YCbCr Bt.601 (16-235)", "YCbCr Bt.709 (16-235)",
1712 "XvYCC Bt.601", "XvYCC Bt.709", 1728 "xvYCC Bt.601", "xvYCC Bt.709",
1713 "YCbCr Bt.601 (0-255)", "YCbCr Bt.709 (0-255)", 1729 "YCbCr Bt.601 (0-255)", "YCbCr Bt.709 (0-255)",
1714 "invalid", "invalid", "invalid", "invalid", "invalid", 1730 "invalid", "invalid", "invalid", "invalid", "invalid",
1715 "invalid", "invalid", "automatic" 1731 "invalid", "invalid", "automatic"