aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tda8290.c
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2007-08-31 16:53:00 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-09 21:07:49 -0400
commit3782e050f8860fb701d4cb14df16cd4ed9cce2d2 (patch)
tree0125684b69c446d3d3a73a9dc39ee8f44bfcae3c /drivers/media/video/tda8290.c
parent6b897f2c3982af51134ba83f4b6de71d28d35944 (diff)
V4L/DVB (6140): tda8290: add get_rf_strength and improve status reading efficiency
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/tda8290.c')
-rw-r--r--drivers/media/video/tda8290.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c
index ec731d6fbfb8..0e5cf459d3ed 100644
--- a/drivers/media/video/tda8290.c
+++ b/drivers/media/video/tda8290.c
@@ -553,27 +553,35 @@ static int tda8290_set_params(struct dvb_frontend *fe,
553static int tda8290_has_signal(struct dvb_frontend *fe) 553static int tda8290_has_signal(struct dvb_frontend *fe)
554{ 554{
555 struct tda8290_priv *priv = fe->tuner_priv; 555 struct tda8290_priv *priv = fe->tuner_priv;
556 int ret;
556 557
557 unsigned char i2c_get_afc[1] = { 0x1B }; 558 unsigned char i2c_get_afc[1] = { 0x1B };
558 unsigned char afc = 0; 559 unsigned char afc = 0;
559 560
561 /* for now, report based on afc status */
560 tuner_i2c_xfer_send(&priv->i2c_props, i2c_get_afc, ARRAY_SIZE(i2c_get_afc)); 562 tuner_i2c_xfer_send(&priv->i2c_props, i2c_get_afc, ARRAY_SIZE(i2c_get_afc));
561 tuner_i2c_xfer_recv(&priv->i2c_props, &afc, 1); 563 tuner_i2c_xfer_recv(&priv->i2c_props, &afc, 1);
562 return (afc & 0x80)? 65535:0; 564
565 ret = (afc & 0x80) ? 65535 : 0;
566
567 tuner_dbg("AFC status: %d\n", ret);
568
569 return ret;
563} 570}
564 571
565static int tda8290_get_status(struct dvb_frontend *fe, u32 *status) 572static int tda8290_get_status(struct dvb_frontend *fe, u32 *status)
566{ 573{
567 struct tda8290_priv *priv = fe->tuner_priv;
568
569 int signal = tda8290_has_signal(fe);
570 *status = 0; 574 *status = 0;
571 575
572 /* for now, report based on afc status */ 576 if (tda8290_has_signal(fe))
573 if (signal)
574 *status = TUNER_STATUS_LOCKED; 577 *status = TUNER_STATUS_LOCKED;
575 578
576 tuner_dbg("tda8290: AFC status: %d\n", signal); 579 return 0;
580}
581
582static int tda8290_get_rf_strength(struct dvb_frontend *fe, u16 *strength)
583{
584 *strength = tda8290_has_signal(fe);
577 585
578 return 0; 586 return 0;
579} 587}
@@ -656,6 +664,7 @@ static struct dvb_tuner_ops tda8290_tuner_ops = {
656 .release = tda8290_release, 664 .release = tda8290_release,
657 .get_frequency = tda8290_get_frequency, 665 .get_frequency = tda8290_get_frequency,
658 .get_status = tda8290_get_status, 666 .get_status = tda8290_get_status,
667 .get_rf_strength = tda8290_get_rf_strength,
659}; 668};
660 669
661struct dvb_frontend *tda8290_attach(struct dvb_frontend *fe, 670struct dvb_frontend *tda8290_attach(struct dvb_frontend *fe,