Commit 1e8852af authored by Lad, Prabhakar's avatar Lad, Prabhakar Committed by Mauro Carvalho Chehab

[media] media: davinci: vpif_capture: return -ENODATA for *dv_timings calls

this patch adds suppport to return -ENODATA for *dv_timings calls
if the current output does not support it.
Signed-off-by: default avatarLad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent b7047713
...@@ -1134,13 +1134,25 @@ static int ...@@ -1134,13 +1134,25 @@ static int
vpif_enum_dv_timings(struct file *file, void *priv, vpif_enum_dv_timings(struct file *file, void *priv,
struct v4l2_enum_dv_timings *timings) struct v4l2_enum_dv_timings *timings)
{ {
struct vpif_capture_config *config = vpif_dev->platform_data;
struct video_device *vdev = video_devdata(file); struct video_device *vdev = video_devdata(file);
struct channel_obj *ch = video_get_drvdata(vdev); struct channel_obj *ch = video_get_drvdata(vdev);
struct vpif_capture_chan_config *chan_cfg;
struct v4l2_input input;
int ret; int ret;
if (config->chan_config[ch->channel_id].inputs == NULL)
return -ENODATA;
chan_cfg = &config->chan_config[ch->channel_id];
input = chan_cfg->inputs[ch->input_idx].input;
if (input.capabilities != V4L2_IN_CAP_DV_TIMINGS)
return -ENODATA;
ret = v4l2_subdev_call(ch->sd, video, enum_dv_timings, timings); ret = v4l2_subdev_call(ch->sd, video, enum_dv_timings, timings);
if (ret == -ENOIOCTLCMD || ret == -ENODEV) if (ret == -ENOIOCTLCMD || ret == -ENODEV)
return -EINVAL; return -EINVAL;
return ret; return ret;
} }
...@@ -1154,13 +1166,25 @@ static int ...@@ -1154,13 +1166,25 @@ static int
vpif_query_dv_timings(struct file *file, void *priv, vpif_query_dv_timings(struct file *file, void *priv,
struct v4l2_dv_timings *timings) struct v4l2_dv_timings *timings)
{ {
struct vpif_capture_config *config = vpif_dev->platform_data;
struct video_device *vdev = video_devdata(file); struct video_device *vdev = video_devdata(file);
struct channel_obj *ch = video_get_drvdata(vdev); struct channel_obj *ch = video_get_drvdata(vdev);
struct vpif_capture_chan_config *chan_cfg;
struct v4l2_input input;
int ret; int ret;
if (config->chan_config[ch->channel_id].inputs == NULL)
return -ENODATA;
chan_cfg = &config->chan_config[ch->channel_id];
input = chan_cfg->inputs[ch->input_idx].input;
if (input.capabilities != V4L2_IN_CAP_DV_TIMINGS)
return -ENODATA;
ret = v4l2_subdev_call(ch->sd, video, query_dv_timings, timings); ret = v4l2_subdev_call(ch->sd, video, query_dv_timings, timings);
if (ret == -ENOIOCTLCMD || ret == -ENODEV) if (ret == -ENOIOCTLCMD || ret == -ENODEV)
return -ENODATA; return -ENODATA;
return ret; return ret;
} }
...@@ -1173,19 +1197,34 @@ vpif_query_dv_timings(struct file *file, void *priv, ...@@ -1173,19 +1197,34 @@ vpif_query_dv_timings(struct file *file, void *priv,
static int vpif_s_dv_timings(struct file *file, void *priv, static int vpif_s_dv_timings(struct file *file, void *priv,
struct v4l2_dv_timings *timings) struct v4l2_dv_timings *timings)
{ {
struct vpif_capture_config *config = vpif_dev->platform_data;
struct video_device *vdev = video_devdata(file); struct video_device *vdev = video_devdata(file);
struct channel_obj *ch = video_get_drvdata(vdev); struct channel_obj *ch = video_get_drvdata(vdev);
struct vpif_params *vpifparams = &ch->vpifparams; struct vpif_params *vpifparams = &ch->vpifparams;
struct vpif_channel_config_params *std_info = &vpifparams->std_info; struct vpif_channel_config_params *std_info = &vpifparams->std_info;
struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
struct video_obj *vid_ch = &ch->video; struct video_obj *vid_ch = &ch->video;
struct v4l2_bt_timings *bt = &vid_ch->dv_timings.bt; struct v4l2_bt_timings *bt = &vid_ch->dv_timings.bt;
struct vpif_capture_chan_config *chan_cfg;
struct v4l2_input input;
int ret; int ret;
if (config->chan_config[ch->channel_id].inputs == NULL)
return -ENODATA;
chan_cfg = &config->chan_config[ch->channel_id];
input = chan_cfg->inputs[ch->input_idx].input;
if (input.capabilities != V4L2_IN_CAP_DV_TIMINGS)
return -ENODATA;
if (timings->type != V4L2_DV_BT_656_1120) { if (timings->type != V4L2_DV_BT_656_1120) {
vpif_dbg(2, debug, "Timing type not defined\n"); vpif_dbg(2, debug, "Timing type not defined\n");
return -EINVAL; return -EINVAL;
} }
if (vb2_is_busy(&common->buffer_queue))
return -EBUSY;
/* Configure subdevice timings, if any */ /* Configure subdevice timings, if any */
ret = v4l2_subdev_call(ch->sd, video, s_dv_timings, timings); ret = v4l2_subdev_call(ch->sd, video, s_dv_timings, timings);
if (ret == -ENOIOCTLCMD || ret == -ENODEV) if (ret == -ENOIOCTLCMD || ret == -ENODEV)
...@@ -1261,9 +1300,20 @@ static int vpif_s_dv_timings(struct file *file, void *priv, ...@@ -1261,9 +1300,20 @@ static int vpif_s_dv_timings(struct file *file, void *priv,
static int vpif_g_dv_timings(struct file *file, void *priv, static int vpif_g_dv_timings(struct file *file, void *priv,
struct v4l2_dv_timings *timings) struct v4l2_dv_timings *timings)
{ {
struct vpif_capture_config *config = vpif_dev->platform_data;
struct video_device *vdev = video_devdata(file); struct video_device *vdev = video_devdata(file);
struct channel_obj *ch = video_get_drvdata(vdev); struct channel_obj *ch = video_get_drvdata(vdev);
struct video_obj *vid_ch = &ch->video; struct video_obj *vid_ch = &ch->video;
struct vpif_capture_chan_config *chan_cfg;
struct v4l2_input input;
if (config->chan_config[ch->channel_id].inputs == NULL)
return -ENODATA;
chan_cfg = &config->chan_config[ch->channel_id];
input = chan_cfg->inputs[ch->input_idx].input;
if (input.capabilities != V4L2_IN_CAP_DV_TIMINGS)
return -ENODATA;
*timings = vid_ch->dv_timings; *timings = vid_ch->dv_timings;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment