V4L/DVB (6723): tda18271: only force init once during attach
authorMichael Krufky <mkrufky@linuxtv.org>
Sat, 1 Dec 2007 20:40:16 +0000 (17:40 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Fri, 25 Jan 2008 21:03:12 +0000 (19:03 -0200)
Once the image rejection calibration procedure has been successful,
we should not initialize the tuner registers again.

Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/dvb/frontends/tda18271-fe.c

index 726e102cbc5d121549fcfd48cc7a65904e48d717..25c127f67c224e62c8edb8775018d882c42aa0e5 100644 (file)
@@ -337,6 +337,20 @@ static int tda18271_init_regs(struct dvb_frontend *fe)
        return 0;
 }
 
+static int tda18271_init(struct dvb_frontend *fe)
+{
+       struct tda18271_priv *priv = fe->tuner_priv;
+       unsigned char *regs = priv->tda18271_regs;
+
+       tda18271_read_regs(fe);
+
+       /* test IR_CAL_OK to see if we need init */
+       if ((regs[R_EP1] & 0x08) == 0)
+               tda18271_init_regs(fe);
+
+       return 0;
+}
+
 static int tda18271_tune(struct dvb_frontend *fe,
                         u32 ifc, u32 freq, u32 bw, u8 std)
 {
@@ -742,7 +756,7 @@ static struct dvb_tuner_ops tda18271_tuner_ops = {
                .frequency_max  = 864000000,
                .frequency_step =     62500
        },
-       .init              = tda18271_init_regs,
+       .init              = tda18271_init,
        .set_params        = tda18271_set_params,
        .set_analog_params = tda18271_set_analog_params,
        .release           = tda18271_release,
@@ -768,6 +782,8 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
 
        fe->tuner_priv = priv;
 
+       tda18271_init_regs(fe);
+
        return fe;
 }
 EXPORT_SYMBOL_GPL(tda18271_attach);