From 434449f4c8902198e6fa90023f60395230f36c23 Mon Sep 17 00:00:00 2001 From: Mike Isely Date: Tue, 8 Aug 2006 09:10:06 -0300 Subject: V4L/DVB (4372): Clean up some post mpeg-controls issues in pvrusb2 Fix a few miscellaneous issues in the pvrusb2 driver related to use of the new mpeg controls. This also should fix problems involving update of the saa7115 / cx25840 configuration as control changes are made. Signed-off-by: Mike Isely Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pvrusb2/pvrusb2-hdw.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'drivers/media/video/pvrusb2/pvrusb2-hdw.c') diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index be1e5cc7808..4ccbd53c715 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -221,14 +221,15 @@ static const struct pvr2_mpeg_ids mpeg_ids[] = { }; #define MPEGDEF_COUNT (sizeof(mpeg_ids)/sizeof(mpeg_ids[0])) + static const char *control_values_srate[] = { - [PVR2_CVAL_SRATE_48] = "48KHz", - [PVR2_CVAL_SRATE_44_1] = "44.1KHz", + [V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100] = "44.1 kHz", + [V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000] = "48 kHz", + [V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000] = "32 kHz", }; - static const char *control_values_input[] = { [PVR2_CVAL_INPUT_TV] = "television", /*xawtv needs this name*/ [PVR2_CVAL_INPUT_RADIO] = "radio", @@ -729,9 +730,9 @@ static const struct pvr2_ctl_info control_defs[] = { DEFINT(200,625), },{ .v4l_id = V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ, - .desc = "Sample rate", + .default_value = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000, + .desc = "Audio Sampling Frequency", .name = "srate", - .default_value = PVR2_CVAL_SRATE_48, DEFREF(srate), DEFENUM(control_values_srate), },{ @@ -2237,11 +2238,14 @@ static int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw) } if (hdw->std_dirty || + hdw->enc_stale || + hdw->srate_dirty || + hdw->res_ver_dirty || + hdw->res_hor_dirty || 0) { /* If any of this changes, then the encoder needs to be reconfigured, and we need to reset the stream. */ stale_subsys_mask |= (1<subsys_stream_mask; } if (hdw->srate_dirty) { -- cgit v1.2.3 From 094ddbe9506706187b58df91d64695547a807916 Mon Sep 17 00:00:00 2001 From: Mike Isely Date: Tue, 8 Aug 2006 09:10:07 -0300 Subject: V4L/DVB (4377): Force horizontal resolution limits in the pvrusb2 driver This change causes the pvrusb2 driver to limit horizontal resolution to be only 720 if 24xxx device hardware is being used. This is a workaround for an unsolved problem in the driver where if the resolution is set to something other than 720 the video quality will be _seriously_ degraded. It only happens on 24xxx devices (29xxx are unaffected by the problem and unaffected by this change). Once the problem is finally solved, this small change can be removed. Signed-off-by: Mike Isely Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pvrusb2/pvrusb2-hdw.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'drivers/media/video/pvrusb2/pvrusb2-hdw.c') diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 4ccbd53c715..199b5e2e5c4 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -363,6 +363,30 @@ static int ctrl_freq_set(struct pvr2_ctrl *cptr,int m,int v) return 0; } +#ifdef CONFIG_VIDEO_PVRUSB2_24XXX +static int ctrl_hres_max_get(struct pvr2_ctrl *cptr,int *vp) +{ + /* If we're dealing with a 24xxx device, force the horizontal + maximum to be 720 no matter what, since we can't get the device + to work properly with any other value. Otherwise just return + the normal value. */ + *vp = cptr->info->def.type_int.max_value; + if (cptr->hdw->hdw_type == PVR2_HDW_TYPE_24XXX) *vp = 720; + return 0; +} + +static int ctrl_hres_min_get(struct pvr2_ctrl *cptr,int *vp) +{ + /* If we're dealing with a 24xxx device, force the horizontal + minimum to be 720 no matter what, since we can't get the device + to work properly with any other value. Otherwise just return + the normal value. */ + *vp = cptr->info->def.type_int.min_value; + if (cptr->hdw->hdw_type == PVR2_HDW_TYPE_24XXX) *vp = 720; + return 0; +} +#endif + static int ctrl_cx2341x_is_dirty(struct pvr2_ctrl *cptr) { return cptr->hdw->enc_stale != 0; @@ -721,6 +745,12 @@ static const struct pvr2_ctl_info control_defs[] = { .default_value = 720, DEFREF(res_hor), DEFINT(320,720), +#ifdef CONFIG_VIDEO_PVRUSB2_24XXX + /* Hook in check for clamp on horizontal resolution in + order to avoid unsolved problem involving cx25840. */ + .get_max_value = ctrl_hres_max_get, + .get_min_value = ctrl_hres_min_get, +#endif },{ .desc = "Vertical capture resolution", .name = "resolution_ver", -- cgit v1.2.3 From 7f19d0278c86c7f27df287fd0bd5170fe75dc7d2 Mon Sep 17 00:00:00 2001 From: Mike Isely Date: Sat, 2 Sep 2006 15:56:33 -0300 Subject: V4L/DVB (4595): Remove CONFIG_VIDEO_PVRUSB2_24XXX from pvrusb2 driver Support for 24xxx devices was previously explicitly bracketed with CONFIG_VIDEO_PVRUSB2_24XXX inside the code because we didn't trust the stability of these changes. We trust it now; so there's no reason to leave this out of the driver anymore. Signed-off-by: Mike Isely Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pvrusb2/pvrusb2-hdw.c | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'drivers/media/video/pvrusb2/pvrusb2-hdw.c') diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 199b5e2e5c4..6ab6fd18734 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -38,9 +38,7 @@ struct usb_device_id pvr2_device_table[] = { [PVR2_HDW_TYPE_29XXX] = { USB_DEVICE(0x2040, 0x2900) }, -#ifdef CONFIG_VIDEO_PVRUSB2_24XXX [PVR2_HDW_TYPE_24XXX] = { USB_DEVICE(0x2040, 0x2400) }, -#endif { } }; @@ -48,9 +46,7 @@ MODULE_DEVICE_TABLE(usb, pvr2_device_table); static const char *pvr2_device_names[] = { [PVR2_HDW_TYPE_29XXX] = "WinTV PVR USB2 Model Category 29xxxx", -#ifdef CONFIG_VIDEO_PVRUSB2_24XXX [PVR2_HDW_TYPE_24XXX] = "WinTV PVR USB2 Model Category 24xxxx", -#endif }; struct pvr2_string_table { @@ -58,14 +54,12 @@ struct pvr2_string_table { unsigned int cnt; }; -#ifdef CONFIG_VIDEO_PVRUSB2_24XXX // Names of other client modules to request for 24xxx model hardware static const char *pvr2_client_24xxx[] = { "cx25840", "tuner", "wm8775", }; -#endif // Names of other client modules to request for 29xxx model hardware static const char *pvr2_client_29xxx[] = { @@ -79,12 +73,10 @@ static struct pvr2_string_table pvr2_client_lists[] = { pvr2_client_29xxx, sizeof(pvr2_client_29xxx)/sizeof(pvr2_client_29xxx[0]), }, -#ifdef CONFIG_VIDEO_PVRUSB2_24XXX [PVR2_HDW_TYPE_24XXX] = { pvr2_client_24xxx, sizeof(pvr2_client_24xxx)/sizeof(pvr2_client_24xxx[0]), }, -#endif }; static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = NULL}; @@ -363,7 +355,6 @@ static int ctrl_freq_set(struct pvr2_ctrl *cptr,int m,int v) return 0; } -#ifdef CONFIG_VIDEO_PVRUSB2_24XXX static int ctrl_hres_max_get(struct pvr2_ctrl *cptr,int *vp) { /* If we're dealing with a 24xxx device, force the horizontal @@ -385,7 +376,6 @@ static int ctrl_hres_min_get(struct pvr2_ctrl *cptr,int *vp) if (cptr->hdw->hdw_type == PVR2_HDW_TYPE_24XXX) *vp = 720; return 0; } -#endif static int ctrl_cx2341x_is_dirty(struct pvr2_ctrl *cptr) { @@ -745,12 +735,10 @@ static const struct pvr2_ctl_info control_defs[] = { .default_value = 720, DEFREF(res_hor), DEFINT(320,720), -#ifdef CONFIG_VIDEO_PVRUSB2_24XXX /* Hook in check for clamp on horizontal resolution in order to avoid unsolved problem involving cx25840. */ .get_max_value = ctrl_hres_max_get, .get_min_value = ctrl_hres_min_get, -#endif },{ .desc = "Vertical capture resolution", .name = "resolution_ver", @@ -966,22 +954,18 @@ static int pvr2_upload_firmware1(struct pvr2_hdw *hdw) static const char *fw_files_29xxx[] = { "v4l-pvrusb2-29xxx-01.fw", }; -#ifdef CONFIG_VIDEO_PVRUSB2_24XXX static const char *fw_files_24xxx[] = { "v4l-pvrusb2-24xxx-01.fw", }; -#endif static const struct pvr2_string_table fw_file_defs[] = { [PVR2_HDW_TYPE_29XXX] = { fw_files_29xxx, sizeof(fw_files_29xxx)/sizeof(fw_files_29xxx[0]), }, -#ifdef CONFIG_VIDEO_PVRUSB2_24XXX [PVR2_HDW_TYPE_24XXX] = { fw_files_24xxx, sizeof(fw_files_24xxx)/sizeof(fw_files_24xxx[0]), }, -#endif }; hdw->fw1_state = FW1_STATE_FAILED; // default result -- cgit v1.2.3 From 3ad9fc37bacd74c5c05eb0bd4b76876e0daf8a2d Mon Sep 17 00:00:00 2001 From: Mike Isely Date: Sat, 2 Sep 2006 22:37:52 -0300 Subject: V4L/DVB (4597): Improve resolution limit enforcements in pvrusb2 The pvrusb2 driver resolution limits are now programmed the following way, based on empirical measurements of the hardware: Vertical max: 480 for NTSC, 576 otherwise Vertical min: 75 for 24xxx, 17 otherwise Horizontal max: 720 Horizontal min: 720 for 24xxx, 19 otherwise Signed-off-by: Mike Isely Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pvrusb2/pvrusb2-hdw.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'drivers/media/video/pvrusb2/pvrusb2-hdw.c') diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 6ab6fd18734..88604365777 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -377,6 +377,28 @@ static int ctrl_hres_min_get(struct pvr2_ctrl *cptr,int *vp) return 0; } +static int ctrl_vres_max_get(struct pvr2_ctrl *cptr,int *vp) +{ + /* Actual maximum depends on the video standard in effect. */ + if (cptr->hdw->std_mask_cur & V4L2_STD_525_60) { + *vp = 480; + } else { + *vp = 576; + } + return 0; +} + +static int ctrl_vres_min_get(struct pvr2_ctrl *cptr,int *vp) +{ + /* Actual minimum depends on device type. */ + if (cptr->hdw->hdw_type == PVR2_HDW_TYPE_24XXX) { + *vp = 75; + } else { + *vp = 17; + } + return 0; +} + static int ctrl_cx2341x_is_dirty(struct pvr2_ctrl *cptr) { return cptr->hdw->enc_stale != 0; @@ -734,7 +756,7 @@ static const struct pvr2_ctl_info control_defs[] = { .internal_id = PVR2_CID_HRES, .default_value = 720, DEFREF(res_hor), - DEFINT(320,720), + DEFINT(19,720), /* Hook in check for clamp on horizontal resolution in order to avoid unsolved problem involving cx25840. */ .get_max_value = ctrl_hres_max_get, @@ -745,7 +767,11 @@ static const struct pvr2_ctl_info control_defs[] = { .internal_id = PVR2_CID_VRES, .default_value = 480, DEFREF(res_ver), - DEFINT(200,625), + DEFINT(17,576), + /* Hook in check for video standard and adjust maximum + depending on the standard. */ + .get_max_value = ctrl_vres_max_get, + .get_min_value = ctrl_vres_min_get, },{ .v4l_id = V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ, .default_value = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000, -- cgit v1.2.3