diff options
Diffstat (limited to 'linux/drivers/media/dvb/frontends/tda18271-fe.c')
-rw-r--r-- | linux/drivers/media/dvb/frontends/tda18271-fe.c | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/linux/drivers/media/dvb/frontends/tda18271-fe.c b/linux/drivers/media/dvb/frontends/tda18271-fe.c index f9fd3889d..cf4033c14 100644 --- a/linux/drivers/media/dvb/frontends/tda18271-fe.c +++ b/linux/drivers/media/dvb/frontends/tda18271-fe.c @@ -28,6 +28,10 @@ module_param_named(debug, tda18271_debug, int, 0644); MODULE_PARM_DESC(debug, "set debug level " "(info=1, map=2, reg=4, adv=8, cal=16 (or-able))"); +int tda18271_cal_on_startup; +module_param_named(cal, tda18271_cal_on_startup, int, 0644); +MODULE_PARM_DESC(cal, "perform RF tracking filter calibration on startup"); + static LIST_HEAD(tda18271_list); static DEFINE_MUTEX(tda18271_list_mutex); @@ -221,8 +225,7 @@ static int tda18271_rf_tracking_filters_correction(struct dvb_frontend *fe, u8 dc_over_dt, rf_tab; /* power up */ - regs[R_EP3] &= ~0xe0; /* sm = 0, sm_lt = 0, sm_xt = 0 */ - tda18271_write_regs(fe, R_EP3, 1); + tda18271_set_standby_mode(fe, 0, 0, 0); /* read die current temperature */ tm_current = tda18271_read_thermometer(fe); @@ -276,9 +279,7 @@ static int tda18271_por(struct dvb_frontend *fe) regs[R_EB21] |= 0x03; /* set agc2_gain to -6 dB */ /* POR mode */ - regs[R_EP3] &= ~0xe0; /* clear sm, sm_lt, sm_xt */ - regs[R_EP3] |= 0x80; /* sm = 1, sm_lt = 0, sm_xt = 0 */ - tda18271_write_regs(fe, R_EP3, 1); + tda18271_set_standby_mode(fe, 1, 0, 0); /* disable 1.5 MHz low pass filter */ regs[R_EB23] &= ~0x04; /* forcelp_fc2_en = 0 */ @@ -613,6 +614,11 @@ static int tda18271_calc_rf_filter_curve(struct dvb_frontend *fe) static int tda18271_rf_cal_init(struct dvb_frontend *fe) { struct tda18271_priv *priv = fe->tuner_priv; + unsigned char *regs = priv->tda18271_regs; + + /* test RF_CAL_OK to see if we need init */ + if ((regs[R_EP1] & 0x10) == 0) + priv->cal_initialized = false; if (priv->cal_initialized) return 0; @@ -621,6 +627,8 @@ static int tda18271_rf_cal_init(struct dvb_frontend *fe) tda18271_por(fe); + tda_info("tda18271: RF tracking filter calibration complete\n"); + priv->cal_initialized = true; return 0; @@ -632,6 +640,9 @@ static int tda18271_init(struct dvb_frontend *fe) mutex_lock(&priv->lock); + /* power up */ + tda18271_set_standby_mode(fe, 0, 0, 0); + /* initialization */ tda18271_ir_cal_init(fe); @@ -975,6 +986,21 @@ fail: return ret; } +static int tda18271_sleep(struct dvb_frontend *fe) +{ + struct tda18271_priv *priv = fe->tuner_priv; + + mutex_lock(&priv->lock); + + /* standby mode w/ slave tuner output + * & loop thru & xtal oscillator on */ + tda18271_set_standby_mode(fe, 1, 0, 0); + + mutex_unlock(&priv->lock); + + return 0; +} + static int tda18271_release(struct dvb_frontend *fe) { struct tda18271_priv *priv = fe->tuner_priv; @@ -1118,6 +1144,7 @@ static struct dvb_tuner_ops tda18271_tuner_ops = { .frequency_step = 62500 }, .init = tda18271_init, + .sleep = tda18271_sleep, .set_params = tda18271_set_params, .set_analog_params = tda18271_set_analog_params, .release = tda18271_release, @@ -1178,6 +1205,10 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, mutex_lock(&priv->lock); tda18271_init_regs(fe); + + if ((tda18271_cal_on_startup) && (priv->id == TDA18271HDC2)) + tda18271_rf_cal_init(fe); + mutex_unlock(&priv->lock); } |