Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] stb0899: enable auto inversion handling unconditionally

It seems that current inversion handling addresses only the signal
routing on the PCB, i. e. IQ signals are either swapped or not.
But when the device is operated in a Satellite Channel Router (SCR)
environment, an additional inversion is required due to the way how
the SCR works. Therefore it makes sense to me to always enable auto
inversion handling and drop the enum value IQ_SWAP_AUTO.

Signed-off-by: Reinhard Nißl <rnissl@gmx.de>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Reinhard Nißl and committed by
Mauro Carvalho Chehab
fa64cfd2 2eeed77f

+28 -34
+28 -33
drivers/media/dvb-frontends/stb0899_algo.c
··· 1373 1373 case IQ_SWAP_ON: 1374 1374 STB0899_SETFIELD_VAL(SPECTRUM_INVERT, reg, 1); 1375 1375 break; 1376 - case IQ_SWAP_AUTO: /* use last successful search first */ 1377 - STB0899_SETFIELD_VAL(SPECTRUM_INVERT, reg, 1); 1378 - break; 1379 1376 } 1380 1377 stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_DMD_CNTRL2, STB0899_OFF0_DMD_CNTRL2, reg); 1381 1378 stb0899_dvbs2_reacquire(state); ··· 1402 1405 } 1403 1406 1404 1407 if (internal->status != DVBS2_FEC_LOCK) { 1405 - if (internal->inversion == IQ_SWAP_AUTO) { 1406 - reg = STB0899_READ_S2REG(STB0899_S2DEMOD, DMD_CNTRL2); 1407 - iqSpectrum = STB0899_GETFIELD(SPECTRUM_INVERT, reg); 1408 - /* IQ Spectrum Inversion */ 1409 - STB0899_SETFIELD_VAL(SPECTRUM_INVERT, reg, !iqSpectrum); 1410 - stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_DMD_CNTRL2, STB0899_OFF0_DMD_CNTRL2, reg); 1411 - /* start acquistion process */ 1412 - stb0899_dvbs2_reacquire(state); 1408 + reg = STB0899_READ_S2REG(STB0899_S2DEMOD, DMD_CNTRL2); 1409 + iqSpectrum = STB0899_GETFIELD(SPECTRUM_INVERT, reg); 1410 + /* IQ Spectrum Inversion */ 1411 + STB0899_SETFIELD_VAL(SPECTRUM_INVERT, reg, !iqSpectrum); 1412 + stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_DMD_CNTRL2, STB0899_OFF0_DMD_CNTRL2, reg); 1413 + /* start acquistion process */ 1414 + stb0899_dvbs2_reacquire(state); 1413 1415 1414 - /* Wait for demod lock (UWP and CSM) */ 1415 - internal->status = stb0899_dvbs2_get_dmd_status(state, searchTime); 1416 - if (internal->status == DVBS2_DEMOD_LOCK) { 1417 - i = 0; 1418 - /* Demod Locked, check FEC */ 1419 - internal->status = stb0899_dvbs2_get_fec_status(state, FecLockTime); 1420 - /*try thrice for false locks, (UWP and CSM Locked but no FEC) */ 1421 - while ((internal->status != DVBS2_FEC_LOCK) && (i < 3)) { 1422 - /* Read the frequency offset*/ 1423 - offsetfreq = STB0899_READ_S2REG(STB0899_S2DEMOD, CRL_FREQ); 1416 + /* Wait for demod lock (UWP and CSM) */ 1417 + internal->status = stb0899_dvbs2_get_dmd_status(state, searchTime); 1418 + if (internal->status == DVBS2_DEMOD_LOCK) { 1419 + i = 0; 1420 + /* Demod Locked, check FEC */ 1421 + internal->status = stb0899_dvbs2_get_fec_status(state, FecLockTime); 1422 + /*try thrice for false locks, (UWP and CSM Locked but no FEC) */ 1423 + while ((internal->status != DVBS2_FEC_LOCK) && (i < 3)) { 1424 + /* Read the frequency offset*/ 1425 + offsetfreq = STB0899_READ_S2REG(STB0899_S2DEMOD, CRL_FREQ); 1424 1426 1425 - /* Set the Nominal frequency to the found frequency offset for the next reacquire*/ 1426 - reg = STB0899_READ_S2REG(STB0899_S2DEMOD, CRL_NOM_FREQ); 1427 - STB0899_SETFIELD_VAL(CRL_NOM_FREQ, reg, offsetfreq); 1428 - stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CRL_NOM_FREQ, STB0899_OFF0_CRL_NOM_FREQ, reg); 1427 + /* Set the Nominal frequency to the found frequency offset for the next reacquire*/ 1428 + reg = STB0899_READ_S2REG(STB0899_S2DEMOD, CRL_NOM_FREQ); 1429 + STB0899_SETFIELD_VAL(CRL_NOM_FREQ, reg, offsetfreq); 1430 + stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CRL_NOM_FREQ, STB0899_OFF0_CRL_NOM_FREQ, reg); 1429 1431 1430 - stb0899_dvbs2_reacquire(state); 1431 - internal->status = stb0899_dvbs2_get_fec_status(state, searchTime); 1432 - i++; 1433 - } 1432 + stb0899_dvbs2_reacquire(state); 1433 + internal->status = stb0899_dvbs2_get_fec_status(state, searchTime); 1434 + i++; 1434 1435 } 1435 - /* 1436 - if (pParams->DVBS2State == FE_DVBS2_FEC_LOCKED) 1437 - pParams->IQLocked = !iqSpectrum; 1438 - */ 1439 1436 } 1437 + /* 1438 + if (pParams->DVBS2State == FE_DVBS2_FEC_LOCKED) 1439 + pParams->IQLocked = !iqSpectrum; 1440 + */ 1440 1441 } 1441 1442 if (internal->status == DVBS2_FEC_LOCK) { 1442 1443 dprintk(state->verbose, FE_DEBUG, 1, "----------------> DVB-S2 FEC Lock !");
-1
drivers/media/dvb-frontends/stb0899_drv.h
··· 47 47 enum stb0899_inversion { 48 48 IQ_SWAP_OFF = 0, 49 49 IQ_SWAP_ON, 50 - IQ_SWAP_AUTO 51 50 }; 52 51 53 52 #define STB0899_GPIO00 0xf140