aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2016-01-27 08:31:42 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-02-10 06:33:06 -0500
commite89792740d769cd30cc296289b00fb9ff7a762e8 (patch)
tree227d21cf6b268d958014eb21f0c47c898851801a
parent297a41448a006def6b87aef5383837c3130a41e4 (diff)
[media] adv7842: add support to for the content type control
This receiver now supports reading 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>
-rw-r--r--drivers/media/i2c/adv7842.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 5fbb788e7b59..7ccb85d45224 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -1359,6 +1359,19 @@ static int adv7842_s_ctrl(struct v4l2_ctrl *ctrl)
1359 return -EINVAL; 1359 return -EINVAL;
1360} 1360}
1361 1361
1362static int adv7842_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
1363{
1364 struct v4l2_subdev *sd = to_sd(ctrl);
1365
1366 if (ctrl->id == V4L2_CID_DV_RX_IT_CONTENT_TYPE) {
1367 ctrl->val = V4L2_DV_IT_CONTENT_TYPE_NO_ITC;
1368 if ((io_read(sd, 0x60) & 1) && (infoframe_read(sd, 0x03) & 0x80))
1369 ctrl->val = (infoframe_read(sd, 0x05) >> 4) & 3;
1370 return 0;
1371 }
1372 return -EINVAL;
1373}
1374
1362static inline bool no_power(struct v4l2_subdev *sd) 1375static inline bool no_power(struct v4l2_subdev *sd)
1363{ 1376{
1364 return io_read(sd, 0x0c) & 0x24; 1377 return io_read(sd, 0x0c) & 0x24;
@@ -3022,6 +3035,7 @@ static int adv7842_subscribe_event(struct v4l2_subdev *sd,
3022 3035
3023static const struct v4l2_ctrl_ops adv7842_ctrl_ops = { 3036static const struct v4l2_ctrl_ops adv7842_ctrl_ops = {
3024 .s_ctrl = adv7842_s_ctrl, 3037 .s_ctrl = adv7842_s_ctrl,
3038 .g_volatile_ctrl = adv7842_g_volatile_ctrl,
3025}; 3039};
3026 3040
3027static const struct v4l2_subdev_core_ops adv7842_core_ops = { 3041static const struct v4l2_subdev_core_ops adv7842_core_ops = {
@@ -3196,6 +3210,7 @@ static int adv7842_probe(struct i2c_client *client,
3196 V4L2_DV_BT_CEA_640X480P59_94; 3210 V4L2_DV_BT_CEA_640X480P59_94;
3197 struct adv7842_platform_data *pdata = client->dev.platform_data; 3211 struct adv7842_platform_data *pdata = client->dev.platform_data;
3198 struct v4l2_ctrl_handler *hdl; 3212 struct v4l2_ctrl_handler *hdl;
3213 struct v4l2_ctrl *ctrl;
3199 struct v4l2_subdev *sd; 3214 struct v4l2_subdev *sd;
3200 u16 rev; 3215 u16 rev;
3201 int err; 3216 int err;
@@ -3261,6 +3276,11 @@ static int adv7842_probe(struct i2c_client *client,
3261 V4L2_CID_SATURATION, 0, 255, 1, 128); 3276 V4L2_CID_SATURATION, 0, 255, 1, 128);
3262 v4l2_ctrl_new_std(hdl, &adv7842_ctrl_ops, 3277 v4l2_ctrl_new_std(hdl, &adv7842_ctrl_ops,
3263 V4L2_CID_HUE, 0, 128, 1, 0); 3278 V4L2_CID_HUE, 0, 128, 1, 0);
3279 ctrl = v4l2_ctrl_new_std_menu(hdl, &adv7842_ctrl_ops,
3280 V4L2_CID_DV_RX_IT_CONTENT_TYPE, V4L2_DV_IT_CONTENT_TYPE_NO_ITC,
3281 0, V4L2_DV_IT_CONTENT_TYPE_NO_ITC);
3282 if (ctrl)
3283 ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;
3264 3284
3265 /* custom controls */ 3285 /* custom controls */
3266 state->detect_tx_5v_ctrl = v4l2_ctrl_new_std(hdl, NULL, 3286 state->detect_tx_5v_ctrl = v4l2_ctrl_new_std(hdl, NULL,