Lines Matching +full:120 +full:- +full:db

1 // SPDX-License-Identifier: GPL-2.0-or-later
30 /* C/N in dB/10, NIRM/NIRL */
40 { 120, 4360 },
54 /* DVB-S AGCIQ_VALUE vs. signal level in dBm/10.
56 * -8.0 to -50.0 dBm directly connected,
57 * -52.0 to -74.8 with extra attenuation.
58 * Cut-off to AGCIQ_VALUE = 0x80 below -74.8dBm.
59 * Crude linear extrapolation below -84.8dBm and above -8.0dBm.
62 { -750, -128 },
63 { -748, -94 },
64 { -745, -92 },
65 { -735, -90 },
66 { -720, -87 },
67 { -670, -77 },
68 { -640, -70 },
69 { -610, -62 },
70 { -600, -60 },
71 { -590, -56 },
72 { -560, -41 },
73 { -540, -25 },
74 { -530, -17 },
75 { -520, -11 },
76 { -500, 1 },
77 { -490, 6 },
78 { -480, 10 },
79 { -440, 22 },
80 { -420, 27 },
81 { -400, 31 },
82 { -380, 34 },
83 { -340, 40 },
84 { -320, 43 },
85 { -280, 48 },
86 { -250, 52 },
87 { -230, 55 },
88 { -180, 61 },
89 { -140, 66 },
90 { -90, 73 },
91 { -80, 74 },
95 /* DVB-S2 IF_AGC_GAIN vs. signal level in dBm/10.
97 * -8.0 to -50.1 dBm directly connected,
98 * -53.0 to -76.6 with extra attenuation.
99 * Cut-off to IF_AGC_GAIN = 0x3fff below -76.6dBm.
100 * Crude linear extrapolation below -76.6dBm and above -8.0dBm.
104 { -80, 3217 },
105 { -150, 3893 },
106 { -190, 4217 },
107 { -240, 4621 },
108 { -280, 4945 },
109 { -320, 5273 },
110 { -350, 5545 },
111 { -370, 5741 },
112 { -410, 6147 },
113 { -450, 6671 },
114 { -490, 7413 },
115 { -501, 7665 },
116 { -530, 8767 },
117 { -560, 10219 },
118 { -580, 10939 },
119 { -590, 11518 },
120 { -600, 11723 },
121 { -650, 12659 },
122 { -690, 13219 },
123 { -730, 13645 },
124 { -750, 13909 },
125 { -766, 14153 },
126 { -950, 16383 }
129 /* DVB-S2 Es/N0 quant in dB/100 vs read value * 100*/
172 /* DVB-S2 Es/N0 estimate in dB/100 vs read value */
222 .addr = state->config->demod_address, in _stb0899_read_reg()
227 .addr = state->config->demod_address, in _stb0899_read_reg()
234 ret = i2c_transfer(state->i2c, msg, 2); in _stb0899_read_reg()
236 if (ret != -ERESTARTSYS) in _stb0899_read_reg()
237 dprintk(state->verbose, FE_ERROR, 1, in _stb0899_read_reg()
241 return ret < 0 ? ret : -EREMOTEIO; in _stb0899_read_reg()
243 if (unlikely(*state->verbose >= FE_DEBUGREG)) in _stb0899_read_reg()
244 dprintk(state->verbose, FE_ERROR, 1, "Reg=[0x%02x], data=%02x", in _stb0899_read_reg()
291 .addr = state->config->demod_address, in _stb0899_read_s2reg()
298 .addr = state->config->demod_address, in _stb0899_read_s2reg()
305 .addr = state->config->demod_address, in _stb0899_read_s2reg()
318 status = i2c_transfer(state->i2c, &msg_0, 1); in _stb0899_read_s2reg()
320 if (status != -ERESTARTSYS) in _stb0899_read_s2reg()
328 status = i2c_transfer(state->i2c, &msg_1, 1); in _stb0899_read_s2reg()
332 status = i2c_transfer(state->i2c, &msg_r, 1); in _stb0899_read_s2reg()
340 status = i2c_transfer(state->i2c, &msg_1, 1); in _stb0899_read_s2reg()
342 if (status != -ERESTARTSYS) in _stb0899_read_s2reg()
348 status = i2c_transfer(state->i2c, &msg_r, 1); in _stb0899_read_s2reg()
350 if (status != -ERESTARTSYS) in _stb0899_read_s2reg()
353 return status < 0 ? status : -EREMOTEIO; in _stb0899_read_s2reg()
357 if (unlikely(*state->verbose >= FE_DEBUGREG)) in _stb0899_read_s2reg()
364 return status < 0 ? status : -EREMOTEIO; in _stb0899_read_s2reg()
394 .addr = state->config->demod_address, in stb0899_write_s2reg()
401 .addr = state->config->demod_address, in stb0899_write_s2reg()
414 if (unlikely(*state->verbose >= FE_DEBUGREG)) in stb0899_write_s2reg()
418 status = i2c_transfer(state->i2c, &msg_0, 1); in stb0899_write_s2reg()
420 if (status != -ERESTARTSYS) in stb0899_write_s2reg()
425 status = i2c_transfer(state->i2c, &msg_1, 1); in stb0899_write_s2reg()
427 if (status != -ERESTARTSYS) in stb0899_write_s2reg()
431 return status < 0 ? status : -EREMOTEIO; in stb0899_write_s2reg()
437 return status < 0 ? status : -EREMOTEIO; in stb0899_write_s2reg()
448 .addr = state->config->demod_address, in stb0899_read_regs()
453 .addr = state->config->demod_address, in stb0899_read_regs()
460 status = i2c_transfer(state->i2c, msg, 2); in stb0899_read_regs()
462 if (status != -ERESTARTSYS) in stb0899_read_regs()
476 dprintk(state->verbose, FE_DEBUGREG, 1, in stb0899_read_regs()
481 return status < 0 ? status : -EREMOTEIO; in stb0899_read_regs()
489 .addr = state->config->demod_address, in stb0899_write_regs()
499 return -EINVAL; in stb0899_write_regs()
506 dprintk(state->verbose, FE_DEBUGREG, 1, in stb0899_write_regs()
508 ret = i2c_transfer(state->i2c, &i2c_msg, 1); in stb0899_write_regs()
519 if (ret != -ERESTARTSYS) in stb0899_write_regs()
520 dprintk(state->verbose, FE_ERROR, 1, "Reg=[0x%04x], Data=[0x%02x ...], Count=%u, Status=%d", in stb0899_write_regs()
522 return ret < 0 ? ret : -EREMOTEIO; in stb0899_write_regs()
544 mclk = (div + 1) * state->config->xtal_freq / 6; in stb0899_get_mclk()
545 dprintk(state->verbose, FE_DEBUG, 1, "div=%d, mclk=%d", div, mclk); in stb0899_get_mclk()
558 struct stb0899_internal *internal = &state->internal; in stb0899_set_mclk()
561 dprintk(state->verbose, FE_DEBUG, 1, "state->config=%p", state->config); in stb0899_set_mclk()
562 mdiv = ((6 * Mclk) / state->config->xtal_freq) - 1; in stb0899_set_mclk()
563 dprintk(state->verbose, FE_DEBUG, 1, "mdiv=%d", mdiv); in stb0899_set_mclk()
566 internal->master_clk = stb0899_get_mclk(state); in stb0899_set_mclk()
568 dprintk(state->verbose, FE_DEBUG, 1, "MasterCLOCK=%d", internal->master_clk); in stb0899_set_mclk()
573 struct stb0899_config *config = state->config; in stb0899_postproc()
574 const struct stb0899_postproc *postproc = config->postproc; in stb0899_postproc()
595 struct stb0899_state *state = fe->demodulator_priv; in stb0899_detach()
603 struct stb0899_state *state = fe->demodulator_priv; in stb0899_release()
605 dprintk(state->verbose, FE_DEBUG, 1, "Release Frontend"); in stb0899_release()
630 struct stb0899_internal *internal = &state->internal; in stb0899_init_calc()
640 internal->t_agc1 = 0; in stb0899_init_calc()
641 internal->t_agc2 = 0; in stb0899_init_calc()
642 internal->master_clk = master_clk; in stb0899_init_calc()
643 internal->mclk = master_clk / 65536L; in stb0899_init_calc()
644 internal->rolloff = stb0899_get_alpha(state); in stb0899_init_calc()
648 internal->agc_gain = 8154; in stb0899_init_calc()
650 STB0899_SETFIELD_VAL(IF_GAIN_INIT, reg, internal->agc_gain); in stb0899_init_calc()
654 internal->rrc_alpha = STB0899_GETFIELD(RRC_ALPHA, reg); in stb0899_init_calc()
656 internal->center_freq = 0; in stb0899_init_calc()
657 internal->av_frame_coarse = 10; in stb0899_init_calc()
658 internal->av_frame_fine = 20; in stb0899_init_calc()
659 internal->step_size = 2; in stb0899_init_calc()
661 if ((pParams->SpectralInv == FE_IQ_NORMAL) || (pParams->SpectralInv == FE_IQ_AUTO)) in stb0899_init_calc()
662 pParams->IQLocked = 0; in stb0899_init_calc()
664 pParams->IQLocked = 1; in stb0899_init_calc()
678 dprintk(state->verbose, FE_ERROR, 1, "timed out !!"); in stb0899_wait_diseqc_fifo_empty()
679 return -ETIMEDOUT; in stb0899_wait_diseqc_fifo_empty()
688 struct stb0899_state *state = fe->demodulator_priv; in stb0899_send_diseqc_msg()
691 if (cmd->msg_len > sizeof(cmd->msg)) in stb0899_send_diseqc_msg()
692 return -EINVAL; in stb0899_send_diseqc_msg()
698 for (i = 0; i < cmd->msg_len; i++) { in stb0899_send_diseqc_msg()
701 return -ETIMEDOUT; in stb0899_send_diseqc_msg()
703 stb0899_write_reg(state, STB0899_DISFIFO, cmd->msg[i]); in stb0899_send_diseqc_msg()
720 dprintk(state->verbose, FE_ERROR, 1, "timed out!!"); in stb0899_wait_diseqc_rxidle()
721 return -ETIMEDOUT; in stb0899_wait_diseqc_rxidle()
731 struct stb0899_state *state = fe->demodulator_priv; in stb0899_recv_slave_reply()
736 return -ETIMEDOUT; in stb0899_recv_slave_reply()
744 if (length > sizeof (reply->msg)) { in stb0899_recv_slave_reply()
745 result = -EOVERFLOW; in stb0899_recv_slave_reply()
748 reply->msg_len = length; in stb0899_recv_slave_reply()
752 reply->msg[i] = stb0899_read_reg(state, STB0899_DISFIFO); in stb0899_recv_slave_reply()
769 dprintk(state->verbose, FE_ERROR, 1, "timed out!!"); in stb0899_wait_diseqc_txidle()
770 return -ETIMEDOUT; in stb0899_wait_diseqc_txidle()
780 struct stb0899_state *state = fe->demodulator_priv; in stb0899_send_diseqc_burst()
785 return -ETIMEDOUT; in stb0899_send_diseqc_burst()
808 return -ETIMEDOUT; in stb0899_send_diseqc_burst()
840 state->rx_freq = 20000; in stb0899_diseqc_init()
847 struct stb0899_state *state = fe->demodulator_priv; in stb0899_sleep()
851 dprintk(state->verbose, FE_DEBUG, 1, "Going to Sleep .. (Really tired .. :-))"); in stb0899_sleep()
861 struct stb0899_state *state = fe->demodulator_priv; in stb0899_wakeup()
865 /* Activate all clocks; DVB-S2 registers are inaccessible otherwise. */ in stb0899_wakeup()
880 struct stb0899_state *state = fe->demodulator_priv; in stb0899_init()
881 struct stb0899_config *config = state->config; in stb0899_init()
883 dprintk(state->verbose, FE_DEBUG, 1, "Initializing STB0899 ... "); in stb0899_init()
886 dprintk(state->verbose, FE_DEBUG, 1, "init device"); in stb0899_init()
887 for (i = 0; config->init_dev[i].address != 0xffff; i++) in stb0899_init()
888 stb0899_write_reg(state, config->init_dev[i].address, config->init_dev[i].data); in stb0899_init()
890 dprintk(state->verbose, FE_DEBUG, 1, "init S2 demod"); in stb0899_init()
892 for (i = 0; config->init_s2_demod[i].offset != 0xffff; i++) in stb0899_init()
894 config->init_s2_demod[i].base_address, in stb0899_init()
895 config->init_s2_demod[i].offset, in stb0899_init()
896 config->init_s2_demod[i].data); in stb0899_init()
898 dprintk(state->verbose, FE_DEBUG, 1, "init S1 demod"); in stb0899_init()
900 for (i = 0; config->init_s1_demod[i].address != 0xffff; i++) in stb0899_init()
901 stb0899_write_reg(state, config->init_s1_demod[i].address, config->init_s1_demod[i].data); in stb0899_init()
903 dprintk(state->verbose, FE_DEBUG, 1, "init S2 FEC"); in stb0899_init()
905 for (i = 0; config->init_s2_fec[i].offset != 0xffff; i++) in stb0899_init()
907 config->init_s2_fec[i].base_address, in stb0899_init()
908 config->init_s2_fec[i].offset, in stb0899_init()
909 config->init_s2_fec[i].data); in stb0899_init()
911 dprintk(state->verbose, FE_DEBUG, 1, "init TST"); in stb0899_init()
913 for (i = 0; config->init_tst[i].address != 0xffff; i++) in stb0899_init()
914 stb0899_write_reg(state, config->init_tst[i].address, config->init_tst[i].data); in stb0899_init()
932 while ((max - min) > 1) { in stb0899_table_lookup()
939 res = ((val - tab[min].read) * in stb0899_table_lookup()
940 (tab[max].real - tab[min].real) / in stb0899_table_lookup()
941 (tab[max].read - tab[min].read)) + in stb0899_table_lookup()
950 struct stb0899_state *state = fe->demodulator_priv; in stb0899_read_signal_strength()
951 struct stb0899_internal *internal = &state->internal; in stb0899_read_signal_strength()
956 switch (state->delsys) { in stb0899_read_signal_strength()
959 if (internal->lock) { in stb0899_read_signal_strength()
966 *strength = stb0899_table_lookup(stb0899_dvbsrf_tab, ARRAY_SIZE(stb0899_dvbsrf_tab) - 1, val); in stb0899_read_signal_strength()
968 dprintk(state->verbose, FE_DEBUG, 1, "AGCIQVALUE = 0x%02x, C = %d * 0.1 dBm", in stb0899_read_signal_strength()
974 if (internal->lock) { in stb0899_read_signal_strength()
978 *strength = stb0899_table_lookup(stb0899_dvbs2rf_tab, ARRAY_SIZE(stb0899_dvbs2rf_tab) - 1, val); in stb0899_read_signal_strength()
980 dprintk(state->verbose, FE_DEBUG, 1, "IF_AGC_GAIN = 0x%04x, C = %d * 0.1 dBm", in stb0899_read_signal_strength()
985 dprintk(state->verbose, FE_DEBUG, 1, "Unsupported delivery system"); in stb0899_read_signal_strength()
986 return -EINVAL; in stb0899_read_signal_strength()
994 struct stb0899_state *state = fe->demodulator_priv; in stb0899_read_snr()
995 struct stb0899_internal *internal = &state->internal; in stb0899_read_snr()
997 unsigned int val, quant, quantn = -1, est, estn = -1; in stb0899_read_snr()
1003 switch (state->delsys) { in stb0899_read_snr()
1006 if (internal->lock) { in stb0899_read_snr()
1012 *snr = stb0899_table_lookup(stb0899_cn_tab, ARRAY_SIZE(stb0899_cn_tab) - 1, val); in stb0899_read_snr()
1013 dprintk(state->verbose, FE_DEBUG, 1, "NIR = 0x%02x%02x = %u, C/N = %d * 0.1 dBm\n", in stb0899_read_snr()
1019 if (internal->lock) { in stb0899_read_snr()
1025 val = 301; /* C/N = 30.1 dB */ in stb0899_read_snr()
1027 val = 270; /* C/N = 27.0 dB */ in stb0899_read_snr()
1030 … quantn = stb0899_table_lookup(stb0899_quant_tab, ARRAY_SIZE(stb0899_quant_tab) - 1, quant * 100); in stb0899_read_snr()
1032 estn = stb0899_table_lookup(stb0899_est_tab, ARRAY_SIZE(stb0899_est_tab) - 1, est); in stb0899_read_snr()
1033 …/* snr(dBm/10) = -10*(log(est)-log(quant^2)) => snr(dBm/10) = (100*log(quant^2)-100*log(est))/10 */ in stb0899_read_snr()
1034 val = (quantn - estn) / 10; in stb0899_read_snr()
1037 …dprintk(state->verbose, FE_DEBUG, 1, "Es/N0 quant = %d (%d) estimate = %u (%d), C/N = %d * 0.1 dBm… in stb0899_read_snr()
1042 dprintk(state->verbose, FE_DEBUG, 1, "Unsupported delivery system"); in stb0899_read_snr()
1043 return -EINVAL; in stb0899_read_snr()
1051 struct stb0899_state *state = fe->demodulator_priv; in stb0899_read_status()
1052 struct stb0899_internal *internal = &state->internal; in stb0899_read_status()
1056 switch (state->delsys) { in stb0899_read_status()
1059 dprintk(state->verbose, FE_DEBUG, 1, "Delivery system DVB-S/DSS"); in stb0899_read_status()
1060 if (internal->lock) { in stb0899_read_status()
1063 dprintk(state->verbose, FE_DEBUG, 1, "--------> FE_HAS_CARRIER | FE_HAS_LOCK"); in stb0899_read_status()
1068 dprintk(state->verbose, FE_DEBUG, 1, "--------> FE_HAS_VITERBI | FE_HAS_SYNC"); in stb0899_read_status()
1077 dprintk(state->verbose, FE_DEBUG, 1, "Delivery system DVB-S2"); in stb0899_read_status()
1078 if (internal->lock) { in stb0899_read_status()
1082 dprintk(state->verbose, FE_DEBUG, 1, in stb0899_read_status()
1083 "UWP & CSM Lock ! ---> DVB-S2 FE_HAS_CARRIER"); in stb0899_read_status()
1088 dprintk(state->verbose, FE_DEBUG, 1, in stb0899_read_status()
1089 "Packet Delineator Locked ! -----> DVB-S2 FE_HAS_LOCK"); in stb0899_read_status()
1094 dprintk(state->verbose, FE_DEBUG, 1, in stb0899_read_status()
1095 "Packet Delineator found VITERBI ! -----> DVB-S2 FE_HAS_VITERBI"); in stb0899_read_status()
1099 dprintk(state->verbose, FE_DEBUG, 1, in stb0899_read_status()
1100 "Packet Delineator found SYNC ! -----> DVB-S2 FE_HAS_SYNC"); in stb0899_read_status()
1108 dprintk(state->verbose, FE_DEBUG, 1, "Unsupported delivery system"); in stb0899_read_status()
1109 return -EINVAL; in stb0899_read_status()
1116 * viterbi error for DVB-S/DSS
1117 * packet error for DVB-S2
1122 struct stb0899_state *state = fe->demodulator_priv; in stb0899_read_ber()
1123 struct stb0899_internal *internal = &state->internal; in stb0899_read_ber()
1129 switch (state->delsys) { in stb0899_read_ber()
1132 if (internal->lock) { in stb0899_read_ber()
1137 if (STB0899_GETFIELD(VSTATUS_PRFVIT, internal->v_status)) { in stb0899_read_ber()
1141 *ber /= (-1 + (1 << (2 * STB0899_GETFIELD(NOE, internal->err_ctrl)))); in stb0899_read_ber()
1147 if (internal->lock) { in stb0899_read_ber()
1153 *ber /= (-1 + (1 << (4 + 2 * STB0899_GETFIELD(NOE, internal->err_ctrl)))); in stb0899_read_ber()
1157 dprintk(state->verbose, FE_DEBUG, 1, "Unsupported delivery system"); in stb0899_read_ber()
1158 return -EINVAL; in stb0899_read_ber()
1167 struct stb0899_state *state = fe->demodulator_priv; in stb0899_set_voltage()
1186 return -EINVAL; in stb0899_set_voltage()
1194 struct stb0899_state *state = fe->demodulator_priv; in stb0899_set_tone()
1195 struct stb0899_internal *internal = &state->internal; in stb0899_set_tone()
1201 return -ETIMEDOUT; in stb0899_set_tone()
1205 div = (internal->master_clk / 100) / 5632; in stb0899_set_tone()
1217 return -EINVAL; in stb0899_set_tone()
1225 struct stb0899_state *state = fe->demodulator_priv; in stb0899_i2c_gate_ctrl()
1232 dprintk(state->verbose, FE_DEBUG, 1, "Enabling I2C Repeater ..."); in stb0899_i2c_gate_ctrl()
1237 dprintk(state->verbose, FE_DEBUG, 1, "Disabling I2C Repeater ..."); in stb0899_i2c_gate_ctrl()
1244 dprintk(state->verbose, FE_ERROR, 1, "I2C Repeater control failed"); in stb0899_i2c_gate_ctrl()
1245 return -EREMOTEIO; in stb0899_i2c_gate_ctrl()
1267 dprintk(state->verbose, FE_DEBUG, 1, "ID reg=[0x%02x]", id); in stb0899_get_dev_id()
1271 dprintk(state->verbose, FE_ERROR, 1, "Device ID=[%d], Release=[%d]", in stb0899_get_dev_id()
1277 …dprintk(state->verbose, FE_ERROR, 1, "Demodulator Core ID=[%s], Version=[%d]", (char *) &demod_str… in stb0899_get_dev_id()
1281 dprintk(state->verbose, FE_ERROR, 1, "couldn't find a STB 0899"); in stb0899_get_dev_id()
1283 return -ENODEV; in stb0899_get_dev_id()
1285 dprintk(state->verbose, FE_ERROR, 1, "FEC Core ID=[%s], Version=[%d]", (char*) &fec_str, fec_ver); in stb0899_get_dev_id()
1298 switch (state->delsys) { in stb0899_set_delivery()
1300 dprintk(state->verbose, FE_DEBUG, 1, "Delivery System -- DVB-S"); in stb0899_set_delivery()
1383 dprintk(state->verbose, FE_ERROR, 1, "Unsupported delivery system"); in stb0899_set_delivery()
1396 struct stb0899_internal *internal = &state->internal; in stb0899_set_iterations()
1397 struct stb0899_config *config = state->config; in stb0899_set_iterations()
1402 iter_scale = 17 * (internal->master_clk / 1000); in stb0899_set_iterations()
1404 iter_scale /= (internal->srate / 1000000); in stb0899_set_iterations()
1407 if (iter_scale > config->ldpc_max_iter) in stb0899_set_iterations()
1408 iter_scale = config->ldpc_max_iter; in stb0899_set_iterations()
1417 struct stb0899_state *state = fe->demodulator_priv; in stb0899_search()
1418 struct stb0899_params *i_params = &state->params; in stb0899_search()
1419 struct stb0899_internal *internal = &state->internal; in stb0899_search()
1420 struct stb0899_config *config = state->config; in stb0899_search()
1421 struct dtv_frontend_properties *props = &fe->dtv_property_cache; in stb0899_search()
1425 i_params->freq = props->frequency; in stb0899_search()
1426 i_params->srate = props->symbol_rate; in stb0899_search()
1427 state->delsys = props->delivery_system; in stb0899_search()
1428 dprintk(state->verbose, FE_DEBUG, 1, "delivery system=%d", state->delsys); in stb0899_search()
1431 dprintk(state->verbose, FE_DEBUG, 1, "Frequency=%d, Srate=%d", i_params->freq, i_params->srate); in stb0899_search()
1433 if (INRANGE(i_params->srate, 1000000, 45000000)) { in stb0899_search()
1434 dprintk(state->verbose, FE_DEBUG, 1, "Parameters IN RANGE"); in stb0899_search()
1437 if (state->config->tuner_set_rfsiggain) { in stb0899_search()
1438 if (internal->srate > 15000000) in stb0899_search()
1439 gain = 8; /* 15Mb < srate < 45Mb, gain = 8dB */ in stb0899_search()
1440 else if (internal->srate > 5000000) in stb0899_search()
1441 gain = 12; /* 5Mb < srate < 15Mb, gain = 12dB */ in stb0899_search()
1443 gain = 14; /* 1Mb < srate < 5Mb, gain = 14db */ in stb0899_search()
1444 state->config->tuner_set_rfsiggain(fe, gain); in stb0899_search()
1447 if (i_params->srate <= 5000000) in stb0899_search()
1448 stb0899_set_mclk(state, config->lo_clk); in stb0899_search()
1450 stb0899_set_mclk(state, config->hi_clk); in stb0899_search()
1452 switch (state->delsys) { in stb0899_search()
1455 dprintk(state->verbose, FE_DEBUG, 1, "DVB-S delivery system"); in stb0899_search()
1456 internal->freq = i_params->freq; in stb0899_search()
1457 internal->srate = i_params->srate; in stb0899_search()
1464 internal->srch_range = SearchRange + 1500000 + (i_params->srate / 5); in stb0899_search()
1465 internal->derot_percent = 30; in stb0899_search()
1469 stb0899_i2c_gate_ctrl(&state->frontend, 1); in stb0899_search()
1471 if (state->config->tuner_set_bandwidth) in stb0899_search()
1472 state->config->tuner_set_bandwidth(fe, (13 * (stb0899_carr_width(state) + SearchRange)) / 10); in stb0899_search()
1473 if (state->config->tuner_get_bandwidth) in stb0899_search()
1474 state->config->tuner_get_bandwidth(fe, &internal->tuner_bw); in stb0899_search()
1477 stb0899_i2c_gate_ctrl(&state->frontend, 0); in stb0899_search()
1479 /* Set DVB-S1 AGC */ in stb0899_search()
1483 dprintk(state->verbose, FE_DEBUG, 1, "running DVB-S search algo .."); in stb0899_search()
1485 internal->lock = 1; in stb0899_search()
1486 dprintk(state->verbose, FE_DEBUG, 1, in stb0899_search()
1487 "-------------------------------------> DVB-S LOCK !"); in stb0899_search()
1490 // internal->v_status = stb0899_read_reg(state, STB0899_VSTATUS); in stb0899_search()
1491 // internal->err_ctrl = stb0899_read_reg(state, STB0899_ERRCTRL1); in stb0899_search()
1492 // dprintk(state->verbose, FE_DEBUG, 1, "VSTATUS=0x%02x", internal->v_status); in stb0899_search()
1493 // dprintk(state->verbose, FE_DEBUG, 1, "ERR_CTRL=0x%02x", internal->err_ctrl); in stb0899_search()
1497 internal->lock = 0; in stb0899_search()
1503 internal->freq = i_params->freq; in stb0899_search()
1504 internal->srate = i_params->srate; in stb0899_search()
1505 internal->srch_range = SearchRange; in stb0899_search()
1508 stb0899_i2c_gate_ctrl(&state->frontend, 1); in stb0899_search()
1510 if (state->config->tuner_set_bandwidth) in stb0899_search()
1511 state->config->tuner_set_bandwidth(fe, (stb0899_carr_width(state) + SearchRange)); in stb0899_search()
1512 if (state->config->tuner_get_bandwidth) in stb0899_search()
1513 state->config->tuner_get_bandwidth(fe, &internal->tuner_bw); in stb0899_search()
1516 stb0899_i2c_gate_ctrl(&state->frontend, 0); in stb0899_search()
1518 // pParams->SpectralInv = pSearch->IQ_Inversion; in stb0899_search()
1520 /* Set DVB-S2 AGC */ in stb0899_search()
1527 dprintk(state->verbose, FE_DEBUG, 1, "running DVB-S2 search algo .."); in stb0899_search()
1529 internal->lock = 1; in stb0899_search()
1530 dprintk(state->verbose, FE_DEBUG, 1, in stb0899_search()
1531 "-------------------------------------> DVB-S2 LOCK !"); in stb0899_search()
1534 // internal->v_status = stb0899_read_reg(state, STB0899_VSTATUS); in stb0899_search()
1535 // internal->err_ctrl = stb0899_read_reg(state, STB0899_ERRCTRL1); in stb0899_search()
1539 internal->lock = 0; in stb0899_search()
1545 dprintk(state->verbose, FE_ERROR, 1, "Unsupported delivery system"); in stb0899_search()
1556 struct stb0899_state *state = fe->demodulator_priv; in stb0899_get_frontend()
1557 struct stb0899_internal *internal = &state->internal; in stb0899_get_frontend()
1559 dprintk(state->verbose, FE_DEBUG, 1, "Get params"); in stb0899_get_frontend()
1560 p->symbol_rate = internal->srate; in stb0899_get_frontend()
1561 p->frequency = internal->freq; in stb0899_get_frontend()
1620 state->verbose = &verbose; in stb0899_attach()
1621 state->config = config; in stb0899_attach()
1622 state->i2c = i2c; in stb0899_attach()
1623 state->frontend.ops = stb0899_ops; in stb0899_attach()
1624 state->frontend.demodulator_priv = state; in stb0899_attach()
1625 /* use configured inversion as default -- we'll later autodetect inversion */ in stb0899_attach()
1626 state->internal.inversion = config->inversion; in stb0899_attach()
1628 stb0899_wakeup(&state->frontend); in stb0899_attach()
1629 if (stb0899_get_dev_id(state) == -ENODEV) { in stb0899_attach()
1635 return &state->frontend; in stb0899_attach()
1644 MODULE_DESCRIPTION("STB0899 Multi-Std frontend");