Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] adv7511: add support to for the content type control

This transmitter now supports configuring the IT content type of the incoming
video.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
df0e5775 e8979274

+20 -2
+20 -2
drivers/media/i2c/adv7511.c
··· 103 103 u32 ycbcr_enc; 104 104 u32 quantization; 105 105 u32 xfer_func; 106 + u32 content_type; 106 107 /* controls */ 107 108 struct v4l2_ctrl *hdmi_mode_ctrl; 108 109 struct v4l2_ctrl *hotplug_ctrl; 109 110 struct v4l2_ctrl *rx_sense_ctrl; 110 111 struct v4l2_ctrl *have_edid0_ctrl; 111 112 struct v4l2_ctrl *rgb_quantization_range_ctrl; 113 + struct v4l2_ctrl *content_type_ctrl; 112 114 struct i2c_client *i2c_edid; 113 115 struct i2c_client *i2c_pktmem; 114 116 struct adv7511_state_edid edid; ··· 402 400 } 403 401 if (state->rgb_quantization_range_ctrl == ctrl) 404 402 return adv7511_set_rgb_quantization_mode(sd, ctrl); 403 + if (state->content_type_ctrl == ctrl) { 404 + u8 itc, cn; 405 + 406 + state->content_type = ctrl->val; 407 + itc = state->content_type != V4L2_DV_IT_CONTENT_TYPE_NO_ITC; 408 + cn = itc ? state->content_type : V4L2_DV_IT_CONTENT_TYPE_GRAPHICS; 409 + adv7511_wr_and_or(sd, 0x57, 0x7f, itc << 7); 410 + adv7511_wr_and_or(sd, 0x59, 0xcf, cn << 4); 411 + return 0; 412 + } 405 413 406 414 return -EINVAL; 407 415 } ··· 1014 1002 u8 y = HDMI_COLORSPACE_RGB; 1015 1003 u8 q = HDMI_QUANTIZATION_RANGE_DEFAULT; 1016 1004 u8 yq = HDMI_YCC_QUANTIZATION_RANGE_LIMITED; 1005 + u8 itc = state->content_type != V4L2_DV_IT_CONTENT_TYPE_NO_ITC; 1006 + u8 cn = itc ? state->content_type : V4L2_DV_IT_CONTENT_TYPE_GRAPHICS; 1017 1007 1018 1008 if (format->pad != 0) 1019 1009 return -EINVAL; ··· 1129 1115 adv7511_wr_and_or(sd, 0x4a, 0xbf, 0); 1130 1116 adv7511_wr_and_or(sd, 0x55, 0x9f, y << 5); 1131 1117 adv7511_wr_and_or(sd, 0x56, 0x3f, c << 6); 1132 - adv7511_wr_and_or(sd, 0x57, 0x83, (ec << 4) | (q << 2)); 1133 - adv7511_wr_and_or(sd, 0x59, 0x3f, yq << 6); 1118 + adv7511_wr_and_or(sd, 0x57, 0x83, (ec << 4) | (q << 2) | (itc << 7)); 1119 + adv7511_wr_and_or(sd, 0x59, 0x0f, (yq << 6) | (cn << 4)); 1134 1120 adv7511_wr_and_or(sd, 0x4a, 0xff, 1); 1135 1121 1136 1122 return 0; ··· 1484 1470 v4l2_ctrl_new_std_menu(hdl, &adv7511_ctrl_ops, 1485 1471 V4L2_CID_DV_TX_RGB_RANGE, V4L2_DV_RGB_RANGE_FULL, 1486 1472 0, V4L2_DV_RGB_RANGE_AUTO); 1473 + state->content_type_ctrl = 1474 + v4l2_ctrl_new_std_menu(hdl, &adv7511_ctrl_ops, 1475 + V4L2_CID_DV_TX_IT_CONTENT_TYPE, V4L2_DV_IT_CONTENT_TYPE_NO_ITC, 1476 + 0, V4L2_DV_IT_CONTENT_TYPE_NO_ITC); 1487 1477 sd->ctrl_handler = hdl; 1488 1478 if (hdl->error) { 1489 1479 err = hdl->error;