Commit f1b82970 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] drxk: Simplify the DVB-C set mode logic

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent cf694b14
...@@ -1806,57 +1806,59 @@ static int SetOperationMode(struct drxk_state *state, ...@@ -1806,57 +1806,59 @@ static int SetOperationMode(struct drxk_state *state,
if (status < 0) if (status < 0)
goto error; goto error;
if (state->m_OperationMode != oMode) { /* Device is already at the required mode */
switch (state->m_OperationMode) { if (state->m_OperationMode == oMode)
/* OM_NONE was added for start up */ return 0;
case OM_NONE:
break; switch (state->m_OperationMode) {
case OM_DVBT: /* OM_NONE was added for start up */
status = MPEGTSStop(state); case OM_NONE:
if (status < 0) break;
goto error; case OM_DVBT:
status = PowerDownDVBT(state, true); status = MPEGTSStop(state);
if (status < 0) 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; 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 Power up new standard
*/ */
switch (oMode) { switch (oMode) {
case OM_DVBT: case OM_DVBT:
state->m_OperationMode = oMode; state->m_OperationMode = oMode;
status = SetDVBTStandard(state, oMode); status = SetDVBTStandard(state, oMode);
if (status < 0) if (status < 0)
goto error; goto error;
break; break;
case OM_QAM_ITU_A: /* fallthrough */ case OM_QAM_ITU_A: /* fallthrough */
case OM_QAM_ITU_C: case OM_QAM_ITU_C:
state->m_OperationMode = oMode; state->m_OperationMode = oMode;
status = SetQAMStandard(state, oMode); status = SetQAMStandard(state, oMode);
if (status < 0) if (status < 0)
goto error; goto error;
break; break;
case OM_QAM_ITU_B: case OM_QAM_ITU_B:
default: default:
status = -EINVAL; status = -EINVAL;
}
} }
error: error:
if (status < 0) if (status < 0)
...@@ -3086,35 +3088,28 @@ static int InitAGC(struct drxk_state *state, bool isDTV) ...@@ -3086,35 +3088,28 @@ static int InitAGC(struct drxk_state *state, bool isDTV)
clpCyclen = 500; clpCyclen = 500;
clpSumMax = 1023; clpSumMax = 1023;
if (IsQAM(state)) { /* AGCInit() not available for DVBT; init done in microcode */
/* Standard specific settings */ if (!IsQAM(state)) {
clpSumMin = 8; printk(KERN_ERR "drxk: %s: mode %d is not DVB-C\n", __func__, state->m_OperationMode);
clpDirTo = (u16) -9; return -EINVAL;
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;
} }
/* 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); status = write16(state, SCU_RAM_AGC_FAST_CLP_CTRL_DELAY__A, fastClpCtrlDelay);
if (status < 0) if (status < 0)
goto error; goto error;
...@@ -3238,13 +3233,13 @@ static int InitAGC(struct drxk_state *state, bool isDTV) ...@@ -3238,13 +3233,13 @@ static int InitAGC(struct drxk_state *state, bool isDTV)
status = read16(state, SCU_RAM_AGC_KI__A, &data); status = read16(state, SCU_RAM_AGC_KI__A, &data);
if (status < 0) if (status < 0)
goto error; goto error;
if (IsQAM(state)) {
data = 0x0657; data = 0x0657;
data &= ~SCU_RAM_AGC_KI_RF__M; data &= ~SCU_RAM_AGC_KI_RF__M;
data |= (DRXK_KI_RAGC_QAM << SCU_RAM_AGC_KI_RF__B); data |= (DRXK_KI_RAGC_QAM << SCU_RAM_AGC_KI_RF__B);
data &= ~SCU_RAM_AGC_KI_IF__M; data &= ~SCU_RAM_AGC_KI_IF__M;
data |= (DRXK_KI_IAGC_QAM << SCU_RAM_AGC_KI_IF__B); data |= (DRXK_KI_IAGC_QAM << SCU_RAM_AGC_KI_IF__B);
}
status = write16(state, SCU_RAM_AGC_KI__A, data); status = write16(state, SCU_RAM_AGC_KI__A, data);
error: error:
if (status < 0) if (status < 0)
...@@ -5627,6 +5622,8 @@ static int SetQAMStandard(struct drxk_state *state, ...@@ -5627,6 +5622,8 @@ static int SetQAMStandard(struct drxk_state *state,
#undef DRXK_QAMA_TAPS_SELECT #undef DRXK_QAMA_TAPS_SELECT
#endif #endif
dprintk(1, "\n");
/* added antenna switch */ /* added antenna switch */
SwitchAntennaToQAM(state); SwitchAntennaToQAM(state);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment