Lines Matching +full:clk +full:- +full:freq +full:- +full:optimized
1 // SPDX-License-Identifier: GPL-2.0-or-later
52 ((temp_dev->internal->i2c_adap != i2c_adap) || in find_dev()
53 (temp_dev->internal->i2c_addr != i2c_addr))) { in find_dev()
55 temp_dev = temp_dev->next_dev; in find_dev()
65 struct stv090x_dev *del_dev = find_dev(internal->i2c_adap, in remove_dev()
66 internal->i2c_addr); in remove_dev()
70 stv090x_first_dev = del_dev->next_dev; in remove_dev()
72 while (prev_dev->next_dev != del_dev) in remove_dev()
73 prev_dev = prev_dev->next_dev; in remove_dev()
75 prev_dev->next_dev = del_dev->next_dev; in remove_dev()
90 new_dev->internal = internal; in append_internal()
91 new_dev->next_dev = NULL; in append_internal()
98 while (temp_dev->next_dev != NULL) in append_internal()
99 temp_dev = temp_dev->next_dev; in append_internal()
101 temp_dev->next_dev = new_dev; in append_internal()
167 { -30, 13348 }, /* -3.0dB */
168 { -20, 12640 }, /* -2d.0B */
169 { -10, 11883 }, /* -1.0dB */
170 { 0, 11101 }, /* -0.0dB */
226 { -5, 0xcaa1 }, /* -5dBm */
227 { -10, 0xc229 }, /* -10dBm */
228 { -15, 0xbb08 }, /* -15dBm */
229 { -20, 0xb4bc }, /* -20dBm */
230 { -25, 0xad5a }, /* -25dBm */
231 { -30, 0xa298 }, /* -30dBm */
232 { -35, 0x98a8 }, /* -35dBm */
233 { -40, 0x8389 }, /* -40dBm */
234 { -45, 0x59be }, /* -45dBm */
235 { -50, 0x3a14 }, /* -50dBm */
236 { -55, 0x2d11 }, /* -55dBm */
237 { -60, 0x210d }, /* -60dBm */
238 { -65, 0xa14f }, /* -65dBm */
239 { -70, 0x07aa } /* -70dBm */
680 return (__x >= (1 << (__width - 1))) ? (__x - (1 << __width)) : __x; in comp2()
685 const struct stv090x_config *config = state->config; in stv090x_read_reg()
692 { .addr = config->address, .flags = 0, .buf = b0, .len = 2 }, in stv090x_read_reg()
693 { .addr = config->address, .flags = I2C_M_RD, .buf = &buf, .len = 1 } in stv090x_read_reg()
696 ret = i2c_transfer(state->i2c, msg, 2); in stv090x_read_reg()
698 if (ret != -ERESTARTSYS) in stv090x_read_reg()
703 return ret < 0 ? ret : -EREMOTEIO; in stv090x_read_reg()
705 if (unlikely(*state->verbose >= FE_DEBUGREG)) in stv090x_read_reg()
714 const struct stv090x_config *config = state->config; in stv090x_write_regs()
717 struct i2c_msg i2c_msg = { .addr = config->address, .flags = 0, .buf = buf, .len = 2 + count }; in stv090x_write_regs()
723 return -EINVAL; in stv090x_write_regs()
733 ret = i2c_transfer(state->i2c, &i2c_msg, 1); in stv090x_write_regs()
735 if (ret != -ERESTARTSYS) in stv090x_write_regs()
738 return ret < 0 ? ret : -EREMOTEIO; in stv090x_write_regs()
753 if (state->config->tuner_i2c_lock) in stv090x_tuner_i2c_lock()
754 state->config->tuner_i2c_lock(&state->frontend, 1); in stv090x_tuner_i2c_lock()
756 mutex_lock(&state->internal->tuner_lock); in stv090x_tuner_i2c_lock()
761 if (state->config->tuner_i2c_lock) in stv090x_tuner_i2c_unlock()
762 state->config->tuner_i2c_lock(&state->frontend, 0); in stv090x_tuner_i2c_unlock()
764 mutex_unlock(&state->internal->tuner_lock); in stv090x_tuner_i2c_unlock()
804 return -1; in stv090x_i2c_gate_ctrl()
809 switch (state->algo) { in stv090x_get_lock_tmg()
812 if (state->srate <= 1500000) { /*10Msps< SR <=15Msps*/ in stv090x_get_lock_tmg()
813 state->DemodTimeout = 1500; in stv090x_get_lock_tmg()
814 state->FecTimeout = 400; in stv090x_get_lock_tmg()
815 } else if (state->srate <= 5000000) { /*10Msps< SR <=15Msps*/ in stv090x_get_lock_tmg()
816 state->DemodTimeout = 1000; in stv090x_get_lock_tmg()
817 state->FecTimeout = 300; in stv090x_get_lock_tmg()
819 state->DemodTimeout = 700; in stv090x_get_lock_tmg()
820 state->FecTimeout = 100; in stv090x_get_lock_tmg()
828 if (state->srate <= 1000000) { /*SR <=1Msps*/ in stv090x_get_lock_tmg()
829 state->DemodTimeout = 4500; in stv090x_get_lock_tmg()
830 state->FecTimeout = 1700; in stv090x_get_lock_tmg()
831 } else if (state->srate <= 2000000) { /*1Msps < SR <= 2Msps */ in stv090x_get_lock_tmg()
832 state->DemodTimeout = 2500; in stv090x_get_lock_tmg()
833 state->FecTimeout = 1100; in stv090x_get_lock_tmg()
834 } else if (state->srate <= 5000000) { /*2Msps < SR <= 5Msps */ in stv090x_get_lock_tmg()
835 state->DemodTimeout = 1000; in stv090x_get_lock_tmg()
836 state->FecTimeout = 550; in stv090x_get_lock_tmg()
837 } else if (state->srate <= 10000000) { /*5Msps < SR <= 10Msps */ in stv090x_get_lock_tmg()
838 state->DemodTimeout = 700; in stv090x_get_lock_tmg()
839 state->FecTimeout = 250; in stv090x_get_lock_tmg()
840 } else if (state->srate <= 20000000) { /*10Msps < SR <= 20Msps */ in stv090x_get_lock_tmg()
841 state->DemodTimeout = 400; in stv090x_get_lock_tmg()
842 state->FecTimeout = 130; in stv090x_get_lock_tmg()
844 state->DemodTimeout = 300; in stv090x_get_lock_tmg()
845 state->FecTimeout = 100; in stv090x_get_lock_tmg()
850 if (state->algo == STV090x_WARM_SEARCH) in stv090x_get_lock_tmg()
851 state->DemodTimeout /= 2; in stv090x_get_lock_tmg()
860 sym /= (state->internal->mclk >> 12); in stv090x_set_srate()
863 sym /= (state->internal->mclk >> 10); in stv090x_set_srate()
866 sym /= (state->internal->mclk >> 7); in stv090x_set_srate()
877 return -1; in stv090x_set_srate()
880 static int stv090x_set_max_srate(struct stv090x_state *state, u32 clk, u32 srate) in stv090x_set_max_srate() argument
887 sym /= (state->internal->mclk >> 12); in stv090x_set_max_srate()
890 sym /= (state->internal->mclk >> 10); in stv090x_set_max_srate()
893 sym /= (state->internal->mclk >> 7); in stv090x_set_max_srate()
911 return -1; in stv090x_set_max_srate()
914 static int stv090x_set_min_srate(struct stv090x_state *state, u32 clk, u32 srate) in stv090x_set_min_srate() argument
921 sym /= (state->internal->mclk >> 12); in stv090x_set_min_srate()
924 sym /= (state->internal->mclk >> 10); in stv090x_set_min_srate()
927 sym /= (state->internal->mclk >> 7); in stv090x_set_min_srate()
937 return -1; in stv090x_set_min_srate()
977 return -1; in stv090x_set_vit_thacq()
997 return -1; in stv090x_set_vit_thtracq()
1002 switch (state->search_mode) { in stv090x_set_viterbi()
1004 if (STV090x_WRITE_DEMOD(state, FECM, 0x10) < 0) /* DVB-S and DVB-S2 */ in stv090x_set_viterbi()
1012 switch (state->fec) { in stv090x_set_viterbi()
1047 switch (state->fec) { in stv090x_set_viterbi()
1075 return -1; in stv090x_set_viterbi()
1115 return -1; in stv090x_stop_modcod()
1156 return -1; in stv090x_activate_modcod()
1199 return -1; in stv090x_activate_modcod_single()
1206 switch (state->demod) { in stv090x_vitclk_ctl()
1208 mutex_lock(&state->internal->demod_lock); in stv090x_vitclk_ctl()
1213 mutex_unlock(&state->internal->demod_lock); in stv090x_vitclk_ctl()
1217 mutex_lock(&state->internal->demod_lock); in stv090x_vitclk_ctl()
1222 mutex_unlock(&state->internal->demod_lock); in stv090x_vitclk_ctl()
1231 mutex_unlock(&state->internal->demod_lock); in stv090x_vitclk_ctl()
1233 return -1; in stv090x_vitclk_ctl()
1238 if (state->internal->dev_ver >= 0x30) { in stv090x_dvbs_track_crl()
1240 if (state->srate >= 15000000) { in stv090x_dvbs_track_crl()
1245 } else if ((state->srate >= 7000000) && (15000000 > state->srate)) { in stv090x_dvbs_track_crl()
1250 } else if (state->srate < 7000000) { in stv090x_dvbs_track_crl()
1267 return -1; in stv090x_dvbs_track_crl()
1274 switch (state->search_mode) { in stv090x_delivery_search()
1292 if (STV090x_WRITE_DEMOD(state, CAR2CFG, 0x22) < 0) /* disable DVB-S2 */ in stv090x_delivery_search()
1315 if (STV090x_WRITE_DEMOD(state, ACLC, 0x1a) < 0) /* stop DVB-S CR loop */ in stv090x_delivery_search()
1320 if (state->internal->dev_ver <= 0x20) { in stv090x_delivery_search()
1330 if (state->demod_mode != STV090x_SINGLE) { in stv090x_delivery_search()
1349 /* enable DVB-S2 and DVB-S2 in Auto MODE */ in stv090x_delivery_search()
1366 if (state->internal->dev_ver <= 0x20) { in stv090x_delivery_search()
1376 if (state->demod_mode != STV090x_SINGLE) { in stv090x_delivery_search()
1399 return -1; in stv090x_delivery_search()
1405 s16 freq; in stv090x_start_search() local
1413 if (state->internal->dev_ver <= 0x20) { in stv090x_start_search()
1414 if (state->srate <= 5000000) { in stv090x_start_search()
1440 if (state->srate <= 5000000) { in stv090x_start_search()
1451 if (state->algo == STV090x_WARM_SEARCH) { in stv090x_start_search()
1453 * CFR min = -1MHz, in stv090x_start_search()
1457 freq_abs /= (state->internal->mclk / 1000); in stv090x_start_search()
1458 freq = (s16) freq_abs; in stv090x_start_search()
1461 * CFR min =- (SearchRange / 2 + 600KHz) in stv090x_start_search()
1465 freq_abs = (state->search_range / 2000) + 600; in stv090x_start_search()
1467 freq_abs /= (state->internal->mclk / 1000); in stv090x_start_search()
1468 freq = (s16) freq_abs; in stv090x_start_search()
1471 if (STV090x_WRITE_DEMOD(state, CFRUP1, MSB(freq)) < 0) in stv090x_start_search()
1473 if (STV090x_WRITE_DEMOD(state, CFRUP0, LSB(freq)) < 0) in stv090x_start_search()
1476 freq *= -1; in stv090x_start_search()
1478 if (STV090x_WRITE_DEMOD(state, CFRLOW1, MSB(freq)) < 0) in stv090x_start_search()
1480 if (STV090x_WRITE_DEMOD(state, CFRLOW0, LSB(freq)) < 0) in stv090x_start_search()
1490 if (state->internal->dev_ver >= 0x20) { in stv090x_start_search()
1496 if ((state->search_mode == STV090x_SEARCH_DVBS1) || in stv090x_start_search()
1497 (state->search_mode == STV090x_SEARCH_DSS) || in stv090x_start_search()
1498 (state->search_mode == STV090x_SEARCH_AUTO)) { in stv090x_start_search()
1527 if (state->internal->dev_ver >= 0x20) { in stv090x_start_search()
1529 if (state->srate < 2000000) { in stv090x_start_search()
1530 if (state->internal->dev_ver <= 0x20) { in stv090x_start_search()
1541 } else if (state->srate < 10000000) { in stv090x_start_search()
1553 if (state->srate < 10000000) { in stv090x_start_search()
1562 switch (state->algo) { in stv090x_start_search()
1587 return -1; in stv090x_start_search()
1616 steps = state->search_range / 1000000; in stv090x_get_agc2_min_level()
1621 freq_step = (1000000 * 256) / (state->internal->mclk / 256); in stv090x_get_agc2_min_level()
1628 freq_init = freq_init - (freq_step * i); in stv090x_get_agc2_min_level()
1630 dir *= -1; in stv090x_get_agc2_min_level()
1655 return -1; in stv090x_get_agc2_min_level()
1658 static u32 stv090x_get_srate(struct stv090x_state *state, u32 clk) in stv090x_get_srate() argument
1670 int_1 = clk >> 16; in stv090x_get_srate()
1673 tmp_1 = clk % 0x10000; in stv090x_get_srate()
1685 struct dvb_frontend *fe = &state->frontend; in stv090x_srate_srch_coarse()
1688 s32 tmg_cpt = 0, dir = 1, steps, cur_step = 0, freq; in stv090x_srate_srch_coarse() local
1692 if (state->internal->dev_ver >= 0x30) in stv090x_srate_srch_coarse()
1728 if (state->internal->dev_ver >= 0x30) { in stv090x_srate_srch_coarse()
1734 } else if (state->internal->dev_ver >= 0x20) { in stv090x_srate_srch_coarse()
1741 if (state->srate <= 2000000) in stv090x_srate_srch_coarse()
1743 else if (state->srate <= 5000000) in stv090x_srate_srch_coarse()
1745 else if (state->srate <= 12000000) in stv090x_srate_srch_coarse()
1750 steps = -1 + ((state->search_range / 1000) / car_step); in stv090x_srate_srch_coarse()
1757 car_step = (state->search_range / 1000) / 10; in stv090x_srate_srch_coarse()
1761 freq = state->frequency; in stv090x_srate_srch_coarse()
1786 srate_coarse = stv090x_get_srate(state, state->internal->mclk); in stv090x_srate_srch_coarse()
1788 dir *= -1; in stv090x_srate_srch_coarse()
1794 freq += cur_step * car_step; in stv090x_srate_srch_coarse()
1796 freq -= cur_step * car_step; in stv090x_srate_srch_coarse()
1802 if (state->config->tuner_set_frequency) { in stv090x_srate_srch_coarse()
1803 if (state->config->tuner_set_frequency(fe, freq) < 0) in stv090x_srate_srch_coarse()
1807 if (state->config->tuner_set_bandwidth) { in stv090x_srate_srch_coarse()
1808 if (state->config->tuner_set_bandwidth(fe, state->tuner_bw) < 0) in stv090x_srate_srch_coarse()
1820 if (state->config->tuner_get_status) { in stv090x_srate_srch_coarse()
1821 if (state->config->tuner_get_status(fe, ®) < 0) in stv090x_srate_srch_coarse()
1838 srate_coarse = stv090x_get_srate(state, state->internal->mclk); in stv090x_srate_srch_coarse()
1846 return -1; in stv090x_srate_srch_coarse()
1853 srate_coarse = stv090x_get_srate(state, state->internal->mclk); in stv090x_srate_srch_fine()
1858 if (sym < state->srate) in stv090x_srate_srch_fine()
1879 if (state->internal->dev_ver >= 0x30) { in stv090x_srate_srch_fine()
1882 } else if (state->internal->dev_ver >= 0x20) { in stv090x_srate_srch_fine()
1890 sym /= (state->internal->mclk / 1000); in stv090x_srate_srch_fine()
1895 sym = 10 * (srate_coarse / 13); /* SFRLOW = SFR - 30% */ in stv090x_srate_srch_fine()
1897 sym /= (state->internal->mclk / 1000); in stv090x_srate_srch_fine()
1903 sym /= (state->internal->mclk / 1000); in stv090x_srate_srch_fine()
1911 sym /= (state->internal->mclk / 100); in stv090x_srate_srch_fine()
1916 sym = 10 * (srate_coarse / 14); /* SFRLOW = SFR - 30% */ in stv090x_srate_srch_fine()
1918 sym /= (state->internal->mclk / 100); in stv090x_srate_srch_fine()
1924 sym /= (state->internal->mclk / 100); in stv090x_srate_srch_fine()
1944 return -1; in stv090x_srate_srch_fine()
1964 case 2: /* DVB-S2 mode */ in stv090x_get_dmdlock()
1965 case 3: /* DVB-S1/legacy mode */ in stv090x_get_dmdlock()
1994 if (agc2 > STV090x_SEARCH_AGC2_TH(state->internal->dev_ver)) { in stv090x_blind_search()
1998 if (state->internal->dev_ver <= 0x20) { in stv090x_blind_search()
2010 if (state->internal->dev_ver >= 0x20) { in stv090x_blind_search()
2030 state->DemodTimeout); in stv090x_blind_search()
2053 k_ref -= 20; in stv090x_blind_search()
2061 return -1; in stv090x_blind_search()
2068 u8 freq, tmg_thh, tmg_thl; in stv090x_chk_tmg() local
2071 freq = STV090x_READ_DEMOD(state, CARFREQ); in stv090x_chk_tmg()
2113 if (STV090x_WRITE_DEMOD(state, RTC, 0x88) < 0) /* DVB-S1 timing */ in stv090x_chk_tmg()
2115 if (STV090x_WRITE_DEMOD(state, RTCS2, 0x68) < 0) /* DVB-S2 timing */ in stv090x_chk_tmg()
2118 if (STV090x_WRITE_DEMOD(state, CARFREQ, freq) < 0) in stv090x_chk_tmg()
2129 return -1; in stv090x_chk_tmg()
2134 struct dvb_frontend *fe = &state->frontend; in stv090x_get_coldlock()
2137 s32 car_step, steps, cur_step, dir, freq, timeout_lock; in stv090x_get_coldlock() local
2140 if (state->srate >= 10000000) in stv090x_get_coldlock()
2149 if (state->srate >= 10000000) { in stv090x_get_coldlock()
2160 if (state->srate <= 4000000) in stv090x_get_coldlock()
2162 else if (state->srate <= 7000000) in stv090x_get_coldlock()
2164 else if (state->srate <= 10000000) in stv090x_get_coldlock()
2169 steps = (state->search_range / 1000) / car_step; in stv090x_get_coldlock()
2180 freq = state->frequency; in stv090x_get_coldlock()
2181 state->tuner_bw = stv090x_car_width(state->srate, state->rolloff) + state->srate; in stv090x_get_coldlock()
2184 freq += cur_step * car_step; in stv090x_get_coldlock()
2186 freq -= cur_step * car_step; in stv090x_get_coldlock()
2192 if (state->config->tuner_set_frequency) { in stv090x_get_coldlock()
2193 if (state->config->tuner_set_frequency(fe, freq) < 0) in stv090x_get_coldlock()
2197 if (state->config->tuner_set_bandwidth) { in stv090x_get_coldlock()
2198 if (state->config->tuner_set_bandwidth(fe, state->tuner_bw) < 0) in stv090x_get_coldlock()
2210 if (state->config->tuner_get_status) { in stv090x_get_coldlock()
2211 if (state->config->tuner_get_status(fe, ®) < 0) in stv090x_get_coldlock()
2233 dir *= -1; in stv090x_get_coldlock()
2243 return -1; in stv090x_get_coldlock()
2250 srate = state->srate; in stv090x_get_loop_params()
2251 car_max = state->search_range / 1000; in stv090x_get_loop_params()
2254 car_max /= (state->internal->mclk / 1000); in stv090x_get_loop_params()
2257 car_max = 0x4000 ; /* maxcarrier should be<= +-1/4 Mclk */ in stv090x_get_loop_params()
2260 inc /= state->internal->mclk / 1000; in stv090x_get_loop_params()
2265 switch (state->search_mode) { in stv090x_get_loop_params()
2268 inc *= 3; /* freq step = 3% of srate */ in stv090x_get_loop_params()
2317 car_max = state->search_range / 1000; in stv090x_chk_signal()
2321 car_max /= state->internal->mclk / 1000; in stv090x_chk_signal()
2326 if ((agc2 > 0x2000) || (offst_car > 2 * car_max) || (offst_car < -2 * car_max)) { in stv090x_chk_signal()
2343 car_max = state->search_range / 1000; in stv090x_search_car_loop()
2346 car_max /= (state->internal->mclk / 1000); in stv090x_search_car_loop()
2353 offst_freq = -car_max + inc; in stv090x_search_car_loop()
2366 STV090x_SETFIELD_Px(reg, ALGOSWRST_FIELD, 0x1); /* stop DVB-S2 packet delin */ in stv090x_search_car_loop()
2372 offst_freq = -offst_freq - 2 * inc; in stv090x_search_car_loop()
2374 offst_freq = -offst_freq; in stv090x_search_car_loop()
2386 ((offst_freq - inc) < car_max) && in stv090x_search_car_loop()
2387 ((offst_freq + inc) > -car_max) && in stv090x_search_car_loop()
2398 return -1; in stv090x_search_car_loop()
2412 switch (state->search_mode) { in stv090x_sw_algo()
2416 if (state->internal->dev_ver >= 0x20) { in stv090x_sw_algo()
2427 if (state->internal->dev_ver >= 0x20) { in stv090x_sw_algo()
2440 if (state->internal->dev_ver >= 0x20) { in stv090x_sw_algo()
2462 if (state->internal->dev_ver >= 0x20) { in stv090x_sw_algo()
2484 if (state->internal->dev_ver >= 0x20) { in stv090x_sw_algo()
2500 return -1; in stv090x_sw_algo()
2557 state->fec = STV090x_PR12; in stv090x_get_viterbi()
2561 state->fec = STV090x_PR23; in stv090x_get_viterbi()
2565 state->fec = STV090x_PR34; in stv090x_get_viterbi()
2569 state->fec = STV090x_PR56; in stv090x_get_viterbi()
2573 state->fec = STV090x_PR67; in stv090x_get_viterbi()
2577 state->fec = STV090x_PR78; in stv090x_get_viterbi()
2581 state->fec = STV090x_PRERR; in stv090x_get_viterbi()
2590 struct dvb_frontend *fe = &state->frontend; in stv090x_get_sig_params()
2598 if (state->algo == STV090x_BLIND_SEARCH) { in stv090x_get_sig_params()
2607 state->delsys = stv090x_get_std(state); in stv090x_get_sig_params()
2612 if (state->config->tuner_get_frequency) { in stv090x_get_sig_params()
2613 if (state->config->tuner_get_frequency(fe, &state->frequency) < 0) in stv090x_get_sig_params()
2620 offst_freq = stv090x_get_car_freq(state, state->internal->mclk) / 1000; in stv090x_get_sig_params()
2621 state->frequency += offst_freq; in stv090x_get_sig_params()
2627 state->modcod = STV090x_GETFIELD_Px(reg, DEMOD_MODCOD_FIELD); in stv090x_get_sig_params()
2628 state->pilots = STV090x_GETFIELD_Px(reg, DEMOD_TYPE_FIELD) & 0x01; in stv090x_get_sig_params()
2629 state->frame_len = STV090x_GETFIELD_Px(reg, DEMOD_TYPE_FIELD) >> 1; in stv090x_get_sig_params()
2631 state->rolloff = STV090x_GETFIELD_Px(reg, ROLLOFF_STATUS_FIELD); in stv090x_get_sig_params()
2633 state->inversion = STV090x_GETFIELD_Px(reg, IQINV_FIELD); in stv090x_get_sig_params()
2635 if ((state->algo == STV090x_BLIND_SEARCH) || (state->srate < 10000000)) { in stv090x_get_sig_params()
2640 if (state->config->tuner_get_frequency) { in stv090x_get_sig_params()
2641 if (state->config->tuner_get_frequency(fe, &state->frequency) < 0) in stv090x_get_sig_params()
2648 if (abs(offst_freq) <= ((state->search_range / 2000) + 500)) in stv090x_get_sig_params()
2650 else if (abs(offst_freq) <= (stv090x_car_width(state->srate, state->rolloff) / 2000)) in stv090x_get_sig_params()
2653 if (abs(offst_freq) <= ((state->search_range / 2000) + 500)) in stv090x_get_sig_params()
2663 return -1; in stv090x_get_sig_params()
2690 if (state->internal->dev_ver == 0x20) { in stv090x_optimize_carloop()
2726 if (state->srate <= 3000000) in stv090x_optimize_carloop()
2728 else if (state->srate <= 7000000) in stv090x_optimize_carloop()
2730 else if (state->srate <= 15000000) in stv090x_optimize_carloop()
2732 else if (state->srate <= 25000000) in stv090x_optimize_carloop()
2737 if (state->srate <= 3000000) in stv090x_optimize_carloop()
2739 else if (state->srate <= 7000000) in stv090x_optimize_carloop()
2741 else if (state->srate <= 15000000) in stv090x_optimize_carloop()
2743 else if (state->srate <= 25000000) in stv090x_optimize_carloop()
2751 if (state->srate <= 3000000) in stv090x_optimize_carloop()
2753 else if (state->srate <= 7000000) in stv090x_optimize_carloop()
2755 else if (state->srate <= 15000000) in stv090x_optimize_carloop()
2757 else if (state->srate <= 25000000) in stv090x_optimize_carloop()
2762 if (state->srate <= 3000000) in stv090x_optimize_carloop()
2764 else if (state->srate <= 7000000) in stv090x_optimize_carloop()
2766 else if (state->srate <= 15000000) in stv090x_optimize_carloop()
2768 else if (state->srate <= 25000000) in stv090x_optimize_carloop()
2780 if (state->srate <= 3000000) in stv090x_optimize_carloop()
2782 else if (state->srate <= 7000000) in stv090x_optimize_carloop()
2784 else if (state->srate <= 15000000) in stv090x_optimize_carloop()
2786 else if (state->srate <= 25000000) in stv090x_optimize_carloop()
2801 switch (state->modulation) { in stv090x_optimize_carloop_short()
2817 if (state->internal->dev_ver >= 0x30) { in stv090x_optimize_carloop_short()
2825 if (state->srate <= 3000000) in stv090x_optimize_carloop_short()
2827 else if (state->srate <= 7000000) in stv090x_optimize_carloop_short()
2829 else if (state->srate <= 15000000) in stv090x_optimize_carloop_short()
2831 else if (state->srate <= 25000000) in stv090x_optimize_carloop_short()
2841 struct dvb_frontend *fe = &state->frontend; in stv090x_optimize_track()
2848 srate = stv090x_get_srate(state, state->internal->mclk); in stv090x_optimize_track()
2851 switch (state->delsys) { in stv090x_optimize_track()
2854 if (state->search_mode == STV090x_SEARCH_AUTO) { in stv090x_optimize_track()
2862 STV090x_SETFIELD_Px(reg, ROLLOFF_CONTROL_FIELD, state->rolloff); in stv090x_optimize_track()
2867 if (state->internal->dev_ver >= 0x30) { in stv090x_optimize_track()
2871 if (state->fec == STV090x_PR12) { in stv090x_optimize_track()
2894 if (state->internal->dev_ver >= 0x30) { in stv090x_optimize_track()
2900 if (state->frame_len == STV090x_LONG_FRAME) { in stv090x_optimize_track()
2913 if ((state->demod_mode == STV090x_SINGLE) && (modcod > STV090x_8PSK_910)) { in stv090x_optimize_track()
2929 if (state->modulation == STV090x_QPSK) { in stv090x_optimize_track()
2932 } else if (state->modulation == STV090x_8PSK) { in stv090x_optimize_track()
2937 } else if (state->modulation == STV090x_16APSK) { in stv090x_optimize_track()
2942 } else if (state->modulation == STV090x_32APSK) { in stv090x_optimize_track()
2967 if (state->algo == STV090x_BLIND_SEARCH) { in stv090x_optimize_track()
2985 if (state->internal->dev_ver >= 0x20) { in stv090x_optimize_track()
2986 if ((state->search_mode == STV090x_SEARCH_DVBS1) || in stv090x_optimize_track()
2987 (state->search_mode == STV090x_SEARCH_DSS) || in stv090x_optimize_track()
2988 (state->search_mode == STV090x_SEARCH_AUTO)) { in stv090x_optimize_track()
3007 if ((state->internal->dev_ver >= 0x20) || (blind_tune == 1) || in stv090x_optimize_track()
3008 (state->srate < 10000000)) { in stv090x_optimize_track()
3009 /* update initial carrier freq with the found freq offset */ in stv090x_optimize_track()
3014 state->tuner_bw = stv090x_car_width(srate, state->rolloff) + 10000000; in stv090x_optimize_track()
3016 if ((state->internal->dev_ver >= 0x20) || (blind_tune == 1)) { in stv090x_optimize_track()
3018 if (state->algo != STV090x_WARM_SEARCH) { in stv090x_optimize_track()
3023 if (state->config->tuner_set_bandwidth) { in stv090x_optimize_track()
3024 if (state->config->tuner_set_bandwidth(fe, state->tuner_bw) < 0) in stv090x_optimize_track()
3033 if ((state->algo == STV090x_BLIND_SEARCH) || (state->srate < 10000000)) in stv090x_optimize_track()
3040 if (!(stv090x_get_dmdlock(state, (state->DemodTimeout / 2)))) { in stv090x_optimize_track()
3052 while ((!(stv090x_get_dmdlock(state, (state->DemodTimeout / 2)))) && (i <= 2)) { in stv090x_optimize_track()
3068 if (state->internal->dev_ver >= 0x20) { in stv090x_optimize_track()
3073 if ((state->delsys == STV090x_DVBS1) || (state->delsys == STV090x_DSS)) in stv090x_optimize_track()
3082 return -1; in stv090x_optimize_track()
3101 case 2: /* DVB-S2 mode */ in stv090x_get_feclock()
3106 case 3: /* DVB-S1/legacy mode */ in stv090x_get_feclock()
3147 if (state->internal->dev_ver <= 0x20) { in stv090x_set_s2rolloff()
3154 /* DVB-S2 rolloff to auto mode if DVBS2 */ in stv090x_set_s2rolloff()
3163 return -1; in stv090x_set_s2rolloff()
3169 struct dvb_frontend *fe = &state->frontend; in stv090x_algo()
3183 if (state->internal->dev_ver >= 0x20) { in stv090x_algo()
3184 if (state->srate > 5000000) { in stv090x_algo()
3195 if (state->algo == STV090x_BLIND_SEARCH) { in stv090x_algo()
3196 state->tuner_bw = 2 * 36000000; /* wide bw for unknown srate */ in stv090x_algo()
3210 if (state->srate < 2000000) { in stv090x_algo()
3223 if (state->internal->dev_ver >= 0x20) { in stv090x_algo()
3226 if (state->algo == STV090x_COLD_SEARCH) in stv090x_algo()
3227 state->tuner_bw = (15 * (stv090x_car_width(state->srate, state->rolloff) + 10000000)) / 10; in stv090x_algo()
3228 else if (state->algo == STV090x_WARM_SEARCH) in stv090x_algo()
3229 state->tuner_bw = stv090x_car_width(state->srate, state->rolloff) + 10000000; in stv090x_algo()
3238 if (stv090x_set_srate(state, state->srate) < 0) in stv090x_algo()
3241 if (stv090x_set_max_srate(state, state->internal->mclk, in stv090x_algo()
3242 state->srate) < 0) in stv090x_algo()
3244 if (stv090x_set_min_srate(state, state->internal->mclk, in stv090x_algo()
3245 state->srate) < 0) in stv090x_algo()
3248 if (state->srate >= 10000000) in stv090x_algo()
3258 if (state->config->tuner_set_bbgain) { in stv090x_algo()
3259 reg = state->config->tuner_bbgain; in stv090x_algo()
3262 if (state->config->tuner_set_bbgain(fe, reg) < 0) in stv090x_algo()
3266 if (state->config->tuner_set_frequency) { in stv090x_algo()
3267 if (state->config->tuner_set_frequency(fe, state->frequency) < 0) in stv090x_algo()
3271 if (state->config->tuner_set_bandwidth) { in stv090x_algo()
3272 if (state->config->tuner_set_bandwidth(fe, state->tuner_bw) < 0) in stv090x_algo()
3281 if (state->config->tuner_get_status) { in stv090x_algo()
3284 if (state->config->tuner_get_status(fe, ®) < 0) in stv090x_algo()
3318 STV090x_SETFIELD_Px(reg, SPECINV_CONTROL_FIELD, state->inversion); in stv090x_algo()
3320 if (state->internal->dev_ver <= 0x20) { in stv090x_algo()
3324 /* DVB-S2 rolloff to auto mode if DVBS2 */ in stv090x_algo()
3333 if (state->algo != STV090x_BLIND_SEARCH) { in stv090x_algo()
3342 if (state->algo == STV090x_BLIND_SEARCH) in stv090x_algo()
3345 else if (state->algo == STV090x_COLD_SEARCH) in stv090x_algo()
3346 lock = stv090x_get_coldlock(state, state->DemodTimeout); in stv090x_algo()
3348 else if (state->algo == STV090x_WARM_SEARCH) in stv090x_algo()
3349 lock = stv090x_get_dmdlock(state, state->DemodTimeout); in stv090x_algo()
3351 if ((!lock) && (state->algo == STV090x_COLD_SEARCH)) { in stv090x_algo()
3364 if (state->internal->dev_ver >= 0x20) { in stv090x_algo()
3366 * demod lock and optimized Tracking in stv090x_algo()
3384 lock = stv090x_get_lock(state, state->FecTimeout, in stv090x_algo()
3385 state->FecTimeout); in stv090x_algo()
3387 if (state->delsys == STV090x_DVBS2) { in stv090x_algo()
3423 return -1; in stv090x_algo()
3438 return -1; in stv090x_set_pls()
3452 dprintk(FE_DEBUG, 1, "Enable MIS filtering - %d", mis); in stv090x_set_mis()
3465 return -1; in stv090x_set_mis()
3470 struct stv090x_state *state = fe->demodulator_priv; in stv090x_search()
3471 struct dtv_frontend_properties *props = &fe->dtv_property_cache; in stv090x_search()
3473 if (props->frequency == 0) in stv090x_search()
3476 switch (props->delivery_system) { in stv090x_search()
3478 state->delsys = STV090x_DSS; in stv090x_search()
3481 state->delsys = STV090x_DVBS1; in stv090x_search()
3484 state->delsys = STV090x_DVBS2; in stv090x_search()
3490 state->frequency = props->frequency; in stv090x_search()
3491 state->srate = props->symbol_rate; in stv090x_search()
3492 state->search_mode = STV090x_SEARCH_AUTO; in stv090x_search()
3493 state->algo = STV090x_COLD_SEARCH; in stv090x_search()
3494 state->fec = STV090x_PRERR; in stv090x_search()
3495 if (state->srate > 10000000) { in stv090x_search()
3497 state->search_range = 10000000; in stv090x_search()
3500 state->search_range = 5000000; in stv090x_search()
3503 stv090x_set_pls(state, props->scrambling_sequence_index); in stv090x_search()
3504 stv090x_set_mis(state, props->stream_id); in stv090x_search()
3519 struct stv090x_state *state = fe->demodulator_priv; in stv090x_read_status()
3539 case 2: /* DVB-S2 mode */ in stv090x_read_status()
3540 dprintk(FE_DEBUG, 1, "Delivery system: DVB-S2"); in stv090x_read_status()
3552 case 3: /* DVB-S1/legacy mode */ in stv090x_read_status()
3553 dprintk(FE_DEBUG, 1, "Delivery system: DVB-S"); in stv090x_read_status()
3571 struct stv090x_state *state = fe->demodulator_priv; in stv090x_read_per()
3617 return -1; in stv090x_read_per()
3627 while ((max - min) > 1) { in stv090x_table_lookup()
3635 res = ((val - tab[min].read) * in stv090x_table_lookup()
3636 (tab[max].real - tab[min].real) / in stv090x_table_lookup()
3637 (tab[max].read - tab[min].read)) + in stv090x_table_lookup()
3658 struct stv090x_state *state = fe->demodulator_priv; in stv090x_read_signal_strength()
3670 ARRAY_SIZE(stv090x_rf_tab) - 1, agc); in stv090x_read_signal_strength()
3673 else if (agc < stv090x_rf_tab[ARRAY_SIZE(stv090x_rf_tab) - 1].read) in stv090x_read_signal_strength()
3674 str = -100; in stv090x_read_signal_strength()
3682 struct stv090x_state *state = fe->demodulator_priv; in stv090x_read_cnr()
3689 switch (state->delsys) { in stv090x_read_cnr()
3704 last = ARRAY_SIZE(stv090x_s2cn_tab) - 1; in stv090x_read_cnr()
3705 div = stv090x_s2cn_tab[last].real - in stv090x_read_cnr()
3729 last = ARRAY_SIZE(stv090x_s1cn_tab) - 1; in stv090x_read_cnr()
3730 div = stv090x_s1cn_tab[last].real - in stv090x_read_cnr()
3745 struct stv090x_state *state = fe->demodulator_priv; in stv090x_set_tone()
3767 return -EINVAL; in stv090x_set_tone()
3773 return -1; in stv090x_set_tone()
3784 struct stv090x_state *state = fe->demodulator_priv; in stv090x_send_diseqc_msg()
3791 (state->config->diseqc_envelope_mode) ? 4 : 2); in stv090x_send_diseqc_msg()
3803 for (i = 0; i < cmd->msg_len; i++) { in stv090x_send_diseqc_msg()
3810 if (STV090x_WRITE_DEMOD(state, DISTXDATA, cmd->msg[i]) < 0) in stv090x_send_diseqc_msg()
3830 return -1; in stv090x_send_diseqc_msg()
3836 struct stv090x_state *state = fe->demodulator_priv; in stv090x_send_diseqc_burst()
3844 mode = (state->config->diseqc_envelope_mode) ? 5 : 3; in stv090x_send_diseqc_burst()
3847 mode = (state->config->diseqc_envelope_mode) ? 4 : 2; in stv090x_send_diseqc_burst()
3888 return -1; in stv090x_send_diseqc_burst()
3893 struct stv090x_state *state = fe->demodulator_priv; in stv090x_recv_slave_reply()
3904 reply->msg_len = STV090x_GETFIELD_Px(reg, FIFO_BYTENBR_FIELD); in stv090x_recv_slave_reply()
3905 for (i = 0; i < reply->msg_len; i++) in stv090x_recv_slave_reply()
3906 reply->msg[i] = STV090x_READ_DEMOD(state, DISRXDATA); in stv090x_recv_slave_reply()
3914 struct stv090x_state *state = fe->demodulator_priv; in stv090x_sleep()
3921 if (state->config->tuner_sleep) { in stv090x_sleep()
3922 if (state->config->tuner_sleep(fe) < 0) in stv090x_sleep()
3930 state->device == STV0900 ? "STV0900" : "STV0903", in stv090x_sleep()
3931 state->demod); in stv090x_sleep()
3933 mutex_lock(&state->internal->demod_lock); in stv090x_sleep()
3935 switch (state->demod) { in stv090x_sleep()
4035 mutex_unlock(&state->internal->demod_lock); in stv090x_sleep()
4042 mutex_unlock(&state->internal->demod_lock); in stv090x_sleep()
4045 return -1; in stv090x_sleep()
4050 struct stv090x_state *state = fe->demodulator_priv; in stv090x_wakeup()
4054 state->device == STV0900 ? "STV0900" : "STV0903", in stv090x_wakeup()
4055 state->demod); in stv090x_wakeup()
4057 mutex_lock(&state->internal->demod_lock); in stv090x_wakeup()
4065 switch (state->demod) { in stv090x_wakeup()
4137 mutex_unlock(&state->internal->demod_lock); in stv090x_wakeup()
4140 mutex_unlock(&state->internal->demod_lock); in stv090x_wakeup()
4142 return -1; in stv090x_wakeup()
4147 struct stv090x_state *state = fe->demodulator_priv; in stv090x_release()
4149 state->internal->num_used--; in stv090x_release()
4150 if (state->internal->num_used <= 0) { in stv090x_release()
4154 remove_dev(state->internal); in stv090x_release()
4155 kfree(state->internal); in stv090x_release()
4170 if ((state->demod_mode != STV090x_DUAL) || (STV090x_GETFIELD(reg, DDEMOD_FIELD) != 1)) { in stv090x_ldpc_mode()
4175 state->demod_mode = STV090x_DUAL; in stv090x_ldpc_mode()
4228 if (state->demod == STV090x_DEMODULATOR_1) { in stv090x_ldpc_mode()
4257 return -1; in stv090x_ldpc_mode()
4260 /* return (Hz), clk in Hz*/
4263 const struct stv090x_config *config = state->config; in stv090x_get_mclk()
4271 return (div + 1) * config->xtal / ratio; /* kHz */ in stv090x_get_mclk()
4274 static int stv090x_set_mclk(struct stv090x_state *state, u32 mclk, u32 clk) in stv090x_set_mclk() argument
4276 const struct stv090x_config *config = state->config; in stv090x_set_mclk()
4282 div = ((clk_sel * mclk) / config->xtal) - 1; in stv090x_set_mclk()
4289 state->internal->mclk = stv090x_get_mclk(state); in stv090x_set_mclk()
4292 div = state->internal->mclk / 704000; in stv090x_set_mclk()
4301 return -1; in stv090x_set_mclk()
4308 if (state->internal->dev_ver >= 0x20) { in stv0900_set_tspath()
4309 switch (state->config->ts1_mode) { in stv0900_set_tspath()
4312 switch (state->config->ts2_mode) { in stv0900_set_tspath()
4342 switch (state->config->ts2_mode) { in stv0900_set_tspath()
4359 switch (state->config->ts1_mode) { in stv0900_set_tspath()
4362 switch (state->config->ts2_mode) { in stv0900_set_tspath()
4391 switch (state->config->ts2_mode) { in stv0900_set_tspath()
4407 switch (state->config->ts1_mode) { in stv0900_set_tspath()
4410 STV090x_SETFIELD_Px(reg, TSFIFO_TEIUPDATE_FIELD, state->config->ts1_tei); in stv0900_set_tspath()
4419 STV090x_SETFIELD_Px(reg, TSFIFO_TEIUPDATE_FIELD, state->config->ts1_tei); in stv0900_set_tspath()
4428 STV090x_SETFIELD_Px(reg, TSFIFO_TEIUPDATE_FIELD, state->config->ts1_tei); in stv0900_set_tspath()
4437 STV090x_SETFIELD_Px(reg, TSFIFO_TEIUPDATE_FIELD, state->config->ts1_tei); in stv0900_set_tspath()
4448 switch (state->config->ts2_mode) { in stv0900_set_tspath()
4451 STV090x_SETFIELD_Px(reg, TSFIFO_TEIUPDATE_FIELD, state->config->ts2_tei); in stv0900_set_tspath()
4460 STV090x_SETFIELD_Px(reg, TSFIFO_TEIUPDATE_FIELD, state->config->ts2_tei); in stv0900_set_tspath()
4469 STV090x_SETFIELD_Px(reg, TSFIFO_TEIUPDATE_FIELD, state->config->ts2_tei); in stv0900_set_tspath()
4478 STV090x_SETFIELD_Px(reg, TSFIFO_TEIUPDATE_FIELD, state->config->ts2_tei); in stv0900_set_tspath()
4489 if (state->config->ts1_clk > 0) { in stv0900_set_tspath()
4492 switch (state->config->ts1_mode) { in stv0900_set_tspath()
4496 speed = state->internal->mclk / in stv0900_set_tspath()
4497 (state->config->ts1_clk / 4); in stv0900_set_tspath()
4505 speed = state->internal->mclk / in stv0900_set_tspath()
4506 (state->config->ts1_clk / 32); in stv0900_set_tspath()
4521 if (state->config->ts2_clk > 0) { in stv0900_set_tspath()
4524 switch (state->config->ts2_mode) { in stv0900_set_tspath()
4528 speed = state->internal->mclk / in stv0900_set_tspath()
4529 (state->config->ts2_clk / 4); in stv0900_set_tspath()
4537 speed = state->internal->mclk / in stv0900_set_tspath()
4538 (state->config->ts2_clk / 32); in stv0900_set_tspath()
4572 return -1; in stv0900_set_tspath()
4579 if (state->internal->dev_ver >= 0x20) { in stv0903_set_tspath()
4580 switch (state->config->ts1_mode) { in stv0903_set_tspath()
4593 switch (state->config->ts1_mode) { in stv0903_set_tspath()
4607 switch (state->config->ts1_mode) { in stv0903_set_tspath()
4644 if (state->config->ts1_clk > 0) { in stv0903_set_tspath()
4647 switch (state->config->ts1_mode) { in stv0903_set_tspath()
4651 speed = state->internal->mclk / in stv0903_set_tspath()
4652 (state->config->ts1_clk / 4); in stv0903_set_tspath()
4660 speed = state->internal->mclk / in stv0903_set_tspath()
4661 (state->config->ts1_clk / 32); in stv0903_set_tspath()
4687 return -1; in stv0903_set_tspath()
4692 struct stv090x_state *state = fe->demodulator_priv; in stv090x_init()
4693 const struct stv090x_config *config = state->config; in stv090x_init()
4696 if (state->internal->mclk == 0) { in stv090x_init()
4703 if (config->tuner_init) { in stv090x_init()
4704 if (config->tuner_init(fe) < 0) in stv090x_init()
4711 stv090x_set_mclk(state, 135000000, config->xtal); /* 135 Mhz */ in stv090x_init()
4714 0x20 | config->clk_mode) < 0) in stv090x_init()
4724 if (stv090x_ldpc_mode(state, state->demod_mode) < 0) in stv090x_init()
4728 STV090x_SETFIELD_Px(reg, TUN_IQSWAP_FIELD, state->inversion); in stv090x_init()
4732 STV090x_SETFIELD_Px(reg, ROLLOFF_CONTROL_FIELD, state->rolloff); in stv090x_init()
4739 if (config->tuner_set_mode) { in stv090x_init()
4740 if (config->tuner_set_mode(fe, TUNER_WAKE) < 0) in stv090x_init()
4744 if (config->tuner_init) { in stv090x_init()
4745 if (config->tuner_init(fe) < 0) in stv090x_init()
4752 if (state->device == STV0900) { in stv090x_init()
4766 return -1; in stv090x_init()
4771 struct stv090x_state *state = fe->demodulator_priv; in stv090x_setup()
4772 const struct stv090x_config *config = state->config; in stv090x_setup()
4780 if (state->device == STV0900) { in stv090x_setup()
4786 } else if (state->device == STV0903) { in stv090x_setup()
4799 if (state->device == STV0900) in stv090x_setup()
4808 if (state->device == STV0900) in stv090x_setup()
4813 STV090x_SETFIELD_Px(reg, ENARPT_LEVEL_FIELD, config->repeater_level); in stv090x_setup()
4816 if (state->device == STV0900) in stv090x_setup()
4825 if (stv090x_write_reg(state, STV090x_SYNTCTRL, 0x20 | config->clk_mode) < 0) /* enable PLL */ in stv090x_setup()
4836 state->internal->dev_ver = stv090x_read_reg(state, STV090x_MID); in stv090x_setup()
4837 if (state->internal->dev_ver >= 0x20) { in stv090x_setup()
4848 } else if (state->internal->dev_ver < 0x20) { in stv090x_setup()
4850 state->internal->dev_ver); in stv090x_setup()
4853 } else if (state->internal->dev_ver > 0x30) { in stv090x_setup()
4856 state->internal->dev_ver); in stv090x_setup()
4862 (config->adc1_range == STV090x_ADC_1Vpp) ? 0 : 1); in stv090x_setup()
4869 (config->adc2_range == STV090x_ADC_1Vpp) ? 0 : 1); in stv090x_setup()
4881 return -1; in stv090x_setup()
4887 struct stv090x_state *state = fe->demodulator_priv; in stv090x_set_gpio()
4901 temp_int = find_dev(state->i2c, in stv090x_setup_compound()
4902 state->config->address); in stv090x_setup_compound()
4904 if (temp_int && state->demod_mode == STV090x_DUAL) { in stv090x_setup_compound()
4905 state->internal = temp_int->internal; in stv090x_setup_compound()
4906 state->internal->num_used++; in stv090x_setup_compound()
4909 state->internal = kmalloc(sizeof(*state->internal), GFP_KERNEL); in stv090x_setup_compound()
4910 if (!state->internal) in stv090x_setup_compound()
4912 temp_int = append_internal(state->internal); in stv090x_setup_compound()
4914 kfree(state->internal); in stv090x_setup_compound()
4917 state->internal->num_used = 1; in stv090x_setup_compound()
4918 state->internal->mclk = 0; in stv090x_setup_compound()
4919 state->internal->dev_ver = 0; in stv090x_setup_compound()
4920 state->internal->i2c_adap = state->i2c; in stv090x_setup_compound()
4921 state->internal->i2c_addr = state->config->address; in stv090x_setup_compound()
4924 mutex_init(&state->internal->demod_lock); in stv090x_setup_compound()
4925 mutex_init(&state->internal->tuner_lock); in stv090x_setup_compound()
4927 if (stv090x_setup(&state->frontend) < 0) { in stv090x_setup_compound()
4933 if (state->internal->dev_ver >= 0x30) in stv090x_setup_compound()
4934 state->frontend.ops.info.caps |= FE_CAN_MULTISTREAM; in stv090x_setup_compound()
4937 if (state->config->diseqc_envelope_mode) in stv090x_setup_compound()
4938 stv090x_send_diseqc_burst(&state->frontend, SEC_MINI_A); in stv090x_setup_compound()
4940 state->config->set_gpio = stv090x_set_gpio; in stv090x_setup_compound()
4943 state->device == STV0900 ? "STV0900" : "STV0903", in stv090x_setup_compound()
4944 state->config->demod, in stv090x_setup_compound()
4945 state->internal->dev_ver); in stv090x_setup_compound()
4950 return -ENOMEM; in stv090x_setup_compound()
4952 remove_dev(state->internal); in stv090x_setup_compound()
4953 kfree(state->internal); in stv090x_setup_compound()
4954 return -ENODEV; in stv090x_setup_compound()
4993 dev_dbg(&client->dev, "\n"); in stv090x_get_dvb_frontend()
4995 return &state->frontend; in stv090x_get_dvb_frontend()
5001 struct stv090x_config *config = client->dev.platform_data; in stv090x_probe()
5007 ret = -ENOMEM; in stv090x_probe()
5011 state->verbose = &verbose; in stv090x_probe()
5012 state->config = config; in stv090x_probe()
5013 state->i2c = client->adapter; in stv090x_probe()
5014 state->frontend.ops = stv090x_ops; in stv090x_probe()
5015 state->frontend.demodulator_priv = state; in stv090x_probe()
5016 state->demod = config->demod; in stv090x_probe()
5018 state->demod_mode = config->demod_mode; in stv090x_probe()
5019 state->device = config->device; in stv090x_probe()
5021 state->rolloff = STV090x_RO_35; in stv090x_probe()
5030 config->get_dvb_frontend = stv090x_get_dvb_frontend; in stv090x_probe()
5043 stv090x_release(&state->frontend); in stv090x_remove()
5057 state->verbose = &verbose; in stv090x_attach()
5058 state->config = config; in stv090x_attach()
5059 state->i2c = i2c; in stv090x_attach()
5060 state->frontend.ops = stv090x_ops; in stv090x_attach()
5061 state->frontend.demodulator_priv = state; in stv090x_attach()
5062 state->demod = demod; in stv090x_attach()
5064 state->demod_mode = config->demod_mode; in stv090x_attach()
5065 state->device = config->device; in stv090x_attach()
5067 state->rolloff = STV090x_RO_35; in stv090x_attach()
5073 return &state->frontend; in stv090x_attach()
5101 MODULE_DESCRIPTION("STV090x Multi-Std Broadcast frontend");