From 9f5b48eab42750388fb1db89c8f9503500614334 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 6 Jan 2008 22:51:48 -0500 Subject: tda18271: report when the RF tracking filter calibration has completed From: Michael Krufky Signed-off-by: Michael Krufky --- linux/drivers/media/dvb/frontends/tda18271-fe.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/dvb/frontends/tda18271-fe.c b/linux/drivers/media/dvb/frontends/tda18271-fe.c index f9fd3889d..69ccd3df8 100644 --- a/linux/drivers/media/dvb/frontends/tda18271-fe.c +++ b/linux/drivers/media/dvb/frontends/tda18271-fe.c @@ -621,6 +621,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; -- cgit v1.2.3 From 348f487c46055dc72d421d32458a6cabd061969e Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 13 Jan 2008 15:01:01 -0500 Subject: tda18271: put the device in standby mode during sleep() From: Michael Krufky Add function, tda18271_set_standby_mode. During sleep, enter standby mode with slave tuner output enabled, loop through on and xtal oscillator on. Signed-off-by: Michael Krufky --- .../drivers/media/dvb/frontends/tda18271-common.c | 36 ++++++++++++++++++++++ linux/drivers/media/dvb/frontends/tda18271-fe.c | 26 +++++++++++++--- linux/drivers/media/dvb/frontends/tda18271-priv.h | 3 ++ 3 files changed, 60 insertions(+), 5 deletions(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/dvb/frontends/tda18271-common.c b/linux/drivers/media/dvb/frontends/tda18271-common.c index 6d45313d6..6dfabc5a5 100644 --- a/linux/drivers/media/dvb/frontends/tda18271-common.c +++ b/linux/drivers/media/dvb/frontends/tda18271-common.c @@ -520,6 +520,42 @@ int tda18271_init_regs(struct dvb_frontend *fe) /*---------------------------------------------------------------------*/ +/* + * Standby modes, EP3 [7:5] + * + * | SM || SM_LT || SM_XT || mode description + * |=====\\=======\\=======\\=================================== + * | 0 || 0 || 0 || normal mode + * |-----||-------||-------||----------------------------------- + * | || || || standby mode w/ slave tuner output + * | 1 || 0 || 0 || & loop thru & xtal oscillator on + * |-----||-------||-------||----------------------------------- + * | 1 || 1 || 0 || standby mode w/ xtal oscillator on + * |-----||-------||-------||----------------------------------- + * | 1 || 1 || 1 || power off + * + */ + +int tda18271_set_standby_mode(struct dvb_frontend *fe, + int sm, int sm_lt, int sm_xt) +{ + struct tda18271_priv *priv = fe->tuner_priv; + unsigned char *regs = priv->tda18271_regs; + + tda_dbg("sm = %d, sm_lt = %d, sm_xt = %d\n", sm, sm_lt, sm_xt); + + regs[R_EP3] &= ~0xe0; /* clear sm, sm_lt, sm_xt */ + regs[R_EP3] |= sm ? (1 << 7) : 0 | + sm_lt ? (1 << 6) : 0 | + sm_xt ? (1 << 5) : 0; + + tda18271_write_regs(fe, R_EP3, 1); + + return 0; +} + +/*---------------------------------------------------------------------*/ + int tda18271_calc_main_pll(struct dvb_frontend *fe, u32 freq) { /* sets main post divider & divider bytes, but does not write them */ diff --git a/linux/drivers/media/dvb/frontends/tda18271-fe.c b/linux/drivers/media/dvb/frontends/tda18271-fe.c index 69ccd3df8..45dd984d2 100644 --- a/linux/drivers/media/dvb/frontends/tda18271-fe.c +++ b/linux/drivers/media/dvb/frontends/tda18271-fe.c @@ -221,8 +221,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 +275,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 */ @@ -634,6 +631,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); @@ -977,6 +977,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; @@ -1120,6 +1135,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, diff --git a/linux/drivers/media/dvb/frontends/tda18271-priv.h b/linux/drivers/media/dvb/frontends/tda18271-priv.h index 877509346..ad4b59771 100644 --- a/linux/drivers/media/dvb/frontends/tda18271-priv.h +++ b/linux/drivers/media/dvb/frontends/tda18271-priv.h @@ -197,6 +197,9 @@ extern int tda18271_read_extended(struct dvb_frontend *fe); extern int tda18271_write_regs(struct dvb_frontend *fe, int idx, int len); extern int tda18271_init_regs(struct dvb_frontend *fe); +extern int tda18271_set_standby_mode(struct dvb_frontend *fe, + int sm, int sm_lt, int sm_xt); + extern int tda18271_calc_main_pll(struct dvb_frontend *fe, u32 freq); extern int tda18271_calc_cal_pll(struct dvb_frontend *fe, u32 freq); -- cgit v1.2.3 From 8e69a781325727ab456ca97c4d7abc8b1e243db5 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 13 Jan 2008 16:29:44 -0500 Subject: tda18271: test RF_CAL_OK to see if we need additional RF calibration From: Michael Krufky Test RF_CAL_OK to see if we need to perform the RF tracking filter calibration after returning from standby. Signed-off-by: Michael Krufky --- linux/drivers/media/dvb/frontends/tda18271-fe.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/dvb/frontends/tda18271-fe.c b/linux/drivers/media/dvb/frontends/tda18271-fe.c index 45dd984d2..071847f18 100644 --- a/linux/drivers/media/dvb/frontends/tda18271-fe.c +++ b/linux/drivers/media/dvb/frontends/tda18271-fe.c @@ -610,6 +610,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; -- cgit v1.2.3 From 79150c25be2d0daef58a7d32afc06b4955fabb54 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 13 Jan 2008 20:01:07 -0500 Subject: tda18271: provide a choice whether to perform rf cal on init or on first tune From: Michael Krufky If module option "cal" is set to 1, the ~22 sec rf tracking filter calibration sequence will be invoked on startup. Otherwise, the calibration will take place during the first tune. Signed-off-by: Michael Krufky --- linux/drivers/media/dvb/frontends/tda18271-fe.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/dvb/frontends/tda18271-fe.c b/linux/drivers/media/dvb/frontends/tda18271-fe.c index 071847f18..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); @@ -1201,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); } -- cgit v1.2.3 From d1deea338b6fde0c91f068592206fe289f18c0ac Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 13 Jan 2008 18:02:52 -0500 Subject: Kconfig: add missing selections for VIDEO_PVRUSB2 From: Michael Krufky VIDEO_PVRUSB2 must select: VIDEO_SAA711X, VIDEO_CX25840, VIDEO_MSP3400, and VIDEO_WM8775 Signed-off-by: Michael Krufky Acked-by: Mike Isely --- linux/drivers/media/video/pvrusb2/Kconfig | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/video/pvrusb2/Kconfig b/linux/drivers/media/video/pvrusb2/Kconfig index 95e439601..6fc1b8be1 100644 --- a/linux/drivers/media/video/pvrusb2/Kconfig +++ b/linux/drivers/media/video/pvrusb2/Kconfig @@ -5,6 +5,10 @@ config VIDEO_PVRUSB2 select VIDEO_TUNER select VIDEO_TVEEPROM select VIDEO_CX2341X + select VIDEO_SAA711X + select VIDEO_CX25840 + select VIDEO_MSP3400 + select VIDEO_WM8775 ---help--- This is a video4linux driver for Conexant 23416 based usb2 personal video recorder devices. -- cgit v1.2.3