Skip to contentSkip to conversation

mxl5007 move reset to attach

PATCH In review Jose Alberto Reguero 2 participants 4 messages Feb 3, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mxl5007 move reset to attach

This patch move the soft reset to the attach function because with dual tuners, when one tuner do reset, the other one is perturbed, and the stream has errors.

drivers/media/tuners/mxl5007t.c +13 -4
diff -upr linux/drivers/media/tuners/mxl5007t.c linux.new/drivers/media/tuners/mxl5007t.c
@@ -531,10 +531,6 @@ static int mxl5007t_tuner_init(struct mx
 	struct reg_pair_t *init_regs;
 	int ret;
 
-	ret = mxl5007t_soft_reset(state);
-	if (mxl_fail(ret))
-		goto fail;
-
 	/* calculate initialization reg array */
 	init_regs = mxl5007t_calc_init_regs(state, mode);
 
@@ -900,7 +896,20 @@ struct dvb_frontend *mxl5007t_attach(str
 		/* existing tuner instance */
 		break;
 	}
+
+	if (fe->ops.i2c_gate_ctrl)
+		fe->ops.i2c_gate_ctrl(fe, 1);
+
+	ret = mxl5007t_soft_reset(state);
+
+	if (fe->ops.i2c_gate_ctrl)
+		fe->ops.i2c_gate_ctrl(fe, 0);
+
+	if (mxl_fail(ret))
+		goto fail;
+
 	fe->tuner_priv = state;
+
 	mutex_unlock(&mxl5007t_list_mutex);
 
 	memcpy(&fe->ops.tuner_ops, &mxl5007t_tuner_ops,
#1 lore raw

PATCH 2/2 mxl5007 move loop_thru to attach

This patch move the loop_thru configuration to the attach function, because with dual tuners until loop_tru configuration the other tuner don't work.

drivers/media/tuners/mxl5007t.c +12 -1
diff -upr linux/drivers/media/tuners/mxl5007t.c linux.new/drivers/media/tuners/mxl5007t.c
@@ -374,7 +374,6 @@ static struct reg_pair_t *mxl5007t_calc_
 	mxl5007t_set_if_freq_bits(state, cfg->if_freq_hz, cfg->invert_if);
 	mxl5007t_set_xtal_freq_bits(state, cfg->xtal_freq_hz);
 
-	set_reg_bits(state->tab_init, 0x04, 0x01, cfg->loop_thru_enable);
 	set_reg_bits(state->tab_init, 0x03, 0x08, cfg->clk_out_enable << 3);
 	set_reg_bits(state->tab_init, 0x03, 0x07, cfg->clk_out_amp);
 
@@ -908,6 +907,18 @@ struct dvb_frontend *mxl5007t_attach(str
 	if (mxl_fail(ret))
 		goto fail;
 
+	if (fe->ops.i2c_gate_ctrl)
+		fe->ops.i2c_gate_ctrl(fe, 1);
+
+	ret = mxl5007t_write_reg(state, 0x04,
+		state->config->loop_thru_enable);
+
+	if (fe->ops.i2c_gate_ctrl)
+		fe->ops.i2c_gate_ctrl(fe, 0);
+
+	if (mxl_fail(ret))
+		goto fail;
+
 	fe->tuner_priv = state;
 
 	mutex_unlock(&mxl5007t_list_mutex);
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATH 2/2] mxl5007 move loop_thru to attach

Quoted 5 lines · Jose Alberto Reguero

This patch move the loop_thru configuration to the attach function, because with dual tuners until loop_tru configuration the other tuner don't work.

Quoted 22 lines

diff -upr linux/drivers/media/tuners/mxl5007t.c linux.new/drivers/media/tuners/mxl5007t.c

drivers/media/tuners/mxl5007t.c +5 -1
@@ -374,7 +374,6 @@ static struct reg_pair_t *mxl5007t_calc_
  	mxl5007t_set_if_freq_bits(state, cfg->if_freq_hz, cfg->invert_if);
  	mxl5007t_set_xtal_freq_bits(state, cfg->xtal_freq_hz);
 
-	set_reg_bits(state->tab_init, 0x04, 0x01, cfg->loop_thru_enable);
  	set_reg_bits(state->tab_init, 0x03, 0x08, cfg->clk_out_enable << 3);
  	set_reg_bits(state->tab_init, 0x03, 0x07, cfg->clk_out_amp);
 
@@ -908,6 +907,18 @@ struct dvb_frontend *mxl5007t_attach(str
  	if (mxl_fail(ret))
  		goto fail;
 
+	if (fe->ops.i2c_gate_ctrl)
+		fe->ops.i2c_gate_ctrl(fe, 1);
+
+	ret = mxl5007t_write_reg(state, 0x04,
+		state->config->loop_thru_enable);

drivers/media/tuners/mxl5007t.c struct dvb_frontend *mxl5007t_attach(str · line 924

Quoted 10 lines
drivers/media/tuners/mxl5007t.c +7 -0
+
+	if (fe->ops.i2c_gate_ctrl)
+		fe->ops.i2c_gate_ctrl(fe, 0);
+
+	if (mxl_fail(ret))
+		goto fail;
+
  	fe->tuner_priv = state;
 
  	mutex_unlock(&mxl5007t_list_mutex);

Looks good for my eyes!

Is clock output is enabled by default?

Are these two patches enough in order to get it working?

regards
Antti

Signature · 1 line
http://palosaari.fi/
Reviewed-by on v1 1/2
#3 lore raw
In reply to Jose Alberto Reguero
Quoted 5 lines · Jose Alberto Reguero

This patch move the soft reset to the attach function because with dual tuners, when one tuner do reset, the other one is perturbed, and the stream has errors.

Looks good for my eyes!

Quoted 37 lines

diff -upr linux/drivers/media/tuners/mxl5007t.c linux.new/drivers/media/tuners/mxl5007t.c

drivers/media/tuners/mxl5007t.c +13 -4
@@ -531,10 +531,6 @@ static int mxl5007t_tuner_init(struct mx
  	struct reg_pair_t *init_regs;
  	int ret;
 
-	ret = mxl5007t_soft_reset(state);
-	if (mxl_fail(ret))
-		goto fail;
-
  	/* calculate initialization reg array */
  	init_regs = mxl5007t_calc_init_regs(state, mode);
 
@@ -900,7 +896,20 @@ struct dvb_frontend *mxl5007t_attach(str
  		/* existing tuner instance */
  		break;
  	}
+
+	if (fe->ops.i2c_gate_ctrl)
+		fe->ops.i2c_gate_ctrl(fe, 1);
+
+	ret = mxl5007t_soft_reset(state);
+
+	if (fe->ops.i2c_gate_ctrl)
+		fe->ops.i2c_gate_ctrl(fe, 0);
+
+	if (mxl_fail(ret))
+		goto fail;
+
  	fe->tuner_priv = state;
+
  	mutex_unlock(&mxl5007t_list_mutex);
 
  	memcpy(&fe->ops.tuner_ops, &mxl5007t_tuner_ops,
Signature · 1 line
http://palosaari.fi/