浏览代码

V4L/DVB (13051): DiB7000P: improve rebostness of HAS_LOCK indicator

Update the dib7000p:
The status is HAS_LOCK only if the demod is able to decode the TPS. Sometimes, there is a TPS data lock, even if the demod is not able to decode it (ex: no RF signal).
For the STK7770P: correct value for the charge pump

Signed-off-by: Olivier Grenie <olivier.grenie@dibcom.fr>
Signed-off-by: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Olivier Grenie 15 年之前
父节点
当前提交
eac1fe1050
共有 2 个文件被更改,包括 11 次插入5 次删除
  1. 1 0
      drivers/media/dvb/dvb-usb/dib0700_devices.c
  2. 10 5
      drivers/media/dvb/frontends/dib7000p.c

+ 1 - 0
drivers/media/dvb/dvb-usb/dib0700_devices.c

@@ -1176,6 +1176,7 @@ static struct dib0070_config dib7770p_dib0070_config = {
 	 .clock_khz = 12000,
 	 .clock_khz = 12000,
 	 .clock_pad_drive = 0,
 	 .clock_pad_drive = 0,
 	 .flip_chip = 1,
 	 .flip_chip = 1,
+	 .charge_pump = 2,
 };
 };
 
 
 static int dib7070_set_param_override(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
 static int dib7070_set_param_override(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)

+ 10 - 5
drivers/media/dvb/frontends/dib7000p.c

@@ -108,7 +108,7 @@ static int dib7000p_set_output_mode(struct dib7000p_state *state, int mode)
 
 
 	outreg = 0;
 	outreg = 0;
 	fifo_threshold = 1792;
 	fifo_threshold = 1792;
-	smo_mode = (dib7000p_read_word(state, 235) & 0x0010) | (1 << 1);
+	smo_mode = (dib7000p_read_word(state, 235) & 0x0050) | (1 << 1);
 
 
 	dprintk( "setting output mode for demod %p to %d",
 	dprintk( "setting output mode for demod %p to %d",
 			&state->demod, mode);
 			&state->demod, mode);
@@ -162,18 +162,19 @@ static int dib7000p_set_diversity_in(struct dvb_frontend *demod, int onoff)
 	if (state->div_force_off) {
 	if (state->div_force_off) {
 		dprintk( "diversity combination deactivated - forced by COFDM parameters");
 		dprintk( "diversity combination deactivated - forced by COFDM parameters");
 		onoff = 0;
 		onoff = 0;
-	}
+		dib7000p_write_word(state, 207, 0);
+	} else
+		dib7000p_write_word(state, 207, (state->div_sync_wait << 4) | (1 << 2) | (2 << 0));
+
 	state->div_state = (u8)onoff;
 	state->div_state = (u8)onoff;
 
 
 	if (onoff) {
 	if (onoff) {
 		dib7000p_write_word(state, 204, 6);
 		dib7000p_write_word(state, 204, 6);
 		dib7000p_write_word(state, 205, 16);
 		dib7000p_write_word(state, 205, 16);
 		/* P_dvsy_sync_mode = 0, P_dvsy_sync_enable=1, P_dvcb_comb_mode=2 */
 		/* P_dvsy_sync_mode = 0, P_dvsy_sync_enable=1, P_dvcb_comb_mode=2 */
-		dib7000p_write_word(state, 207, (state->div_sync_wait << 4) | (1 << 2) | (2 << 0));
 	} else {
 	} else {
 		dib7000p_write_word(state, 204, 1);
 		dib7000p_write_word(state, 204, 1);
 		dib7000p_write_word(state, 205, 0);
 		dib7000p_write_word(state, 205, 0);
-		dib7000p_write_word(state, 207, 0);
 	}
 	}
 
 
 	return 0;
 	return 0;
@@ -1188,7 +1189,7 @@ static int dib7000p_read_status(struct dvb_frontend *fe, fe_status_t *stat)
 		*stat |= FE_HAS_VITERBI;
 		*stat |= FE_HAS_VITERBI;
 	if (lock & 0x0010)
 	if (lock & 0x0010)
 		*stat |= FE_HAS_SYNC;
 		*stat |= FE_HAS_SYNC;
-	if (lock & 0x0008)
+    if ((lock & 0x0038) == 0x38)
 		*stat |= FE_HAS_LOCK;
 		*stat |= FE_HAS_LOCK;
 
 
 	return 0;
 	return 0;
@@ -1332,8 +1333,10 @@ int dib7000p_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 defau
 		/* designated i2c address */
 		/* designated i2c address */
 		new_addr          = (0x40 + k) << 1;
 		new_addr          = (0x40 + k) << 1;
 		st.i2c_addr = new_addr;
 		st.i2c_addr = new_addr;
+		dib7000p_write_word(&st, 1287, 0x0003); /* sram lead in, rdy */
 		if (dib7000p_identify(&st) != 0) {
 		if (dib7000p_identify(&st) != 0) {
 			st.i2c_addr = default_addr;
 			st.i2c_addr = default_addr;
+			dib7000p_write_word(&st, 1287, 0x0003); /* sram lead in, rdy */
 			if (dib7000p_identify(&st) != 0) {
 			if (dib7000p_identify(&st) != 0) {
 				dprintk("DiB7000P #%d: not identified\n", k);
 				dprintk("DiB7000P #%d: not identified\n", k);
 				return -EIO;
 				return -EIO;
@@ -1390,6 +1393,8 @@ struct dvb_frontend * dib7000p_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr,
 	demod->demodulator_priv = st;
 	demod->demodulator_priv = st;
 	memcpy(&st->demod.ops, &dib7000p_ops, sizeof(struct dvb_frontend_ops));
 	memcpy(&st->demod.ops, &dib7000p_ops, sizeof(struct dvb_frontend_ops));
 
 
+    dib7000p_write_word(st, 1287, 0x0003); /* sram lead in, rdy */
+
 	if (dib7000p_identify(st) != 0)
 	if (dib7000p_identify(st) != 0)
 		goto error;
 		goto error;