aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c
index 55f04a0b2047..16bb11902a52 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c
@@ -37,6 +37,7 @@ static void set_standard(struct pvr2_hdw *hdw)
37 pvr2_i2c_core_cmd(hdw,VIDIOC_S_STD,&vs); 37 pvr2_i2c_core_cmd(hdw,VIDIOC_S_STD,&vs);
38 } 38 }
39 hdw->tuner_signal_stale = !0; 39 hdw->tuner_signal_stale = !0;
40 hdw->cropcap_stale = !0;
40} 41}
41 42
42 43
@@ -233,6 +234,37 @@ const struct pvr2_i2c_op pvr2_i2c_op_v4l2_size = {
233}; 234};
234 235
235 236
237static void set_crop(struct pvr2_hdw *hdw)
238{
239 struct v4l2_crop crop;
240
241 memset(&crop, 0, sizeof crop);
242 crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
243 crop.c.left = hdw->cropl_val;
244 crop.c.top = hdw->cropt_val;
245 crop.c.height = hdw->croph_val;
246 crop.c.width = hdw->cropw_val;
247
248 pvr2_trace(PVR2_TRACE_CHIPS,
249 "i2c v4l2 set_crop crop=%d:%d:%d:%d",
250 crop.c.width, crop.c.height, crop.c.left, crop.c.top);
251
252 pvr2_i2c_core_cmd(hdw, VIDIOC_S_CROP, &crop);
253}
254
255static int check_crop(struct pvr2_hdw *hdw)
256{
257 return (hdw->cropl_dirty || hdw->cropt_dirty ||
258 hdw->cropw_dirty || hdw->croph_dirty);
259}
260
261const struct pvr2_i2c_op pvr2_i2c_op_v4l2_crop = {
262 .check = check_crop,
263 .update = set_crop,
264 .name = "v4l2_crop",
265};
266
267
236static void do_log(struct pvr2_hdw *hdw) 268static void do_log(struct pvr2_hdw *hdw)
237{ 269{
238 pvr2_trace(PVR2_TRACE_CHIPS,"i2c v4l2 do_log()"); 270 pvr2_trace(PVR2_TRACE_CHIPS,"i2c v4l2 do_log()");
@@ -263,7 +295,19 @@ void pvr2_v4l2_cmd_stream(struct pvr2_i2c_client *cp,int fl)
263 295
264void pvr2_v4l2_cmd_status_poll(struct pvr2_i2c_client *cp) 296void pvr2_v4l2_cmd_status_poll(struct pvr2_i2c_client *cp)
265{ 297{
266 pvr2_i2c_client_cmd(cp,VIDIOC_G_TUNER,&cp->hdw->tuner_signal_info); 298 int stat;
299 struct pvr2_hdw *hdw = cp->hdw;
300 if (hdw->cropcap_stale) {
301 hdw->cropcap_info.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
302 stat = pvr2_i2c_client_cmd(cp, VIDIOC_CROPCAP,
303 &hdw->cropcap_info);
304 if (stat == 0) {
305 /* Check was successful, so the data is no
306 longer considered stale. */
307 hdw->cropcap_stale = 0;
308 }
309 }
310 pvr2_i2c_client_cmd(cp, VIDIOC_G_TUNER, &hdw->tuner_signal_info);
267} 311}
268 312
269 313