diff options
author | Mike Isely <isely@pobox.com> | 2006-04-19 23:59:11 -0500 |
---|---|---|
committer | Mike Isely <isely@pobox.com> | 2006-04-19 23:59:11 -0500 |
commit | f6ff726f1d538206996f33ae3cce23dfaf21d1ad (patch) | |
tree | a52c83ffec2f3c594a279c873bd7a13b7d3dd359 /linux | |
parent | bbfdc6d1fdaea36ca996bb4cfdcc493d998a65f6 (diff) | |
download | mediapointer-dvb-s2-f6ff726f1d538206996f33ae3cce23dfaf21d1ad.tar.gz mediapointer-dvb-s2-f6ff726f1d538206996f33ae3cce23dfaf21d1ad.tar.bz2 |
Another rework of pvrusb2 video standard handling
From: Mike Isely <isely@pobox.com>
Clean up logic for handling video standards in the pvrusb2 driver.
New implementation should be able to handle all possible V4L defined
video standards now, and it should be far easier to maintain this
going forward.
Signed-off-by: Mike Isely <isely@pobox.com>
Diffstat (limited to 'linux')
7 files changed, 208 insertions, 156 deletions
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.c b/linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.c index b2c43a389..e55f43e44 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.c @@ -514,8 +514,8 @@ int pvr2_ctrl_value_to_sym_internal(struct pvr2_ctrl *cptr, } } else if (cptr->info->type == pvr2_ctl_bitmask) { *len = gen_bitmask_string( - mask & cptr->info->def.type_bitmask.valid_bits, - val,0, + val & mask & cptr->info->def.type_bitmask.valid_bits, + ~0,!0, cptr->info->def.type_bitmask.bit_names, buf,maxlen); } diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-eeprom.c b/linux/drivers/media/video/pvrusb2/pvrusb2-eeprom.c index 78bc968c0..1509ed6d6 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-eeprom.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-eeprom.c @@ -147,7 +147,7 @@ int pvr2_eeprom_analyze(struct pvr2_hdw *hdw) trace_eeprom("rev_str=%s",tvdata.rev_str); hdw->tuner_type = tvdata.tuner_type; hdw->serial_number = tvdata.serial_number; - pvr2_hdw_internal_set_std_avail(hdw,tvdata.tuner_formats); + hdw->std_mask_eeprom = tvdata.tuner_formats; kfree(eeprom); diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-encoder.c b/linux/drivers/media/video/pvrusb2/pvrusb2-encoder.c index c60786390..962c88740 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-encoder.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-encoder.c @@ -268,7 +268,7 @@ static int pvr2_write_encoder_vcmd (struct pvr2_hdw *hdw, u8 cmd, int pvr2_encoder_configure(struct pvr2_hdw *hdw) { int ret = 0, audio, i; - v4l2_std_id vd_std = hdw->video_std_cur; + v4l2_std_id vd_std = hdw->std_mask_cur; int height = hdw->res_ver_val; int width = hdw->res_hor_val; int height_full = !hdw->interlace_val; diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h index ad48f0751..abf2faf10 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h @@ -129,7 +129,7 @@ struct pvr2_ctl_info { int skip_init; /* Starting value for this control */ - long default_value; + int default_value; /* Type-specific control information */ union { @@ -238,8 +238,6 @@ struct pvr2_hdw { unsigned int freqTable[FREQTABLE_SIZE]; unsigned int freqProgSlot; unsigned int freqSlot; - unsigned int freqVal; - int freqDirty; /* Stuff for handling low level control interaction with device */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) @@ -289,18 +287,25 @@ struct pvr2_hdw { /* Tuner / frequency control stuff */ unsigned int tuner_type; int tuner_updated; - v4l2_std_id video_std_avail; - v4l2_std_id video_std_cur; - int video_std_dirty; - struct pvr2_ctl_info video_std_info_enum; - struct pvr2_ctl_info video_std_info_avail; - struct pvr2_ctl_info video_std_info_cur; + unsigned int freqVal; + int freqDirty; + + /* Video standard handling */ + v4l2_std_id std_mask_eeprom; // Hardware supported selections + v4l2_std_id std_mask_avail; // Which standards we may select from + v4l2_std_id std_mask_cur; // Currently selected standard(s) + unsigned int std_enum_cnt; // # of enumerated standards + int std_enum_cur; // selected standard enumeration value + int std_dirty; // True if std_mask_cur has changed + struct pvr2_ctl_info std_info_enum; + struct pvr2_ctl_info std_info_avail; + struct pvr2_ctl_info std_info_cur; struct v4l2_standard *std_defs; - const char **video_std_enum_names; - const char *video_std_mask_ptrs[32]; - char video_std_mask_names[32][10]; - unsigned int std_cnt; - int std_id; + const char **std_enum_names; + + // Generated string names, one per actual V4L2 standard + const char *std_mask_ptrs[32]; + char std_mask_names[32][10]; int unit_number; /* ID for driver instance */ unsigned long serial_number; /* ID for hardware itself */ @@ -358,9 +363,8 @@ void pvr2_hdw_subsys_stream_bit_chg_no_lock(struct pvr2_hdw *hdw, unsigned long msk, unsigned long val); -int pvr2_hdw_internal_set_stdenum_cur(struct pvr2_hdw *hdw,int val); -void pvr2_hdw_internal_set_std_cur(struct pvr2_hdw *hdw,int msk); -void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw,int msk); +void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw); +void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw); #endif /* __PVRUSB2_HDW_INTERNAL_H */ diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 9ea68eeef..4843f2823 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -61,6 +61,7 @@ static int initusbreset = 1; static int procreload = 0; static int tuner[PVR_NUM] = { [0 ... PVR_NUM-1] = -1 }; static int tolerance[PVR_NUM] = { [0 ... PVR_NUM-1] = 0 }; +static int video_std[PVR_NUM] = { [0 ... PVR_NUM-1] = 0 }; static int init_pause_msec = 0; module_param(ctlchg, int, S_IRUGO|S_IWUSR); @@ -74,6 +75,8 @@ MODULE_PARM_DESC(procreload, "Attempt init failure recovery with firmware reload"); module_param_array(tuner, int, NULL, 0444); MODULE_PARM_DESC(tuner,"specify installed tuner type"); +module_param_array(video_std, int, NULL, 0444); +MODULE_PARM_DESC(video_std,"specify initial video standard"); module_param_array(tolerance, int, NULL, 0444); MODULE_PARM_DESC(tolerance,"specify stream error tolerance"); @@ -255,7 +258,20 @@ static int ctrl_hsm_get(struct pvr2_ctrl *cptr,int *vp) static int ctrl_stdavail_get(struct pvr2_ctrl *cptr,int *vp) { - *vp = cptr->hdw->video_std_avail; + *vp = cptr->hdw->std_mask_avail; + return 0; +} + +static int ctrl_stdavail_set(struct pvr2_ctrl *cptr,int m,int v) +{ + struct pvr2_hdw *hdw = cptr->hdw; + v4l2_std_id ns; + ns = hdw->std_mask_avail; + ns = (ns & ~m) | (v & m); + if (ns == hdw->std_mask_avail) return 0; + hdw->std_mask_avail = ns; + pvr2_hdw_internal_set_std_avail(hdw); + pvr2_hdw_internal_find_stdenum(hdw); return 0; } @@ -282,16 +298,33 @@ static int ctrl_std_sym_to_val(struct pvr2_ctrl *cptr, static int ctrl_stdcur_get(struct pvr2_ctrl *cptr,int *vp) { - *vp = cptr->hdw->video_std_cur; + *vp = cptr->hdw->std_mask_cur; return 0; } static int ctrl_stdcur_set(struct pvr2_ctrl *cptr,int m,int v) { - pvr2_hdw_internal_set_std_cur(cptr->hdw,v); + struct pvr2_hdw *hdw = cptr->hdw; + v4l2_std_id ns; + ns = hdw->std_mask_cur; + ns = (ns & ~m) | (v & m); + if (ns == hdw->std_mask_cur) return 0; + hdw->std_mask_cur = ns; + hdw->std_dirty = !0; + pvr2_hdw_internal_find_stdenum(hdw); return 0; } +static int ctrl_stdcur_is_dirty(struct pvr2_ctrl *cptr) +{ + return cptr->hdw->std_dirty != 0; +} + +static void ctrl_stdcur_clear_dirty(struct pvr2_ctrl *cptr) +{ + cptr->hdw->std_dirty = 0; +} + static int ctrl_signal_get(struct pvr2_ctrl *cptr,int *vp) { *vp = ((pvr2_hdw_get_signal_status_internal(cptr->hdw) & @@ -325,31 +358,35 @@ static int ctrl_subsys_stream_set(struct pvr2_ctrl *cptr,int m,int v) static int ctrl_stdenumcur_set(struct pvr2_ctrl *cptr,int m,int v) { + struct pvr2_hdw *hdw = cptr->hdw; if (v < 0) return -EINVAL; - if (v >= cptr->hdw->std_cnt) return -EINVAL; - cptr->hdw->std_id = v; - pvr2_hdw_internal_set_std_cur(cptr->hdw, - cptr->hdw->std_id); + if (v > hdw->std_enum_cnt) return -EINVAL; + hdw->std_enum_cur = v; + if (!v) return 0; + v--; + if (hdw->std_mask_cur == hdw->std_defs[v].id) return 0; + hdw->std_mask_cur = hdw->std_defs[v].id; + hdw->std_dirty = !0; return 0; } static int ctrl_stdenumcur_get(struct pvr2_ctrl *cptr,int *vp) { - *vp = cptr->hdw->std_id; + *vp = cptr->hdw->std_enum_cur; return 0; } static int ctrl_stdenumcur_is_dirty(struct pvr2_ctrl *cptr) { - return cptr->hdw->video_std_dirty != 0; + return cptr->hdw->std_dirty != 0; } static void ctrl_stdenumcur_clear_dirty(struct pvr2_ctrl *cptr) { - cptr->hdw->video_std_dirty = 0; + cptr->hdw->std_dirty = 0; } @@ -613,7 +650,9 @@ static const struct pvr2_ctl_info control_defs[] = { .desc = "Video Standards Available Mask", .name = "video_standard_mask_available", .internal_id = PVR2_CID_STDAVAIL, + .skip_init = !0, .get_value = ctrl_stdavail_get, + .set_value = ctrl_stdavail_set, .val_to_sym = ctrl_std_val_to_sym, .sym_to_val = ctrl_std_sym_to_val, .type = pvr2_ctl_bitmask, @@ -624,6 +663,8 @@ static const struct pvr2_ctl_info control_defs[] = { .skip_init = !0, .get_value = ctrl_stdcur_get, .set_value = ctrl_stdcur_set, + .is_dirty = ctrl_stdcur_is_dirty, + .clear_dirty = ctrl_stdcur_clear_dirty, .val_to_sym = ctrl_std_val_to_sym, .sym_to_val = ctrl_std_sym_to_val, .type = pvr2_ctl_bitmask, @@ -1279,6 +1320,17 @@ static int get_default_tuner_type(struct pvr2_hdw *hdw) } +static v4l2_std_id get_default_standard(struct pvr2_hdw *hdw) +{ + int unit_number = hdw->unit_number; + int tp = 0; + if ((unit_number >= 0) && (unit_number < PVR_NUM)) { + tp = video_std[unit_number]; + } + return tp; +} + + static unsigned int get_default_error_tolerance(struct pvr2_hdw *hdw) { int unit_number = hdw->unit_number; @@ -1316,6 +1368,60 @@ static int pvr2_hdw_check_firmware(struct pvr2_hdw *hdw) } +static void pvr2_hdw_setup_std(struct pvr2_hdw *hdw) +{ + char buf[40]; + unsigned int bcnt; + v4l2_std_id std1,std2; + + std1 = get_default_standard(hdw); + + bcnt = pvr2_std_id_to_str(buf,sizeof(buf),hdw->std_mask_eeprom); + pvr2_trace(PVR2_TRACE_INIT, + "Supported video standard(s) reported by eeprom: %.*s", + bcnt,buf); + + hdw->std_mask_avail = hdw->std_mask_eeprom; + + std2 = std1 & ~hdw->std_mask_avail; + if (std2) { + bcnt = pvr2_std_id_to_str(buf,sizeof(buf),std2); + pvr2_trace(PVR2_TRACE_INIT, + "Expanding supported video standards" + " to include: %.*s", + bcnt,buf); + hdw->std_mask_avail |= std2; + } + + pvr2_hdw_internal_set_std_avail(hdw); + + if (std1) { + bcnt = pvr2_std_id_to_str(buf,sizeof(buf),std1); + pvr2_trace(PVR2_TRACE_INIT, + "Initial video standard forced to %.*s", + bcnt,buf); + hdw->std_mask_cur = std1; + hdw->std_dirty = !0; + pvr2_hdw_internal_find_stdenum(hdw); + return; + } + + if (hdw->std_enum_cnt > 1) { + // Autoselect the first listed standard + hdw->std_enum_cur = 1; + hdw->std_mask_cur = hdw->std_defs[hdw->std_enum_cur-1].id; + hdw->std_dirty = !0; + pvr2_trace(PVR2_TRACE_INIT, + "Initial video standard auto-selected to %s", + hdw->std_defs[hdw->std_enum_cur-1].name); + return; + } + + pvr2_trace(PVR2_TRACE_EEPROM, + "Unable to select a viable initial video standard"); +} + + static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw) { int ret; @@ -1388,6 +1494,8 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw) if (!pvr2_hdw_dev_ok(hdw)) return; } + pvr2_hdw_setup_std(hdw); + if (!get_default_tuner_type(hdw)) { pvr2_trace(PVR2_TRACE_INIT, "pvr2_hdw_setup: Tuner type overridden to %d", @@ -1400,23 +1508,6 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw) if (!pvr2_hdw_dev_ok(hdw)) return; - for (idx = 0; idx < hdw->std_cnt; idx++) { - pvr2_trace(PVR2_TRACE_EEPROM, - "Detected video standard %s (from eeprom)", - hdw->std_defs[idx].name); - } - if (hdw->std_cnt) { - pvr2_trace(PVR2_TRACE_EEPROM, - "Initial video standard set to %s" - " (detected from eeprom)", - hdw->std_defs[hdw->std_id].name); - } else { - pvr2_trace(PVR2_TRACE_EEPROM, - "Unable to select a viable video standard"); - } - - if (!pvr2_hdw_dev_ok(hdw)) return; - pvr2_hdw_commit_ctl_internal(hdw); if (!pvr2_hdw_dev_ok(hdw)) return; @@ -1545,8 +1636,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, hdw->hdw_type = hdw_type; for (idx = 0; idx < 32; idx++) { - hdw->video_std_mask_ptrs[idx] = - hdw->video_std_mask_names[idx]; + hdw->std_mask_ptrs[idx] = hdw->std_mask_names[idx]; } for (idx = 0; idx < CTRL_COUNT; idx++) { @@ -1558,9 +1648,9 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, // Initialize video standard enum dynamic control cptr = pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_STDENUM); if (cptr) { - memcpy(&hdw->video_std_info_enum,cptr->info, - sizeof(hdw->video_std_info_enum)); - cptr->info = &hdw->video_std_info_enum; + memcpy(&hdw->std_info_enum,cptr->info, + sizeof(hdw->std_info_enum)); + cptr->info = &hdw->std_info_enum; } // Initialize control data regarding video standard masks @@ -1568,29 +1658,29 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, for (idx = 0; idx < 32; idx++) { if (!(valid_std_mask & (1 << idx))) continue; cnt1 = pvr2_std_id_to_str( - hdw->video_std_mask_names[idx], - sizeof(hdw->video_std_mask_names[idx])-1, + hdw->std_mask_names[idx], + sizeof(hdw->std_mask_names[idx])-1, 1 << idx); - hdw->video_std_mask_names[idx][cnt1] = 0; + hdw->std_mask_names[idx][cnt1] = 0; } cptr = pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_STDAVAIL); if (cptr) { - memcpy(&hdw->video_std_info_avail,cptr->info, - sizeof(hdw->video_std_info_avail)); - cptr->info = &hdw->video_std_info_avail; - hdw->video_std_info_avail.def.type_bitmask.bit_names = - hdw->video_std_mask_ptrs; - hdw->video_std_info_avail.def.type_bitmask.valid_bits = + memcpy(&hdw->std_info_avail,cptr->info, + sizeof(hdw->std_info_avail)); + cptr->info = &hdw->std_info_avail; + hdw->std_info_avail.def.type_bitmask.bit_names = + hdw->std_mask_ptrs; + hdw->std_info_avail.def.type_bitmask.valid_bits = valid_std_mask; } cptr = pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_STDCUR); if (cptr) { - memcpy(&hdw->video_std_info_cur,cptr->info, - sizeof(hdw->video_std_info_cur)); - cptr->info = &hdw->video_std_info_cur; - hdw->video_std_info_cur.def.type_bitmask.bit_names = - hdw->video_std_mask_ptrs; - hdw->video_std_info_avail.def.type_bitmask.valid_bits = + memcpy(&hdw->std_info_cur,cptr->info, + sizeof(hdw->std_info_cur)); + 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 = valid_std_mask; } @@ -1722,7 +1812,7 @@ void pvr2_hdw_destroy(struct pvr2_hdw *hdw) } while (0); up(&pvr2_unit_sem); kfree(hdw->controls); if (hdw->std_defs) kfree(hdw->std_defs); - if (hdw->video_std_enum_names) kfree(hdw->video_std_enum_names); + if (hdw->std_enum_names) kfree(hdw->std_enum_names); kfree(hdw); } @@ -1751,60 +1841,59 @@ void pvr2_hdw_disconnect(struct pvr2_hdw *hdw) } -// Given a mask of viable video standards to choose from, generate an -// appropriate array of v4l2_standard data that corresponds to it and set -// up related state in the driver to match. -void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw,int arg) +// Attempt to autoselect an appropriate value for std_enum_cur given +// whatever is currently in std_mask_cur +void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw) +{ + unsigned int idx; + for (idx = 1; idx < hdw->std_enum_cnt; idx++) { + if (hdw->std_defs[idx-1].id == hdw->std_mask_cur) { + hdw->std_enum_cur = idx; + return; + } + } + hdw->std_enum_cur = 0; +} + + +// Calculate correct set of enumerated standards based on currently known +// set of available standards bits. +void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw) { struct v4l2_standard *newstd; unsigned int std_cnt; unsigned int idx; - newstd = pvr2_std_create_enum(&std_cnt,arg); + newstd = pvr2_std_create_enum(&std_cnt,hdw->std_mask_avail); if (hdw->std_defs) { kfree(hdw->std_defs); hdw->std_defs = 0; } - hdw->std_cnt = 0; - if (hdw->video_std_enum_names) { - kfree(hdw->video_std_enum_names); - hdw->video_std_enum_names = 0; + hdw->std_enum_cnt = 0; + if (hdw->std_enum_names) { + kfree(hdw->std_enum_names); + hdw->std_enum_names = 0; } if (!std_cnt) { pvr2_trace( PVR2_TRACE_ERROR_LEGS, - "Failed to identify any viable standard groups"); - hdw->video_std_avail = 0; - pvr2_hdw_internal_set_std_cur(hdw,0); - return; - } else { - hdw->video_std_enum_names = kmalloc(sizeof(char *)*std_cnt, - GFP_KERNEL); - for (idx = 0; idx < std_cnt; idx++) { - hdw->video_std_enum_names[idx] = - newstd[idx].name; - } - // Set up the dynamic control for this standard - hdw->video_std_info_enum.def.type_enum.value_names = - hdw->video_std_enum_names; - hdw->video_std_info_enum.def.type_enum.count = std_cnt; - hdw->std_defs = newstd; - hdw->std_cnt = std_cnt; + "WARNING: Failed to identify any viable standards"); } - - hdw->video_std_avail = arg; - if (!(hdw->video_std_avail & hdw->video_std_cur)) { - // Reselect standard if there isn't one that matches... - pvr2_hdw_internal_set_stdenum_cur(hdw,0); + hdw->std_enum_names = kmalloc(sizeof(char *)*(std_cnt+1),GFP_KERNEL); + hdw->std_enum_names[0] = "none"; + for (idx = 0; idx < std_cnt; idx++) { + hdw->std_enum_names[idx+1] = + newstd[idx].name; } -} - - -unsigned int pvr2_hdw_get_stdenum_count(struct pvr2_hdw *hdw) -{ - return hdw->std_cnt; + // Set up the dynamic control for this standard + hdw->std_info_enum.def.type_enum.value_names = hdw->std_enum_names; + hdw->std_info_enum.def.type_enum.count = std_cnt+1; + hdw->std_defs = newstd; + hdw->std_enum_cnt = std_cnt+1; + hdw->std_enum_cur = 0; + hdw->std_info_cur.def.type_bitmask.valid_bits = hdw->std_mask_avail; } @@ -1813,8 +1902,10 @@ int pvr2_hdw_get_stdenum_value(struct pvr2_hdw *hdw, unsigned int idx) { int ret = -EINVAL; + if (!idx) return ret; + idx--; LOCK_TAKE(hdw->big_lock); do { - if (idx >= hdw->std_cnt) break; + if (idx >= hdw->std_enum_cnt) break; memcpy(std,hdw->std_defs+idx,sizeof(*std)); ret = 0; } while (0); LOCK_GIVE(hdw->big_lock); @@ -1822,49 +1913,6 @@ int pvr2_hdw_get_stdenum_value(struct pvr2_hdw *hdw, } -int pvr2_hdw_internal_set_stdenum_cur(struct pvr2_hdw *hdw,int val) -{ - if (val < 0) return -EINVAL; - if (val >= hdw->std_cnt) return -EINVAL; - pvr2_hdw_internal_set_std_cur(hdw,hdw->std_defs[val].id); - return 0; -} - - -void pvr2_hdw_internal_set_std_cur(struct pvr2_hdw *hdw,int val) -{ - unsigned int idx; - v4l2_std_id msk,id; - - id = (v4l2_std_id)val; - // Only select from available standards - id &= hdw->video_std_avail; - - // Only select a single bit - for (idx = 0, msk = 1; msk; idx++, msk <<= 1) { - if (!(id & msk)) continue; - id = msk; - break; - } - - // Get out if nothing found - if (!msk) return; - - // Fix up standard group now - hdw->video_std_cur = id; - hdw->video_std_dirty = !0; - for (idx = 0; idx < hdw->std_cnt; idx++) { - if (hdw->std_defs[idx].id & id) { - hdw->std_id = idx; - return; - } - } - - // Should never really get here, but just in case... - hdw->std_id = 0; -} - - /* Get the number of defined controls */ unsigned int pvr2_hdw_get_ctrl_count(struct pvr2_hdw *hdw) { @@ -1976,11 +2024,11 @@ int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw) /* When video standard changes, reset the hres and vres values - but if the user has pending changes there, then let the changes take priority. */ - if (hdw->video_std_dirty) { + if (hdw->std_dirty) { /* Rewrite the vertical resolution to be appropriate to the video standard that has been selected. */ int nvres; - if (hdw->video_std_cur & V4L2_STD_525_60) { + if (hdw->std_mask_cur & V4L2_STD_525_60) { nvres = 480; } else { nvres = 576; @@ -1995,7 +2043,7 @@ int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw) } } - if (hdw->video_std_dirty || + if (hdw->std_dirty || hdw->res_ver_dirty || hdw->res_hor_dirty || hdw->interlace_dirty || diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c b/linux/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c index e6b176bf3..9f81aff2b 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c @@ -29,7 +29,7 @@ static void set_standard(struct pvr2_hdw *hdw) { v4l2_std_id vs; - vs = hdw->video_std_cur; + vs = hdw->std_mask_cur; pvr2_trace(PVR2_TRACE_CHIPS, "i2c v4l2 set_standard(0x%llx)",(__u64)vs); @@ -39,7 +39,7 @@ static void set_standard(struct pvr2_hdw *hdw) static int check_standard(struct pvr2_hdw *hdw) { - return hdw->video_std_dirty != 0; + return hdw->std_dirty != 0; } diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index c8f392a7f..3701d479d 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c @@ -247,7 +247,7 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file, { struct v4l2_standard *vs = (struct v4l2_standard *)arg; int idx = vs->index; - ret = pvr2_hdw_get_stdenum_value(hdw,vs,idx); + ret = pvr2_hdw_get_stdenum_value(hdw,vs,idx+1); break; } |