diff options
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-hdw.c')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.c | 84 |
1 files changed, 50 insertions, 34 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 66ad516bdfd9..9d0dd08f57f8 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -499,31 +499,35 @@ static int ctrl_cropt_max_get(struct pvr2_ctrl *cptr, int *top) | |||
499 | return 0; | 499 | return 0; |
500 | } | 500 | } |
501 | 501 | ||
502 | static int ctrl_cropw_max_get(struct pvr2_ctrl *cptr, int *val) | 502 | static int ctrl_cropw_max_get(struct pvr2_ctrl *cptr, int *width) |
503 | { | 503 | { |
504 | struct v4l2_cropcap *cap = &cptr->hdw->cropcap_info; | 504 | struct v4l2_cropcap *cap = &cptr->hdw->cropcap_info; |
505 | int stat = pvr2_hdw_check_cropcap(cptr->hdw); | 505 | int stat, bleftend, cleft; |
506 | |||
507 | stat = pvr2_hdw_check_cropcap(cptr->hdw); | ||
506 | if (stat != 0) { | 508 | if (stat != 0) { |
507 | return stat; | 509 | return stat; |
508 | } | 510 | } |
509 | *val = 0; | 511 | bleftend = cap->bounds.left+cap->bounds.width; |
510 | if (cap->bounds.width > cptr->hdw->cropl_val) { | 512 | cleft = cptr->hdw->cropl_val; |
511 | *val = cap->bounds.width - cptr->hdw->cropl_val; | 513 | |
512 | } | 514 | *width = cleft < bleftend ? bleftend-cleft : 0; |
513 | return 0; | 515 | return 0; |
514 | } | 516 | } |
515 | 517 | ||
516 | static int ctrl_croph_max_get(struct pvr2_ctrl *cptr, int *val) | 518 | static int ctrl_croph_max_get(struct pvr2_ctrl *cptr, int *height) |
517 | { | 519 | { |
518 | struct v4l2_cropcap *cap = &cptr->hdw->cropcap_info; | 520 | struct v4l2_cropcap *cap = &cptr->hdw->cropcap_info; |
519 | int stat = pvr2_hdw_check_cropcap(cptr->hdw); | 521 | int stat, btopend, ctop; |
522 | |||
523 | stat = pvr2_hdw_check_cropcap(cptr->hdw); | ||
520 | if (stat != 0) { | 524 | if (stat != 0) { |
521 | return stat; | 525 | return stat; |
522 | } | 526 | } |
523 | *val = 0; | 527 | btopend = cap->bounds.top+cap->bounds.height; |
524 | if (cap->bounds.height > cptr->hdw->cropt_val) { | 528 | ctop = cptr->hdw->cropt_val; |
525 | *val = cap->bounds.height - cptr->hdw->cropt_val; | 529 | |
526 | } | 530 | *height = ctop < btopend ? btopend-ctop : 0; |
527 | return 0; | 531 | return 0; |
528 | } | 532 | } |
529 | 533 | ||
@@ -1114,6 +1118,7 @@ static const struct pvr2_ctl_info control_defs[] = { | |||
1114 | .internal_id = PVR2_CID_CROPW, | 1118 | .internal_id = PVR2_CID_CROPW, |
1115 | .default_value = 720, | 1119 | .default_value = 720, |
1116 | DEFREF(cropw), | 1120 | DEFREF(cropw), |
1121 | DEFINT(0, 864), | ||
1117 | .get_max_value = ctrl_cropw_max_get, | 1122 | .get_max_value = ctrl_cropw_max_get, |
1118 | .get_def_value = ctrl_get_cropcapdw, | 1123 | .get_def_value = ctrl_get_cropcapdw, |
1119 | }, { | 1124 | }, { |
@@ -1122,6 +1127,7 @@ static const struct pvr2_ctl_info control_defs[] = { | |||
1122 | .internal_id = PVR2_CID_CROPH, | 1127 | .internal_id = PVR2_CID_CROPH, |
1123 | .default_value = 480, | 1128 | .default_value = 480, |
1124 | DEFREF(croph), | 1129 | DEFREF(croph), |
1130 | DEFINT(0, 576), | ||
1125 | .get_max_value = ctrl_croph_max_get, | 1131 | .get_max_value = ctrl_croph_max_get, |
1126 | .get_def_value = ctrl_get_cropcapdh, | 1132 | .get_def_value = ctrl_get_cropcapdh, |
1127 | }, { | 1133 | }, { |
@@ -2027,6 +2033,8 @@ static void pvr2_hdw_cx25840_vbi_hack(struct pvr2_hdw *hdw) | |||
2027 | hdw->decoder_client_id); | 2033 | hdw->decoder_client_id); |
2028 | memset(&fmt, 0, sizeof(fmt)); | 2034 | memset(&fmt, 0, sizeof(fmt)); |
2029 | fmt.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE; | 2035 | fmt.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE; |
2036 | fmt.fmt.sliced.service_lines[0][21] = V4L2_SLICED_CAPTION_525; | ||
2037 | fmt.fmt.sliced.service_lines[1][21] = V4L2_SLICED_CAPTION_525; | ||
2030 | v4l2_device_call_all(&hdw->v4l2_dev, hdw->decoder_client_id, | 2038 | v4l2_device_call_all(&hdw->v4l2_dev, hdw->decoder_client_id, |
2031 | vbi, s_sliced_fmt, &fmt.fmt.sliced); | 2039 | vbi, s_sliced_fmt, &fmt.fmt.sliced); |
2032 | } | 2040 | } |
@@ -2842,15 +2850,23 @@ static void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw) | |||
2842 | PVR2_TRACE_ERROR_LEGS, | 2850 | PVR2_TRACE_ERROR_LEGS, |
2843 | "WARNING: Failed to identify any viable standards"); | 2851 | "WARNING: Failed to identify any viable standards"); |
2844 | } | 2852 | } |
2853 | |||
2854 | /* Set up the dynamic control for this standard */ | ||
2845 | hdw->std_enum_names = kmalloc(sizeof(char *)*(std_cnt+1),GFP_KERNEL); | 2855 | hdw->std_enum_names = kmalloc(sizeof(char *)*(std_cnt+1),GFP_KERNEL); |
2846 | hdw->std_enum_names[0] = "none"; | 2856 | if (hdw->std_enum_names) { |
2847 | for (idx = 0; idx < std_cnt; idx++) { | 2857 | hdw->std_enum_names[0] = "none"; |
2848 | hdw->std_enum_names[idx+1] = | 2858 | for (idx = 0; idx < std_cnt; idx++) |
2849 | newstd[idx].name; | 2859 | hdw->std_enum_names[idx+1] = newstd[idx].name; |
2850 | } | 2860 | hdw->std_info_enum.def.type_enum.value_names = |
2851 | // Set up the dynamic control for this standard | 2861 | hdw->std_enum_names; |
2852 | hdw->std_info_enum.def.type_enum.value_names = hdw->std_enum_names; | 2862 | hdw->std_info_enum.def.type_enum.count = std_cnt+1; |
2853 | hdw->std_info_enum.def.type_enum.count = std_cnt+1; | 2863 | } else { |
2864 | pvr2_trace( | ||
2865 | PVR2_TRACE_ERROR_LEGS, | ||
2866 | "WARNING: Failed to alloc memory for names"); | ||
2867 | hdw->std_info_enum.def.type_enum.value_names = NULL; | ||
2868 | hdw->std_info_enum.def.type_enum.count = 0; | ||
2869 | } | ||
2854 | hdw->std_defs = newstd; | 2870 | hdw->std_defs = newstd; |
2855 | hdw->std_enum_cnt = std_cnt+1; | 2871 | hdw->std_enum_cnt = std_cnt+1; |
2856 | hdw->std_enum_cur = 0; | 2872 | hdw->std_enum_cur = 0; |
@@ -3165,6 +3181,19 @@ static int pvr2_hdw_commit_execute(struct pvr2_hdw *hdw) | |||
3165 | struct pvr2_ctrl *cptr; | 3181 | struct pvr2_ctrl *cptr; |
3166 | int disruptive_change; | 3182 | int disruptive_change; |
3167 | 3183 | ||
3184 | if (hdw->input_dirty && hdw->state_pathway_ok && | ||
3185 | (((hdw->input_val == PVR2_CVAL_INPUT_DTV) ? | ||
3186 | PVR2_PATHWAY_DIGITAL : PVR2_PATHWAY_ANALOG) != | ||
3187 | hdw->pathway_state)) { | ||
3188 | /* Change of mode being asked for... */ | ||
3189 | hdw->state_pathway_ok = 0; | ||
3190 | trace_stbit("state_pathway_ok", hdw->state_pathway_ok); | ||
3191 | } | ||
3192 | if (!hdw->state_pathway_ok) { | ||
3193 | /* Can't commit anything until pathway is ok. */ | ||
3194 | return 0; | ||
3195 | } | ||
3196 | |||
3168 | /* Handle some required side effects when the video standard is | 3197 | /* Handle some required side effects when the video standard is |
3169 | changed.... */ | 3198 | changed.... */ |
3170 | if (hdw->std_dirty) { | 3199 | if (hdw->std_dirty) { |
@@ -3199,18 +3228,6 @@ static int pvr2_hdw_commit_execute(struct pvr2_hdw *hdw) | |||
3199 | } | 3228 | } |
3200 | } | 3229 | } |
3201 | 3230 | ||
3202 | if (hdw->input_dirty && hdw->state_pathway_ok && | ||
3203 | (((hdw->input_val == PVR2_CVAL_INPUT_DTV) ? | ||
3204 | PVR2_PATHWAY_DIGITAL : PVR2_PATHWAY_ANALOG) != | ||
3205 | hdw->pathway_state)) { | ||
3206 | /* Change of mode being asked for... */ | ||
3207 | hdw->state_pathway_ok = 0; | ||
3208 | trace_stbit("state_pathway_ok",hdw->state_pathway_ok); | ||
3209 | } | ||
3210 | if (!hdw->state_pathway_ok) { | ||
3211 | /* Can't commit anything until pathway is ok. */ | ||
3212 | return 0; | ||
3213 | } | ||
3214 | /* The broadcast decoder can only scale down, so if | 3231 | /* The broadcast decoder can only scale down, so if |
3215 | * res_*_dirty && crop window < output format ==> enlarge crop. | 3232 | * res_*_dirty && crop window < output format ==> enlarge crop. |
3216 | * | 3233 | * |
@@ -5159,8 +5176,7 @@ void pvr2_hdw_status_poll(struct pvr2_hdw *hdw) | |||
5159 | using v4l2-subdev - therefore we can't support that AT ALL right | 5176 | using v4l2-subdev - therefore we can't support that AT ALL right |
5160 | now. (Of course, no sub-drivers seem to implement it either. | 5177 | now. (Of course, no sub-drivers seem to implement it either. |
5161 | But now it's a a chicken and egg problem...) */ | 5178 | But now it's a a chicken and egg problem...) */ |
5162 | v4l2_device_call_all(&hdw->v4l2_dev, 0, tuner, g_tuner, | 5179 | v4l2_device_call_all(&hdw->v4l2_dev, 0, tuner, g_tuner, vtp); |
5163 | &hdw->tuner_signal_info); | ||
5164 | pvr2_trace(PVR2_TRACE_CHIPS, "subdev status poll" | 5180 | pvr2_trace(PVR2_TRACE_CHIPS, "subdev status poll" |
5165 | " type=%u strength=%u audio=0x%x cap=0x%x" | 5181 | " type=%u strength=%u audio=0x%x cap=0x%x" |
5166 | " low=%u hi=%u", | 5182 | " low=%u hi=%u", |