aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2013-03-25 07:14:13 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-03-25 14:10:39 -0400
commit106cf649d06c55b881cf4eadf2ca1a28a04d93aa (patch)
treea8202276ccf1cdff2feb30dd79809597d0542c9f
parentea86968fb91471493ccac7d8f2a65bc65db6803b (diff)
[media] tuner-core: don't set has_signal/get_afc if not supported
If the tuner frontend does not support get_rf_strength, then don't set the has_signal callback. Ditto for get_afc. Both callbacks overwrite the signal and afc fields of struct v4l2_tuner but that should only happen if the tuner can actually detect this. If it can't, then it should leave those fields alone so other subdevices can try and detect the signal/afc. This fixes the bug where the au8522 detected a signal and then tuner-core overwrote it with 0 since the xc5000 tuner does not support get_rf_strength. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/v4l2-core/tuner-core.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/media/v4l2-core/tuner-core.c b/drivers/media/v4l2-core/tuner-core.c
index f775768d088d..dd8a803fb111 100644
--- a/drivers/media/v4l2-core/tuner-core.c
+++ b/drivers/media/v4l2-core/tuner-core.c
@@ -253,7 +253,7 @@ static int fe_set_config(struct dvb_frontend *fe, void *priv_cfg)
253 253
254static void tuner_status(struct dvb_frontend *fe); 254static void tuner_status(struct dvb_frontend *fe);
255 255
256static struct analog_demod_ops tuner_analog_ops = { 256static const struct analog_demod_ops tuner_analog_ops = {
257 .set_params = fe_set_params, 257 .set_params = fe_set_params,
258 .standby = fe_standby, 258 .standby = fe_standby,
259 .has_signal = fe_has_signal, 259 .has_signal = fe_has_signal,
@@ -453,6 +453,11 @@ static void set_type(struct i2c_client *c, unsigned int type,
453 memcpy(analog_ops, &tuner_analog_ops, 453 memcpy(analog_ops, &tuner_analog_ops,
454 sizeof(struct analog_demod_ops)); 454 sizeof(struct analog_demod_ops));
455 455
456 if (fe_tuner_ops->get_rf_strength == NULL)
457 analog_ops->has_signal = NULL;
458 if (fe_tuner_ops->get_afc == NULL)
459 analog_ops->get_afc = NULL;
460
456 } else { 461 } else {
457 t->name = analog_ops->info.name; 462 t->name = analog_ops->info.name;
458 } 463 }