diff options
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h | 1 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.c | 38 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.h | 4 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 7 |
4 files changed, 40 insertions, 10 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h index 305e6aaa844..17fc57989f6 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h @@ -323,6 +323,7 @@ struct pvr2_hdw { struct pvr2_ctl_info std_info_enum; struct pvr2_ctl_info std_info_avail; struct pvr2_ctl_info std_info_cur; + struct pvr2_ctl_info std_info_detect; struct v4l2_standard *std_defs; const char **std_enum_names; diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 534dbf3d014..c4bb0d1b5f9 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -346,7 +346,7 @@ static int pvr2_send_request_ex(struct pvr2_hdw *hdw, void *write_data,unsigned int write_len, void *read_data,unsigned int read_len); static int pvr2_hdw_check_cropcap(struct pvr2_hdw *hdw); - +static v4l2_std_id pvr2_hdw_get_detected_std(struct pvr2_hdw *hdw); static void trace_stbit(const char *name,int val) { @@ -840,6 +840,12 @@ static int ctrl_hsm_get(struct pvr2_ctrl *cptr,int *vp) return 0; } +static int ctrl_stddetect_get(struct pvr2_ctrl *cptr, int *vp) +{ + *vp = pvr2_hdw_get_detected_std(cptr->hdw); + return 0; +} + static int ctrl_stdavail_get(struct pvr2_ctrl *cptr,int *vp) { *vp = cptr->hdw->std_mask_avail; @@ -1302,6 +1308,15 @@ static const struct pvr2_ctl_info control_defs[] = { .is_dirty = ctrl_stdenumcur_is_dirty, .clear_dirty = ctrl_stdenumcur_clear_dirty, .type = pvr2_ctl_enum, + },{ + .desc = "Video Standards Detected Mask", + .name = "video_standard_mask_detected", + .internal_id = PVR2_CID_STDDETECT, + .skip_init = !0, + .get_value = ctrl_stddetect_get, + .val_to_sym = ctrl_std_val_to_sym, + .sym_to_val = ctrl_std_sym_to_val, + .type = pvr2_ctl_bitmask, } }; @@ -2629,7 +2644,17 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, cptr->info = &hdw->std_info_cur; hdw->std_info_cur.def.type_bitmask.bit_names = hdw->std_mask_ptrs; - hdw->std_info_avail.def.type_bitmask.valid_bits = + hdw->std_info_cur.def.type_bitmask.valid_bits = + valid_std_mask; + } + cptr = pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_STDDETECT); + if (cptr) { + memcpy(&hdw->std_info_detect,cptr->info, + sizeof(hdw->std_info_detect)); + cptr->info = &hdw->std_info_detect; + hdw->std_info_detect.def.type_bitmask.bit_names = + hdw->std_mask_ptrs; + hdw->std_info_detect.def.type_bitmask.valid_bits = valid_std_mask; } @@ -2995,12 +3020,13 @@ static void pvr2_subdev_set_control(struct pvr2_hdw *hdw, int id, pvr2_subdev_set_control(hdw, id, #lab, (hdw)->lab##_val); \ } -int pvr2_hdw_get_detected_std(struct pvr2_hdw *hdw, v4l2_std_id *std) +v4l2_std_id pvr2_hdw_get_detected_std(struct pvr2_hdw *hdw) { - *std = V4L2_STD_ALL; + v4l2_std_id std; + std = V4L2_STD_ALL; v4l2_device_call_all(&hdw->v4l2_dev, 0, - video, querystd, std); - return 0; + video, querystd, &std); + return std; } /* Execute whatever commands are required to update the state of all the diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.h b/drivers/media/video/pvrusb2/pvrusb2-hdw.h index 66546580b17..45ddb81475b 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.h +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.h @@ -46,6 +46,7 @@ #define PVR2_CID_CROPCAPBT 16 #define PVR2_CID_CROPCAPBW 17 #define PVR2_CID_CROPCAPBH 18 +#define PVR2_CID_STDDETECT 19 /* Legal values for the INPUT state variable */ #define PVR2_CVAL_INPUT_TV 0 @@ -214,9 +215,6 @@ struct pvr2_stream *pvr2_hdw_get_video_stream(struct pvr2_hdw *); int pvr2_hdw_get_stdenum_value(struct pvr2_hdw *hdw,struct v4l2_standard *std, unsigned int idx); -/* Get the detected video standard */ -int pvr2_hdw_get_detected_std(struct pvr2_hdw *hdw, v4l2_std_id *std); - /* Enable / disable retrieval of CPU firmware or prom contents. This must be enabled before pvr2_hdw_cpufw_get() will function. Note that doing this may prevent the device from running (and leaving this mode may diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index 3669090f330..ed497bbf539 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c @@ -209,8 +209,13 @@ static int pvr2_querystd(struct file *file, void *priv, v4l2_std_id *std) { struct pvr2_v4l2_fh *fh = file->private_data; struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; + int val = 0; + int ret; - return pvr2_hdw_get_detected_std(hdw, std); + ret = pvr2_ctrl_get_value( + pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_STDDETECT), &val); + *std = val; + return ret; } static int pvr2_enum_input(struct file *file, void *priv, struct v4l2_input *vi) |