diff options
-rw-r--r-- | drivers/media/dvb/frontends/drxk_hard.c | 165 |
1 files changed, 81 insertions, 84 deletions
diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c index 7ea73dfacdfb..bb8627ffae73 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, | |||
1806 | if (status < 0) | 1806 | if (status < 0) |
1807 | goto error; | 1807 | goto error; |
1808 | 1808 | ||
1809 | if (state->m_OperationMode != oMode) { | 1809 | /* Device is already at the required mode */ |
1810 | switch (state->m_OperationMode) { | 1810 | if (state->m_OperationMode == oMode) |
1811 | /* OM_NONE was added for start up */ | 1811 | return 0; |
1812 | case OM_NONE: | 1812 | |
1813 | break; | 1813 | switch (state->m_OperationMode) { |
1814 | case OM_DVBT: | 1814 | /* OM_NONE was added for start up */ |
1815 | status = MPEGTSStop(state); | 1815 | case OM_NONE: |
1816 | if (status < 0) | 1816 | break; |
1817 | goto error; | 1817 | case OM_DVBT: |
1818 | status = PowerDownDVBT(state, true); | 1818 | status = MPEGTSStop(state); |
1819 | if (status < 0) | 1819 | if (status < 0) |
1820 | goto error; | ||
1821 | state->m_OperationMode = OM_NONE; | ||
1822 | break; | ||
1823 | case OM_QAM_ITU_A: /* fallthrough */ | ||
1824 | case OM_QAM_ITU_C: | ||
1825 | status = MPEGTSStop(state); | ||
1826 | if (status < 0) | ||
1827 | goto error; | ||
1828 | status = PowerDownQAM(state); | ||
1829 | if (status < 0) | ||
1830 | goto error; | ||
1831 | state->m_OperationMode = OM_NONE; | ||
1832 | break; | ||
1833 | case OM_QAM_ITU_B: | ||
1834 | default: | ||
1835 | status = -EINVAL; | ||
1836 | goto error; | 1820 | goto error; |
1837 | } | 1821 | status = PowerDownDVBT(state, true); |
1822 | if (status < 0) | ||
1823 | goto error; | ||
1824 | state->m_OperationMode = OM_NONE; | ||
1825 | break; | ||
1826 | case OM_QAM_ITU_A: /* fallthrough */ | ||
1827 | case OM_QAM_ITU_C: | ||
1828 | status = MPEGTSStop(state); | ||
1829 | if (status < 0) | ||
1830 | goto error; | ||
1831 | status = PowerDownQAM(state); | ||
1832 | if (status < 0) | ||
1833 | goto error; | ||
1834 | state->m_OperationMode = OM_NONE; | ||
1835 | break; | ||
1836 | case OM_QAM_ITU_B: | ||
1837 | default: | ||
1838 | status = -EINVAL; | ||
1839 | goto error; | ||
1840 | } | ||
1838 | 1841 | ||
1839 | /* | 1842 | /* |
1840 | Power up new standard | 1843 | Power up new standard |
1841 | */ | 1844 | */ |
1842 | switch (oMode) { | 1845 | switch (oMode) { |
1843 | case OM_DVBT: | 1846 | case OM_DVBT: |
1844 | state->m_OperationMode = oMode; | 1847 | state->m_OperationMode = oMode; |
1845 | status = SetDVBTStandard(state, oMode); | 1848 | status = SetDVBTStandard(state, oMode); |
1846 | if (status < 0) | 1849 | if (status < 0) |
1847 | goto error; | 1850 | goto error; |
1848 | break; | 1851 | break; |
1849 | case OM_QAM_ITU_A: /* fallthrough */ | 1852 | case OM_QAM_ITU_A: /* fallthrough */ |
1850 | case OM_QAM_ITU_C: | 1853 | case OM_QAM_ITU_C: |
1851 | state->m_OperationMode = oMode; | 1854 | state->m_OperationMode = oMode; |
1852 | status = SetQAMStandard(state, oMode); | 1855 | status = SetQAMStandard(state, oMode); |
1853 | if (status < 0) | 1856 | if (status < 0) |
1854 | goto error; | 1857 | goto error; |
1855 | break; | 1858 | break; |
1856 | case OM_QAM_ITU_B: | 1859 | case OM_QAM_ITU_B: |
1857 | default: | 1860 | default: |
1858 | status = -EINVAL; | 1861 | status = -EINVAL; |
1859 | } | ||
1860 | } | 1862 | } |
1861 | error: | 1863 | error: |
1862 | if (status < 0) | 1864 | if (status < 0) |
@@ -3086,35 +3088,28 @@ static int InitAGC(struct drxk_state *state, bool isDTV) | |||
3086 | clpCyclen = 500; | 3088 | clpCyclen = 500; |
3087 | clpSumMax = 1023; | 3089 | clpSumMax = 1023; |
3088 | 3090 | ||
3089 | if (IsQAM(state)) { | 3091 | /* AGCInit() not available for DVBT; init done in microcode */ |
3090 | /* Standard specific settings */ | 3092 | if (!IsQAM(state)) { |
3091 | clpSumMin = 8; | 3093 | printk(KERN_ERR "drxk: %s: mode %d is not DVB-C\n", __func__, state->m_OperationMode); |
3092 | clpDirTo = (u16) -9; | 3094 | return -EINVAL; |
3093 | clpCtrlMode = 0; | ||
3094 | snsSumMin = 8; | ||
3095 | snsDirTo = (u16) -9; | ||
3096 | kiInnergainMin = (u16) -1030; | ||
3097 | } else { | ||
3098 | status = -EINVAL; | ||
3099 | goto error; | ||
3100 | } | ||
3101 | if (IsQAM(state)) { | ||
3102 | ifIaccuHiTgtMax = 0x2380; | ||
3103 | ifIaccuHiTgt = 0x2380; | ||
3104 | ingainTgtMin = 0x0511; | ||
3105 | ingainTgt = 0x0511; | ||
3106 | ingainTgtMax = 5119; | ||
3107 | fastClpCtrlDelay = | ||
3108 | state->m_qamIfAgcCfg.FastClipCtrlDelay; | ||
3109 | } else { | ||
3110 | ifIaccuHiTgtMax = 0x1200; | ||
3111 | ifIaccuHiTgt = 0x1200; | ||
3112 | ingainTgtMin = 13424; | ||
3113 | ingainTgt = 13424; | ||
3114 | ingainTgtMax = 30000; | ||
3115 | fastClpCtrlDelay = | ||
3116 | state->m_dvbtIfAgcCfg.FastClipCtrlDelay; | ||
3117 | } | 3095 | } |
3096 | |||
3097 | /* FIXME: Analog TV AGC require different settings */ | ||
3098 | |||
3099 | /* Standard specific settings */ | ||
3100 | clpSumMin = 8; | ||
3101 | clpDirTo = (u16) -9; | ||
3102 | clpCtrlMode = 0; | ||
3103 | snsSumMin = 8; | ||
3104 | snsDirTo = (u16) -9; | ||
3105 | kiInnergainMin = (u16) -1030; | ||
3106 | ifIaccuHiTgtMax = 0x2380; | ||
3107 | ifIaccuHiTgt = 0x2380; | ||
3108 | ingainTgtMin = 0x0511; | ||
3109 | ingainTgt = 0x0511; | ||
3110 | ingainTgtMax = 5119; | ||
3111 | fastClpCtrlDelay = state->m_qamIfAgcCfg.FastClipCtrlDelay; | ||
3112 | |||
3118 | status = write16(state, SCU_RAM_AGC_FAST_CLP_CTRL_DELAY__A, fastClpCtrlDelay); | 3113 | status = write16(state, SCU_RAM_AGC_FAST_CLP_CTRL_DELAY__A, fastClpCtrlDelay); |
3119 | if (status < 0) | 3114 | if (status < 0) |
3120 | goto error; | 3115 | goto error; |
@@ -3238,13 +3233,13 @@ static int InitAGC(struct drxk_state *state, bool isDTV) | |||
3238 | status = read16(state, SCU_RAM_AGC_KI__A, &data); | 3233 | status = read16(state, SCU_RAM_AGC_KI__A, &data); |
3239 | if (status < 0) | 3234 | if (status < 0) |
3240 | goto error; | 3235 | goto error; |
3241 | if (IsQAM(state)) { | 3236 | |
3242 | data = 0x0657; | 3237 | data = 0x0657; |
3243 | data &= ~SCU_RAM_AGC_KI_RF__M; | 3238 | data &= ~SCU_RAM_AGC_KI_RF__M; |
3244 | data |= (DRXK_KI_RAGC_QAM << SCU_RAM_AGC_KI_RF__B); | 3239 | data |= (DRXK_KI_RAGC_QAM << SCU_RAM_AGC_KI_RF__B); |
3245 | data &= ~SCU_RAM_AGC_KI_IF__M; | 3240 | data &= ~SCU_RAM_AGC_KI_IF__M; |
3246 | data |= (DRXK_KI_IAGC_QAM << SCU_RAM_AGC_KI_IF__B); | 3241 | data |= (DRXK_KI_IAGC_QAM << SCU_RAM_AGC_KI_IF__B); |
3247 | } | 3242 | |
3248 | status = write16(state, SCU_RAM_AGC_KI__A, data); | 3243 | status = write16(state, SCU_RAM_AGC_KI__A, data); |
3249 | error: | 3244 | error: |
3250 | if (status < 0) | 3245 | if (status < 0) |
@@ -5627,6 +5622,8 @@ static int SetQAMStandard(struct drxk_state *state, | |||
5627 | #undef DRXK_QAMA_TAPS_SELECT | 5622 | #undef DRXK_QAMA_TAPS_SELECT |
5628 | #endif | 5623 | #endif |
5629 | 5624 | ||
5625 | dprintk(1, "\n"); | ||
5626 | |||
5630 | /* added antenna switch */ | 5627 | /* added antenna switch */ |
5631 | SwitchAntennaToQAM(state); | 5628 | SwitchAntennaToQAM(state); |
5632 | 5629 | ||