aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLad, Prabhakar <prabhakar.csengg@gmail.com>2014-05-16 09:33:51 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-05-24 15:43:46 -0400
commit1e8852af358d2c7f01b8ca5b7af40716f0017e69 (patch)
tree80b72d9a47e32fc64f8509dcc5ce443f70668ec8
parentb7047713bda9c21f97494985e96b3bc7df1d0af1 (diff)
[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: Lad, Prabhakar <prabhakar.csengg@gmail.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/platform/davinci/vpif_capture.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index ce532034ba7c..54343a3c7b73 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -1134,13 +1134,25 @@ static int
1134vpif_enum_dv_timings(struct file *file, void *priv, 1134vpif_enum_dv_timings(struct file *file, void *priv,
1135 struct v4l2_enum_dv_timings *timings) 1135 struct v4l2_enum_dv_timings *timings)
1136{ 1136{
1137 struct vpif_capture_config *config = vpif_dev->platform_data;
1137 struct video_device *vdev = video_devdata(file); 1138 struct video_device *vdev = video_devdata(file);
1138 struct channel_obj *ch = video_get_drvdata(vdev); 1139 struct channel_obj *ch = video_get_drvdata(vdev);
1140 struct vpif_capture_chan_config *chan_cfg;
1141 struct v4l2_input input;
1139 int ret; 1142 int ret;
1140 1143
1144 if (config->chan_config[ch->channel_id].inputs == NULL)
1145 return -ENODATA;
1146
1147 chan_cfg = &config->chan_config[ch->channel_id];
1148 input = chan_cfg->inputs[ch->input_idx].input;
1149 if (input.capabilities != V4L2_IN_CAP_DV_TIMINGS)
1150 return -ENODATA;
1151
1141 ret = v4l2_subdev_call(ch->sd, video, enum_dv_timings, timings); 1152 ret = v4l2_subdev_call(ch->sd, video, enum_dv_timings, timings);
1142 if (ret == -ENOIOCTLCMD || ret == -ENODEV) 1153 if (ret == -ENOIOCTLCMD || ret == -ENODEV)
1143 return -EINVAL; 1154 return -EINVAL;
1155
1144 return ret; 1156 return ret;
1145} 1157}
1146 1158
@@ -1154,13 +1166,25 @@ static int
1154vpif_query_dv_timings(struct file *file, void *priv, 1166vpif_query_dv_timings(struct file *file, void *priv,
1155 struct v4l2_dv_timings *timings) 1167 struct v4l2_dv_timings *timings)
1156{ 1168{
1169 struct vpif_capture_config *config = vpif_dev->platform_data;
1157 struct video_device *vdev = video_devdata(file); 1170 struct video_device *vdev = video_devdata(file);
1158 struct channel_obj *ch = video_get_drvdata(vdev); 1171 struct channel_obj *ch = video_get_drvdata(vdev);
1172 struct vpif_capture_chan_config *chan_cfg;
1173 struct v4l2_input input;
1159 int ret; 1174 int ret;
1160 1175
1176 if (config->chan_config[ch->channel_id].inputs == NULL)
1177 return -ENODATA;
1178
1179 chan_cfg = &config->chan_config[ch->channel_id];
1180 input = chan_cfg->inputs[ch->input_idx].input;
1181 if (input.capabilities != V4L2_IN_CAP_DV_TIMINGS)
1182 return -ENODATA;
1183
1161 ret = v4l2_subdev_call(ch->sd, video, query_dv_timings, timings); 1184 ret = v4l2_subdev_call(ch->sd, video, query_dv_timings, timings);
1162 if (ret == -ENOIOCTLCMD || ret == -ENODEV) 1185 if (ret == -ENOIOCTLCMD || ret == -ENODEV)
1163 return -ENODATA; 1186 return -ENODATA;
1187
1164 return ret; 1188 return ret;
1165} 1189}
1166 1190
@@ -1173,19 +1197,34 @@ vpif_query_dv_timings(struct file *file, void *priv,
1173static int vpif_s_dv_timings(struct file *file, void *priv, 1197static int vpif_s_dv_timings(struct file *file, void *priv,
1174 struct v4l2_dv_timings *timings) 1198 struct v4l2_dv_timings *timings)
1175{ 1199{
1200 struct vpif_capture_config *config = vpif_dev->platform_data;
1176 struct video_device *vdev = video_devdata(file); 1201 struct video_device *vdev = video_devdata(file);
1177 struct channel_obj *ch = video_get_drvdata(vdev); 1202 struct channel_obj *ch = video_get_drvdata(vdev);
1178 struct vpif_params *vpifparams = &ch->vpifparams; 1203 struct vpif_params *vpifparams = &ch->vpifparams;
1179 struct vpif_channel_config_params *std_info = &vpifparams->std_info; 1204 struct vpif_channel_config_params *std_info = &vpifparams->std_info;
1205 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
1180 struct video_obj *vid_ch = &ch->video; 1206 struct video_obj *vid_ch = &ch->video;
1181 struct v4l2_bt_timings *bt = &vid_ch->dv_timings.bt; 1207 struct v4l2_bt_timings *bt = &vid_ch->dv_timings.bt;
1208 struct vpif_capture_chan_config *chan_cfg;
1209 struct v4l2_input input;
1182 int ret; 1210 int ret;
1183 1211
1212 if (config->chan_config[ch->channel_id].inputs == NULL)
1213 return -ENODATA;
1214
1215 chan_cfg = &config->chan_config[ch->channel_id];
1216 input = chan_cfg->inputs[ch->input_idx].input;
1217 if (input.capabilities != V4L2_IN_CAP_DV_TIMINGS)
1218 return -ENODATA;
1219
1184 if (timings->type != V4L2_DV_BT_656_1120) { 1220 if (timings->type != V4L2_DV_BT_656_1120) {
1185 vpif_dbg(2, debug, "Timing type not defined\n"); 1221 vpif_dbg(2, debug, "Timing type not defined\n");
1186 return -EINVAL; 1222 return -EINVAL;
1187 } 1223 }
1188 1224
1225 if (vb2_is_busy(&common->buffer_queue))
1226 return -EBUSY;
1227
1189 /* Configure subdevice timings, if any */ 1228 /* Configure subdevice timings, if any */
1190 ret = v4l2_subdev_call(ch->sd, video, s_dv_timings, timings); 1229 ret = v4l2_subdev_call(ch->sd, video, s_dv_timings, timings);
1191 if (ret == -ENOIOCTLCMD || ret == -ENODEV) 1230 if (ret == -ENOIOCTLCMD || ret == -ENODEV)
@@ -1261,9 +1300,20 @@ static int vpif_s_dv_timings(struct file *file, void *priv,
1261static int vpif_g_dv_timings(struct file *file, void *priv, 1300static int vpif_g_dv_timings(struct file *file, void *priv,
1262 struct v4l2_dv_timings *timings) 1301 struct v4l2_dv_timings *timings)
1263{ 1302{
1303 struct vpif_capture_config *config = vpif_dev->platform_data;
1264 struct video_device *vdev = video_devdata(file); 1304 struct video_device *vdev = video_devdata(file);
1265 struct channel_obj *ch = video_get_drvdata(vdev); 1305 struct channel_obj *ch = video_get_drvdata(vdev);
1266 struct video_obj *vid_ch = &ch->video; 1306 struct video_obj *vid_ch = &ch->video;
1307 struct vpif_capture_chan_config *chan_cfg;
1308 struct v4l2_input input;
1309
1310 if (config->chan_config[ch->channel_id].inputs == NULL)
1311 return -ENODATA;
1312
1313 chan_cfg = &config->chan_config[ch->channel_id];
1314 input = chan_cfg->inputs[ch->input_idx].input;
1315 if (input.capabilities != V4L2_IN_CAP_DV_TIMINGS)
1316 return -ENODATA;
1267 1317
1268 *timings = vid_ch->dv_timings; 1318 *timings = vid_ch->dv_timings;
1269 1319