Commit 7c74e57e authored by Mike Isely's avatar Mike Isely Committed by Mauro Carvalho Chehab

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: default avatarMike Isely <isely@pobox.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent fe23a280
...@@ -318,7 +318,6 @@ struct pvr2_hdw { ...@@ -318,7 +318,6 @@ struct pvr2_hdw {
VCREATE_DATA(res_hor); VCREATE_DATA(res_hor);
VCREATE_DATA(res_ver); VCREATE_DATA(res_ver);
VCREATE_DATA(srate); VCREATE_DATA(srate);
VCREATE_DATA(automodeswitch);
#undef VCREATE_DATA #undef VCREATE_DATA
struct pvr2_ctld_info *mpeg_ctrl_info; struct pvr2_ctld_info *mpeg_ctrl_info;
......
...@@ -94,7 +94,6 @@ static int procreload = 0; ...@@ -94,7 +94,6 @@ static int procreload = 0;
static int tuner[PVR_NUM] = { [0 ... PVR_NUM-1] = -1 }; static int tuner[PVR_NUM] = { [0 ... PVR_NUM-1] = -1 };
static int tolerance[PVR_NUM] = { [0 ... PVR_NUM-1] = 0 }; static int tolerance[PVR_NUM] = { [0 ... PVR_NUM-1] = 0 };
static int video_std[PVR_NUM] = { [0 ... PVR_NUM-1] = 0 }; static int video_std[PVR_NUM] = { [0 ... PVR_NUM-1] = 0 };
static int auto_mode_switch[PVR_NUM];
static int init_pause_msec = 0; static int init_pause_msec = 0;
module_param(ctlchg, int, S_IRUGO|S_IWUSR); module_param(ctlchg, int, S_IRUGO|S_IWUSR);
...@@ -112,8 +111,6 @@ module_param_array(video_std, int, NULL, 0444); ...@@ -112,8 +111,6 @@ module_param_array(video_std, int, NULL, 0444);
MODULE_PARM_DESC(video_std,"specify initial video standard"); MODULE_PARM_DESC(video_std,"specify initial video standard");
module_param_array(tolerance, int, NULL, 0444); module_param_array(tolerance, int, NULL, 0444);
MODULE_PARM_DESC(tolerance,"specify stream error tolerance"); MODULE_PARM_DESC(tolerance,"specify stream error tolerance");
module_param_array(auto_mode_switch, int, NULL, 0444);
MODULE_PARM_DESC(auto_mode_switch,"Enable TV/Radio automatic mode switch based on freq");
#define PVR2_CTL_WRITE_ENDPOINT 0x01 #define PVR2_CTL_WRITE_ENDPOINT 0x01
#define PVR2_CTL_READ_ENDPOINT 0x81 #define PVR2_CTL_READ_ENDPOINT 0x81
...@@ -759,7 +756,6 @@ VCREATE_FUNCS(audiomode) ...@@ -759,7 +756,6 @@ VCREATE_FUNCS(audiomode)
VCREATE_FUNCS(res_hor) VCREATE_FUNCS(res_hor)
VCREATE_FUNCS(res_ver) VCREATE_FUNCS(res_ver)
VCREATE_FUNCS(srate) VCREATE_FUNCS(srate)
VCREATE_FUNCS(automodeswitch)
/* Table definition of all controls which can be manipulated */ /* Table definition of all controls which can be manipulated */
static const struct pvr2_ctl_info control_defs[] = { static const struct pvr2_ctl_info control_defs[] = {
...@@ -858,12 +854,6 @@ static const struct pvr2_ctl_info control_defs[] = { ...@@ -858,12 +854,6 @@ static const struct pvr2_ctl_info control_defs[] = {
depending on the standard. */ depending on the standard. */
.get_max_value = ctrl_vres_max_get, .get_max_value = ctrl_vres_max_get,
.get_min_value = ctrl_vres_min_get, .get_min_value = ctrl_vres_min_get,
},{
.desc = "Automatic TV / Radio mode switch based on frequency",
.name = "auto_mode_switch",
.default_value = 0,
DEFREF(automodeswitch),
DEFBOOL,
},{ },{
.v4l_id = V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ, .v4l_id = V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ,
.default_value = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000, .default_value = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000,
...@@ -1022,72 +1012,29 @@ unsigned long pvr2_hdw_get_cur_freq(struct pvr2_hdw *hdw) ...@@ -1022,72 +1012,29 @@ unsigned long pvr2_hdw_get_cur_freq(struct pvr2_hdw *hdw)
driver-core side effects of this action. */ driver-core side effects of this action. */
void pvr2_hdw_set_cur_freq(struct pvr2_hdw *hdw,unsigned long val) void pvr2_hdw_set_cur_freq(struct pvr2_hdw *hdw,unsigned long val)
{ {
int mode = 0;
/* If hdw->automodeswitch_val is set, then we do something clever:
Look at the desired frequency and see if it looks like FM or TV.
Execute a possible mode switch based on this result. Otherwise
we use the current input setting to determine which frequency
register we need to adjust. */
if (hdw->automodeswitch_val) {
/* Note that since FM RADIO frequency range sits *inside*
the TV spectrum that we must therefore check the radio
range first... */
if ((val >= RADIO_MIN_FREQ) && (val <= RADIO_MAX_FREQ)) {
mode = 1;
} else if ((val >= TV_MIN_FREQ) && (val <= TV_MAX_FREQ)) {
mode = 2;
}
} else {
if (hdw->input_val == PVR2_CVAL_INPUT_RADIO) { if (hdw->input_val == PVR2_CVAL_INPUT_RADIO) {
mode = 1;
} else {
mode = 2;
}
}
switch (mode) {
case 1:
if (hdw->freqSelector) { if (hdw->freqSelector) {
/* Swing over to radio frequency selection */ /* Swing over to radio frequency selection */
hdw->freqSelector = 0; hdw->freqSelector = 0;
hdw->freqDirty = !0; hdw->freqDirty = !0;
} }
if (hdw->input_val == PVR2_CVAL_INPUT_TV) {
/* Force switch to radio mode */
hdw->input_val = PVR2_CVAL_INPUT_RADIO;
hdw->input_dirty = !0;
}
if (hdw->freqValRadio != val) { if (hdw->freqValRadio != val) {
hdw->freqValRadio = val; hdw->freqValRadio = val;
hdw->freqSlotRadio = 0; hdw->freqSlotRadio = 0;
if (hdw->input_val == PVR2_CVAL_INPUT_RADIO) {
hdw->freqDirty = !0; hdw->freqDirty = !0;
} }
} } else {
break;
case 2:
if (!(hdw->freqSelector)) { if (!(hdw->freqSelector)) {
/* Swing over to television frequency selection */ /* Swing over to television frequency selection */
hdw->freqSelector = 1; hdw->freqSelector = 1;
hdw->freqDirty = !0; hdw->freqDirty = !0;
} }
if (hdw->input_val == PVR2_CVAL_INPUT_RADIO) {
/* Force switch to television mode */
hdw->input_val = PVR2_CVAL_INPUT_TV;
hdw->input_dirty = !0;
}
if (hdw->freqValTelevision != val) { if (hdw->freqValTelevision != val) {
hdw->freqValTelevision = val; hdw->freqValTelevision = val;
hdw->freqSlotTelevision = 0; hdw->freqSlotTelevision = 0;
if (hdw->input_val == PVR2_CVAL_INPUT_TV) {
hdw->freqDirty = !0; hdw->freqDirty = !0;
} }
} }
break;
default:
break;
}
} }
int pvr2_hdw_get_unit_number(struct pvr2_hdw *hdw) int pvr2_hdw_get_unit_number(struct pvr2_hdw *hdw)
...@@ -1839,11 +1786,6 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw) ...@@ -1839,11 +1786,6 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw)
/* 104.3 MHz, a usable FM station for my area */ /* 104.3 MHz, a usable FM station for my area */
hdw->freqValRadio = 104300000L; hdw->freqValRadio = 104300000L;
/* Default value for auto mode switch based on module option */
if ((hdw->unit_number >= 0) && (hdw->unit_number < PVR_NUM)) {
hdw->automodeswitch_val = auto_mode_switch[hdw->unit_number];
}
// Do not use pvr2_reset_ctl_endpoints() here. It is not // Do not use pvr2_reset_ctl_endpoints() here. It is not
// thread-safe against the normal pvr2_send_request() mechanism. // thread-safe against the normal pvr2_send_request() mechanism.
// (We should make it thread safe). // (We should make it thread safe).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment