public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [media] drxk: Switch the delivery system on FE_SET_PROPERTY
@ 2011-12-09 18:20 Mauro Carvalho Chehab
  2011-12-09 18:26 ` Antti Palosaari
  0 siblings, 1 reply; 21+ messages in thread
From: Mauro Carvalho Chehab @ 2011-12-09 18:20 UTC (permalink / raw)
  To: linux-media; +Cc: Mauro Carvalho Chehab

The DRX-K doesn't change the delivery system at set_properties,
but do it at frontend init. This causes problems on programs like
w_scan that, by default, opens both frontends.

Instead, explicitly set the format when set_parameters callback is
called.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
---
 drivers/media/dvb/frontends/drxk_hard.c |   32 ++++++++++++++++++++++--------
 drivers/media/dvb/frontends/drxk_hard.h |    2 +
 2 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c
index 95cbc98..c8e0921 100644
--- a/drivers/media/dvb/frontends/drxk_hard.c
+++ b/drivers/media/dvb/frontends/drxk_hard.c
@@ -1847,6 +1847,7 @@ static int SetOperationMode(struct drxk_state *state,
 		*/
 	switch (oMode) {
 	case OM_DVBT:
+		dprintk(1, ": DVB-T\n");
 		state->m_OperationMode = oMode;
 		status = SetDVBTStandard(state, oMode);
 		if (status < 0)
@@ -1854,6 +1855,8 @@ static int SetOperationMode(struct drxk_state *state,
 		break;
 	case OM_QAM_ITU_A:	/* fallthrough */
 	case OM_QAM_ITU_C:
+		dprintk(1, ": DVB-C Annex %c\n",
+			(state->m_OperationMode == OM_QAM_ITU_A) ? 'A' : 'C');
 		state->m_OperationMode = oMode;
 		status = SetQAMStandard(state, oMode);
 		if (status < 0)
@@ -6183,7 +6186,10 @@ static int drxk_c_init(struct dvb_frontend *fe)
 	dprintk(1, "\n");
 	if (mutex_trylock(&state->ctlock) == 0)
 		return -EBUSY;
-	SetOperationMode(state, OM_QAM_ITU_A);
+	if (state->m_itut_annex_c)
+		SetOperationMode(state, OM_QAM_ITU_C);
+	else
+		SetOperationMode(state, OM_QAM_ITU_A);
 	return 0;
 }
 
@@ -6219,14 +6225,6 @@ static int drxk_set_parameters(struct dvb_frontend *fe,
 		return -EINVAL;
 	}
 
-	if (state->m_OperationMode == OM_QAM_ITU_A ||
-	    state->m_OperationMode == OM_QAM_ITU_C) {
-		if (fe->dtv_property_cache.rolloff == ROLLOFF_13)
-			state->m_OperationMode = OM_QAM_ITU_C;
-		else
-			state->m_OperationMode = OM_QAM_ITU_A;
-	}
-
 	if (fe->ops.i2c_gate_ctrl)
 		fe->ops.i2c_gate_ctrl(fe, 1);
 	if (fe->ops.tuner_ops.set_params)
@@ -6235,6 +6233,22 @@ static int drxk_set_parameters(struct dvb_frontend *fe,
 		fe->ops.i2c_gate_ctrl(fe, 0);
 	state->param = *p;
 	fe->ops.tuner_ops.get_if_frequency(fe, &IF);
+
+	/*
+	 * Make sure that the frontend is on the right state
+	 */
+
+	if (fe->ops.info.type == FE_QAM) {
+		if (fe->dtv_property_cache.rolloff == ROLLOFF_13) {
+			state->m_itut_annex_c = true;
+			SetOperationMode(state, OM_QAM_ITU_C);
+		} else {
+			state->m_itut_annex_c = false;
+			SetOperationMode(state, OM_QAM_ITU_A);
+		}
+	} else
+		SetOperationMode(state, OM_DVBT);
+
 	Start(state, 0, IF);
 
 	/* printk(KERN_DEBUG "drxk: %s IF=%d done\n", __func__, IF); */
diff --git a/drivers/media/dvb/frontends/drxk_hard.h b/drivers/media/dvb/frontends/drxk_hard.h
index a05c32e..85a423f 100644
--- a/drivers/media/dvb/frontends/drxk_hard.h
+++ b/drivers/media/dvb/frontends/drxk_hard.h
@@ -263,6 +263,8 @@ struct drxk_state {
 	u8     m_TSDataStrength;
 	u8     m_TSClockkStrength;
 
+	bool   m_itut_annex_c;      /* If true, uses ITU-T DVB-C Annex C, instead of Annex A */
+
 	enum DRXMPEGStrWidth_t  m_widthSTR;    /**< MPEG start width */
 	u32    m_mpegTsStaticBitrate;          /**< Maximum bitrate in b/s in case
 						    static clockrate is selected */
-- 
1.7.8


^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2011-12-10 16:16 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-09 18:20 [PATCH] [media] drxk: Switch the delivery system on FE_SET_PROPERTY Mauro Carvalho Chehab
2011-12-09 18:26 ` Antti Palosaari
2011-12-09 18:58   ` Mauro Carvalho Chehab
2011-12-09 19:08     ` Antti Palosaari
2011-12-09 22:11       ` Mauro Carvalho Chehab
2011-12-09 22:33         ` Devin Heitmueller
2011-12-09 23:37           ` Mauro Carvalho Chehab
2011-12-09 23:43             ` Mauro Carvalho Chehab
2011-12-10  1:37               ` [PATCH] DVB: dvb_frontend: fix delayed thread exit Andreas Oberritter
2011-12-10  1:59                 ` Devin Heitmueller
2011-12-10  2:06                   ` Andreas Oberritter
2011-12-10  2:25                     ` Devin Heitmueller
2011-12-10 10:28                       ` Mauro Carvalho Chehab
2011-12-10 13:43                         ` Devin Heitmueller
2011-12-10 16:16                           ` Mauro Carvalho Chehab
2011-12-10 11:12                 ` Mauro Carvalho Chehab
2011-12-09 19:00   ` [PATCHv2] [media] drxk: Switch the delivery system on FE_SET_PROPERTY Mauro Carvalho Chehab
2011-12-09 20:04     ` Eddi De Pieri
2011-12-09 22:04       ` Mauro Carvalho Chehab
2011-12-10  4:00     ` Oliver Endriss
2011-12-10 11:18       ` Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox