diff options
author | Mike Isely <isely@pobox.com> | 2012-02-20 00:39:22 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-05-07 15:57:05 -0400 |
commit | c0bb609fdc0b842799d5108aec7fae13b0fd32cd (patch) | |
tree | 0bb9b2a338e5f9ccfed99ae7a79a41f78c93616e /drivers/media/video/pvrusb2/pvrusb2-hdw.c | |
parent | 598e978aadd39e24749e0da5a6cff568570b1d00 (diff) |
[media] pvrusb2: Get rid of obsolete code for video standard enumeration
Get rid of pvrusb2-local implementation for enumeration of video
standards - with video_ioctl2 this happens automatically now in the
v4l core.
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-hdw.c')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.c | 160 |
1 files changed, 2 insertions, 158 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index c4bb0d1b5f9f..d882c95c5788 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -334,8 +334,6 @@ static void pvr2_hdw_state_log_state(struct pvr2_hdw *); | |||
334 | static int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl); | 334 | static int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl); |
335 | static int pvr2_hdw_commit_setup(struct pvr2_hdw *hdw); | 335 | static int pvr2_hdw_commit_setup(struct pvr2_hdw *hdw); |
336 | static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw); | 336 | static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw); |
337 | static void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw); | ||
338 | static void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw); | ||
339 | static void pvr2_hdw_quiescent_timeout(unsigned long); | 337 | static void pvr2_hdw_quiescent_timeout(unsigned long); |
340 | static void pvr2_hdw_decoder_stabilization_timeout(unsigned long); | 338 | static void pvr2_hdw_decoder_stabilization_timeout(unsigned long); |
341 | static void pvr2_hdw_encoder_wait_timeout(unsigned long); | 339 | static void pvr2_hdw_encoder_wait_timeout(unsigned long); |
@@ -860,8 +858,7 @@ static int ctrl_stdavail_set(struct pvr2_ctrl *cptr,int m,int v) | |||
860 | ns = (ns & ~m) | (v & m); | 858 | ns = (ns & ~m) | (v & m); |
861 | if (ns == hdw->std_mask_avail) return 0; | 859 | if (ns == hdw->std_mask_avail) return 0; |
862 | hdw->std_mask_avail = ns; | 860 | hdw->std_mask_avail = ns; |
863 | pvr2_hdw_internal_set_std_avail(hdw); | 861 | hdw->std_info_cur.def.type_bitmask.valid_bits = hdw->std_mask_avail; |
864 | pvr2_hdw_internal_find_stdenum(hdw); | ||
865 | return 0; | 862 | return 0; |
866 | } | 863 | } |
867 | 864 | ||
@@ -901,7 +898,6 @@ static int ctrl_stdcur_set(struct pvr2_ctrl *cptr,int m,int v) | |||
901 | if (ns == hdw->std_mask_cur) return 0; | 898 | if (ns == hdw->std_mask_cur) return 0; |
902 | hdw->std_mask_cur = ns; | 899 | hdw->std_mask_cur = ns; |
903 | hdw->std_dirty = !0; | 900 | hdw->std_dirty = !0; |
904 | pvr2_hdw_internal_find_stdenum(hdw); | ||
905 | return 0; | 901 | return 0; |
906 | } | 902 | } |
907 | 903 | ||
@@ -947,40 +943,6 @@ static int ctrl_audio_modes_present_get(struct pvr2_ctrl *cptr,int *vp) | |||
947 | } | 943 | } |
948 | 944 | ||
949 | 945 | ||
950 | static int ctrl_stdenumcur_set(struct pvr2_ctrl *cptr,int m,int v) | ||
951 | { | ||
952 | struct pvr2_hdw *hdw = cptr->hdw; | ||
953 | if (v < 0) return -EINVAL; | ||
954 | if (v > hdw->std_enum_cnt) return -EINVAL; | ||
955 | hdw->std_enum_cur = v; | ||
956 | if (!v) return 0; | ||
957 | v--; | ||
958 | if (hdw->std_mask_cur == hdw->std_defs[v].id) return 0; | ||
959 | hdw->std_mask_cur = hdw->std_defs[v].id; | ||
960 | hdw->std_dirty = !0; | ||
961 | return 0; | ||
962 | } | ||
963 | |||
964 | |||
965 | static int ctrl_stdenumcur_get(struct pvr2_ctrl *cptr,int *vp) | ||
966 | { | ||
967 | *vp = cptr->hdw->std_enum_cur; | ||
968 | return 0; | ||
969 | } | ||
970 | |||
971 | |||
972 | static int ctrl_stdenumcur_is_dirty(struct pvr2_ctrl *cptr) | ||
973 | { | ||
974 | return cptr->hdw->std_dirty != 0; | ||
975 | } | ||
976 | |||
977 | |||
978 | static void ctrl_stdenumcur_clear_dirty(struct pvr2_ctrl *cptr) | ||
979 | { | ||
980 | cptr->hdw->std_dirty = 0; | ||
981 | } | ||
982 | |||
983 | |||
984 | #define DEFINT(vmin,vmax) \ | 946 | #define DEFINT(vmin,vmax) \ |
985 | .type = pvr2_ctl_int, \ | 947 | .type = pvr2_ctl_int, \ |
986 | .def.type_int.min_value = vmin, \ | 948 | .def.type_int.min_value = vmin, \ |
@@ -1299,16 +1261,6 @@ static const struct pvr2_ctl_info control_defs[] = { | |||
1299 | .sym_to_val = ctrl_std_sym_to_val, | 1261 | .sym_to_val = ctrl_std_sym_to_val, |
1300 | .type = pvr2_ctl_bitmask, | 1262 | .type = pvr2_ctl_bitmask, |
1301 | },{ | 1263 | },{ |
1302 | .desc = "Video Standard Name", | ||
1303 | .name = "video_standard", | ||
1304 | .internal_id = PVR2_CID_STDENUM, | ||
1305 | .skip_init = !0, | ||
1306 | .get_value = ctrl_stdenumcur_get, | ||
1307 | .set_value = ctrl_stdenumcur_set, | ||
1308 | .is_dirty = ctrl_stdenumcur_is_dirty, | ||
1309 | .clear_dirty = ctrl_stdenumcur_clear_dirty, | ||
1310 | .type = pvr2_ctl_enum, | ||
1311 | },{ | ||
1312 | .desc = "Video Standards Detected Mask", | 1264 | .desc = "Video Standards Detected Mask", |
1313 | .name = "video_standard_mask_detected", | 1265 | .name = "video_standard_mask_detected", |
1314 | .internal_id = PVR2_CID_STDDETECT, | 1266 | .internal_id = PVR2_CID_STDDETECT, |
@@ -1951,7 +1903,7 @@ static void pvr2_hdw_setup_std(struct pvr2_hdw *hdw) | |||
1951 | hdw->std_mask_avail |= std2; | 1903 | hdw->std_mask_avail |= std2; |
1952 | } | 1904 | } |
1953 | 1905 | ||
1954 | pvr2_hdw_internal_set_std_avail(hdw); | 1906 | hdw->std_info_cur.def.type_bitmask.valid_bits = hdw->std_mask_avail; |
1955 | 1907 | ||
1956 | if (std1) { | 1908 | if (std1) { |
1957 | bcnt = pvr2_std_id_to_str(buf,sizeof(buf),std1); | 1909 | bcnt = pvr2_std_id_to_str(buf,sizeof(buf),std1); |
@@ -1960,7 +1912,6 @@ static void pvr2_hdw_setup_std(struct pvr2_hdw *hdw) | |||
1960 | bcnt,buf); | 1912 | bcnt,buf); |
1961 | hdw->std_mask_cur = std1; | 1913 | hdw->std_mask_cur = std1; |
1962 | hdw->std_dirty = !0; | 1914 | hdw->std_dirty = !0; |
1963 | pvr2_hdw_internal_find_stdenum(hdw); | ||
1964 | return; | 1915 | return; |
1965 | } | 1916 | } |
1966 | if (std3) { | 1917 | if (std3) { |
@@ -1970,7 +1921,6 @@ static void pvr2_hdw_setup_std(struct pvr2_hdw *hdw) | |||
1970 | " (determined by device type): %.*s",bcnt,buf); | 1921 | " (determined by device type): %.*s",bcnt,buf); |
1971 | hdw->std_mask_cur = std3; | 1922 | hdw->std_mask_cur = std3; |
1972 | hdw->std_dirty = !0; | 1923 | hdw->std_dirty = !0; |
1973 | pvr2_hdw_internal_find_stdenum(hdw); | ||
1974 | return; | 1924 | return; |
1975 | } | 1925 | } |
1976 | 1926 | ||
@@ -1990,24 +1940,10 @@ static void pvr2_hdw_setup_std(struct pvr2_hdw *hdw) | |||
1990 | bcnt,buf); | 1940 | bcnt,buf); |
1991 | hdw->std_mask_cur = std_eeprom_maps[idx].std; | 1941 | hdw->std_mask_cur = std_eeprom_maps[idx].std; |
1992 | hdw->std_dirty = !0; | 1942 | hdw->std_dirty = !0; |
1993 | pvr2_hdw_internal_find_stdenum(hdw); | ||
1994 | return; | 1943 | return; |
1995 | } | 1944 | } |
1996 | } | 1945 | } |
1997 | 1946 | ||
1998 | if (hdw->std_enum_cnt > 1) { | ||
1999 | // Autoselect the first listed standard | ||
2000 | hdw->std_enum_cur = 1; | ||
2001 | hdw->std_mask_cur = hdw->std_defs[hdw->std_enum_cur-1].id; | ||
2002 | hdw->std_dirty = !0; | ||
2003 | pvr2_trace(PVR2_TRACE_STD, | ||
2004 | "Initial video standard auto-selected to %s", | ||
2005 | hdw->std_defs[hdw->std_enum_cur-1].name); | ||
2006 | return; | ||
2007 | } | ||
2008 | |||
2009 | pvr2_trace(PVR2_TRACE_ERROR_LEGS, | ||
2010 | "Unable to select a viable initial video standard"); | ||
2011 | } | 1947 | } |
2012 | 1948 | ||
2013 | 1949 | ||
@@ -2609,14 +2545,6 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, | |||
2609 | cptr->info = ciptr; | 2545 | cptr->info = ciptr; |
2610 | } | 2546 | } |
2611 | 2547 | ||
2612 | // Initialize video standard enum dynamic control | ||
2613 | cptr = pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_STDENUM); | ||
2614 | if (cptr) { | ||
2615 | memcpy(&hdw->std_info_enum,cptr->info, | ||
2616 | sizeof(hdw->std_info_enum)); | ||
2617 | cptr->info = &hdw->std_info_enum; | ||
2618 | |||
2619 | } | ||
2620 | // Initialize control data regarding video standard masks | 2548 | // Initialize control data regarding video standard masks |
2621 | valid_std_mask = pvr2_std_get_usable(); | 2549 | valid_std_mask = pvr2_std_get_usable(); |
2622 | for (idx = 0; idx < 32; idx++) { | 2550 | for (idx = 0; idx < 32; idx++) { |
@@ -2736,8 +2664,6 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, | |||
2736 | kfree(hdw->ctl_write_buffer); | 2664 | kfree(hdw->ctl_write_buffer); |
2737 | kfree(hdw->controls); | 2665 | kfree(hdw->controls); |
2738 | kfree(hdw->mpeg_ctrl_info); | 2666 | kfree(hdw->mpeg_ctrl_info); |
2739 | kfree(hdw->std_defs); | ||
2740 | kfree(hdw->std_enum_names); | ||
2741 | kfree(hdw); | 2667 | kfree(hdw); |
2742 | } | 2668 | } |
2743 | return NULL; | 2669 | return NULL; |
@@ -2813,8 +2739,6 @@ void pvr2_hdw_destroy(struct pvr2_hdw *hdw) | |||
2813 | } while (0); mutex_unlock(&pvr2_unit_mtx); | 2739 | } while (0); mutex_unlock(&pvr2_unit_mtx); |
2814 | kfree(hdw->controls); | 2740 | kfree(hdw->controls); |
2815 | kfree(hdw->mpeg_ctrl_info); | 2741 | kfree(hdw->mpeg_ctrl_info); |
2816 | kfree(hdw->std_defs); | ||
2817 | kfree(hdw->std_enum_names); | ||
2818 | kfree(hdw); | 2742 | kfree(hdw); |
2819 | } | 2743 | } |
2820 | 2744 | ||
@@ -2837,86 +2761,6 @@ void pvr2_hdw_disconnect(struct pvr2_hdw *hdw) | |||
2837 | } | 2761 | } |
2838 | 2762 | ||
2839 | 2763 | ||
2840 | // Attempt to autoselect an appropriate value for std_enum_cur given | ||
2841 | // whatever is currently in std_mask_cur | ||
2842 | static void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw) | ||
2843 | { | ||
2844 | unsigned int idx; | ||
2845 | for (idx = 1; idx < hdw->std_enum_cnt; idx++) { | ||
2846 | if (hdw->std_defs[idx-1].id == hdw->std_mask_cur) { | ||
2847 | hdw->std_enum_cur = idx; | ||
2848 | return; | ||
2849 | } | ||
2850 | } | ||
2851 | hdw->std_enum_cur = 0; | ||
2852 | } | ||
2853 | |||
2854 | |||
2855 | // Calculate correct set of enumerated standards based on currently known | ||
2856 | // set of available standards bits. | ||
2857 | static void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw) | ||
2858 | { | ||
2859 | struct v4l2_standard *newstd; | ||
2860 | unsigned int std_cnt; | ||
2861 | unsigned int idx; | ||
2862 | |||
2863 | newstd = pvr2_std_create_enum(&std_cnt,hdw->std_mask_avail); | ||
2864 | |||
2865 | if (hdw->std_defs) { | ||
2866 | kfree(hdw->std_defs); | ||
2867 | hdw->std_defs = NULL; | ||
2868 | } | ||
2869 | hdw->std_enum_cnt = 0; | ||
2870 | if (hdw->std_enum_names) { | ||
2871 | kfree(hdw->std_enum_names); | ||
2872 | hdw->std_enum_names = NULL; | ||
2873 | } | ||
2874 | |||
2875 | if (!std_cnt) { | ||
2876 | pvr2_trace( | ||
2877 | PVR2_TRACE_ERROR_LEGS, | ||
2878 | "WARNING: Failed to identify any viable standards"); | ||
2879 | } | ||
2880 | |||
2881 | /* Set up the dynamic control for this standard */ | ||
2882 | hdw->std_enum_names = kmalloc(sizeof(char *)*(std_cnt+1),GFP_KERNEL); | ||
2883 | if (hdw->std_enum_names) { | ||
2884 | hdw->std_enum_names[0] = "none"; | ||
2885 | for (idx = 0; idx < std_cnt; idx++) | ||
2886 | hdw->std_enum_names[idx+1] = newstd[idx].name; | ||
2887 | hdw->std_info_enum.def.type_enum.value_names = | ||
2888 | hdw->std_enum_names; | ||
2889 | hdw->std_info_enum.def.type_enum.count = std_cnt+1; | ||
2890 | } else { | ||
2891 | pvr2_trace( | ||
2892 | PVR2_TRACE_ERROR_LEGS, | ||
2893 | "WARNING: Failed to alloc memory for names"); | ||
2894 | hdw->std_info_enum.def.type_enum.value_names = NULL; | ||
2895 | hdw->std_info_enum.def.type_enum.count = 0; | ||
2896 | } | ||
2897 | hdw->std_defs = newstd; | ||
2898 | hdw->std_enum_cnt = std_cnt+1; | ||
2899 | hdw->std_enum_cur = 0; | ||
2900 | hdw->std_info_cur.def.type_bitmask.valid_bits = hdw->std_mask_avail; | ||
2901 | } | ||
2902 | |||
2903 | |||
2904 | int pvr2_hdw_get_stdenum_value(struct pvr2_hdw *hdw, | ||
2905 | struct v4l2_standard *std, | ||
2906 | unsigned int idx) | ||
2907 | { | ||
2908 | int ret = -EINVAL; | ||
2909 | if (!idx) return ret; | ||
2910 | LOCK_TAKE(hdw->big_lock); do { | ||
2911 | if (idx >= hdw->std_enum_cnt) break; | ||
2912 | idx--; | ||
2913 | memcpy(std,hdw->std_defs+idx,sizeof(*std)); | ||
2914 | ret = 0; | ||
2915 | } while (0); LOCK_GIVE(hdw->big_lock); | ||
2916 | return ret; | ||
2917 | } | ||
2918 | |||
2919 | |||
2920 | /* Get the number of defined controls */ | 2764 | /* Get the number of defined controls */ |
2921 | unsigned int pvr2_hdw_get_ctrl_count(struct pvr2_hdw *hdw) | 2765 | unsigned int pvr2_hdw_get_ctrl_count(struct pvr2_hdw *hdw) |
2922 | { | 2766 | { |