Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=09f83c4fc06b02597ad4458c2a6675b0872f0b5c
Commit:     09f83c4fc06b02597ad4458c2a6675b0872f0b5c
Parent:     98512f7b36ec412ea0461e9aab8f16c882df055d
Author:     Michael Krufky <[EMAIL PROTECTED]>
AuthorDate: Sat Jan 5 20:00:09 2008 -0300
Committer:  Mauro Carvalho Chehab <[EMAIL PROTECTED]>
CommitDate: Fri Jan 25 19:04:41 2008 -0200

    V4L/DVB (6977): tda18271: clean up calibration initialization procedures
    
    Always initialize registers during attach.
    
    Perform IR Calibration during init if needed.
    Perform RF Calibration during init if needed for C2, only.
    
    Signed-off-by: Michael Krufky <[EMAIL PROTECTED]>
    Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
---
 drivers/media/dvb/frontends/tda18271-fe.c   |   37 ++++++++++++++++-----------
 drivers/media/dvb/frontends/tda18271-priv.h |    1 +
 2 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/drivers/media/dvb/frontends/tda18271-fe.c 
b/drivers/media/dvb/frontends/tda18271-fe.c
index 55c17fc..1a86c9f 100644
--- a/drivers/media/dvb/frontends/tda18271-fe.c
+++ b/drivers/media/dvb/frontends/tda18271-fe.c
@@ -29,7 +29,7 @@ MODULE_PARM_DESC(debug, "set debug level "
 
 /*---------------------------------------------------------------------*/
 
-static int tda18271_init(struct dvb_frontend *fe)
+static int tda18271_ir_cal_init(struct dvb_frontend *fe)
 {
        struct tda18271_priv *priv = fe->tuner_priv;
        unsigned char *regs = priv->tda18271_regs;
@@ -184,7 +184,7 @@ static int tda18271_read_thermometer(struct dvb_frontend 
*fe)
 }
 
 static int tda18271_rf_tracking_filters_correction(struct dvb_frontend *fe,
-                                                  u32 freq, int tm_rfcal)
+                                                  u32 freq)
 {
        struct tda18271_priv *priv = fe->tuner_priv;
        struct tda18271_rf_tracking_filter_cal *map = priv->rf_cal_state;
@@ -224,7 +224,7 @@ static int tda18271_rf_tracking_filters_correction(struct 
dvb_frontend *fe,
        tda18271_lookup_map(fe, RF_CAL_DC_OVER_DT, &freq, &dc_over_dt);
 
        /* calculate temperature compensation */
-       rfcal_comp = dc_over_dt * (tm_current - tm_rfcal);
+       rfcal_comp = dc_over_dt * (tm_current - priv->tm_rfcal);
 
        regs[R_EB14] = approx + rfcal_comp;
        tda18271_write_regs(fe, R_EB14, 1);
@@ -554,8 +554,7 @@ static int tda18271_rf_tracking_filters_init(struct 
dvb_frontend *fe, u32 freq)
        return 0;
 }
 
-static int tda18271_calc_rf_filter_curve(struct dvb_frontend *fe,
-                                        int *tm_rfcal)
+static int tda18271_calc_rf_filter_curve(struct dvb_frontend *fe)
 {
        struct tda18271_priv *priv = fe->tuner_priv;
        unsigned int i;
@@ -572,24 +571,21 @@ static int tda18271_calc_rf_filter_curve(struct 
dvb_frontend *fe,
                tda18271_rf_tracking_filters_init(fe, 1000 *
                                                  priv->rf_cal_state[i].rfmax);
 
-       *tm_rfcal = tda18271_read_thermometer(fe);
+       priv->tm_rfcal = tda18271_read_thermometer(fe);
 
        return 0;
 }
 
 /* ------------------------------------------------------------------ */
 
-static int tda18271_init_cal(struct dvb_frontend *fe, int *tm)
+static int tda18271_rf_cal_init(struct dvb_frontend *fe)
 {
        struct tda18271_priv *priv = fe->tuner_priv;
 
        if (priv->cal_initialized)
                return 0;
 
-       /* initialization */
-       tda18271_init(fe);
-
-       tda18271_calc_rf_filter_curve(fe, tm);
+       tda18271_calc_rf_filter_curve(fe);
 
        tda18271_por(fe);
 
@@ -598,16 +594,27 @@ static int tda18271_init_cal(struct dvb_frontend *fe, int 
*tm)
        return 0;
 }
 
+static int tda18271_init(struct dvb_frontend *fe)
+{
+       struct tda18271_priv *priv = fe->tuner_priv;
+
+       /* initialization */
+       tda18271_ir_cal_init(fe);
+
+       if (priv->id == TDA18271HDC2)
+               tda18271_rf_cal_init(fe);
+
+       return 0;
+}
+
 static int tda18271c2_tune(struct dvb_frontend *fe,
                           u32 ifc, u32 freq, u32 bw, u8 std)
 {
-       int tm = 0;
-
        tda_dbg("freq = %d, ifc = %d\n", freq, ifc);
 
-       tda18271_init_cal(fe, &tm);
+       tda18271_init(fe);
 
-       tda18271_rf_tracking_filters_correction(fe, freq, tm);
+       tda18271_rf_tracking_filters_correction(fe, freq);
 
        tda18271_channel_configuration(fe, ifc, freq, bw, std);
 
diff --git a/drivers/media/dvb/frontends/tda18271-priv.h 
b/drivers/media/dvb/frontends/tda18271-priv.h
index 6e04258..7b06e05 100644
--- a/drivers/media/dvb/frontends/tda18271-priv.h
+++ b/drivers/media/dvb/frontends/tda18271-priv.h
@@ -105,6 +105,7 @@ struct tda18271_priv {
        enum tda18271_i2c_gate gate;
        enum tda18271_ver id;
 
+       unsigned int tm_rfcal;
        unsigned int cal_initialized:1;
 
        struct tda18271_map_layout *maps;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to