aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorAndreas Regel <andreas.regel@gmx.de>2009-04-16 07:40:36 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 17:20:40 -0400
commit4e58a6827a7d67f65d166d28635ac13bdf65dbb0 (patch)
tree1a716a1beafdc6ba54c32db7340aa3ac11c8e6e1 /drivers/media/dvb
parentf2b2fd401343b188f251b29ec2981ea8054ce1b7 (diff)
V4L/DVB (11593): stv090x: Fix Rolloff
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.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c
index 3e0acd7cc822..db3c09183a22 100644
--- a/drivers/media/dvb/frontends/stv090x.c
+++ b/drivers/media/dvb/frontends/stv090x.c
@@ -807,9 +807,24 @@ err:
807 return -1; 807 return -1;
808} 808}
809 809
810static u32 stv090x_car_width(u32 srate, u32 rolloff) 810static u32 stv090x_car_width(u32 srate, enum stv090x_rolloff rolloff)
811{ 811{
812 return srate + (srate * rolloff) / 100; 812 u32 ro;
813
814 switch (rolloff) {
815 case STV090x_RO_20:
816 ro = 20;
817 break;
818 case STV090x_RO_25:
819 ro = 25;
820 break;
821 case STV090x_RO_35:
822 default:
823 ro = 35;
824 break;
825 }
826
827 return srate + (srate * ro) / 100;
813} 828}
814 829
815static int stv090x_set_vit_thacq(struct stv090x_state *state) 830static int stv090x_set_vit_thacq(struct stv090x_state *state)
@@ -1148,12 +1163,12 @@ static int stv090x_delivery_search(struct stv090x_state *state)
1148 if (STV090x_WRITE_DEMOD(state, DMDCFGMD, reg) < 0) 1163 if (STV090x_WRITE_DEMOD(state, DMDCFGMD, reg) < 0)
1149 goto err; 1164 goto err;
1150 1165
1151 if (stv090x_vitclk_ctl(state, 1) < 0) 1166 if (stv090x_vitclk_ctl(state, 0) < 0)
1152 goto err; 1167 goto err;
1153 1168
1154 if (STV090x_WRITE_DEMOD(state, ACLC, 0x1a) < 0) 1169 if (STV090x_WRITE_DEMOD(state, ACLC, 0x1a) < 0)
1155 goto err; 1170 goto err;
1156 if (STV090x_WRITE_DEMOD(state, ACLC, 0x09) < 0) 1171 if (STV090x_WRITE_DEMOD(state, BCLC, 0x09) < 0)
1157 goto err; 1172 goto err;
1158 if (STV090x_WRITE_DEMOD(state, CAR2CFG, 0x26) < 0) 1173 if (STV090x_WRITE_DEMOD(state, CAR2CFG, 0x26) < 0)
1159 goto err; 1174 goto err;
@@ -2904,7 +2919,7 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)
2904 enum stv090x_signal_state signal_state = STV090x_NOCARRIER; 2919 enum stv090x_signal_state signal_state = STV090x_NOCARRIER;
2905 u32 reg; 2920 u32 reg;
2906 s32 timeout_dmd = 500, timeout_fec = 50; 2921 s32 timeout_dmd = 500, timeout_fec = 50;
2907 int lock = 0, low_sr, no_signal = 0; 2922 int lock = 0, low_sr = 0, no_signal = 0;
2908 2923
2909 reg = STV090x_READ_DEMOD(state, TSCFGH); 2924 reg = STV090x_READ_DEMOD(state, TSCFGH);
2910 STV090x_SETFIELD_Px(reg, RST_HWARE_FIELD, 1); /* Stop path 1 stream merger */ 2925 STV090x_SETFIELD_Px(reg, RST_HWARE_FIELD, 1); /* Stop path 1 stream merger */
@@ -2948,7 +2963,7 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)
2948 if (STV090x_WRITE_DEMOD(state, KREFTMG, 0x5a) < 0) 2963 if (STV090x_WRITE_DEMOD(state, KREFTMG, 0x5a) < 0)
2949 goto err; 2964 goto err;
2950 if (state->algo == STV090x_COLD_SEARCH) 2965 if (state->algo == STV090x_COLD_SEARCH)
2951 state->tuner_bw = (15 * (stv090x_car_width(state->srate, state->rolloff) + 1000000)) / 10; 2966 state->tuner_bw = (15 * (stv090x_car_width(state->srate, state->rolloff) + 10000000)) / 10;
2952 else if (state->algo == STV090x_WARM_SEARCH) 2967 else if (state->algo == STV090x_WARM_SEARCH)
2953 state->tuner_bw = stv090x_car_width(state->srate, state->rolloff) + 10000000; 2968 state->tuner_bw = stv090x_car_width(state->srate, state->rolloff) + 10000000;
2954 } else { 2969 } else {
@@ -2963,6 +2978,8 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)
2963 stv090x_set_min_srate(state, state->mclk, state->srate); 2978 stv090x_set_min_srate(state, state->mclk, state->srate);
2964 2979
2965 if (state->srate >= 10000000) 2980 if (state->srate >= 10000000)
2981 low_sr = 0;
2982 else
2966 low_sr = 1; 2983 low_sr = 1;
2967 } 2984 }
2968 2985
@@ -3000,7 +3017,7 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)
3000 if (STV090x_WRITE_DEMOD(state, DEMOD, reg) < 0) 3017 if (STV090x_WRITE_DEMOD(state, DEMOD, reg) < 0)
3001 goto err; 3018 goto err;
3002 stv090x_delivery_search(state); 3019 stv090x_delivery_search(state);
3003 if (state->algo == STV090x_BLIND_SEARCH) 3020 if (state->algo != STV090x_BLIND_SEARCH)
3004 stv090x_start_search(state); 3021 stv090x_start_search(state);
3005 3022
3006 if (state->dev_ver == 0x12) { 3023 if (state->dev_ver == 0x12) {
@@ -3117,6 +3134,10 @@ static enum dvbfe_search stv090x_search(struct dvb_frontend *fe, struct dvb_fron
3117 state->delsys = props->delivery_system; 3134 state->delsys = props->delivery_system;
3118 state->frequency = p->frequency; 3135 state->frequency = p->frequency;
3119 state->srate = p->u.qpsk.symbol_rate; 3136 state->srate = p->u.qpsk.symbol_rate;
3137 state->search_mode = STV090x_SEARCH_AUTO;
3138 state->algo = STV090x_COLD_SEARCH;
3139 state->fec = STV090x_PRERR;
3140 state->search_range = 2000000;
3120 3141
3121 if (!stv090x_algo(state)) { 3142 if (!stv090x_algo(state)) {
3122 dprintk(FE_DEBUG, 1, "Search success!"); 3143 dprintk(FE_DEBUG, 1, "Search success!");
@@ -4008,7 +4029,7 @@ struct dvb_frontend *stv090x_attach(const struct stv090x_config *config,
4008 state->demod = demod; 4029 state->demod = demod;
4009 state->demod_mode = config->demod_mode; /* Single or Dual mode */ 4030 state->demod_mode = config->demod_mode; /* Single or Dual mode */
4010 state->device = config->device; 4031 state->device = config->device;
4011 state->rolloff = 35; /* default */ 4032 state->rolloff = STV090x_RO_35; /* default */
4012 4033
4013 if (state->demod == STV090x_DEMODULATOR_0) 4034 if (state->demod == STV090x_DEMODULATOR_0)
4014 mutex_init(&demod_lock); 4035 mutex_init(&demod_lock);