[media] tuner-core/simple: get_rf_strength can be tuner mode specific
The get_rf_strength op in tuner-simple is valid only for the radio mode.
But due to the way get_signal in analog_demod_ops was designed it would
overwrite the signal value with a bogus value when in TV mode.
Pass a pointer to the signal value instead, and when not in radio mode
leave it alone in the tuner-simple.
This broke in commit 030755bde4
(tuner-core: call has_signal for both TV and radio) in kernel 3.6. Before
that this was working correctly. That commit did the right thing, but what
wasn't realized at the time was that tuner-simple should have been updated
as well to restrict setting the signal strength to the radio mode only.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:

committed by
Mauro Carvalho Chehab

parent
a2192cf47f
commit
dfc2e12df0
@@ -115,6 +115,7 @@ struct tuner_simple_priv {
|
||||
|
||||
u32 frequency;
|
||||
u32 bandwidth;
|
||||
bool radio_mode;
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@@ -189,7 +190,7 @@ static int simple_get_rf_strength(struct dvb_frontend *fe, u16 *strength)
|
||||
struct tuner_simple_priv *priv = fe->tuner_priv;
|
||||
int signal;
|
||||
|
||||
if (priv->i2c_props.adap == NULL)
|
||||
if (priv->i2c_props.adap == NULL || !priv->radio_mode)
|
||||
return -EINVAL;
|
||||
|
||||
signal = tuner_signal(tuner_read_status(fe));
|
||||
@@ -776,11 +777,13 @@ static int simple_set_params(struct dvb_frontend *fe,
|
||||
|
||||
switch (params->mode) {
|
||||
case V4L2_TUNER_RADIO:
|
||||
priv->radio_mode = true;
|
||||
ret = simple_set_radio_freq(fe, params);
|
||||
priv->frequency = params->frequency * 125 / 2;
|
||||
break;
|
||||
case V4L2_TUNER_ANALOG_TV:
|
||||
case V4L2_TUNER_DIGITAL_TV:
|
||||
priv->radio_mode = false;
|
||||
ret = simple_set_tv_freq(fe, params);
|
||||
priv->frequency = params->frequency * 62500;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user