Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

V4L/DVB (7661): stv0299: Add flag to turn off OP0 output

Add flag to turn off OP0 output.

Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>

authored by

Oliver Endriss and committed by
Mauro Carvalho Chehab
e84b133e 94ad6de7

+33 -15
+30 -15
drivers/media/dvb/frontends/stv0299.c
··· 366 366 * H/V switching over OP0, OP1 and OP2 are LNB power enable bits 367 367 */ 368 368 reg0x0c &= 0x0f; 369 - 370 - if (voltage == SEC_VOLTAGE_OFF) { 371 - stv0299_writeregI (state, 0x0c, 0x00); /* LNB power off! */ 372 - return stv0299_writeregI (state, 0x08, 0x00); /* LNB power off! */ 373 - } 374 - 375 - stv0299_writeregI (state, 0x08, (reg0x08 & 0x3f) | (state->config->lock_output << 6)); 369 + reg0x08 = (reg0x08 & 0x3f) | (state->config->lock_output << 6); 376 370 377 371 switch (voltage) { 378 372 case SEC_VOLTAGE_13: 379 - if (state->config->volt13_op0_op1 == STV0299_VOLT13_OP0) reg0x0c |= 0x10; 380 - else reg0x0c |= 0x40; 381 - 382 - return stv0299_writeregI(state, 0x0c, reg0x0c); 383 - 373 + if (state->config->volt13_op0_op1 == STV0299_VOLT13_OP0) 374 + reg0x0c |= 0x10; /* OP1 off, OP0 on */ 375 + else 376 + reg0x0c |= 0x40; /* OP1 on, OP0 off */ 377 + break; 384 378 case SEC_VOLTAGE_18: 385 - return stv0299_writeregI(state, 0x0c, reg0x0c | 0x50); 379 + reg0x0c |= 0x50; /* OP1 on, OP0 on */ 380 + break; 381 + case SEC_VOLTAGE_OFF: 382 + /* LNB power off! */ 383 + reg0x08 = 0x00; 384 + reg0x0c = 0x00; 385 + break; 386 386 default: 387 387 return -EINVAL; 388 388 }; 389 + 390 + if (state->config->op0_off) 391 + reg0x0c &= ~0x10; 392 + 393 + stv0299_writeregI(state, 0x08, reg0x08); 394 + return stv0299_writeregI(state, 0x0c, reg0x0c); 389 395 } 390 396 391 397 static int stv0299_send_legacy_dish_cmd (struct dvb_frontend* fe, unsigned long cmd) ··· 451 445 { 452 446 struct stv0299_state* state = fe->demodulator_priv; 453 447 int i; 448 + u8 reg; 449 + u8 val; 454 450 455 451 dprintk("stv0299: init chip\n"); 456 452 457 - for (i=0; !(state->config->inittab[i] == 0xff && state->config->inittab[i+1] == 0xff); i+=2) 458 - stv0299_writeregI(state, state->config->inittab[i], state->config->inittab[i+1]); 453 + for (i = 0; ; i += 2) { 454 + reg = state->config->inittab[i]; 455 + val = state->config->inittab[i+1]; 456 + if (reg == 0xff && val == 0xff) 457 + break; 458 + if (reg == 0x0c && state->config->op0_off) 459 + val &= ~0x10; 460 + stv0299_writeregI(state, reg, val); 461 + } 459 462 460 463 return 0; 461 464 }
+3
drivers/media/dvb/frontends/stv0299.h
··· 82 82 /* Is 13v controlled by OP0 or OP1? */ 83 83 u8 volt13_op0_op1:1; 84 84 85 + /* Turn-off OP0? */ 86 + u8 op0_off:1; 87 + 85 88 /* minimum delay before retuning */ 86 89 int min_delay_ms; 87 90