diff options
Diffstat (limited to 'linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c')
-rw-r--r-- | linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c | 66 |
1 files changed, 55 insertions, 11 deletions
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 5ad657e89..211b789ff 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -222,14 +222,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", @@ -363,6 +364,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 +746,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", @@ -730,9 +761,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), },{ @@ -860,8 +891,8 @@ struct pvr2_hdw *pvr2_hdw_find(int unit_number) if (unit_number >= PVR_NUM) return NULL; return unit_pointers[unit_number]; } -#endif /* 0 */ +#endif /* 0 */ int pvr2_hdw_get_unit_number(struct pvr2_hdw *hdw) { return hdw->unit_number; @@ -1337,13 +1368,16 @@ void pvr2_hdw_subsys_bit_chg(struct pvr2_hdw *hdw, } #if 0 - +/* Shortcut for pvr2_hdw_subsys_bit_chg(hdw,msk,msk) */ void pvr2_hdw_subsys_bit_set(struct pvr2_hdw *hdw,unsigned long msk) { pvr2_hdw_subsys_bit_chg(hdw,msk,msk); } +#endif /* 0 */ +#if 0 +/* Shortcut for pvr2_hdw_subsys_bit_chg(hdw,msk,0) */ void pvr2_hdw_subsys_bit_clr(struct pvr2_hdw *hdw,unsigned long msk) { pvr2_hdw_subsys_bit_chg(hdw,msk,0); @@ -2261,17 +2295,17 @@ static int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw) } if (hdw->std_dirty || -#if 0 /* Don't toggle encoder for now - seems to work better this way */ hdw->enc_stale || hdw->srate_dirty || hdw->res_ver_dirty || hdw->res_hor_dirty || -#endif 0) { /* If any of this changes, then the encoder needs to be reconfigured, and we need to reset the stream. */ stale_subsys_mask |= (1<<PVR2_SUBSYS_B_ENC_CFG); +#if 0 /* Don't toggle encoder for now - seems to work better this way */ stale_subsys_mask |= hdw->subsys_stream_mask; +#endif } if (hdw->srate_dirty) { @@ -2354,8 +2388,8 @@ void pvr2_hdw_poll_trigger(struct pvr2_hdw *hdw) pvr2_hdw_poll_trigger_unlocked(hdw); } while (0); LOCK_GIVE(hdw->big_lock); } -#endif /* 0 */ +#endif /* 0 */ /* Return name for this driver instance */ const char *pvr2_hdw_get_driver_name(struct pvr2_hdw *hdw) { @@ -2545,7 +2579,10 @@ void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *hdw,int v) hdw->v4l_minor_number = v; } + #if 0 +/* Attempt to recover from a USB foul-up (in practice I find that if you + have to do this, then it's already too late). */ void pvr2_reset_ctl_endpoints(struct pvr2_hdw *hdw) { if (!hdw->usb_dev) return; @@ -2560,8 +2597,9 @@ void pvr2_reset_ctl_endpoints(struct pvr2_hdw *hdw) usb_sndbulkpipe(hdw->usb_dev, PVR2_CTL_WRITE_ENDPOINT & 0x7f)); } -#endif /* 0 */ + +#endif /* 0 */ static void pvr2_ctl_write_complete(struct urb *urb, struct pt_regs *regs) { struct pvr2_hdw *hdw = urb->context; @@ -2595,6 +2633,10 @@ static void pvr2_ctl_timeout(unsigned long data) } +/* Issue a command and get a response from the device. This extended + version includes a probe flag (which if set means that device errors + should not be logged or treated as fatal) and a timeout in jiffies. + This can be used to non-lethally probe the health of endpoint 1. */ static int pvr2_send_request_ex(struct pvr2_hdw *hdw, unsigned int timeout,int probe_fl, void *write_data,unsigned int write_len, @@ -3069,6 +3111,7 @@ int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *hdw) } +/* Stop / start video stream transport */ static int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl) { int status; @@ -3167,6 +3210,7 @@ int pvr2_hdw_gpio_chg_out(struct pvr2_hdw *hdw,u32 msk,u32 val) } +/* Find I2C address of eeprom */ static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw) { int result; |