aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/ttpci/budget-ci.c
diff options
context:
space:
mode:
authorPerceval Anichini <perceval.anichini@streamvision.fr>2006-03-16 09:22:47 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-21 11:53:54 -0500
commit265366e8fb8c31706711aea5f79d763816a968db (patch)
tree13841d27e621067180884f00d4019580674c28d5 /drivers/media/dvb/ttpci/budget-ci.c
parentad5125913be0a723a2e17824ec688d4890bf978b (diff)
V4L/DVB (3532): Moved duplicated code of ALPS BSRU6 tuner to a standalone file.
Moved duplicated code of ALPS BSRU6 tuner to a standalone file. Modified av7110 and budget drivers to include the new file. Signed-off-by: Perceval Anichini <perceval.anichini@streamvision.fr> Signed-off-by: Oliver Endriss <o.endriss@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/ttpci/budget-ci.c')
-rw-r--r--drivers/media/dvb/ttpci/budget-ci.c118
1 files changed, 1 insertions, 117 deletions
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c
index 09b972b9ffe3..5f91036f5b87 100644
--- a/drivers/media/dvb/ttpci/budget-ci.c
+++ b/drivers/media/dvb/ttpci/budget-ci.c
@@ -44,6 +44,7 @@
44#include "tda1004x.h" 44#include "tda1004x.h"
45#include "lnbp21.h" 45#include "lnbp21.h"
46#include "bsbe1.h" 46#include "bsbe1.h"
47#include "bsru6.h"
47 48
48#define DEBIADDR_IR 0x1234 49#define DEBIADDR_IR 0x1234
49#define DEBIADDR_CICONTROL 0x0000 50#define DEBIADDR_CICONTROL 0x0000
@@ -476,123 +477,6 @@ static void budget_ci_irq(struct saa7146_dev *dev, u32 * isr)
476 tasklet_schedule(&budget_ci->ciintf_irq_tasklet); 477 tasklet_schedule(&budget_ci->ciintf_irq_tasklet);
477} 478}
478 479
479
480static u8 alps_bsru6_inittab[] = {
481 0x01, 0x15,
482 0x02, 0x00,
483 0x03, 0x00,
484 0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */
485 0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */
486 0x06, 0x40, /* DAC not used, set to high impendance mode */
487 0x07, 0x00, /* DAC LSB */
488 0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */
489 0x09, 0x00, /* FIFO */
490 0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */
491 0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */
492 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */
493 0x10, 0x3f, // AGC2 0x3d
494 0x11, 0x84,
495 0x12, 0xb9,
496 0x15, 0xc9, // lock detector threshold
497 0x16, 0x00,
498 0x17, 0x00,
499 0x18, 0x00,
500 0x19, 0x00,
501 0x1a, 0x00,
502 0x1f, 0x50,
503 0x20, 0x00,
504 0x21, 0x00,
505 0x22, 0x00,
506 0x23, 0x00,
507 0x28, 0x00, // out imp: normal out type: parallel FEC mode:0
508 0x29, 0x1e, // 1/2 threshold
509 0x2a, 0x14, // 2/3 threshold
510 0x2b, 0x0f, // 3/4 threshold
511 0x2c, 0x09, // 5/6 threshold
512 0x2d, 0x05, // 7/8 threshold
513 0x2e, 0x01,
514 0x31, 0x1f, // test all FECs
515 0x32, 0x19, // viterbi and synchro search
516 0x33, 0xfc, // rs control
517 0x34, 0x93, // error control
518 0x0f, 0x52,
519 0xff, 0xff
520};
521
522static int alps_bsru6_set_symbol_rate(struct dvb_frontend *fe, u32 srate, u32 ratio)
523{
524 u8 aclk = 0;
525 u8 bclk = 0;
526
527 if (srate < 1500000) {
528 aclk = 0xb7;
529 bclk = 0x47;
530 } else if (srate < 3000000) {
531 aclk = 0xb7;
532 bclk = 0x4b;
533 } else if (srate < 7000000) {
534 aclk = 0xb7;
535 bclk = 0x4f;
536 } else if (srate < 14000000) {
537 aclk = 0xb7;
538 bclk = 0x53;
539 } else if (srate < 30000000) {
540 aclk = 0xb6;
541 bclk = 0x53;
542 } else if (srate < 45000000) {
543 aclk = 0xb4;
544 bclk = 0x51;
545 }
546
547 stv0299_writereg(fe, 0x13, aclk);
548 stv0299_writereg(fe, 0x14, bclk);
549 stv0299_writereg(fe, 0x1f, (ratio >> 16) & 0xff);
550 stv0299_writereg(fe, 0x20, (ratio >> 8) & 0xff);
551 stv0299_writereg(fe, 0x21, (ratio) & 0xf0);
552
553 return 0;
554}
555
556static int alps_bsru6_pll_set(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters *params)
557{
558 u8 buf[4];
559 u32 div;
560 struct i2c_msg msg = {.addr = 0x61,.flags = 0,.buf = buf,.len = sizeof(buf) };
561
562 if ((params->frequency < 950000) || (params->frequency > 2150000))
563 return -EINVAL;
564
565 div = (params->frequency + (125 - 1)) / 125; // round correctly
566 buf[0] = (div >> 8) & 0x7f;
567 buf[1] = div & 0xff;
568 buf[2] = 0x80 | ((div & 0x18000) >> 10) | 4;
569 buf[3] = 0xC4;
570
571 if (params->frequency > 1530000)
572 buf[3] = 0xc0;
573
574 if (i2c_transfer(i2c, &msg, 1) != 1)
575 return -EIO;
576 return 0;
577}
578
579static struct stv0299_config alps_bsru6_config = {
580
581 .demod_address = 0x68,
582 .inittab = alps_bsru6_inittab,
583 .mclk = 88000000UL,
584 .invert = 1,
585 .skip_reinit = 0,
586 .lock_output = STV0229_LOCKOUTPUT_1,
587 .volt13_op0_op1 = STV0299_VOLT13_OP1,
588 .min_delay_ms = 100,
589 .set_symbol_rate = alps_bsru6_set_symbol_rate,
590 .pll_set = alps_bsru6_pll_set,
591};
592
593
594
595
596static u8 philips_su1278_tt_inittab[] = { 480static u8 philips_su1278_tt_inittab[] = {
597 0x01, 0x0f, 481 0x01, 0x0f,
598 0x02, 0x30, 482 0x02, 0x30,