Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 59152b1c authored by tvboxspy's avatar tvboxspy Committed by Mauro Carvalho Chehab
Browse files

[media] STV0288 frontend provide wider carrier search and DVB-S2 drop out. resend



The following patch provides wider carrier search.

As with existing code search starts at MSB aligned. The boundary
is widened to start at -9.  In order to save time, if no carrier is
detected at the start it advances to the next alignment until carrier
is found.

The stv0288 will detect a DVB-S2 carrier on all steps , a
time out of 11 steps is introduced to drop out of the loop.

In stv0288_set_symbol carrier and timing loops are restored to
default values (inittab) before setting the symbol rate on each tune. A
slight drift was noticed with full scan in the higher IF frequencies of
each band.

Signed-off-by: default avatarMalcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 6783fe5f
Loading
Loading
Loading
Loading
+21 −8
Original line number Original line Diff line number Diff line
@@ -127,6 +127,11 @@ static int stv0288_set_symbolrate(struct dvb_frontend *fe, u32 srate)
	if ((srate < 1000000) || (srate > 45000000))
	if ((srate < 1000000) || (srate > 45000000))
		return -EINVAL;
		return -EINVAL;


	stv0288_writeregI(state, 0x22, 0);
	stv0288_writeregI(state, 0x23, 0);
	stv0288_writeregI(state, 0x2b, 0xff);
	stv0288_writeregI(state, 0x2c, 0xf7);

	temp = (unsigned int)srate / 1000;
	temp = (unsigned int)srate / 1000;


		temp = temp * 32768;
		temp = temp * 32768;
@@ -461,6 +466,7 @@ static int stv0288_set_frontend(struct dvb_frontend *fe,


	char tm;
	char tm;
	unsigned char tda[3];
	unsigned char tda[3];
	u8 reg, time_out = 0;


	dprintk("%s : FE_SET_FRONTEND\n", __func__);
	dprintk("%s : FE_SET_FRONTEND\n", __func__);


@@ -488,22 +494,29 @@ static int stv0288_set_frontend(struct dvb_frontend *fe,
	/* Carrier lock control register */
	/* Carrier lock control register */
	stv0288_writeregI(state, 0x15, 0xc5);
	stv0288_writeregI(state, 0x15, 0xc5);


	tda[0] = 0x2b; /* CFRM */
	tda[2] = 0x0; /* CFRL */
	tda[2] = 0x0; /* CFRL */
	for (tm = -6; tm < 7;) {
	for (tm = -9; tm < 7;) {
		/* Viterbi status */
		/* Viterbi status */
		if (stv0288_readreg(state, 0x24) & 0x8)
		reg = stv0288_readreg(state, 0x24);
		if (reg & 0x8)
				break;
		if (reg & 0x80) {
			time_out++;
			if (time_out > 10)
				break;
				break;

			tda[2] += 40;
			tda[2] += 40;
			if (tda[2] < 40)
			if (tda[2] < 40)
				tm++;
				tm++;
		} else {
			tm++;
			tda[2] = 0;
			time_out = 0;
		}
		tda[1] = (unsigned char)tm;
		tda[1] = (unsigned char)tm;
		stv0288_writeregI(state, 0x2b, tda[1]);
		stv0288_writeregI(state, 0x2b, tda[1]);
		stv0288_writeregI(state, 0x2c, tda[2]);
		stv0288_writeregI(state, 0x2c, tda[2]);
		udelay(30);
		udelay(30);
	}
	}

	state->tuner_frequency = c->frequency;
	state->tuner_frequency = c->frequency;
	state->fec_inner = FEC_AUTO;
	state->fec_inner = FEC_AUTO;
	state->symbol_rate = c->symbol_rate;
	state->symbol_rate = c->symbol_rate;