diff options
author | Andreas Regel <andreas.regel@gmx.de> | 2009-11-13 16:17:45 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-05 15:41:30 -0500 |
commit | a4978a83e51324aed08b1f1105a58f7e6491b751 (patch) | |
tree | 2e3827ea6be328bc893755f3d17f76f06207154c | |
parent | b4a4248d56a6985f5d37fc5a219ba0675fc6f503 (diff) |
V4L/DVB (13356): stv090x: fixes signal lock logic
This patch contains several fixes for the stv090x driver:
- added missing else
- use calculated timeout instead of fixed one
- use correct frequency when doing zigzag scan
- added missing read of GENCFG register
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>
-rw-r--r-- | drivers/media/dvb/frontends/stv090x.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c index 8c0d351405f3..a2ec0ed48832 100644 --- a/drivers/media/dvb/frontends/stv090x.c +++ b/drivers/media/dvb/frontends/stv090x.c | |||
@@ -1436,9 +1436,7 @@ static int stv090x_start_search(struct stv090x_state *state) | |||
1436 | } | 1436 | } |
1437 | if (STV090x_WRITE_DEMOD(state, CARHDR, 0x40) < 0) | 1437 | if (STV090x_WRITE_DEMOD(state, CARHDR, 0x40) < 0) |
1438 | goto err; | 1438 | goto err; |
1439 | } | 1439 | } else if (state->srate < 10000000) { |
1440 | |||
1441 | if (state->srate < 10000000) { | ||
1442 | if (STV090x_WRITE_DEMOD(state, CARFREQ, 0x4c) < 0) | 1440 | if (STV090x_WRITE_DEMOD(state, CARFREQ, 0x4c) < 0) |
1443 | goto err; | 1441 | goto err; |
1444 | } else { | 1442 | } else { |
@@ -1689,7 +1687,7 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state) | |||
1689 | goto err; | 1687 | goto err; |
1690 | 1688 | ||
1691 | if (state->config->tuner_set_frequency) { | 1689 | if (state->config->tuner_set_frequency) { |
1692 | if (state->config->tuner_set_frequency(fe, state->frequency) < 0) | 1690 | if (state->config->tuner_set_frequency(fe, freq) < 0) |
1693 | goto err; | 1691 | goto err; |
1694 | } | 1692 | } |
1695 | 1693 | ||
@@ -1867,7 +1865,7 @@ static int stv090x_get_dmdlock(struct stv090x_state *state, s32 timeout) | |||
1867 | static int stv090x_blind_search(struct stv090x_state *state) | 1865 | static int stv090x_blind_search(struct stv090x_state *state) |
1868 | { | 1866 | { |
1869 | u32 agc2, reg, srate_coarse; | 1867 | u32 agc2, reg, srate_coarse; |
1870 | s32 timeout_dmd = 500, cpt_fail, agc2_ovflw, i; | 1868 | s32 cpt_fail, agc2_ovflw, i; |
1871 | u8 k_ref, k_max, k_min; | 1869 | u8 k_ref, k_max, k_min; |
1872 | int coarse_fail, lock; | 1870 | int coarse_fail, lock; |
1873 | 1871 | ||
@@ -1911,7 +1909,8 @@ static int stv090x_blind_search(struct stv090x_state *state) | |||
1911 | srate_coarse = stv090x_srate_srch_fine(state); | 1909 | srate_coarse = stv090x_srate_srch_fine(state); |
1912 | if (srate_coarse != 0) { | 1910 | if (srate_coarse != 0) { |
1913 | stv090x_get_lock_tmg(state); | 1911 | stv090x_get_lock_tmg(state); |
1914 | lock = stv090x_get_dmdlock(state, timeout_dmd); | 1912 | lock = stv090x_get_dmdlock(state, |
1913 | state->DemodTimeout); | ||
1915 | } else { | 1914 | } else { |
1916 | lock = 0; | 1915 | lock = 0; |
1917 | } | 1916 | } |
@@ -2073,7 +2072,7 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd) | |||
2073 | goto err; | 2072 | goto err; |
2074 | 2073 | ||
2075 | if (state->config->tuner_set_frequency) { | 2074 | if (state->config->tuner_set_frequency) { |
2076 | if (state->config->tuner_set_frequency(fe, state->frequency) < 0) | 2075 | if (state->config->tuner_set_frequency(fe, freq) < 0) |
2077 | goto err; | 2076 | goto err; |
2078 | } | 2077 | } |
2079 | 2078 | ||
@@ -3053,7 +3052,7 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state) | |||
3053 | struct dvb_frontend *fe = &state->frontend; | 3052 | struct dvb_frontend *fe = &state->frontend; |
3054 | enum stv090x_signal_state signal_state = STV090x_NOCARRIER; | 3053 | enum stv090x_signal_state signal_state = STV090x_NOCARRIER; |
3055 | u32 reg; | 3054 | u32 reg; |
3056 | s32 timeout_dmd = 500, timeout_fec = 50, agc1_power, power_iq = 0, i; | 3055 | s32 agc1_power, power_iq = 0, i; |
3057 | int lock = 0, low_sr = 0, no_signal = 0; | 3056 | int lock = 0, low_sr = 0, no_signal = 0; |
3058 | 3057 | ||
3059 | reg = STV090x_READ_DEMOD(state, TSCFGH); | 3058 | reg = STV090x_READ_DEMOD(state, TSCFGH); |
@@ -3218,10 +3217,10 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state) | |||
3218 | lock = stv090x_blind_search(state); | 3217 | lock = stv090x_blind_search(state); |
3219 | 3218 | ||
3220 | else if (state->algo == STV090x_COLD_SEARCH) | 3219 | else if (state->algo == STV090x_COLD_SEARCH) |
3221 | lock = stv090x_get_coldlock(state, timeout_dmd); | 3220 | lock = stv090x_get_coldlock(state, state->DemodTimeout); |
3222 | 3221 | ||
3223 | else if (state->algo == STV090x_WARM_SEARCH) | 3222 | else if (state->algo == STV090x_WARM_SEARCH) |
3224 | lock = stv090x_get_dmdlock(state, timeout_dmd); | 3223 | lock = stv090x_get_dmdlock(state, state->DemodTimeout); |
3225 | 3224 | ||
3226 | if ((!lock) && (state->algo == STV090x_COLD_SEARCH)) { | 3225 | if ((!lock) && (state->algo == STV090x_COLD_SEARCH)) { |
3227 | if (!low_sr) { | 3226 | if (!low_sr) { |
@@ -3256,8 +3255,9 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state) | |||
3256 | goto err; | 3255 | goto err; |
3257 | } | 3256 | } |
3258 | 3257 | ||
3259 | if (stv090x_get_lock(state, timeout_fec, timeout_fec)) { | 3258 | lock = stv090x_get_lock(state, state->FecTimeout, |
3260 | lock = 1; | 3259 | state->FecTimeout); |
3260 | if (lock) { | ||
3261 | if (state->delsys == STV090x_DVBS2) { | 3261 | if (state->delsys == STV090x_DVBS2) { |
3262 | stv090x_set_s2rolloff(state); | 3262 | stv090x_set_s2rolloff(state); |
3263 | 3263 | ||
@@ -3284,7 +3284,6 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state) | |||
3284 | if (STV090x_WRITE_DEMOD(state, ERRCTRL2, 0xc1) < 0) | 3284 | if (STV090x_WRITE_DEMOD(state, ERRCTRL2, 0xc1) < 0) |
3285 | goto err; | 3285 | goto err; |
3286 | } else { | 3286 | } else { |
3287 | lock = 0; | ||
3288 | signal_state = STV090x_NODATA; | 3287 | signal_state = STV090x_NODATA; |
3289 | no_signal = stv090x_chk_signal(state); | 3288 | no_signal = stv090x_chk_signal(state); |
3290 | } | 3289 | } |
@@ -3769,6 +3768,8 @@ static int stv090x_ldpc_mode(struct stv090x_state *state, enum stv090x_mode ldpc | |||
3769 | { | 3768 | { |
3770 | u32 reg = 0; | 3769 | u32 reg = 0; |
3771 | 3770 | ||
3771 | reg = stv090x_read_reg(state, STV090x_GENCFG); | ||
3772 | |||
3772 | switch (ldpc_mode) { | 3773 | switch (ldpc_mode) { |
3773 | case STV090x_DUAL: | 3774 | case STV090x_DUAL: |
3774 | default: | 3775 | default: |