aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorAndreas Regel <andreas.regel@gmx.de>2009-11-13 16:20:54 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-05 15:41:31 -0500
commit7b035da93eb6ba839b39c61c5d993365ae308684 (patch)
tree93074e739df30d5b663955b3f513da6ccd5242c4 /drivers/media/dvb
parent1d4361718a47fba3b51f6e155524b5473a5b8d18 (diff)
V4L/DVB (13359): stv090x: adds corrections of some register values
While here, also do some blind scan related fixes. Signed-off-by: Andreas Regel <andreas.regel@gmx.de> Signed-off-by: Manu Abraham <manu@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/frontends/stv090x.c84
1 files changed, 44 insertions, 40 deletions
diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c
index 65ae677015e4..48edd542242e 100644
--- a/drivers/media/dvb/frontends/stv090x.c
+++ b/drivers/media/dvb/frontends/stv090x.c
@@ -1238,6 +1238,8 @@ static int stv090x_delivery_search(struct stv090x_state *state)
1238 goto err; 1238 goto err;
1239 } 1239 }
1240 1240
1241 if (stv090x_set_vit_thtracq(state) < 0)
1242 goto err;
1241 break; 1243 break;
1242 1244
1243 case STV090x_SEARCH_AUTO: 1245 case STV090x_SEARCH_AUTO:
@@ -1278,17 +1280,8 @@ static int stv090x_delivery_search(struct stv090x_state *state)
1278 goto err; 1280 goto err;
1279 } 1281 }
1280 1282
1281 if (state->srate >= 2000000) { 1283 if (stv090x_set_vit_thacq(state) < 0)
1282 /* Srate >= 2MSPS, Viterbi threshold to acquire */ 1284 goto err;
1283 if (stv090x_set_vit_thacq(state) < 0)
1284 goto err;
1285 } else {
1286 /* Srate < 2MSPS, Reset Viterbi thresholdto track
1287 * and then re-acquire
1288 */
1289 if (stv090x_set_vit_thtracq(state) < 0)
1290 goto err;
1291 }
1292 1285
1293 if (stv090x_set_viterbi(state) < 0) 1286 if (stv090x_set_viterbi(state) < 0)
1294 goto err; 1287 goto err;
@@ -1422,6 +1415,9 @@ static int stv090x_start_search(struct stv090x_state *state)
1422 if (STV090x_WRITE_DEMOD(state, DMDCFG2, reg) < 0) 1415 if (STV090x_WRITE_DEMOD(state, DMDCFG2, reg) < 0)
1423 goto err; 1416 goto err;
1424 1417
1418 if (STV090x_WRITE_DEMOD(state, RTC, 0x88) < 0)
1419 goto err;
1420
1425 if (state->dev_ver >= 0x20) { 1421 if (state->dev_ver >= 0x20) {
1426 /*Frequency offset detector setting*/ 1422 /*Frequency offset detector setting*/
1427 if (state->srate < 2000000) { 1423 if (state->srate < 2000000) {
@@ -1430,7 +1426,7 @@ static int stv090x_start_search(struct stv090x_state *state)
1430 if (STV090x_WRITE_DEMOD(state, CARFREQ, 0x39) < 0) 1426 if (STV090x_WRITE_DEMOD(state, CARFREQ, 0x39) < 0)
1431 goto err; 1427 goto err;
1432 } else { 1428 } else {
1433 /* Cut 2 */ 1429 /* Cut 3 */
1434 if (STV090x_WRITE_DEMOD(state, CARFREQ, 0x89) < 0) 1430 if (STV090x_WRITE_DEMOD(state, CARFREQ, 0x89) < 0)
1435 goto err; 1431 goto err;
1436 } 1432 }
@@ -1439,9 +1435,13 @@ static int stv090x_start_search(struct stv090x_state *state)
1439 } else if (state->srate < 10000000) { 1435 } else if (state->srate < 10000000) {
1440 if (STV090x_WRITE_DEMOD(state, CARFREQ, 0x4c) < 0) 1436 if (STV090x_WRITE_DEMOD(state, CARFREQ, 0x4c) < 0)
1441 goto err; 1437 goto err;
1438 if (STV090x_WRITE_DEMOD(state, CARHDR, 0x20) < 0)
1439 goto err;
1442 } else { 1440 } else {
1443 if (STV090x_WRITE_DEMOD(state, CARFREQ, 0x4b) < 0) 1441 if (STV090x_WRITE_DEMOD(state, CARFREQ, 0x4b) < 0)
1444 goto err; 1442 goto err;
1443 if (STV090x_WRITE_DEMOD(state, CARHDR, 0x20) < 0)
1444 goto err;
1445 } 1445 }
1446 } else { 1446 } else {
1447 if (state->srate < 10000000) { 1447 if (state->srate < 10000000) {
@@ -1489,8 +1489,8 @@ static int stv090x_get_agc2_min_level(struct stv090x_state *state)
1489 if (STV090x_WRITE_DEMOD(state, AGC2REF, 0x38) < 0) 1489 if (STV090x_WRITE_DEMOD(state, AGC2REF, 0x38) < 0)
1490 goto err; 1490 goto err;
1491 reg = STV090x_READ_DEMOD(state, DMDCFGMD); 1491 reg = STV090x_READ_DEMOD(state, DMDCFGMD);
1492 STV090x_SETFIELD_Px(reg, SCAN_ENABLE_FIELD, 1); 1492 STV090x_SETFIELD_Px(reg, SCAN_ENABLE_FIELD, 0);
1493 STV090x_SETFIELD_Px(reg, CFR_AUTOSCAN_FIELD, 1); 1493 STV090x_SETFIELD_Px(reg, CFR_AUTOSCAN_FIELD, 0);
1494 if (STV090x_WRITE_DEMOD(state, DMDCFGMD, reg) < 0) 1494 if (STV090x_WRITE_DEMOD(state, DMDCFGMD, reg) < 0)
1495 goto err; 1495 goto err;
1496 1496
@@ -1507,10 +1507,8 @@ static int stv090x_get_agc2_min_level(struct stv090x_state *state)
1507 if (stv090x_set_srate(state, 1000000) < 0) 1507 if (stv090x_set_srate(state, 1000000) < 0)
1508 goto err; 1508 goto err;
1509 1509
1510 steps = -1 + state->search_range / 1000000; 1510 steps = state->search_range / 1000000;
1511 steps /= 2; 1511 if (steps <= 0)
1512 steps = (2 * steps) + 1;
1513 if (steps < 0)
1514 steps = 1; 1512 steps = 1;
1515 1513
1516 dir = 1; 1514 dir = 1;
@@ -1596,13 +1594,15 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state)
1596 goto err; 1594 goto err;
1597 if (STV090x_WRITE_DEMOD(state, TMGCFG, 0x12) < 0) 1595 if (STV090x_WRITE_DEMOD(state, TMGCFG, 0x12) < 0)
1598 goto err; 1596 goto err;
1597 if (STV090x_WRITE_DEMOD(state, TMGCFG2, 0xc0) < 0)
1598 goto err;
1599 if (STV090x_WRITE_DEMOD(state, TMGTHRISE, 0xf0) < 0) 1599 if (STV090x_WRITE_DEMOD(state, TMGTHRISE, 0xf0) < 0)
1600 goto err; 1600 goto err;
1601 if (STV090x_WRITE_DEMOD(state, TMGTHFALL, 0xe0) < 0) 1601 if (STV090x_WRITE_DEMOD(state, TMGTHFALL, 0xe0) < 0)
1602 goto err; 1602 goto err;
1603 reg = STV090x_READ_DEMOD(state, DMDCFGMD); 1603 reg = STV090x_READ_DEMOD(state, DMDCFGMD);
1604 STV090x_SETFIELD_Px(reg, SCAN_ENABLE_FIELD, 1); 1604 STV090x_SETFIELD_Px(reg, SCAN_ENABLE_FIELD, 1);
1605 STV090x_SETFIELD_Px(reg, CFR_AUTOSCAN_FIELD, 1); 1605 STV090x_SETFIELD_Px(reg, CFR_AUTOSCAN_FIELD, 0);
1606 if (STV090x_WRITE_DEMOD(state, DMDCFGMD, reg) < 0) 1606 if (STV090x_WRITE_DEMOD(state, DMDCFGMD, reg) < 0)
1607 goto err; 1607 goto err;
1608 1608
@@ -1622,7 +1622,7 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state)
1622 if (state->dev_ver >= 0x30) { 1622 if (state->dev_ver >= 0x30) {
1623 if (STV090x_WRITE_DEMOD(state, CARFREQ, 0x99) < 0) 1623 if (STV090x_WRITE_DEMOD(state, CARFREQ, 0x99) < 0)
1624 goto err; 1624 goto err;
1625 if (STV090x_WRITE_DEMOD(state, SFRSTEP, 0x95) < 0) 1625 if (STV090x_WRITE_DEMOD(state, SFRSTEP, 0x98) < 0)
1626 goto err; 1626 goto err;
1627 1627
1628 } else if (state->dev_ver >= 0x20) { 1628 } else if (state->dev_ver >= 0x20) {
@@ -1657,9 +1657,16 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state)
1657 while ((!tmg_lock) && (cur_step < steps)) { 1657 while ((!tmg_lock) && (cur_step < steps)) {
1658 if (STV090x_WRITE_DEMOD(state, DMDISTATE, 0x5f) < 0) /* Demod RESET */ 1658 if (STV090x_WRITE_DEMOD(state, DMDISTATE, 0x5f) < 0) /* Demod RESET */
1659 goto err; 1659 goto err;
1660 reg = STV090x_READ_DEMOD(state, DMDISTATE); 1660 if (STV090x_WRITE_DEMOD(state, CFRINIT1, 0x00) < 0)
1661 STV090x_SETFIELD_Px(reg, I2C_DEMOD_MODE_FIELD, 0x00); /* trigger acquisition */ 1661 goto err;
1662 if (STV090x_WRITE_DEMOD(state, DMDISTATE, reg) < 0) 1662 if (STV090x_WRITE_DEMOD(state, CFRINIT0, 0x00) < 0)
1663 goto err;
1664 if (STV090x_WRITE_DEMOD(state, SFRINIT1, 0x00) < 0)
1665 goto err;
1666 if (STV090x_WRITE_DEMOD(state, SFRINIT0, 0x00) < 0)
1667 goto err;
1668 /* trigger acquisition */
1669 if (STV090x_WRITE_DEMOD(state, DMDISTATE, 0x40) < 0)
1663 goto err; 1670 goto err;
1664 msleep(50); 1671 msleep(50);
1665 for (i = 0; i < 10; i++) { 1672 for (i = 0; i < 10; i++) {
@@ -1744,7 +1751,7 @@ static u32 stv090x_srate_srch_fine(struct stv090x_state *state)
1744 else { 1751 else {
1745 if (STV090x_WRITE_DEMOD(state, DMDISTATE, 0x1f) < 0) /* Demod RESET */ 1752 if (STV090x_WRITE_DEMOD(state, DMDISTATE, 0x1f) < 0) /* Demod RESET */
1746 goto err; 1753 goto err;
1747 if (STV090x_WRITE_DEMOD(state, TMGCFG2, 0x01) < 0) 1754 if (STV090x_WRITE_DEMOD(state, TMGCFG2, 0xc1) < 0)
1748 goto err; 1755 goto err;
1749 if (STV090x_WRITE_DEMOD(state, TMGTHRISE, 0x20) < 0) 1756 if (STV090x_WRITE_DEMOD(state, TMGTHRISE, 0x20) < 0)
1750 goto err; 1757 goto err;
@@ -1869,8 +1876,8 @@ static int stv090x_blind_search(struct stv090x_state *state)
1869 u8 k_ref, k_max, k_min; 1876 u8 k_ref, k_max, k_min;
1870 int coarse_fail, lock; 1877 int coarse_fail, lock;
1871 1878
1872 k_max = 120; 1879 k_max = 110;
1873 k_min = 30; 1880 k_min = 10;
1874 1881
1875 agc2 = stv090x_get_agc2_min_level(state); 1882 agc2 = stv090x_get_agc2_min_level(state);
1876 1883
@@ -1933,7 +1940,7 @@ static int stv090x_blind_search(struct stv090x_state *state)
1933 1940
1934 lock = 0; 1941 lock = 0;
1935 } 1942 }
1936 k_ref -= 30; 1943 k_ref -= 20;
1937 } while ((k_ref >= k_min) && (!lock) && (!coarse_fail)); 1944 } while ((k_ref >= k_min) && (!lock) && (!coarse_fail));
1938 } 1945 }
1939 1946
@@ -2103,17 +2110,6 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd)
2103 goto err; 2110 goto err;
2104 2111
2105 STV090x_WRITE_DEMOD(state, DMDISTATE, 0x1c); 2112 STV090x_WRITE_DEMOD(state, DMDISTATE, 0x1c);
2106 if (state->delsys == STV090x_DVBS2) {
2107 reg = STV090x_READ_DEMOD(state, DMDCFGMD);
2108 STV090x_SETFIELD_Px(reg, DVBS1_ENABLE_FIELD, 0);
2109 STV090x_SETFIELD_Px(reg, DVBS2_ENABLE_FIELD, 0);
2110 if (STV090x_WRITE_DEMOD(state, DMDCFGMD, reg) < 0)
2111 goto err;
2112 STV090x_SETFIELD_Px(reg, DVBS1_ENABLE_FIELD, 1);
2113 STV090x_SETFIELD_Px(reg, DVBS2_ENABLE_FIELD, 1);
2114 if (STV090x_WRITE_DEMOD(state, DMDCFGMD, reg) < 0)
2115 goto err;
2116 }
2117 if (STV090x_WRITE_DEMOD(state, CFRINIT1, 0x00) < 0) 2113 if (STV090x_WRITE_DEMOD(state, CFRINIT1, 0x00) < 0)
2118 goto err; 2114 goto err;
2119 if (STV090x_WRITE_DEMOD(state, CFRINIT0, 0x00) < 0) 2115 if (STV090x_WRITE_DEMOD(state, CFRINIT0, 0x00) < 0)
@@ -2867,6 +2863,9 @@ static int stv090x_optimize_track(struct stv090x_state *state)
2867 if (stv090x_set_srate(state, srate) < 0) 2863 if (stv090x_set_srate(state, srate) < 0)
2868 goto err; 2864 goto err;
2869 blind_tune = 1; 2865 blind_tune = 1;
2866
2867 if (stv090x_dvbs_track_crl(state) < 0)
2868 goto err;
2870 } 2869 }
2871 2870
2872 if (state->dev_ver >= 0x20) { 2871 if (state->dev_ver >= 0x20) {
@@ -3064,8 +3063,13 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)
3064 goto err; 3063 goto err;
3065 3064
3066 if (state->dev_ver >= 0x20) { 3065 if (state->dev_ver >= 0x20) {
3067 if (STV090x_WRITE_DEMOD(state, CORRELABS, 0x9e) < 0) /* cut 2.0 */ 3066 if (state->srate > 5000000) {
3068 goto err; 3067 if (STV090x_WRITE_DEMOD(state, CORRELABS, 0x9e) < 0)
3068 goto err;
3069 } else {
3070 if (STV090x_WRITE_DEMOD(state, CORRELABS, 0x82) < 0)
3071 goto err;
3072 }
3069 } 3073 }
3070 3074
3071 stv090x_get_lock_tmg(state); 3075 stv090x_get_lock_tmg(state);