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, 64 insertions, 20 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index be1e5cc78081..88604365777c 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -38,9 +38,7 @@ | |||
38 | 38 | ||
39 | struct usb_device_id pvr2_device_table[] = { | 39 | struct usb_device_id pvr2_device_table[] = { |
40 | [PVR2_HDW_TYPE_29XXX] = { USB_DEVICE(0x2040, 0x2900) }, | 40 | [PVR2_HDW_TYPE_29XXX] = { USB_DEVICE(0x2040, 0x2900) }, |
41 | #ifdef CONFIG_VIDEO_PVRUSB2_24XXX | ||
42 | [PVR2_HDW_TYPE_24XXX] = { USB_DEVICE(0x2040, 0x2400) }, | 41 | [PVR2_HDW_TYPE_24XXX] = { USB_DEVICE(0x2040, 0x2400) }, |
43 | #endif | ||
44 | { } | 42 | { } |
45 | }; | 43 | }; |
46 | 44 | ||
@@ -48,9 +46,7 @@ MODULE_DEVICE_TABLE(usb, pvr2_device_table); | |||
48 | 46 | ||
49 | static const char *pvr2_device_names[] = { | 47 | static const char *pvr2_device_names[] = { |
50 | [PVR2_HDW_TYPE_29XXX] = "WinTV PVR USB2 Model Category 29xxxx", | 48 | [PVR2_HDW_TYPE_29XXX] = "WinTV PVR USB2 Model Category 29xxxx", |
51 | #ifdef CONFIG_VIDEO_PVRUSB2_24XXX | ||
52 | [PVR2_HDW_TYPE_24XXX] = "WinTV PVR USB2 Model Category 24xxxx", | 49 | [PVR2_HDW_TYPE_24XXX] = "WinTV PVR USB2 Model Category 24xxxx", |
53 | #endif | ||
54 | }; | 50 | }; |
55 | 51 | ||
56 | struct pvr2_string_table { | 52 | struct pvr2_string_table { |
@@ -58,14 +54,12 @@ struct pvr2_string_table { | |||
58 | unsigned int cnt; | 54 | unsigned int cnt; |
59 | }; | 55 | }; |
60 | 56 | ||
61 | #ifdef CONFIG_VIDEO_PVRUSB2_24XXX | ||
62 | // Names of other client modules to request for 24xxx model hardware | 57 | // Names of other client modules to request for 24xxx model hardware |
63 | static const char *pvr2_client_24xxx[] = { | 58 | static const char *pvr2_client_24xxx[] = { |
64 | "cx25840", | 59 | "cx25840", |
65 | "tuner", | 60 | "tuner", |
66 | "wm8775", | 61 | "wm8775", |
67 | }; | 62 | }; |
68 | #endif | ||
69 | 63 | ||
70 | // Names of other client modules to request for 29xxx model hardware | 64 | // Names of other client modules to request for 29xxx model hardware |
71 | static const char *pvr2_client_29xxx[] = { | 65 | static const char *pvr2_client_29xxx[] = { |
@@ -79,12 +73,10 @@ static struct pvr2_string_table pvr2_client_lists[] = { | |||
79 | pvr2_client_29xxx, | 73 | pvr2_client_29xxx, |
80 | sizeof(pvr2_client_29xxx)/sizeof(pvr2_client_29xxx[0]), | 74 | sizeof(pvr2_client_29xxx)/sizeof(pvr2_client_29xxx[0]), |
81 | }, | 75 | }, |
82 | #ifdef CONFIG_VIDEO_PVRUSB2_24XXX | ||
83 | [PVR2_HDW_TYPE_24XXX] = { | 76 | [PVR2_HDW_TYPE_24XXX] = { |
84 | pvr2_client_24xxx, | 77 | pvr2_client_24xxx, |
85 | sizeof(pvr2_client_24xxx)/sizeof(pvr2_client_24xxx[0]), | 78 | sizeof(pvr2_client_24xxx)/sizeof(pvr2_client_24xxx[0]), |
86 | }, | 79 | }, |
87 | #endif | ||
88 | }; | 80 | }; |
89 | 81 | ||
90 | static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = NULL}; | 82 | static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = NULL}; |
@@ -221,14 +213,15 @@ static const struct pvr2_mpeg_ids mpeg_ids[] = { | |||
221 | }; | 213 | }; |
222 | #define MPEGDEF_COUNT (sizeof(mpeg_ids)/sizeof(mpeg_ids[0])) | 214 | #define MPEGDEF_COUNT (sizeof(mpeg_ids)/sizeof(mpeg_ids[0])) |
223 | 215 | ||
216 | |||
224 | static const char *control_values_srate[] = { | 217 | static const char *control_values_srate[] = { |
225 | [PVR2_CVAL_SRATE_48] = "48KHz", | 218 | [V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100] = "44.1 kHz", |
226 | [PVR2_CVAL_SRATE_44_1] = "44.1KHz", | 219 | [V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000] = "48 kHz", |
220 | [V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000] = "32 kHz", | ||
227 | }; | 221 | }; |
228 | 222 | ||
229 | 223 | ||
230 | 224 | ||
231 | |||
232 | static const char *control_values_input[] = { | 225 | static const char *control_values_input[] = { |
233 | [PVR2_CVAL_INPUT_TV] = "television", /*xawtv needs this name*/ | 226 | [PVR2_CVAL_INPUT_TV] = "television", /*xawtv needs this name*/ |
234 | [PVR2_CVAL_INPUT_RADIO] = "radio", | 227 | [PVR2_CVAL_INPUT_RADIO] = "radio", |
@@ -362,6 +355,50 @@ static int ctrl_freq_set(struct pvr2_ctrl *cptr,int m,int v) | |||
362 | return 0; | 355 | return 0; |
363 | } | 356 | } |
364 | 357 | ||
358 | static int ctrl_hres_max_get(struct pvr2_ctrl *cptr,int *vp) | ||
359 | { | ||
360 | /* If we're dealing with a 24xxx device, force the horizontal | ||
361 | maximum to be 720 no matter what, since we can't get the device | ||
362 | to work properly with any other value. Otherwise just return | ||
363 | the normal value. */ | ||
364 | *vp = cptr->info->def.type_int.max_value; | ||
365 | if (cptr->hdw->hdw_type == PVR2_HDW_TYPE_24XXX) *vp = 720; | ||
366 | return 0; | ||
367 | } | ||
368 | |||
369 | static int ctrl_hres_min_get(struct pvr2_ctrl *cptr,int *vp) | ||
370 | { | ||
371 | /* If we're dealing with a 24xxx device, force the horizontal | ||
372 | minimum to be 720 no matter what, since we can't get the device | ||
373 | to work properly with any other value. Otherwise just return | ||
374 | the normal value. */ | ||
375 | *vp = cptr->info->def.type_int.min_value; | ||
376 | if (cptr->hdw->hdw_type == PVR2_HDW_TYPE_24XXX) *vp = 720; | ||
377 | return 0; | ||
378 | } | ||
379 | |||
380 | static int ctrl_vres_max_get(struct pvr2_ctrl *cptr,int *vp) | ||
381 | { | ||
382 | /* Actual maximum depends on the video standard in effect. */ | ||
383 | if (cptr->hdw->std_mask_cur & V4L2_STD_525_60) { | ||
384 | *vp = 480; | ||
385 | } else { | ||
386 | *vp = 576; | ||
387 | } | ||
388 | return 0; | ||
389 | } | ||
390 | |||
391 | static int ctrl_vres_min_get(struct pvr2_ctrl *cptr,int *vp) | ||
392 | { | ||
393 | /* Actual minimum depends on device type. */ | ||
394 | if (cptr->hdw->hdw_type == PVR2_HDW_TYPE_24XXX) { | ||
395 | *vp = 75; | ||
396 | } else { | ||
397 | *vp = 17; | ||
398 | } | ||
399 | return 0; | ||
400 | } | ||
401 | |||
365 | static int ctrl_cx2341x_is_dirty(struct pvr2_ctrl *cptr) | 402 | static int ctrl_cx2341x_is_dirty(struct pvr2_ctrl *cptr) |
366 | { | 403 | { |
367 | return cptr->hdw->enc_stale != 0; | 404 | return cptr->hdw->enc_stale != 0; |
@@ -719,19 +756,27 @@ static const struct pvr2_ctl_info control_defs[] = { | |||
719 | .internal_id = PVR2_CID_HRES, | 756 | .internal_id = PVR2_CID_HRES, |
720 | .default_value = 720, | 757 | .default_value = 720, |
721 | DEFREF(res_hor), | 758 | DEFREF(res_hor), |
722 | DEFINT(320,720), | 759 | DEFINT(19,720), |
760 | /* Hook in check for clamp on horizontal resolution in | ||
761 | order to avoid unsolved problem involving cx25840. */ | ||
762 | .get_max_value = ctrl_hres_max_get, | ||
763 | .get_min_value = ctrl_hres_min_get, | ||
723 | },{ | 764 | },{ |
724 | .desc = "Vertical capture resolution", | 765 | .desc = "Vertical capture resolution", |
725 | .name = "resolution_ver", | 766 | .name = "resolution_ver", |
726 | .internal_id = PVR2_CID_VRES, | 767 | .internal_id = PVR2_CID_VRES, |
727 | .default_value = 480, | 768 | .default_value = 480, |
728 | DEFREF(res_ver), | 769 | DEFREF(res_ver), |
729 | DEFINT(200,625), | 770 | DEFINT(17,576), |
771 | /* Hook in check for video standard and adjust maximum | ||
772 | depending on the standard. */ | ||
773 | .get_max_value = ctrl_vres_max_get, | ||
774 | .get_min_value = ctrl_vres_min_get, | ||
730 | },{ | 775 | },{ |
731 | .v4l_id = V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ, | 776 | .v4l_id = V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ, |
732 | .desc = "Sample rate", | 777 | .default_value = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000, |
778 | .desc = "Audio Sampling Frequency", | ||
733 | .name = "srate", | 779 | .name = "srate", |
734 | .default_value = PVR2_CVAL_SRATE_48, | ||
735 | DEFREF(srate), | 780 | DEFREF(srate), |
736 | DEFENUM(control_values_srate), | 781 | DEFENUM(control_values_srate), |
737 | },{ | 782 | },{ |
@@ -935,22 +980,18 @@ static int pvr2_upload_firmware1(struct pvr2_hdw *hdw) | |||
935 | static const char *fw_files_29xxx[] = { | 980 | static const char *fw_files_29xxx[] = { |
936 | "v4l-pvrusb2-29xxx-01.fw", | 981 | "v4l-pvrusb2-29xxx-01.fw", |
937 | }; | 982 | }; |
938 | #ifdef CONFIG_VIDEO_PVRUSB2_24XXX | ||
939 | static const char *fw_files_24xxx[] = { | 983 | static const char *fw_files_24xxx[] = { |
940 | "v4l-pvrusb2-24xxx-01.fw", | 984 | "v4l-pvrusb2-24xxx-01.fw", |
941 | }; | 985 | }; |
942 | #endif | ||
943 | static const struct pvr2_string_table fw_file_defs[] = { | 986 | static const struct pvr2_string_table fw_file_defs[] = { |
944 | [PVR2_HDW_TYPE_29XXX] = { | 987 | [PVR2_HDW_TYPE_29XXX] = { |
945 | fw_files_29xxx, | 988 | fw_files_29xxx, |
946 | sizeof(fw_files_29xxx)/sizeof(fw_files_29xxx[0]), | 989 | sizeof(fw_files_29xxx)/sizeof(fw_files_29xxx[0]), |
947 | }, | 990 | }, |
948 | #ifdef CONFIG_VIDEO_PVRUSB2_24XXX | ||
949 | [PVR2_HDW_TYPE_24XXX] = { | 991 | [PVR2_HDW_TYPE_24XXX] = { |
950 | fw_files_24xxx, | 992 | fw_files_24xxx, |
951 | sizeof(fw_files_24xxx)/sizeof(fw_files_24xxx[0]), | 993 | sizeof(fw_files_24xxx)/sizeof(fw_files_24xxx[0]), |
952 | }, | 994 | }, |
953 | #endif | ||
954 | }; | 995 | }; |
955 | hdw->fw1_state = FW1_STATE_FAILED; // default result | 996 | hdw->fw1_state = FW1_STATE_FAILED; // default result |
956 | 997 | ||
@@ -2237,11 +2278,14 @@ static int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw) | |||
2237 | } | 2278 | } |
2238 | 2279 | ||
2239 | if (hdw->std_dirty || | 2280 | if (hdw->std_dirty || |
2281 | hdw->enc_stale || | ||
2282 | hdw->srate_dirty || | ||
2283 | hdw->res_ver_dirty || | ||
2284 | hdw->res_hor_dirty || | ||
2240 | 0) { | 2285 | 0) { |
2241 | /* If any of this changes, then the encoder needs to be | 2286 | /* If any of this changes, then the encoder needs to be |
2242 | reconfigured, and we need to reset the stream. */ | 2287 | reconfigured, and we need to reset the stream. */ |
2243 | stale_subsys_mask |= (1<<PVR2_SUBSYS_B_ENC_CFG); | 2288 | stale_subsys_mask |= (1<<PVR2_SUBSYS_B_ENC_CFG); |
2244 | stale_subsys_mask |= hdw->subsys_stream_mask; | ||
2245 | } | 2289 | } |
2246 | 2290 | ||
2247 | if (hdw->srate_dirty) { | 2291 | if (hdw->srate_dirty) { |