diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2013-04-06 04:41:29 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-04-14 19:44:50 -0300 |
commit | dfc2e12df02d49a1567bc90989ceef870cf5b147 (patch) | |
tree | 772748f182a85c71d118f94c8e38a2a8ef05f8f7 /drivers/media/v4l2-core | |
parent | a2192cf47f593681cd65798880853c5224066c81 (diff) | |
download | op-kernel-dev-dfc2e12df02d49a1567bc90989ceef870cf5b147.zip op-kernel-dev-dfc2e12df02d49a1567bc90989ceef870cf5b147.tar.gz |
[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 030755bde42bbed133182b0ece7c7a9c759478e8
(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>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r-- | drivers/media/v4l2-core/tuner-core.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/drivers/media/v4l2-core/tuner-core.c b/drivers/media/v4l2-core/tuner-core.c index a0b10e6..ddc9379 100644 --- a/drivers/media/v4l2-core/tuner-core.c +++ b/drivers/media/v4l2-core/tuner-core.c @@ -218,16 +218,6 @@ static void fe_standby(struct dvb_frontend *fe) fe_tuner_ops->sleep(fe); } -static int fe_has_signal(struct dvb_frontend *fe) -{ - u16 strength; - - if (fe->ops.tuner_ops.get_rf_strength(fe, &strength) < 0) - return 0; - - return strength; -} - static int fe_set_config(struct dvb_frontend *fe, void *priv_cfg) { struct dvb_tuner_ops *fe_tuner_ops = &fe->ops.tuner_ops; @@ -436,7 +426,7 @@ static void set_type(struct i2c_client *c, unsigned int type, sizeof(struct analog_demod_ops)); if (fe_tuner_ops->get_rf_strength) - analog_ops->has_signal = fe_has_signal; + analog_ops->has_signal = fe_tuner_ops->get_rf_strength; if (fe_tuner_ops->get_afc) analog_ops->get_afc = fe_tuner_ops->get_afc; @@ -1060,9 +1050,12 @@ static void tuner_status(struct dvb_frontend *fe) if (tuner_status & TUNER_STATUS_STEREO) tuner_info("Stereo: yes\n"); } - if (analog_ops->has_signal) - tuner_info("Signal strength: %d\n", - analog_ops->has_signal(fe)); + if (analog_ops->has_signal) { + u16 signal; + + if (!analog_ops->has_signal(fe, &signal)) + tuner_info("Signal strength: %hu\n", signal); + } } /* @@ -1181,8 +1174,12 @@ static int tuner_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) return 0; if (vt->type == t->mode && analog_ops->get_afc) analog_ops->get_afc(&t->fe, &vt->afc); - if (analog_ops->has_signal) - vt->signal = analog_ops->has_signal(&t->fe); + if (vt->type == t->mode && analog_ops->has_signal) { + u16 signal = (u16)vt->signal; + + if (!analog_ops->has_signal(&t->fe, &signal)) + vt->signal = signal; + } if (vt->type != V4L2_TUNER_RADIO) { vt->capability |= V4L2_TUNER_CAP_NORM; vt->rangelow = tv_range[0] * 16; |