aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-01-13 15:01:01 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:04:58 -0500
commit518d87399baee908b0353bc0ef7d41c3c46295ec (patch)
tree9d0c2cd42c6b533854616921fbbb18e108ec924c /drivers/media
parent6bfa6657246013bf999fecda0874105441f6ecb5 (diff)
V4L/DVB (7027): tda18271: put the device in standby mode during sleep()
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 <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/frontends/tda18271-common.c36
-rw-r--r--drivers/media/dvb/frontends/tda18271-fe.c26
-rw-r--r--drivers/media/dvb/frontends/tda18271-priv.h3
3 files changed, 60 insertions, 5 deletions
diff --git a/drivers/media/dvb/frontends/tda18271-common.c b/drivers/media/dvb/frontends/tda18271-common.c
index d7a335659474..cebb6b90b7e0 100644
--- a/drivers/media/dvb/frontends/tda18271-common.c
+++ b/drivers/media/dvb/frontends/tda18271-common.c
@@ -452,6 +452,42 @@ int tda18271_init_regs(struct dvb_frontend *fe)
452 452
453/*---------------------------------------------------------------------*/ 453/*---------------------------------------------------------------------*/
454 454
455/*
456 * Standby modes, EP3 [7:5]
457 *
458 * | SM || SM_LT || SM_XT || mode description
459 * |=====\\=======\\=======\\===================================
460 * | 0 || 0 || 0 || normal mode
461 * |-----||-------||-------||-----------------------------------
462 * | || || || standby mode w/ slave tuner output
463 * | 1 || 0 || 0 || & loop thru & xtal oscillator on
464 * |-----||-------||-------||-----------------------------------
465 * | 1 || 1 || 0 || standby mode w/ xtal oscillator on
466 * |-----||-------||-------||-----------------------------------
467 * | 1 || 1 || 1 || power off
468 *
469 */
470
471int tda18271_set_standby_mode(struct dvb_frontend *fe,
472 int sm, int sm_lt, int sm_xt)
473{
474 struct tda18271_priv *priv = fe->tuner_priv;
475 unsigned char *regs = priv->tda18271_regs;
476
477 tda_dbg("sm = %d, sm_lt = %d, sm_xt = %d\n", sm, sm_lt, sm_xt);
478
479 regs[R_EP3] &= ~0xe0; /* clear sm, sm_lt, sm_xt */
480 regs[R_EP3] |= sm ? (1 << 7) : 0 |
481 sm_lt ? (1 << 6) : 0 |
482 sm_xt ? (1 << 5) : 0;
483
484 tda18271_write_regs(fe, R_EP3, 1);
485
486 return 0;
487}
488
489/*---------------------------------------------------------------------*/
490
455int tda18271_calc_main_pll(struct dvb_frontend *fe, u32 freq) 491int tda18271_calc_main_pll(struct dvb_frontend *fe, u32 freq)
456{ 492{
457 /* sets main post divider & divider bytes, but does not write them */ 493 /* sets main post divider & divider bytes, but does not write them */
diff --git a/drivers/media/dvb/frontends/tda18271-fe.c b/drivers/media/dvb/frontends/tda18271-fe.c
index c254ac367e72..c8ab1fda1dea 100644
--- a/drivers/media/dvb/frontends/tda18271-fe.c
+++ b/drivers/media/dvb/frontends/tda18271-fe.c
@@ -201,8 +201,7 @@ static int tda18271_rf_tracking_filters_correction(struct dvb_frontend *fe,
201 u8 dc_over_dt, rf_tab; 201 u8 dc_over_dt, rf_tab;
202 202
203 /* power up */ 203 /* power up */
204 regs[R_EP3] &= ~0xe0; /* sm = 0, sm_lt = 0, sm_xt = 0 */ 204 tda18271_set_standby_mode(fe, 0, 0, 0);
205 tda18271_write_regs(fe, R_EP3, 1);
206 205
207 /* read die current temperature */ 206 /* read die current temperature */
208 tm_current = tda18271_read_thermometer(fe); 207 tm_current = tda18271_read_thermometer(fe);
@@ -256,9 +255,7 @@ static int tda18271_por(struct dvb_frontend *fe)
256 regs[R_EB21] |= 0x03; /* set agc2_gain to -6 dB */ 255 regs[R_EB21] |= 0x03; /* set agc2_gain to -6 dB */
257 256
258 /* POR mode */ 257 /* POR mode */
259 regs[R_EP3] &= ~0xe0; /* clear sm, sm_lt, sm_xt */ 258 tda18271_set_standby_mode(fe, 1, 0, 0);
260 regs[R_EP3] |= 0x80; /* sm = 1, sm_lt = 0, sm_xt = 0 */
261 tda18271_write_regs(fe, R_EP3, 1);
262 259
263 /* disable 1.5 MHz low pass filter */ 260 /* disable 1.5 MHz low pass filter */
264 regs[R_EB23] &= ~0x04; /* forcelp_fc2_en = 0 */ 261 regs[R_EB23] &= ~0x04; /* forcelp_fc2_en = 0 */
@@ -610,6 +607,9 @@ static int tda18271_init(struct dvb_frontend *fe)
610 607
611 mutex_lock(&priv->lock); 608 mutex_lock(&priv->lock);
612 609
610 /* power up */
611 tda18271_set_standby_mode(fe, 0, 0, 0);
612
613 /* initialization */ 613 /* initialization */
614 tda18271_ir_cal_init(fe); 614 tda18271_ir_cal_init(fe);
615 615
@@ -953,6 +953,21 @@ fail:
953 return ret; 953 return ret;
954} 954}
955 955
956static int tda18271_sleep(struct dvb_frontend *fe)
957{
958 struct tda18271_priv *priv = fe->tuner_priv;
959
960 mutex_lock(&priv->lock);
961
962 /* standby mode w/ slave tuner output
963 * & loop thru & xtal oscillator on */
964 tda18271_set_standby_mode(fe, 1, 0, 0);
965
966 mutex_unlock(&priv->lock);
967
968 return 0;
969}
970
956static int tda18271_release(struct dvb_frontend *fe) 971static int tda18271_release(struct dvb_frontend *fe)
957{ 972{
958 struct tda18271_priv *priv = fe->tuner_priv; 973 struct tda18271_priv *priv = fe->tuner_priv;
@@ -1096,6 +1111,7 @@ static struct dvb_tuner_ops tda18271_tuner_ops = {
1096 .frequency_step = 62500 1111 .frequency_step = 62500
1097 }, 1112 },
1098 .init = tda18271_init, 1113 .init = tda18271_init,
1114 .sleep = tda18271_sleep,
1099 .set_params = tda18271_set_params, 1115 .set_params = tda18271_set_params,
1100 .set_analog_params = tda18271_set_analog_params, 1116 .set_analog_params = tda18271_set_analog_params,
1101 .release = tda18271_release, 1117 .release = tda18271_release,
diff --git a/drivers/media/dvb/frontends/tda18271-priv.h b/drivers/media/dvb/frontends/tda18271-priv.h
index 080efb3991ed..7b939a5325fb 100644
--- a/drivers/media/dvb/frontends/tda18271-priv.h
+++ b/drivers/media/dvb/frontends/tda18271-priv.h
@@ -188,6 +188,9 @@ extern int tda18271_read_extended(struct dvb_frontend *fe);
188extern int tda18271_write_regs(struct dvb_frontend *fe, int idx, int len); 188extern int tda18271_write_regs(struct dvb_frontend *fe, int idx, int len);
189extern int tda18271_init_regs(struct dvb_frontend *fe); 189extern int tda18271_init_regs(struct dvb_frontend *fe);
190 190
191extern int tda18271_set_standby_mode(struct dvb_frontend *fe,
192 int sm, int sm_lt, int sm_xt);
193
191extern int tda18271_calc_main_pll(struct dvb_frontend *fe, u32 freq); 194extern int tda18271_calc_main_pll(struct dvb_frontend *fe, u32 freq);
192extern int tda18271_calc_cal_pll(struct dvb_frontend *fe, u32 freq); 195extern int tda18271_calc_cal_pll(struct dvb_frontend *fe, u32 freq);
193 196