Lines Matching refs:state

60 static u32 stb0899_get_srate(struct stb0899_state *state)
62 struct stb0899_internal *internal = &state->internal;
65 stb0899_read_regs(state, STB0899_SFRH, sfr, 3);
78 static u32 stb0899_set_srate(struct stb0899_state *state, u32 master_clk, u32 srate) in stb0899_set_srate() argument
83 dprintk(state->verbose, FE_DEBUG, 1, "-->"); in stb0899_set_srate()
108 stb0899_write_regs(state, STB0899_SFRH, sfr, 3); in stb0899_set_srate()
132 long stb0899_carr_width(struct stb0899_state *state) in stb0899_carr_width() argument
134 struct stb0899_internal *internal = &state->internal; in stb0899_carr_width()
143 static void stb0899_first_subrange(struct stb0899_state *state) in stb0899_first_subrange() argument
145 struct stb0899_internal *internal = &state->internal; in stb0899_first_subrange()
146 struct stb0899_params *params = &state->params; in stb0899_first_subrange()
147 struct stb0899_config *config = state->config; in stb0899_first_subrange()
153 stb0899_i2c_gate_ctrl(&state->frontend, 1); in stb0899_first_subrange()
154 config->tuner_get_bandwidth(&state->frontend, &bandwidth); in stb0899_first_subrange()
155 stb0899_i2c_gate_ctrl(&state->frontend, 0); in stb0899_first_subrange()
156 range = bandwidth - stb0899_carr_width(state) / 2; in stb0899_first_subrange()
174 static enum stb0899_status stb0899_check_tmg(struct stb0899_state *state) in stb0899_check_tmg() argument
176 struct stb0899_internal *internal = &state->internal; in stb0899_check_tmg()
183 stb0899_write_reg(state, STB0899_RTF, 0xf2); in stb0899_check_tmg()
184 reg = stb0899_read_reg(state, STB0899_TLIR); in stb0899_check_tmg()
186 timing = stb0899_read_reg(state, STB0899_RTF); in stb0899_check_tmg()
191 dprintk(state->verbose, FE_DEBUG, 1, "-->ANALOG Carrier !"); in stb0899_check_tmg()
194 dprintk(state->verbose, FE_DEBUG, 1, "------->TIMING OK !"); in stb0899_check_tmg()
198 dprintk(state->verbose, FE_DEBUG, 1, "-->NO TIMING !"); in stb0899_check_tmg()
207 static enum stb0899_status stb0899_search_tmg(struct stb0899_state *state) in stb0899_search_tmg() argument
209 struct stb0899_internal *internal = &state->internal; in stb0899_search_tmg()
210 struct stb0899_params *params = &state->params; in stb0899_search_tmg()
222 while ((stb0899_check_tmg(state) != TIMINGOK) && next_loop) { in stb0899_search_tmg()
232 stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator frequency */ in stb0899_search_tmg()
238 stb0899_read_regs(state, STB0899_CFRM, cfr, 2); /* get derotator frequency */ in stb0899_search_tmg()
240 dprintk(state->verbose, FE_DEBUG, 1, "------->TIMING OK ! Derot Freq = %d", internal->derot_freq); in stb0899_search_tmg()
250 static enum stb0899_status stb0899_check_carrier(struct stb0899_state *state) in stb0899_check_carrier() argument
252 struct stb0899_internal *internal = &state->internal; in stb0899_check_carrier()
257 reg = stb0899_read_reg(state, STB0899_CFD); in stb0899_check_carrier()
259 stb0899_write_reg(state, STB0899_CFD, reg); in stb0899_check_carrier()
261 reg = stb0899_read_reg(state, STB0899_DSTATUS); in stb0899_check_carrier()
262 dprintk(state->verbose, FE_DEBUG, 1, "--------------------> STB0899_DSTATUS=[0x%02x]", reg); in stb0899_check_carrier()
265 dprintk(state->verbose, FE_DEBUG, 1, "-------------> CARRIEROK !"); in stb0899_check_carrier()
268 dprintk(state->verbose, FE_DEBUG, 1, "-------------> NOCARRIER !"); in stb0899_check_carrier()
278 static enum stb0899_status stb0899_search_carrier(struct stb0899_state *state) in stb0899_search_carrier() argument
280 struct stb0899_internal *internal = &state->internal; in stb0899_search_carrier()
291 reg = stb0899_read_reg(state, STB0899_CFD); in stb0899_search_carrier()
293 stb0899_write_reg(state, STB0899_CFD, reg); in stb0899_search_carrier()
296 dprintk(state->verbose, FE_DEBUG, 1, "Derot Freq=%d, mclk=%d", derot_freq, internal->mclk); in stb0899_search_carrier()
297 if (stb0899_check_carrier(state) == NOCARRIER) { in stb0899_search_carrier()
306 reg = stb0899_read_reg(state, STB0899_CFD); in stb0899_search_carrier()
308 stb0899_write_reg(state, STB0899_CFD, reg); in stb0899_search_carrier()
312 stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator frequency */ in stb0899_search_carrier()
320 stb0899_read_regs(state, STB0899_CFRM, cfr, 2); /* get derotator frequency */ in stb0899_search_carrier()
322 dprintk(state->verbose, FE_DEBUG, 1, "----> CARRIER OK !, Derot Freq=%d", internal->derot_freq); in stb0899_search_carrier()
334 static enum stb0899_status stb0899_check_data(struct stb0899_state *state) in stb0899_check_data() argument
336 struct stb0899_internal *internal = &state->internal; in stb0899_check_data()
337 struct stb0899_params *params = &state->params; in stb0899_check_data()
345 reg = stb0899_read_reg(state, STB0899_TSTRES); in stb0899_check_data()
347 stb0899_write_reg(state, STB0899_TSTRES, reg); in stb0899_check_data()
349 reg = stb0899_read_reg(state, STB0899_TSTRES); in stb0899_check_data()
351 stb0899_write_reg(state, STB0899_TSTRES, reg); in stb0899_check_data()
363 stb0899_read_reg(state, STB0899_VSTATUS); in stb0899_check_data()
365 stb0899_write_reg(state, STB0899_DSTATUS2, 0x00); /* force search loop */ in stb0899_check_data()
368 reg = stb0899_read_reg(state, STB0899_VSTATUS); in stb0899_check_data()
379 dprintk(state->verbose, FE_DEBUG, 1, "-----------------> DATA OK !"); in stb0899_check_data()
389 static enum stb0899_status stb0899_search_data(struct stb0899_state *state) in stb0899_search_data() argument
396 struct stb0899_internal *internal = &state->internal; in stb0899_search_data()
397 struct stb0899_params *params = &state->params; in stb0899_search_data()
404 if ((internal->status != CARRIEROK) || (stb0899_check_data(state) != DATAOK)) { in stb0899_search_data()
411 dprintk(state->verbose, FE_DEBUG, 1, "Derot freq=%d, mclk=%d", derot_freq, internal->mclk); in stb0899_search_data()
412 reg = stb0899_read_reg(state, STB0899_CFD); in stb0899_search_data()
414 stb0899_write_reg(state, STB0899_CFD, reg); in stb0899_search_data()
418 stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator frequency */ in stb0899_search_data()
420 stb0899_check_carrier(state); in stb0899_search_data()
428 stb0899_read_regs(state, STB0899_CFRM, cfr, 2); /* get derotator frequency */ in stb0899_search_data()
431 reg = stb0899_read_reg(state, STB0899_IQSWAP); in stb0899_search_data()
438 dprintk(state->verbose, FE_DEBUG, 1, "------> DATAOK ! Derot Freq=%d", internal->derot_freq); in stb0899_search_data()
448 static enum stb0899_status stb0899_check_range(struct stb0899_state *state) in stb0899_check_range() argument
450 struct stb0899_internal *internal = &state->internal; in stb0899_check_range()
451 struct stb0899_params *params = &state->params; in stb0899_check_range()
460 dprintk(state->verbose, FE_DEBUG, 1, "----> RANGEOK !"); in stb0899_check_range()
463 dprintk(state->verbose, FE_DEBUG, 1, "----> OUT OF RANGE !"); in stb0899_check_range()
473 static void next_sub_range(struct stb0899_state *state) in next_sub_range() argument
475 struct stb0899_internal *internal = &state->internal; in next_sub_range()
476 struct stb0899_params *params = &state->params; in next_sub_range()
501 enum stb0899_status stb0899_dvbs_algo(struct stb0899_state *state) in stb0899_dvbs_algo() argument
503 struct stb0899_params *params = &state->params; in stb0899_dvbs_algo()
504 struct stb0899_internal *internal = &state->internal; in stb0899_dvbs_algo()
505 struct stb0899_config *config = state->config; in stb0899_dvbs_algo()
525 stb0899_set_srate(state, internal->master_clk, params->srate); in stb0899_dvbs_algo()
528 stb0899_write_reg(state, STB0899_ACLC, 0x89); in stb0899_dvbs_algo()
529 bclc = stb0899_read_reg(state, STB0899_BCLC); in stb0899_dvbs_algo()
531 stb0899_write_reg(state, STB0899_BCLC, bclc); in stb0899_dvbs_algo()
534 stb0899_write_reg(state, STB0899_ACLC, 0xc9); in stb0899_dvbs_algo()
535 bclc = stb0899_read_reg(state, STB0899_BCLC); in stb0899_dvbs_algo()
537 stb0899_write_reg(state, STB0899_BCLC, bclc); in stb0899_dvbs_algo()
540 stb0899_write_reg(state, STB0899_ACLC, 0x89); in stb0899_dvbs_algo()
541 bclc = stb0899_read_reg(state, STB0899_BCLC); in stb0899_dvbs_algo()
543 stb0899_write_reg(state, STB0899_BCLC, bclc); in stb0899_dvbs_algo()
546 stb0899_write_reg(state, STB0899_ACLC, 0xc8); in stb0899_dvbs_algo()
547 bclc = stb0899_read_reg(state, STB0899_BCLC); in stb0899_dvbs_algo()
549 stb0899_write_reg(state, STB0899_BCLC, bclc); in stb0899_dvbs_algo()
553 dprintk(state->verbose, FE_DEBUG, 1, "Set the timing loop to acquisition"); in stb0899_dvbs_algo()
555 stb0899_write_reg(state, STB0899_RTC, 0x46); in stb0899_dvbs_algo()
556 stb0899_write_reg(state, STB0899_CFD, 0xee); in stb0899_dvbs_algo()
564 dprintk(state->verbose, FE_DEBUG, 1, "Derot Percent=%d Srate=%d mclk=%d", in stb0899_dvbs_algo()
572 dprintk(state->verbose, FE_DEBUG, 1, "RESET stream merger"); in stb0899_dvbs_algo()
574 reg = stb0899_read_reg(state, STB0899_TSTRES); in stb0899_dvbs_algo()
576 stb0899_write_reg(state, STB0899_TSTRES, reg); in stb0899_dvbs_algo()
582 reg = stb0899_read_reg(state, STB0899_DEMAPVIT); in stb0899_dvbs_algo()
584 stb0899_write_reg(state, STB0899_DEMAPVIT, reg); in stb0899_dvbs_algo()
586 stb0899_write_reg(state, STB0899_EQON, 0x01); /* Equalizer OFF while acquiring */ in stb0899_dvbs_algo()
587 stb0899_write_reg(state, STB0899_VITSYNC, 0x19); in stb0899_dvbs_algo()
589 stb0899_first_subrange(state); in stb0899_dvbs_algo()
593 stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* RESET derotator frequency */ in stb0899_dvbs_algo()
595 stb0899_write_reg(state, STB0899_RTF, 0); in stb0899_dvbs_algo()
596 reg = stb0899_read_reg(state, STB0899_CFD); in stb0899_dvbs_algo()
598 stb0899_write_reg(state, STB0899_CFD, reg); in stb0899_dvbs_algo()
604 stb0899_i2c_gate_ctrl(&state->frontend, 1); in stb0899_dvbs_algo()
607 dprintk(state->verbose, FE_DEBUG, 1, "Tuner set frequency"); in stb0899_dvbs_algo()
608 if (state->config->tuner_set_frequency) in stb0899_dvbs_algo()
609 state->config->tuner_set_frequency(&state->frontend, internal->freq); in stb0899_dvbs_algo()
611 if (state->config->tuner_get_frequency) in stb0899_dvbs_algo()
612 state->config->tuner_get_frequency(&state->frontend, &internal->freq); in stb0899_dvbs_algo()
615 dprintk(state->verbose, FE_DEBUG, 1, "current derot freq=%d", internal->derot_freq); in stb0899_dvbs_algo()
620 config->tuner_get_bandwidth(&state->frontend, &bandwidth); in stb0899_dvbs_algo()
623 stb0899_i2c_gate_ctrl(&state->frontend, 0); in stb0899_dvbs_algo()
626 stb0899_search_tmg(state); /* For low rates (SCPC) */ in stb0899_dvbs_algo()
628 stb0899_check_tmg(state); /* For high rates (MCPC) */ in stb0899_dvbs_algo()
631 dprintk(state->verbose, FE_DEBUG, 1, in stb0899_dvbs_algo()
635 if (stb0899_search_carrier(state) == CARRIEROK) { /* Search for carrier */ in stb0899_dvbs_algo()
636 dprintk(state->verbose, FE_DEBUG, 1, in stb0899_dvbs_algo()
640 if (stb0899_search_data(state) == DATAOK) { /* Check for data */ in stb0899_dvbs_algo()
641 dprintk(state->verbose, FE_DEBUG, 1, in stb0899_dvbs_algo()
645 if (stb0899_check_range(state) == RANGEOK) { in stb0899_dvbs_algo()
646 dprintk(state->verbose, FE_DEBUG, 1, in stb0899_dvbs_algo()
651 reg = stb0899_read_reg(state, STB0899_PLPARM); in stb0899_dvbs_algo()
653 dprintk(state->verbose, FE_DEBUG, 1, in stb0899_dvbs_algo()
657 dprintk(state->verbose, FE_DEBUG, 1, in stb0899_dvbs_algo()
665 next_sub_range(state); in stb0899_dvbs_algo()
670 stb0899_write_reg(state, STB0899_RTC, 0x33); in stb0899_dvbs_algo()
671 stb0899_write_reg(state, STB0899_CFD, 0xf7); in stb0899_dvbs_algo()
674 dprintk(state->verbose, FE_DEBUG, 1, "Locked & Range OK !"); in stb0899_dvbs_algo()
675 stb0899_write_reg(state, STB0899_EQON, 0x41); /* Equalizer OFF while acquiring */ in stb0899_dvbs_algo()
676 stb0899_write_reg(state, STB0899_VITSYNC, 0x39); /* SN to b'11 for acquisition */ in stb0899_dvbs_algo()
682 reg = stb0899_read_reg(state, STB0899_BCLC); in stb0899_dvbs_algo()
685 stb0899_write_reg(state, STB0899_DEMAPVIT, 0x1a); in stb0899_dvbs_algo()
687 stb0899_write_reg(state, STB0899_BCLC, reg); in stb0899_dvbs_algo()
690 stb0899_write_reg(state, STB0899_DEMAPVIT, 44); in stb0899_dvbs_algo()
692 stb0899_write_reg(state, STB0899_BCLC, reg); in stb0899_dvbs_algo()
695 stb0899_write_reg(state, STB0899_DEMAPVIT, 60); in stb0899_dvbs_algo()
697 stb0899_write_reg(state, STB0899_BCLC, reg); in stb0899_dvbs_algo()
700 stb0899_write_reg(state, STB0899_DEMAPVIT, 75); in stb0899_dvbs_algo()
702 stb0899_write_reg(state, STB0899_BCLC, reg); in stb0899_dvbs_algo()
705 stb0899_write_reg(state, STB0899_DEMAPVIT, 88); in stb0899_dvbs_algo()
706 stb0899_write_reg(state, STB0899_ACLC, 0x88); in stb0899_dvbs_algo()
707 stb0899_write_reg(state, STB0899_BCLC, 0x9a); in stb0899_dvbs_algo()
710 stb0899_write_reg(state, STB0899_DEMAPVIT, 94); in stb0899_dvbs_algo()
712 stb0899_write_reg(state, STB0899_BCLC, reg); in stb0899_dvbs_algo()
715 dprintk(state->verbose, FE_DEBUG, 1, "Unsupported Puncture Rate"); in stb0899_dvbs_algo()
719 reg = stb0899_read_reg(state, STB0899_TSTRES); in stb0899_dvbs_algo()
721 stb0899_write_reg(state, STB0899_TSTRES, reg); in stb0899_dvbs_algo()
724 reg = stb0899_read_reg(state, STB0899_CFD); in stb0899_dvbs_algo()
726 stb0899_write_reg(state, STB0899_CFD, reg); in stb0899_dvbs_algo()
728 stb0899_read_regs(state, STB0899_EQUAI1, eq_const, 10); in stb0899_dvbs_algo()
738 static void stb0899_dvbs2_config_uwp(struct stb0899_state *state) in stb0899_dvbs2_config_uwp() argument
740 struct stb0899_internal *internal = &state->internal; in stb0899_dvbs2_config_uwp()
741 struct stb0899_config *config = state->config; in stb0899_dvbs2_config_uwp()
759 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_UWP_CNTRL1, STB0899_OFF0_UWP_CNTRL1, uwp1… in stb0899_dvbs2_config_uwp()
760 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_UWP_CNTRL2, STB0899_OFF0_UWP_CNTRL2, uwp2… in stb0899_dvbs2_config_uwp()
761 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_UWP_CNTRL3, STB0899_OFF0_UWP_CNTRL3, uwp3… in stb0899_dvbs2_config_uwp()
765 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_SOF_SRCH_TO, STB0899_OFF0_SOF_SRCH_TO, re… in stb0899_dvbs2_config_uwp()
772 static void stb0899_dvbs2_config_csm_auto(struct stb0899_state *state) in stb0899_dvbs2_config_csm_auto() argument
778 stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CSM_CNTRL1, STB0899_OFF0_CSM_CNTRL1, reg); in stb0899_dvbs2_config_csm_auto()
799 static u32 stb0899_dvbs2_calc_srate(struct stb0899_state *state) in stb0899_dvbs2_calc_srate() argument
801 struct stb0899_internal *internal = &state->internal; in stb0899_dvbs2_calc_srate()
802 struct stb0899_config *config = state->config; in stb0899_dvbs2_calc_srate()
830 static u32 stb0899_dvbs2_calc_dev(struct stb0899_state *state) in stb0899_dvbs2_calc_dev() argument
832 struct stb0899_internal *internal = &state->internal; in stb0899_dvbs2_calc_dev()
849 static void stb0899_dvbs2_set_srate(struct stb0899_state *state) in stb0899_dvbs2_set_srate() argument
851 struct stb0899_internal *internal = &state->internal; in stb0899_dvbs2_set_srate()
876 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_DECIM_CNTRL, STB0899_OFF0_DECIM_CNTRL, de… in stb0899_dvbs2_set_srate()
885 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_ANTI_ALIAS_SEL, STB0899_OFF0_ANTI_ALIAS_S… in stb0899_dvbs2_set_srate()
886 btr_nom_freq = stb0899_dvbs2_calc_srate(state); in stb0899_dvbs2_set_srate()
887 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_BTR_NOM_FREQ, STB0899_OFF0_BTR_NOM_FREQ, … in stb0899_dvbs2_set_srate()
889 correction = stb0899_dvbs2_calc_dev(state); in stb0899_dvbs2_set_srate()
892 stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_BTR_CNTRL, STB0899_OFF0_BTR_CNTRL, reg); in stb0899_dvbs2_set_srate()
896 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_FREQ_ADJ_SCALE, STB0899_OFF0_FREQ_ADJ_SCA… in stb0899_dvbs2_set_srate()
903 static void stb0899_dvbs2_set_btr_loopbw(struct stb0899_state *state) in stb0899_dvbs2_set_btr_loopbw() argument
905 struct stb0899_internal *internal = &state->internal; in stb0899_dvbs2_set_btr_loopbw()
906 struct stb0899_config *config = state->config; in stb0899_dvbs2_set_btr_loopbw()
954 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_BTR_LOOP_GAIN, STB0899_OFF0_BTR_LOOP_GAIN… in stb0899_dvbs2_set_btr_loopbw()
956 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_BTR_LOOP_GAIN, STB0899_OFF0_BTR_LOOP_GAIN… in stb0899_dvbs2_set_btr_loopbw()
963 static void stb0899_dvbs2_set_carr_freq(struct stb0899_state *state, s32 carr_freq, u32 master_clk) in stb0899_dvbs2_set_carr_freq() argument
965 struct stb0899_config *config = state->config; in stb0899_dvbs2_set_carr_freq()
973 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CRL_NOM_FREQ, STB0899_OFF0_CRL_NOM_FREQ, … in stb0899_dvbs2_set_carr_freq()
980 static void stb0899_dvbs2_init_calc(struct stb0899_state *state) in stb0899_dvbs2_init_calc() argument
982 struct stb0899_internal *internal = &state->internal; in stb0899_dvbs2_init_calc()
987 stb0899_dvbs2_config_uwp(state); in stb0899_dvbs2_init_calc()
988 stb0899_dvbs2_config_csm_auto(state); in stb0899_dvbs2_init_calc()
991 stb0899_dvbs2_set_srate(state); in stb0899_dvbs2_init_calc()
992 stb0899_dvbs2_set_btr_loopbw(state); in stb0899_dvbs2_init_calc()
1008 stb0899_dvbs2_set_carr_freq(state, internal->center_freq - in stb0899_dvbs2_init_calc()
1012 stb0899_dvbs2_set_carr_freq(state, internal->center_freq, (internal->master_clk) / 1000000); in stb0899_dvbs2_init_calc()
1019 stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_ACQ_CNTRL2, STB0899_OFF0_ACQ_CNTRL2, reg); in stb0899_dvbs2_init_calc()
1026 static void stb0899_dvbs2_btr_init(struct stb0899_state *state) in stb0899_dvbs2_btr_init() argument
1034 stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_BTR_CNTRL, STB0899_OFF0_BTR_CNTRL, reg); in stb0899_dvbs2_btr_init()
1037 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_BTR_FREQ_INIT, STB0899_OFF0_BTR_FREQ_INIT… in stb0899_dvbs2_btr_init()
1038 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_BTR_FREQ_INIT, STB0899_OFF0_BTR_FREQ_INIT… in stb0899_dvbs2_btr_init()
1041 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_BTR_PHS_INIT, STB0899_OFF0_BTR_PHS_INIT, … in stb0899_dvbs2_btr_init()
1042 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_BTR_PHS_INIT, STB0899_OFF0_BTR_PHS_INIT, … in stb0899_dvbs2_btr_init()
1049 static void stb0899_dvbs2_reacquire(struct stb0899_state *state) in stb0899_dvbs2_reacquire() argument
1055 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_RESET_CNTRL, STB0899_OFF0_RESET_CNTRL, re… in stb0899_dvbs2_reacquire()
1058 stb0899_dvbs2_btr_init(state); in stb0899_dvbs2_reacquire()
1061 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CRL_FREQ_INIT, STB0899_OFF0_CRL_FREQ_INIT… in stb0899_dvbs2_reacquire()
1062 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CRL_FREQ_INIT, STB0899_OFF0_CRL_FREQ_INIT… in stb0899_dvbs2_reacquire()
1063 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CRL_LOOP_GAIN, STB0899_OFF0_CRL_LOOP_GAIN… in stb0899_dvbs2_reacquire()
1064 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CRL_PHS_INIT, STB0899_OFF0_CRL_PHS_INIT, … in stb0899_dvbs2_reacquire()
1065 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CRL_PHS_INIT, STB0899_OFF0_CRL_PHS_INIT, … in stb0899_dvbs2_reacquire()
1070 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_RESET_CNTRL, STB0899_OFF0_RESET_CNTRL, re… in stb0899_dvbs2_reacquire()
1073 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_ACQUIRE_TRIG, STB0899_OFF0_ACQUIRE_TRIG, … in stb0899_dvbs2_reacquire()
1074 stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_LOCK_LOST, STB0899_OFF0_LOCK_LOST, 0); in stb0899_dvbs2_reacquire()
1077 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_EQUALIZER_INIT, STB0899_OFF0_EQUALIZER_IN… in stb0899_dvbs2_reacquire()
1080 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_EQUALIZER_INIT, STB0899_OFF0_EQUALIZER_IN… in stb0899_dvbs2_reacquire()
1087 stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_EQ_CNTRL, STB0899_OFF0_EQ_CNTRL, reg); in stb0899_dvbs2_reacquire()
1090 stb0899_write_reg(state, STB0899_PDELCTRL, 0x4a); in stb0899_dvbs2_reacquire()
1097 static enum stb0899_status stb0899_dvbs2_get_dmd_status(struct stb0899_state *state, int timeout) in stb0899_dvbs2_get_dmd_status() argument
1104 dprintk(state->verbose, FE_DEBUG, 1, "DMD_STATUS=[0x%02x]", reg); in stb0899_dvbs2_get_dmd_status()
1106 dprintk(state->verbose, FE_DEBUG, 1, "------------->IF AGC LOCKED !"); in stb0899_dvbs2_get_dmd_status()
1108 dprintk(state->verbose, FE_DEBUG, 1, "----------->DMD STAT2=[0x%02x]", reg); in stb0899_dvbs2_get_dmd_status()
1120 dprintk(state->verbose, FE_DEBUG, 1, "----------------> DVB-S2 LOCK !"); in stb0899_dvbs2_get_dmd_status()
1131 static int stb0899_dvbs2_get_data_lock(struct stb0899_state *state, int timeout) in stb0899_dvbs2_get_data_lock() argument
1137 reg = stb0899_read_reg(state, STB0899_CFGPDELSTATUS1); in stb0899_dvbs2_get_data_lock()
1138 dprintk(state->verbose, FE_DEBUG, 1, "---------> CFGPDELSTATUS=[0x%02x]", reg); in stb0899_dvbs2_get_data_lock()
1150 static enum stb0899_status stb0899_dvbs2_get_fec_status(struct stb0899_state *state, int timeout) in stb0899_dvbs2_get_fec_status() argument
1155 Locked = stb0899_dvbs2_get_data_lock(state, 1); in stb0899_dvbs2_get_fec_status()
1162 dprintk(state->verbose, FE_DEBUG, 1, "---------->DVB-S2 FEC LOCK !"); in stb0899_dvbs2_get_fec_status()
1174 static void stb0899_dvbs2_init_csm(struct stb0899_state *state, int pilots, enum stb0899_modcod mod… in stb0899_dvbs2_init_csm() argument
1176 struct stb0899_internal *internal = &state->internal; in stb0899_dvbs2_init_csm()
1251 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CSM_CNTRL1, STB0899_OFF0_CSM_CNTRL1, csm1… in stb0899_dvbs2_init_csm()
1270 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CSM_CNTRL1, STB0899_OFF0_CSM_CNTRL1, csm1… in stb0899_dvbs2_init_csm()
1271 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CSM_CNTRL2, STB0899_OFF0_CSM_CNTRL2, csm2… in stb0899_dvbs2_init_csm()
1272 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CSM_CNTRL3, STB0899_OFF0_CSM_CNTRL3, csm3… in stb0899_dvbs2_init_csm()
1273 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CSM_CNTRL4, STB0899_OFF0_CSM_CNTRL4, csm4… in stb0899_dvbs2_init_csm()
1281 static u32 stb0899_dvbs2_get_srate(struct stb0899_state *state) in stb0899_dvbs2_get_srate() argument
1283 struct stb0899_internal *internal = &state->internal; in stb0899_dvbs2_get_srate()
1284 struct stb0899_config *config = state->config; in stb0899_dvbs2_get_srate()
1315 enum stb0899_status stb0899_dvbs2_algo(struct stb0899_state *state) in stb0899_dvbs2_algo() argument
1317 struct stb0899_internal *internal = &state->internal; in stb0899_dvbs2_algo()
1348 reg = stb0899_read_reg(state, STB0899_TSTRES); in stb0899_dvbs2_algo()
1350 stb0899_write_reg(state, STB0899_TSTRES, reg); in stb0899_dvbs2_algo()
1353 stb0899_i2c_gate_ctrl(&state->frontend, 1); in stb0899_dvbs2_algo()
1356 if (state->config->tuner_set_frequency) in stb0899_dvbs2_algo()
1357 state->config->tuner_set_frequency(&state->frontend, internal->freq); in stb0899_dvbs2_algo()
1358 if (state->config->tuner_get_frequency) in stb0899_dvbs2_algo()
1359 state->config->tuner_get_frequency(&state->frontend, &internal->freq); in stb0899_dvbs2_algo()
1362 stb0899_i2c_gate_ctrl(&state->frontend, 0); in stb0899_dvbs2_algo()
1368 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_IF_AGC_CNTRL, STB0899_OFF0_IF_AGC_CNTRL, … in stb0899_dvbs2_algo()
1372 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_IF_AGC_CNTRL2, STB0899_OFF0_IF_AGC_CNTRL2… in stb0899_dvbs2_algo()
1375 stb0899_dvbs2_init_calc(state); in stb0899_dvbs2_algo()
1386 stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_DMD_CNTRL2, STB0899_OFF0_DMD_CNTRL2, reg); in stb0899_dvbs2_algo()
1387 stb0899_dvbs2_reacquire(state); in stb0899_dvbs2_algo()
1390 internal->status = stb0899_dvbs2_get_dmd_status(state, searchTime); in stb0899_dvbs2_algo()
1393 dprintk(state->verbose, FE_DEBUG, 1, "------------> DVB-S2 DEMOD LOCK !"); in stb0899_dvbs2_algo()
1396 internal->status = stb0899_dvbs2_get_fec_status(state, FecLockTime); in stb0899_dvbs2_algo()
1406 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CRL_NOM_FREQ, STB0899_OFF0_CRL_NOM_FREQ, … in stb0899_dvbs2_algo()
1407 stb0899_dvbs2_reacquire(state); in stb0899_dvbs2_algo()
1408 internal->status = stb0899_dvbs2_get_fec_status(state, searchTime); in stb0899_dvbs2_algo()
1418 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_DMD_CNTRL2, STB0899_OFF0_DMD_CNTRL2, reg); in stb0899_dvbs2_algo()
1420 stb0899_dvbs2_reacquire(state); in stb0899_dvbs2_algo()
1423 internal->status = stb0899_dvbs2_get_dmd_status(state, searchTime); in stb0899_dvbs2_algo()
1427 internal->status = stb0899_dvbs2_get_fec_status(state, FecLockTime); in stb0899_dvbs2_algo()
1436 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CRL_NOM_FREQ, STB0899_OFF0_CRL_NOM_FREQ, … in stb0899_dvbs2_algo()
1438 stb0899_dvbs2_reacquire(state); in stb0899_dvbs2_algo()
1439 internal->status = stb0899_dvbs2_get_fec_status(state, searchTime); in stb0899_dvbs2_algo()
1449 dprintk(state->verbose, FE_DEBUG, 1, "----------------> DVB-S2 FEC Lock !"); in stb0899_dvbs2_algo()
1458 stb0899_dvbs2_init_csm(state, pilots, modcod); in stb0899_dvbs2_algo()
1460 internal->status = stb0899_dvbs2_get_fec_status(state, FecLockTime); in stb0899_dvbs2_algo()
1466 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CSM_CNTRL1, STB0899_OFF0_CSM_CNTRL1, csm1… in stb0899_dvbs2_algo()
1469 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CSM_CNTRL1, STB0899_OFF0_CSM_CNTRL1, csm1… in stb0899_dvbs2_algo()
1471 internal->status = stb0899_dvbs2_get_fec_status(state, FecLockTime); in stb0899_dvbs2_algo()
1483 stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_EQ_CNTRL, STB0899_OFF0_EQ_CNTRL, reg); in stb0899_dvbs2_algo()
1489 stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_EQ_CNTRL, STB0899_OFF0_EQ_CNTRL, reg); in stb0899_dvbs2_algo()
1507 internal->srate = stb0899_dvbs2_get_srate(state); in stb0899_dvbs2_algo()
1522 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_IF_AGC_CNTRL, STB0899_OFF0_IF_AGC_CNTRL, … in stb0899_dvbs2_algo()
1526 …stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_IF_AGC_CNTRL2, STB0899_OFF0_IF_AGC_CNTRL2… in stb0899_dvbs2_algo()
1530 reg = stb0899_read_reg(state, STB0899_TSTRES); in stb0899_dvbs2_algo()
1532 stb0899_write_reg(state, STB0899_TSTRES, reg); in stb0899_dvbs2_algo()