From d9180378b29b88dc370019189d0b8289e5f167fa Mon Sep 17 00:00:00 2001 From: Oliver Endriss Date: Sun, 20 Apr 2008 21:57:34 -0300 Subject: [PATCH] --- yaml --- r: 92735 b: refs/heads/master c: e84b133e329ddad725907844c285efcd35dae39d h: refs/heads/master i: 92733: e476ef51682657c655f2d76b24343d2dafb65b3f 92731: 1be2fe5396fc1ab95a7dbb256c86a5234d57c3db 92727: 5b78b6d67453066fe54244053cbb9e83dedb5cf8 92719: aac48ea8da124650f1ab775fb2d020ee19f3979e 92703: ab0ddad16f452bb41f7f4c13d9ed66e1346653fe 92671: 9942408bff2b7af799a99ce8a1024154ddd419bd v: v3 --- [refs] | 2 +- trunk/drivers/media/dvb/frontends/stv0299.c | 45 ++++++++++++++------- trunk/drivers/media/dvb/frontends/stv0299.h | 3 ++ 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/[refs] b/[refs] index d716e263232d..8c9b45a2bcb7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 94ad6de7051a9eb6beda096144c5b409538eab86 +refs/heads/master: e84b133e329ddad725907844c285efcd35dae39d diff --git a/trunk/drivers/media/dvb/frontends/stv0299.c b/trunk/drivers/media/dvb/frontends/stv0299.c index f7c36741537d..17556183e871 100644 --- a/trunk/drivers/media/dvb/frontends/stv0299.c +++ b/trunk/drivers/media/dvb/frontends/stv0299.c @@ -366,26 +366,32 @@ static int stv0299_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltag * H/V switching over OP0, OP1 and OP2 are LNB power enable bits */ reg0x0c &= 0x0f; - - if (voltage == SEC_VOLTAGE_OFF) { - stv0299_writeregI (state, 0x0c, 0x00); /* LNB power off! */ - return stv0299_writeregI (state, 0x08, 0x00); /* LNB power off! */ - } - - stv0299_writeregI (state, 0x08, (reg0x08 & 0x3f) | (state->config->lock_output << 6)); + reg0x08 = (reg0x08 & 0x3f) | (state->config->lock_output << 6); switch (voltage) { case SEC_VOLTAGE_13: - if (state->config->volt13_op0_op1 == STV0299_VOLT13_OP0) reg0x0c |= 0x10; - else reg0x0c |= 0x40; - - return stv0299_writeregI(state, 0x0c, reg0x0c); - + if (state->config->volt13_op0_op1 == STV0299_VOLT13_OP0) + reg0x0c |= 0x10; /* OP1 off, OP0 on */ + else + reg0x0c |= 0x40; /* OP1 on, OP0 off */ + break; case SEC_VOLTAGE_18: - return stv0299_writeregI(state, 0x0c, reg0x0c | 0x50); + reg0x0c |= 0x50; /* OP1 on, OP0 on */ + break; + case SEC_VOLTAGE_OFF: + /* LNB power off! */ + reg0x08 = 0x00; + reg0x0c = 0x00; + break; default: return -EINVAL; }; + + if (state->config->op0_off) + reg0x0c &= ~0x10; + + stv0299_writeregI(state, 0x08, reg0x08); + return stv0299_writeregI(state, 0x0c, reg0x0c); } static int stv0299_send_legacy_dish_cmd (struct dvb_frontend* fe, unsigned long cmd) @@ -445,11 +451,20 @@ static int stv0299_init (struct dvb_frontend* fe) { struct stv0299_state* state = fe->demodulator_priv; int i; + u8 reg; + u8 val; dprintk("stv0299: init chip\n"); - for (i=0; !(state->config->inittab[i] == 0xff && state->config->inittab[i+1] == 0xff); i+=2) - stv0299_writeregI(state, state->config->inittab[i], state->config->inittab[i+1]); + for (i = 0; ; i += 2) { + reg = state->config->inittab[i]; + val = state->config->inittab[i+1]; + if (reg == 0xff && val == 0xff) + break; + if (reg == 0x0c && state->config->op0_off) + val &= ~0x10; + stv0299_writeregI(state, reg, val); + } return 0; } diff --git a/trunk/drivers/media/dvb/frontends/stv0299.h b/trunk/drivers/media/dvb/frontends/stv0299.h index 84eaeb518540..abd9cf8153cf 100644 --- a/trunk/drivers/media/dvb/frontends/stv0299.h +++ b/trunk/drivers/media/dvb/frontends/stv0299.h @@ -82,6 +82,9 @@ struct stv0299_config /* Is 13v controlled by OP0 or OP1? */ u8 volt13_op0_op1:1; + /* Turn-off OP0? */ + u8 op0_off:1; + /* minimum delay before retuning */ int min_delay_ms;