From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: unlisted-recipients:; (no To-header on input)@casper.infradead.org
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: [PATCH 19/21] [media] drxk: Simplify the DVB-C set mode logic
Date: Sun, 10 Jul 2011 22:59:05 -0300 [thread overview]
Message-ID: <20110710225905.5d1e021b@pedra> (raw)
In-Reply-To: <cover.1310347962.git.mchehab@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c
index 7ea73df..bb8627f 100644
--- a/drivers/media/dvb/frontends/drxk_hard.c
+++ b/drivers/media/dvb/frontends/drxk_hard.c
@@ -1806,57 +1806,59 @@ static int SetOperationMode(struct drxk_state *state,
if (status < 0)
goto error;
- if (state->m_OperationMode != oMode) {
- switch (state->m_OperationMode) {
- /* OM_NONE was added for start up */
- case OM_NONE:
- break;
- case OM_DVBT:
- status = MPEGTSStop(state);
- if (status < 0)
- goto error;
- status = PowerDownDVBT(state, true);
- if (status < 0)
- goto error;
- state->m_OperationMode = OM_NONE;
- break;
- case OM_QAM_ITU_A: /* fallthrough */
- case OM_QAM_ITU_C:
- status = MPEGTSStop(state);
- if (status < 0)
- goto error;
- status = PowerDownQAM(state);
- if (status < 0)
- goto error;
- state->m_OperationMode = OM_NONE;
- break;
- case OM_QAM_ITU_B:
- default:
- status = -EINVAL;
+ /* Device is already at the required mode */
+ if (state->m_OperationMode == oMode)
+ return 0;
+
+ switch (state->m_OperationMode) {
+ /* OM_NONE was added for start up */
+ case OM_NONE:
+ break;
+ case OM_DVBT:
+ status = MPEGTSStop(state);
+ if (status < 0)
+ goto error;
+ status = PowerDownDVBT(state, true);
+ if (status < 0)
+ goto error;
+ state->m_OperationMode = OM_NONE;
+ break;
+ case OM_QAM_ITU_A: /* fallthrough */
+ case OM_QAM_ITU_C:
+ status = MPEGTSStop(state);
+ if (status < 0)
goto error;
- }
+ status = PowerDownQAM(state);
+ if (status < 0)
+ goto error;
+ state->m_OperationMode = OM_NONE;
+ break;
+ case OM_QAM_ITU_B:
+ default:
+ status = -EINVAL;
+ goto error;
+ }
- /*
- Power up new standard
- */
- switch (oMode) {
- case OM_DVBT:
- state->m_OperationMode = oMode;
- status = SetDVBTStandard(state, oMode);
- if (status < 0)
- goto error;
- break;
- case OM_QAM_ITU_A: /* fallthrough */
- case OM_QAM_ITU_C:
- state->m_OperationMode = oMode;
- status = SetQAMStandard(state, oMode);
- if (status < 0)
- goto error;
- break;
- case OM_QAM_ITU_B:
- default:
- status = -EINVAL;
- }
+ /*
+ Power up new standard
+ */
+ switch (oMode) {
+ case OM_DVBT:
+ state->m_OperationMode = oMode;
+ status = SetDVBTStandard(state, oMode);
+ if (status < 0)
+ goto error;
+ break;
+ case OM_QAM_ITU_A: /* fallthrough */
+ case OM_QAM_ITU_C:
+ state->m_OperationMode = oMode;
+ status = SetQAMStandard(state, oMode);
+ if (status < 0)
+ goto error;
+ break;
+ case OM_QAM_ITU_B:
+ default:
+ status = -EINVAL;
}
error:
if (status < 0)
@@ -3086,35 +3088,28 @@ static int InitAGC(struct drxk_state *state, bool isDTV)
clpCyclen = 500;
clpSumMax = 1023;
- if (IsQAM(state)) {
- /* Standard specific settings */
- clpSumMin = 8;
- clpDirTo = (u16) -9;
- clpCtrlMode = 0;
- snsSumMin = 8;
- snsDirTo = (u16) -9;
- kiInnergainMin = (u16) -1030;
- } else {
- status = -EINVAL;
- goto error;
- }
- if (IsQAM(state)) {
- ifIaccuHiTgtMax = 0x2380;
- ifIaccuHiTgt = 0x2380;
- ingainTgtMin = 0x0511;
- ingainTgt = 0x0511;
- ingainTgtMax = 5119;
- fastClpCtrlDelay =
- state->m_qamIfAgcCfg.FastClipCtrlDelay;
- } else {
- ifIaccuHiTgtMax = 0x1200;
- ifIaccuHiTgt = 0x1200;
- ingainTgtMin = 13424;
- ingainTgt = 13424;
- ingainTgtMax = 30000;
- fastClpCtrlDelay =
- state->m_dvbtIfAgcCfg.FastClipCtrlDelay;
+ /* AGCInit() not available for DVBT; init done in microcode */
+ if (!IsQAM(state)) {
+ printk(KERN_ERR "drxk: %s: mode %d is not DVB-C\n", __func__, state->m_OperationMode);
+ return -EINVAL;
}
+
+ /* FIXME: Analog TV AGC require different settings */
+
+ /* Standard specific settings */
+ clpSumMin = 8;
+ clpDirTo = (u16) -9;
+ clpCtrlMode = 0;
+ snsSumMin = 8;
+ snsDirTo = (u16) -9;
+ kiInnergainMin = (u16) -1030;
+ ifIaccuHiTgtMax = 0x2380;
+ ifIaccuHiTgt = 0x2380;
+ ingainTgtMin = 0x0511;
+ ingainTgt = 0x0511;
+ ingainTgtMax = 5119;
+ fastClpCtrlDelay = state->m_qamIfAgcCfg.FastClipCtrlDelay;
+
status = write16(state, SCU_RAM_AGC_FAST_CLP_CTRL_DELAY__A, fastClpCtrlDelay);
if (status < 0)
goto error;
@@ -3238,13 +3233,13 @@ static int InitAGC(struct drxk_state *state, bool isDTV)
status = read16(state, SCU_RAM_AGC_KI__A, &data);
if (status < 0)
goto error;
- if (IsQAM(state)) {
- data = 0x0657;
- data &= ~SCU_RAM_AGC_KI_RF__M;
- data |= (DRXK_KI_RAGC_QAM << SCU_RAM_AGC_KI_RF__B);
- data &= ~SCU_RAM_AGC_KI_IF__M;
- data |= (DRXK_KI_IAGC_QAM << SCU_RAM_AGC_KI_IF__B);
- }
+
+ data = 0x0657;
+ data &= ~SCU_RAM_AGC_KI_RF__M;
+ data |= (DRXK_KI_RAGC_QAM << SCU_RAM_AGC_KI_RF__B);
+ data &= ~SCU_RAM_AGC_KI_IF__M;
+ data |= (DRXK_KI_IAGC_QAM << SCU_RAM_AGC_KI_IF__B);
+
status = write16(state, SCU_RAM_AGC_KI__A, data);
error:
if (status < 0)
@@ -5627,6 +5622,8 @@ static int SetQAMStandard(struct drxk_state *state,
#undef DRXK_QAMA_TAPS_SELECT
#endif
+ dprintk(1, "\n");
+
/* added antenna switch */
SwitchAntennaToQAM(state);
--
1.7.1
next prev parent reply other threads:[~2011-07-11 2:00 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1310347962.git.mchehab@redhat.com>
2011-07-11 1:58 ` [PATCH 09/21] [media] Add initial support for Terratec H5 Mauro Carvalho Chehab
2011-07-11 1:58 ` [PATCH 01/21] [media] drxk: add drxk prefix to the errors Mauro Carvalho Chehab
2011-07-11 1:58 ` [PATCH 02/21] [media] tda18271c2dd: add tda18271c2dd " Mauro Carvalho Chehab
2011-07-11 1:58 ` [PATCH 03/21] [media] drxk: Add debug printk's Mauro Carvalho Chehab
2011-07-11 1:58 ` [PATCH 04/21] [media] drxk: remove _0 from read/write routines Mauro Carvalho Chehab
2011-07-11 1:58 ` [PATCH 05/21] [media] drxk: Move I2C address into a config structure Mauro Carvalho Chehab
2011-07-11 1:58 ` [PATCH 06/21] [media] drxk: Convert an #ifdef logic as a new config parameter Mauro Carvalho Chehab
2011-07-11 1:58 ` [PATCH 10/21] [media] drxk: Add a parameter for the microcode name Mauro Carvalho Chehab
2011-07-11 1:58 ` [PATCH 07/21] [media] drxk: Avoid OOPSes if firmware is corrupted Mauro Carvalho Chehab
2011-07-11 1:58 ` [PATCH 08/21] [media] drxk: Print an error if firmware is not loaded Mauro Carvalho Chehab
2011-07-11 1:58 ` [PATCH 11/21] [media] em28xx-i2c: Add a read after I2C write Mauro Carvalho Chehab
2011-07-11 1:58 ` [PATCH 12/21] [media] drxk: Allow to disable I2C Bridge control switch Mauro Carvalho Chehab
2011-07-11 1:59 ` [PATCH 13/21] [media] drxk: Proper handle/propagate the error codes Mauro Carvalho Chehab
2011-07-11 1:59 ` [PATCH 15/21] [media] drxk: Fix the antenna switch logic Mauro Carvalho Chehab
2011-07-11 1:59 ` [PATCH 16/21] [media] drxk: Print detected configuration Mauro Carvalho Chehab
2011-07-11 1:59 ` [PATCH 17/21] [media] drxk: Improves the UIO handling Mauro Carvalho Chehab
2011-07-11 1:59 ` [PATCH 18/21] [media] drxk: Fix driver removal Mauro Carvalho Chehab
2011-07-11 1:59 ` [PATCH 14/21] [media] drxk: change mode before calling the set mode routines Mauro Carvalho Chehab
2011-07-11 1:59 ` Mauro Carvalho Chehab [this message]
2011-07-11 1:59 ` [PATCH 20/21] [media] drxk: Improve the scu_command error message Mauro Carvalho Chehab
2011-07-11 1:59 ` [PATCH 21/21] [media] drxk: Add a fallback method for QAM parameter setting Mauro Carvalho Chehab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110710225905.5d1e021b@pedra \
--to=mchehab@redhat.com \
--cc=linux-media@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.