Lines Matching refs:internal

50 	struct stb0899_internal *internal = &state->internal;
55 return stb0899_calc_srate(internal->master_clk, sfr);
122 struct stb0899_internal *internal = &state->internal; in stb0899_carr_width() local
124 return (internal->srate + (internal->srate * internal->rolloff) / 100); in stb0899_carr_width()
133 struct stb0899_internal *internal = &state->internal; in stb0899_first_subrange() local
148 internal->sub_range = min(internal->srch_range, range); in stb0899_first_subrange()
150 internal->sub_range = 0; in stb0899_first_subrange()
152 internal->freq = params->freq; in stb0899_first_subrange()
153 internal->tuner_offst = 0L; in stb0899_first_subrange()
154 internal->sub_dir = 1; in stb0899_first_subrange()
164 struct stb0899_internal *internal = &state->internal; in stb0899_check_tmg() local
169 msleep(internal->t_derot); in stb0899_check_tmg()
178 internal->status = ANALOGCARRIER; in stb0899_check_tmg()
181 internal->status = TIMINGOK; in stb0899_check_tmg()
185 internal->status = NOTIMING; in stb0899_check_tmg()
188 return internal->status; in stb0899_check_tmg()
197 struct stb0899_internal *internal = &state->internal; in stb0899_search_tmg() local
204 internal->status = NOTIMING; in stb0899_search_tmg()
207 derot_limit = (internal->sub_range / 2L) / internal->mclk; in stb0899_search_tmg()
208 derot_step = (params->srate / 2L) / internal->mclk; in stb0899_search_tmg()
212 derot_freq += index * internal->direction * derot_step; /* next derot zig zag position */ in stb0899_search_tmg()
218 STB0899_SETFIELD_VAL(CFRM, cfr[0], MSB(internal->inversion * derot_freq)); in stb0899_search_tmg()
219 STB0899_SETFIELD_VAL(CFRL, cfr[1], LSB(internal->inversion * derot_freq)); in stb0899_search_tmg()
222 internal->direction = -internal->direction; /* Change zigzag direction */ in stb0899_search_tmg()
225 if (internal->status == TIMINGOK) { in stb0899_search_tmg()
227 internal->derot_freq = internal->inversion * MAKEWORD16(cfr[0], cfr[1]); in stb0899_search_tmg()
228 dprintk(state->verbose, FE_DEBUG, 1, "------->TIMING OK ! Derot Freq = %d", internal->derot_freq); in stb0899_search_tmg()
231 return internal->status; in stb0899_search_tmg()
240 struct stb0899_internal *internal = &state->internal; in stb0899_check_carrier() local
243 msleep(internal->t_derot); /* wait for derotator ok */ in stb0899_check_carrier()
252 internal->status = CARRIEROK; in stb0899_check_carrier()
255 internal->status = NOCARRIER; in stb0899_check_carrier()
259 return internal->status; in stb0899_check_carrier()
268 struct stb0899_internal *internal = &state->internal; in stb0899_search_carrier() local
275 internal->status = NOCARRIER; in stb0899_search_carrier()
276 derot_limit = (internal->sub_range / 2L) / internal->mclk; in stb0899_search_carrier()
277 derot_freq = internal->derot_freq; in stb0899_search_carrier()
284 dprintk(state->verbose, FE_DEBUG, 1, "Derot Freq=%d, mclk=%d", derot_freq, internal->mclk); in stb0899_search_carrier()
288 …derot_freq += index * internal->direction * internal->derot_step; /* next zig zag derotator positi… in stb0899_search_carrier()
298 STB0899_SETFIELD_VAL(CFRM, cfr[0], MSB(internal->inversion * derot_freq)); in stb0899_search_carrier()
299 STB0899_SETFIELD_VAL(CFRL, cfr[1], LSB(internal->inversion * derot_freq)); in stb0899_search_carrier()
304 internal->direction = -internal->direction; /* Change zigzag direction */ in stb0899_search_carrier()
305 } while ((internal->status != CARRIEROK) && next_loop); in stb0899_search_carrier()
307 if (internal->status == CARRIEROK) { in stb0899_search_carrier()
309 internal->derot_freq = internal->inversion * MAKEWORD16(cfr[0], cfr[1]); in stb0899_search_carrier()
310 dprintk(state->verbose, FE_DEBUG, 1, "----> CARRIER OK !, Derot Freq=%d", internal->derot_freq); in stb0899_search_carrier()
312 internal->derot_freq = last_derot_freq; in stb0899_search_carrier()
315 return internal->status; in stb0899_search_carrier()
324 struct stb0899_internal *internal = &state->internal; in stb0899_check_data() local
330 internal->status = NODATA; in stb0899_check_data()
366 internal->status = DATAOK; in stb0899_check_data()
370 return internal->status; in stb0899_check_data()
384 struct stb0899_internal *internal = &state->internal; in stb0899_search_data() local
387 derot_step = (params->srate / 4L) / internal->mclk; in stb0899_search_data()
388 derot_limit = (internal->sub_range / 2L) / internal->mclk; in stb0899_search_data()
389 derot_freq = internal->derot_freq; in stb0899_search_data()
392 if ((internal->status != CARRIEROK) || (stb0899_check_data(state) != DATAOK)) { in stb0899_search_data()
394 derot_freq += index * internal->direction * derot_step; /* next zig zag derotator position */ in stb0899_search_data()
399 dprintk(state->verbose, FE_DEBUG, 1, "Derot freq=%d, mclk=%d", derot_freq, internal->mclk); in stb0899_search_data()
404 STB0899_SETFIELD_VAL(CFRM, cfr[0], MSB(internal->inversion * derot_freq)); in stb0899_search_data()
405 STB0899_SETFIELD_VAL(CFRL, cfr[1], LSB(internal->inversion * derot_freq)); in stb0899_search_data()
412 internal->direction = -internal->direction; /* change zig zag direction */ in stb0899_search_data()
413 } while ((internal->status != DATAOK) && next_loop); in stb0899_search_data()
415 if (internal->status == DATAOK) { in stb0899_search_data()
421 internal->inversion = IQ_SWAP_ON; in stb0899_search_data()
423 internal->inversion = IQ_SWAP_OFF; in stb0899_search_data()
425 internal->derot_freq = internal->inversion * MAKEWORD16(cfr[0], cfr[1]); in stb0899_search_data()
426 dprintk(state->verbose, FE_DEBUG, 1, "------> DATAOK ! Derot Freq=%d", internal->derot_freq); in stb0899_search_data()
429 return internal->status; in stb0899_search_data()
438 struct stb0899_internal *internal = &state->internal; in stb0899_check_range() local
443 range_offst = internal->srch_range / 2000; in stb0899_check_range()
444 tp_freq = internal->freq - (internal->derot_freq * internal->mclk) / 1000; in stb0899_check_range()
447 internal->status = RANGEOK; in stb0899_check_range()
450 internal->status = OUTOFRANGE; in stb0899_check_range()
454 return internal->status; in stb0899_check_range()
463 struct stb0899_internal *internal = &state->internal; in next_sub_range() local
468 if (internal->sub_dir > 0) { in next_sub_range()
469 old_sub_range = internal->sub_range; in next_sub_range()
470 internal->sub_range = min((internal->srch_range / 2) - in next_sub_range()
471 (internal->tuner_offst + internal->sub_range / 2), in next_sub_range()
472 internal->sub_range); in next_sub_range()
474 if (internal->sub_range < 0) in next_sub_range()
475 internal->sub_range = 0; in next_sub_range()
477 internal->tuner_offst += (old_sub_range + internal->sub_range) / 2; in next_sub_range()
480 internal->freq = params->freq + (internal->sub_dir * internal->tuner_offst) / 1000; in next_sub_range()
481 internal->sub_dir = -internal->sub_dir; in next_sub_range()
492 struct stb0899_internal *internal = &state->internal; in stb0899_dvbs_algo() local
511 internal->direction = 1; in stb0899_dvbs_algo()
513 stb0899_set_srate(state, internal->master_clk, params->srate); in stb0899_dvbs_algo()
553 internal->derot_percent, params->srate, internal->mclk); in stb0899_dvbs_algo()
556internal->derot_step = internal->derot_percent * (params->srate / 1000L) / internal->mclk; /* Dero… in stb0899_dvbs_algo()
557 internal->t_derot = stb0899_calc_derot_time(params->srate); in stb0899_dvbs_algo()
558 internal->t_data = 500; in stb0899_dvbs_algo()
588 internal->derot_freq = 0; in stb0899_dvbs_algo()
589 internal->status = NOAGC1; in stb0899_dvbs_algo()
597 state->config->tuner_set_frequency(&state->frontend, internal->freq); in stb0899_dvbs_algo()
600 state->config->tuner_get_frequency(&state->frontend, &internal->freq); in stb0899_dvbs_algo()
602 msleep(internal->t_agc1 + internal->t_agc2 + internal->t_derot); /* AGC1, AGC2 and timing loop */ in stb0899_dvbs_algo()
603 dprintk(state->verbose, FE_DEBUG, 1, "current derot freq=%d", internal->derot_freq); in stb0899_dvbs_algo()
604 internal->status = AGC1OK; in stb0899_dvbs_algo()
618 if (internal->status == TIMINGOK) { in stb0899_dvbs_algo()
621 internal->derot_freq, internal->mclk); in stb0899_dvbs_algo()
626 internal->derot_freq, internal->mclk); in stb0899_dvbs_algo()
631 internal->derot_freq, internal->mclk); in stb0899_dvbs_algo()
636 internal->derot_freq, internal->mclk); in stb0899_dvbs_algo()
638 internal->freq = params->freq - ((internal->derot_freq * internal->mclk) / 1000); in stb0899_dvbs_algo()
640 internal->fecrate = STB0899_GETFIELD(VITCURPUN, reg); in stb0899_dvbs_algo()
643 params->freq, internal->freq); in stb0899_dvbs_algo()
647 internal->fecrate); in stb0899_dvbs_algo()
652 if (internal->status != RANGEOK) in stb0899_dvbs_algo()
655 } while (internal->sub_range && internal->status != RANGEOK); in stb0899_dvbs_algo()
661 if (internal->status == RANGEOK) { in stb0899_dvbs_algo()
671 switch (internal->fecrate) { in stb0899_dvbs_algo()
719 return internal->status; in stb0899_dvbs_algo()
728 struct stb0899_internal *internal = &state->internal; in stb0899_dvbs2_config_uwp() local
740 STB0899_SETFIELD_VAL(FE_COARSE_TRK, uwp2, internal->av_frame_coarse); in stb0899_dvbs2_config_uwp()
741 STB0899_SETFIELD_VAL(FE_FINE_TRK, uwp2, internal->av_frame_fine); in stb0899_dvbs2_config_uwp()
789 struct stb0899_internal *internal = &state->internal; in stb0899_dvbs2_calc_srate() local
795 dec_ratio = (internal->master_clk * 2) / (5 * internal->srate); in stb0899_dvbs2_calc_srate()
799 master_clk = internal->master_clk / 1000; in stb0899_dvbs2_calc_srate()
800 srate = internal->srate / 1000; in stb0899_dvbs2_calc_srate()
820 struct stb0899_internal *internal = &state->internal; in stb0899_dvbs2_calc_dev() local
823 dec_ratio = (internal->master_clk * 2) / (5 * internal->srate); in stb0899_dvbs2_calc_dev()
826 master_clk = internal->master_clk / 1000; /* for integer Calculation*/ in stb0899_dvbs2_calc_dev()
827 srate = internal->srate / 1000; /* for integer Calculation*/ in stb0899_dvbs2_calc_dev()
839 struct stb0899_internal *internal = &state->internal; in stb0899_dvbs2_set_srate() local
846 dec_ratio = (internal->master_clk * 2) / (5 * internal->srate); in stb0899_dvbs2_set_srate()
856 f_sym = internal->master_clk / ((decim * internal->srate) / 1000); in stb0899_dvbs2_set_srate()
883 freq_adj = internal->srate / (internal->master_clk / 4096); in stb0899_dvbs2_set_srate()
893 struct stb0899_internal *internal = &state->internal; in stb0899_dvbs2_set_btr_loopbw() local
902 dec_ratio = (internal->master_clk * 2) / (5 * internal->srate); in stb0899_dvbs2_set_btr_loopbw()
908 K = (1 << config->btr_nco_bits) / (internal->master_clk / 1000); in stb0899_dvbs2_set_btr_loopbw()
909 K *= (internal->srate / 1000000) * decim; /*k=k 10^-8*/ in stb0899_dvbs2_set_btr_loopbw()
969 struct stb0899_internal *internal = &state->internal; in stb0899_dvbs2_init_calc() local
981 if (internal->srate / 1000000 >= 15) in stb0899_dvbs2_init_calc()
983 else if (internal->srate / 1000000 >= 10) in stb0899_dvbs2_init_calc()
985 else if (internal->srate / 1000000 >= 5) in stb0899_dvbs2_init_calc()
990 range = internal->srch_range / 1000000; in stb0899_dvbs2_init_calc()
991 steps = (10 * range * (1 << 17)) / (step_size * (internal->srate / 1000000)); in stb0899_dvbs2_init_calc()
995 stb0899_dvbs2_set_carr_freq(state, internal->center_freq - in stb0899_dvbs2_init_calc()
996 (internal->step_size * (internal->srate / 20000000)), in stb0899_dvbs2_init_calc()
997 (internal->master_clk) / 1000000); in stb0899_dvbs2_init_calc()
999 stb0899_dvbs2_set_carr_freq(state, internal->center_freq, (internal->master_clk) / 1000000); in stb0899_dvbs2_init_calc()
1163 struct stb0899_internal *internal = &state->internal; in stb0899_dvbs2_init_csm() local
1169 if (((internal->master_clk / internal->srate) <= 4) && (modcod <= 11) && (pilots == 1)) { in stb0899_dvbs2_init_csm()
1270 struct stb0899_internal *internal = &state->internal; in stb0899_dvbs2_get_srate() local
1285 intval1 = internal->master_clk / (1 << div1); in stb0899_dvbs2_get_srate()
1288 rem1 = internal->master_clk % (1 << div1); in stb0899_dvbs2_get_srate()
1304 struct stb0899_internal *internal = &state->internal; in stb0899_dvbs2_algo() local
1311 if (internal->srate <= 2000000) { in stb0899_dvbs2_algo()
1314 } else if (internal->srate <= 5000000) { in stb0899_dvbs2_algo()
1317 } else if (internal->srate <= 10000000) { in stb0899_dvbs2_algo()
1320 } else if (internal->srate <= 15000000) { in stb0899_dvbs2_algo()
1323 } else if (internal->srate <= 20000000) { in stb0899_dvbs2_algo()
1326 } else if (internal->srate <= 25000000) { in stb0899_dvbs2_algo()
1344 state->config->tuner_set_frequency(&state->frontend, internal->freq); in stb0899_dvbs2_algo()
1346 state->config->tuner_get_frequency(&state->frontend, &internal->freq); in stb0899_dvbs2_algo()
1365 switch (internal->inversion) { in stb0899_dvbs2_algo()
1377 internal->status = stb0899_dvbs2_get_dmd_status(state, searchTime); in stb0899_dvbs2_algo()
1379 if (internal->status == DVBS2_DEMOD_LOCK) { in stb0899_dvbs2_algo()
1383 internal->status = stb0899_dvbs2_get_fec_status(state, FecLockTime); in stb0899_dvbs2_algo()
1386 while ((internal->status != DVBS2_FEC_LOCK) && (i < 3)) { in stb0899_dvbs2_algo()
1395 internal->status = stb0899_dvbs2_get_fec_status(state, searchTime); in stb0899_dvbs2_algo()
1400 if (internal->status != DVBS2_FEC_LOCK) { in stb0899_dvbs2_algo()
1410 internal->status = stb0899_dvbs2_get_dmd_status(state, searchTime); in stb0899_dvbs2_algo()
1411 if (internal->status == DVBS2_DEMOD_LOCK) { in stb0899_dvbs2_algo()
1414 internal->status = stb0899_dvbs2_get_fec_status(state, FecLockTime); in stb0899_dvbs2_algo()
1416 while ((internal->status != DVBS2_FEC_LOCK) && (i < 3)) { in stb0899_dvbs2_algo()
1426 internal->status = stb0899_dvbs2_get_fec_status(state, searchTime); in stb0899_dvbs2_algo()
1435 if (internal->status == DVBS2_FEC_LOCK) { in stb0899_dvbs2_algo()
1441 if ((((10 * internal->master_clk) / (internal->srate / 10)) <= 410) && in stb0899_dvbs2_algo()
1447 internal->status = stb0899_dvbs2_get_fec_status(state, FecLockTime); in stb0899_dvbs2_algo()
1450 while ((internal->status != DVBS2_FEC_LOCK) && (i < 3)) { in stb0899_dvbs2_algo()
1458 internal->status = stb0899_dvbs2_get_fec_status(state, FecLockTime); in stb0899_dvbs2_algo()
1463 if ((((10 * internal->master_clk) / (internal->srate / 10)) <= 410) && in stb0899_dvbs2_algo()
1484 offsetfreq *= (internal->master_clk / 1000000); in stb0899_dvbs2_algo()
1489 internal->inversion = IQ_SWAP_ON; in stb0899_dvbs2_algo()
1491 internal->inversion = IQ_SWAP_OFF; in stb0899_dvbs2_algo()
1493 internal->freq = internal->freq + offsetfreq; in stb0899_dvbs2_algo()
1494 internal->srate = stb0899_dvbs2_get_srate(state); in stb0899_dvbs2_algo()
1497 internal->modcod = STB0899_GETFIELD(UWP_DECODE_MOD, reg) >> 2; in stb0899_dvbs2_algo()
1498 internal->pilots = STB0899_GETFIELD(UWP_DECODE_MOD, reg) & 0x01; in stb0899_dvbs2_algo()
1499 internal->frame_length = (STB0899_GETFIELD(UWP_DECODE_MOD, reg) >> 1) & 0x01; in stb0899_dvbs2_algo()
1506 if (INRANGE(STB0899_QPSK_12, internal->modcod, STB0899_QPSK_23)) in stb0899_dvbs2_algo()
1521 return internal->status; in stb0899_dvbs2_algo()