aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2007-01-19 22:15:41 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-02-21 10:34:38 -0500
commit7c74e57e6fb2ce986134e74634aeb78b3ea41a97 (patch)
tree32a6a3be3f7bd94006f5d17789bc6f566827d1be /drivers
parentfe23a2809d1f88887f7df7da38652826933b8ce6 (diff)
V4L/DVB (5083): Pvrusb2: Remove automodeswitch control
The automodeswitch control was a feature that enable automatic radio / tv switching based on the selected frequency. However since frequency ranges can overlap and also since apparently in some cases it's possible for the same frequency range to be both tv and radio in a specific region, then this feature can't safely work. So it's removed. Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h1
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c66
2 files changed, 4 insertions, 63 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
index bc911ff75306..16bd74199601 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
@@ -318,7 +318,6 @@ struct pvr2_hdw {
318 VCREATE_DATA(res_hor); 318 VCREATE_DATA(res_hor);
319 VCREATE_DATA(res_ver); 319 VCREATE_DATA(res_ver);
320 VCREATE_DATA(srate); 320 VCREATE_DATA(srate);
321 VCREATE_DATA(automodeswitch);
322#undef VCREATE_DATA 321#undef VCREATE_DATA
323 322
324 struct pvr2_ctld_info *mpeg_ctrl_info; 323 struct pvr2_ctld_info *mpeg_ctrl_info;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 776125491c81..11890a0a72af 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -94,7 +94,6 @@ static int procreload = 0;
94static int tuner[PVR_NUM] = { [0 ... PVR_NUM-1] = -1 }; 94static int tuner[PVR_NUM] = { [0 ... PVR_NUM-1] = -1 };
95static int tolerance[PVR_NUM] = { [0 ... PVR_NUM-1] = 0 }; 95static int tolerance[PVR_NUM] = { [0 ... PVR_NUM-1] = 0 };
96static int video_std[PVR_NUM] = { [0 ... PVR_NUM-1] = 0 }; 96static int video_std[PVR_NUM] = { [0 ... PVR_NUM-1] = 0 };
97static int auto_mode_switch[PVR_NUM];
98static int init_pause_msec = 0; 97static int init_pause_msec = 0;
99 98
100module_param(ctlchg, int, S_IRUGO|S_IWUSR); 99module_param(ctlchg, int, S_IRUGO|S_IWUSR);
@@ -112,8 +111,6 @@ module_param_array(video_std, int, NULL, 0444);
112MODULE_PARM_DESC(video_std,"specify initial video standard"); 111MODULE_PARM_DESC(video_std,"specify initial video standard");
113module_param_array(tolerance, int, NULL, 0444); 112module_param_array(tolerance, int, NULL, 0444);
114MODULE_PARM_DESC(tolerance,"specify stream error tolerance"); 113MODULE_PARM_DESC(tolerance,"specify stream error tolerance");
115module_param_array(auto_mode_switch, int, NULL, 0444);
116MODULE_PARM_DESC(auto_mode_switch,"Enable TV/Radio automatic mode switch based on freq");
117 114
118#define PVR2_CTL_WRITE_ENDPOINT 0x01 115#define PVR2_CTL_WRITE_ENDPOINT 0x01
119#define PVR2_CTL_READ_ENDPOINT 0x81 116#define PVR2_CTL_READ_ENDPOINT 0x81
@@ -759,7 +756,6 @@ VCREATE_FUNCS(audiomode)
759VCREATE_FUNCS(res_hor) 756VCREATE_FUNCS(res_hor)
760VCREATE_FUNCS(res_ver) 757VCREATE_FUNCS(res_ver)
761VCREATE_FUNCS(srate) 758VCREATE_FUNCS(srate)
762VCREATE_FUNCS(automodeswitch)
763 759
764/* Table definition of all controls which can be manipulated */ 760/* Table definition of all controls which can be manipulated */
765static const struct pvr2_ctl_info control_defs[] = { 761static const struct pvr2_ctl_info control_defs[] = {
@@ -859,12 +855,6 @@ static const struct pvr2_ctl_info control_defs[] = {
859 .get_max_value = ctrl_vres_max_get, 855 .get_max_value = ctrl_vres_max_get,
860 .get_min_value = ctrl_vres_min_get, 856 .get_min_value = ctrl_vres_min_get,
861 },{ 857 },{
862 .desc = "Automatic TV / Radio mode switch based on frequency",
863 .name = "auto_mode_switch",
864 .default_value = 0,
865 DEFREF(automodeswitch),
866 DEFBOOL,
867 },{
868 .v4l_id = V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ, 858 .v4l_id = V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ,
869 .default_value = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000, 859 .default_value = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000,
870 .desc = "Audio Sampling Frequency", 860 .desc = "Audio Sampling Frequency",
@@ -1022,71 +1012,28 @@ unsigned long pvr2_hdw_get_cur_freq(struct pvr2_hdw *hdw)
1022 driver-core side effects of this action. */ 1012 driver-core side effects of this action. */
1023void pvr2_hdw_set_cur_freq(struct pvr2_hdw *hdw,unsigned long val) 1013void pvr2_hdw_set_cur_freq(struct pvr2_hdw *hdw,unsigned long val)
1024{ 1014{
1025 int mode = 0; 1015 if (hdw->input_val == PVR2_CVAL_INPUT_RADIO) {
1026
1027 /* If hdw->automodeswitch_val is set, then we do something clever:
1028 Look at the desired frequency and see if it looks like FM or TV.
1029 Execute a possible mode switch based on this result. Otherwise
1030 we use the current input setting to determine which frequency
1031 register we need to adjust. */
1032 if (hdw->automodeswitch_val) {
1033 /* Note that since FM RADIO frequency range sits *inside*
1034 the TV spectrum that we must therefore check the radio
1035 range first... */
1036 if ((val >= RADIO_MIN_FREQ) && (val <= RADIO_MAX_FREQ)) {
1037 mode = 1;
1038 } else if ((val >= TV_MIN_FREQ) && (val <= TV_MAX_FREQ)) {
1039 mode = 2;
1040 }
1041 } else {
1042 if (hdw->input_val == PVR2_CVAL_INPUT_RADIO) {
1043 mode = 1;
1044 } else {
1045 mode = 2;
1046 }
1047 }
1048
1049 switch (mode) {
1050 case 1:
1051 if (hdw->freqSelector) { 1016 if (hdw->freqSelector) {
1052 /* Swing over to radio frequency selection */ 1017 /* Swing over to radio frequency selection */
1053 hdw->freqSelector = 0; 1018 hdw->freqSelector = 0;
1054 hdw->freqDirty = !0; 1019 hdw->freqDirty = !0;
1055 } 1020 }
1056 if (hdw->input_val == PVR2_CVAL_INPUT_TV) {
1057 /* Force switch to radio mode */
1058 hdw->input_val = PVR2_CVAL_INPUT_RADIO;
1059 hdw->input_dirty = !0;
1060 }
1061 if (hdw->freqValRadio != val) { 1021 if (hdw->freqValRadio != val) {
1062 hdw->freqValRadio = val; 1022 hdw->freqValRadio = val;
1063 hdw->freqSlotRadio = 0; 1023 hdw->freqSlotRadio = 0;
1064 if (hdw->input_val == PVR2_CVAL_INPUT_RADIO) { 1024 hdw->freqDirty = !0;
1065 hdw->freqDirty = !0;
1066 }
1067 } 1025 }
1068 break; 1026 } else {
1069 case 2:
1070 if (!(hdw->freqSelector)) { 1027 if (!(hdw->freqSelector)) {
1071 /* Swing over to television frequency selection */ 1028 /* Swing over to television frequency selection */
1072 hdw->freqSelector = 1; 1029 hdw->freqSelector = 1;
1073 hdw->freqDirty = !0; 1030 hdw->freqDirty = !0;
1074 } 1031 }
1075 if (hdw->input_val == PVR2_CVAL_INPUT_RADIO) {
1076 /* Force switch to television mode */
1077 hdw->input_val = PVR2_CVAL_INPUT_TV;
1078 hdw->input_dirty = !0;
1079 }
1080 if (hdw->freqValTelevision != val) { 1032 if (hdw->freqValTelevision != val) {
1081 hdw->freqValTelevision = val; 1033 hdw->freqValTelevision = val;
1082 hdw->freqSlotTelevision = 0; 1034 hdw->freqSlotTelevision = 0;
1083 if (hdw->input_val == PVR2_CVAL_INPUT_TV) { 1035 hdw->freqDirty = !0;
1084 hdw->freqDirty = !0;
1085 }
1086 } 1036 }
1087 break;
1088 default:
1089 break;
1090 } 1037 }
1091} 1038}
1092 1039
@@ -1839,11 +1786,6 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw)
1839 /* 104.3 MHz, a usable FM station for my area */ 1786 /* 104.3 MHz, a usable FM station for my area */
1840 hdw->freqValRadio = 104300000L; 1787 hdw->freqValRadio = 104300000L;
1841 1788
1842 /* Default value for auto mode switch based on module option */
1843 if ((hdw->unit_number >= 0) && (hdw->unit_number < PVR_NUM)) {
1844 hdw->automodeswitch_val = auto_mode_switch[hdw->unit_number];
1845 }
1846
1847 // Do not use pvr2_reset_ctl_endpoints() here. It is not 1789 // Do not use pvr2_reset_ctl_endpoints() here. It is not
1848 // thread-safe against the normal pvr2_send_request() mechanism. 1790 // thread-safe against the normal pvr2_send_request() mechanism.
1849 // (We should make it thread safe). 1791 // (We should make it thread safe).