1*c942fddfSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */ 29a0bf528SMauro Carvalho Chehab /* 39a0bf528SMauro Carvalho Chehab * stv0900_priv.h 49a0bf528SMauro Carvalho Chehab * 59a0bf528SMauro Carvalho Chehab * Driver for ST STV0900 satellite demodulator IC. 69a0bf528SMauro Carvalho Chehab * 79a0bf528SMauro Carvalho Chehab * Copyright (C) ST Microelectronics. 89a0bf528SMauro Carvalho Chehab * Copyright (C) 2009 NetUP Inc. 99a0bf528SMauro Carvalho Chehab * Copyright (C) 2009 Igor M. Liplianin <liplianin@netup.ru> 109a0bf528SMauro Carvalho Chehab */ 119a0bf528SMauro Carvalho Chehab 129a0bf528SMauro Carvalho Chehab #ifndef STV0900_PRIV_H 139a0bf528SMauro Carvalho Chehab #define STV0900_PRIV_H 149a0bf528SMauro Carvalho Chehab 159a0bf528SMauro Carvalho Chehab #include <linux/i2c.h> 169a0bf528SMauro Carvalho Chehab 179a0bf528SMauro Carvalho Chehab #define INRANGE(X, Y, Z) ((((X) <= (Y)) && ((Y) <= (Z))) \ 189a0bf528SMauro Carvalho Chehab || (((Z) <= (Y)) && ((Y) <= (X))) ? 1 : 0) 199a0bf528SMauro Carvalho Chehab 209a0bf528SMauro Carvalho Chehab #ifndef MAKEWORD 219a0bf528SMauro Carvalho Chehab #define MAKEWORD(X, Y) (((X) << 8) + (Y)) 229a0bf528SMauro Carvalho Chehab #endif 239a0bf528SMauro Carvalho Chehab 249a0bf528SMauro Carvalho Chehab #define LSB(X) (((X) & 0xFF)) 259a0bf528SMauro Carvalho Chehab #define MSB(Y) (((Y) >> 8) & 0xFF) 269a0bf528SMauro Carvalho Chehab 279a0bf528SMauro Carvalho Chehab #ifndef TRUE 289a0bf528SMauro Carvalho Chehab #define TRUE (1 == 1) 299a0bf528SMauro Carvalho Chehab #endif 309a0bf528SMauro Carvalho Chehab #ifndef FALSE 319a0bf528SMauro Carvalho Chehab #define FALSE (!TRUE) 329a0bf528SMauro Carvalho Chehab #endif 339a0bf528SMauro Carvalho Chehab 349a0bf528SMauro Carvalho Chehab #define dprintk(args...) \ 359a0bf528SMauro Carvalho Chehab do { \ 369a0bf528SMauro Carvalho Chehab if (stvdebug) \ 379a0bf528SMauro Carvalho Chehab printk(KERN_DEBUG args); \ 389a0bf528SMauro Carvalho Chehab } while (0) 399a0bf528SMauro Carvalho Chehab 409a0bf528SMauro Carvalho Chehab #define STV0900_MAXLOOKUPSIZE 500 419a0bf528SMauro Carvalho Chehab #define STV0900_BLIND_SEARCH_AGC2_TH 700 429a0bf528SMauro Carvalho Chehab #define STV0900_BLIND_SEARCH_AGC2_TH_CUT30 1400 439a0bf528SMauro Carvalho Chehab #define IQPOWER_THRESHOLD 30 449a0bf528SMauro Carvalho Chehab 459a0bf528SMauro Carvalho Chehab /* One point of the lookup table */ 469a0bf528SMauro Carvalho Chehab struct stv000_lookpoint { 479a0bf528SMauro Carvalho Chehab s32 realval;/* real value */ 489a0bf528SMauro Carvalho Chehab s32 regval;/* binary value */ 499a0bf528SMauro Carvalho Chehab }; 509a0bf528SMauro Carvalho Chehab 519a0bf528SMauro Carvalho Chehab /* Lookup table definition */ 529a0bf528SMauro Carvalho Chehab struct stv0900_table{ 539a0bf528SMauro Carvalho Chehab s32 size;/* Size of the lookup table */ 549a0bf528SMauro Carvalho Chehab struct stv000_lookpoint table[STV0900_MAXLOOKUPSIZE];/* Lookup table */ 559a0bf528SMauro Carvalho Chehab }; 569a0bf528SMauro Carvalho Chehab 579a0bf528SMauro Carvalho Chehab enum fe_stv0900_error { 589a0bf528SMauro Carvalho Chehab STV0900_NO_ERROR = 0, 599a0bf528SMauro Carvalho Chehab STV0900_INVALID_HANDLE, 609a0bf528SMauro Carvalho Chehab STV0900_BAD_PARAMETER, 619a0bf528SMauro Carvalho Chehab STV0900_I2C_ERROR, 629a0bf528SMauro Carvalho Chehab STV0900_SEARCH_FAILED, 639a0bf528SMauro Carvalho Chehab }; 649a0bf528SMauro Carvalho Chehab 659a0bf528SMauro Carvalho Chehab enum fe_stv0900_clock_type { 669a0bf528SMauro Carvalho Chehab STV0900_USE_REGISTERS_DEFAULT, 679a0bf528SMauro Carvalho Chehab STV0900_SERIAL_PUNCT_CLOCK,/*Serial punctured clock */ 689a0bf528SMauro Carvalho Chehab STV0900_SERIAL_CONT_CLOCK,/*Serial continues clock */ 699a0bf528SMauro Carvalho Chehab STV0900_PARALLEL_PUNCT_CLOCK,/*Parallel punctured clock */ 709a0bf528SMauro Carvalho Chehab STV0900_DVBCI_CLOCK/*Parallel continues clock : DVBCI */ 719a0bf528SMauro Carvalho Chehab }; 729a0bf528SMauro Carvalho Chehab 739a0bf528SMauro Carvalho Chehab enum fe_stv0900_search_state { 749a0bf528SMauro Carvalho Chehab STV0900_SEARCH = 0, 759a0bf528SMauro Carvalho Chehab STV0900_PLH_DETECTED, 769a0bf528SMauro Carvalho Chehab STV0900_DVBS2_FOUND, 779a0bf528SMauro Carvalho Chehab STV0900_DVBS_FOUND 789a0bf528SMauro Carvalho Chehab 799a0bf528SMauro Carvalho Chehab }; 809a0bf528SMauro Carvalho Chehab 819a0bf528SMauro Carvalho Chehab enum fe_stv0900_ldpc_state { 829a0bf528SMauro Carvalho Chehab STV0900_PATH1_OFF_PATH2_OFF = 0, 839a0bf528SMauro Carvalho Chehab STV0900_PATH1_ON_PATH2_OFF = 1, 849a0bf528SMauro Carvalho Chehab STV0900_PATH1_OFF_PATH2_ON = 2, 859a0bf528SMauro Carvalho Chehab STV0900_PATH1_ON_PATH2_ON = 3 869a0bf528SMauro Carvalho Chehab }; 879a0bf528SMauro Carvalho Chehab 889a0bf528SMauro Carvalho Chehab enum fe_stv0900_signal_type { 899a0bf528SMauro Carvalho Chehab STV0900_NOAGC1 = 0, 909a0bf528SMauro Carvalho Chehab STV0900_AGC1OK, 919a0bf528SMauro Carvalho Chehab STV0900_NOTIMING, 929a0bf528SMauro Carvalho Chehab STV0900_ANALOGCARRIER, 939a0bf528SMauro Carvalho Chehab STV0900_TIMINGOK, 949a0bf528SMauro Carvalho Chehab STV0900_NOAGC2, 959a0bf528SMauro Carvalho Chehab STV0900_AGC2OK, 969a0bf528SMauro Carvalho Chehab STV0900_NOCARRIER, 979a0bf528SMauro Carvalho Chehab STV0900_CARRIEROK, 989a0bf528SMauro Carvalho Chehab STV0900_NODATA, 999a0bf528SMauro Carvalho Chehab STV0900_DATAOK, 1009a0bf528SMauro Carvalho Chehab STV0900_OUTOFRANGE, 1019a0bf528SMauro Carvalho Chehab STV0900_RANGEOK 1029a0bf528SMauro Carvalho Chehab }; 1039a0bf528SMauro Carvalho Chehab 1049a0bf528SMauro Carvalho Chehab enum fe_stv0900_demod_num { 1059a0bf528SMauro Carvalho Chehab STV0900_DEMOD_1, 1069a0bf528SMauro Carvalho Chehab STV0900_DEMOD_2 1079a0bf528SMauro Carvalho Chehab }; 1089a0bf528SMauro Carvalho Chehab 1099a0bf528SMauro Carvalho Chehab enum fe_stv0900_tracking_standard { 1109a0bf528SMauro Carvalho Chehab STV0900_DVBS1_STANDARD,/* Found Standard*/ 1119a0bf528SMauro Carvalho Chehab STV0900_DVBS2_STANDARD, 1129a0bf528SMauro Carvalho Chehab STV0900_DSS_STANDARD, 1139a0bf528SMauro Carvalho Chehab STV0900_TURBOCODE_STANDARD, 1149a0bf528SMauro Carvalho Chehab STV0900_UNKNOWN_STANDARD 1159a0bf528SMauro Carvalho Chehab }; 1169a0bf528SMauro Carvalho Chehab 1179a0bf528SMauro Carvalho Chehab enum fe_stv0900_search_standard { 1189a0bf528SMauro Carvalho Chehab STV0900_AUTO_SEARCH, 1199a0bf528SMauro Carvalho Chehab STV0900_SEARCH_DVBS1,/* Search Standard*/ 1209a0bf528SMauro Carvalho Chehab STV0900_SEARCH_DVBS2, 1219a0bf528SMauro Carvalho Chehab STV0900_SEARCH_DSS, 1229a0bf528SMauro Carvalho Chehab STV0900_SEARCH_TURBOCODE 1239a0bf528SMauro Carvalho Chehab }; 1249a0bf528SMauro Carvalho Chehab 1259a0bf528SMauro Carvalho Chehab enum fe_stv0900_search_algo { 1269a0bf528SMauro Carvalho Chehab STV0900_BLIND_SEARCH,/* offset freq and SR are Unknown */ 1279a0bf528SMauro Carvalho Chehab STV0900_COLD_START,/* only the SR is known */ 1289a0bf528SMauro Carvalho Chehab STV0900_WARM_START/* offset freq and SR are known */ 1299a0bf528SMauro Carvalho Chehab }; 1309a0bf528SMauro Carvalho Chehab 1319a0bf528SMauro Carvalho Chehab enum fe_stv0900_modulation { 1329a0bf528SMauro Carvalho Chehab STV0900_QPSK, 1339a0bf528SMauro Carvalho Chehab STV0900_8PSK, 1349a0bf528SMauro Carvalho Chehab STV0900_16APSK, 1359a0bf528SMauro Carvalho Chehab STV0900_32APSK, 1369a0bf528SMauro Carvalho Chehab STV0900_UNKNOWN 1379a0bf528SMauro Carvalho Chehab }; 1389a0bf528SMauro Carvalho Chehab 1399a0bf528SMauro Carvalho Chehab enum fe_stv0900_modcode { 1409a0bf528SMauro Carvalho Chehab STV0900_DUMMY_PLF, 1419a0bf528SMauro Carvalho Chehab STV0900_QPSK_14, 1429a0bf528SMauro Carvalho Chehab STV0900_QPSK_13, 1439a0bf528SMauro Carvalho Chehab STV0900_QPSK_25, 1449a0bf528SMauro Carvalho Chehab STV0900_QPSK_12, 1459a0bf528SMauro Carvalho Chehab STV0900_QPSK_35, 1469a0bf528SMauro Carvalho Chehab STV0900_QPSK_23, 1479a0bf528SMauro Carvalho Chehab STV0900_QPSK_34, 1489a0bf528SMauro Carvalho Chehab STV0900_QPSK_45, 1499a0bf528SMauro Carvalho Chehab STV0900_QPSK_56, 1509a0bf528SMauro Carvalho Chehab STV0900_QPSK_89, 1519a0bf528SMauro Carvalho Chehab STV0900_QPSK_910, 1529a0bf528SMauro Carvalho Chehab STV0900_8PSK_35, 1539a0bf528SMauro Carvalho Chehab STV0900_8PSK_23, 1549a0bf528SMauro Carvalho Chehab STV0900_8PSK_34, 1559a0bf528SMauro Carvalho Chehab STV0900_8PSK_56, 1569a0bf528SMauro Carvalho Chehab STV0900_8PSK_89, 1579a0bf528SMauro Carvalho Chehab STV0900_8PSK_910, 1589a0bf528SMauro Carvalho Chehab STV0900_16APSK_23, 1599a0bf528SMauro Carvalho Chehab STV0900_16APSK_34, 1609a0bf528SMauro Carvalho Chehab STV0900_16APSK_45, 1619a0bf528SMauro Carvalho Chehab STV0900_16APSK_56, 1629a0bf528SMauro Carvalho Chehab STV0900_16APSK_89, 1639a0bf528SMauro Carvalho Chehab STV0900_16APSK_910, 1649a0bf528SMauro Carvalho Chehab STV0900_32APSK_34, 1659a0bf528SMauro Carvalho Chehab STV0900_32APSK_45, 1669a0bf528SMauro Carvalho Chehab STV0900_32APSK_56, 1679a0bf528SMauro Carvalho Chehab STV0900_32APSK_89, 1689a0bf528SMauro Carvalho Chehab STV0900_32APSK_910, 1699a0bf528SMauro Carvalho Chehab STV0900_MODCODE_UNKNOWN 1709a0bf528SMauro Carvalho Chehab }; 1719a0bf528SMauro Carvalho Chehab 1729a0bf528SMauro Carvalho Chehab enum fe_stv0900_fec {/*DVBS1, DSS and turbo code puncture rate*/ 1739a0bf528SMauro Carvalho Chehab STV0900_FEC_1_2 = 0, 1749a0bf528SMauro Carvalho Chehab STV0900_FEC_2_3, 1759a0bf528SMauro Carvalho Chehab STV0900_FEC_3_4, 1769a0bf528SMauro Carvalho Chehab STV0900_FEC_4_5,/*for turbo code only*/ 1779a0bf528SMauro Carvalho Chehab STV0900_FEC_5_6, 1789a0bf528SMauro Carvalho Chehab STV0900_FEC_6_7,/*for DSS only */ 1799a0bf528SMauro Carvalho Chehab STV0900_FEC_7_8, 1809a0bf528SMauro Carvalho Chehab STV0900_FEC_8_9,/*for turbo code only*/ 1819a0bf528SMauro Carvalho Chehab STV0900_FEC_UNKNOWN 1829a0bf528SMauro Carvalho Chehab }; 1839a0bf528SMauro Carvalho Chehab 1849a0bf528SMauro Carvalho Chehab enum fe_stv0900_frame_length { 1859a0bf528SMauro Carvalho Chehab STV0900_LONG_FRAME, 1869a0bf528SMauro Carvalho Chehab STV0900_SHORT_FRAME 1879a0bf528SMauro Carvalho Chehab }; 1889a0bf528SMauro Carvalho Chehab 1899a0bf528SMauro Carvalho Chehab enum fe_stv0900_pilot { 1909a0bf528SMauro Carvalho Chehab STV0900_PILOTS_OFF, 1919a0bf528SMauro Carvalho Chehab STV0900_PILOTS_ON 1929a0bf528SMauro Carvalho Chehab }; 1939a0bf528SMauro Carvalho Chehab 1949a0bf528SMauro Carvalho Chehab enum fe_stv0900_rolloff { 1959a0bf528SMauro Carvalho Chehab STV0900_35, 1969a0bf528SMauro Carvalho Chehab STV0900_25, 1979a0bf528SMauro Carvalho Chehab STV0900_20 1989a0bf528SMauro Carvalho Chehab }; 1999a0bf528SMauro Carvalho Chehab 2009a0bf528SMauro Carvalho Chehab enum fe_stv0900_search_iq { 2019a0bf528SMauro Carvalho Chehab STV0900_IQ_AUTO, 2029a0bf528SMauro Carvalho Chehab STV0900_IQ_AUTO_NORMAL_FIRST, 2039a0bf528SMauro Carvalho Chehab STV0900_IQ_FORCE_NORMAL, 2049a0bf528SMauro Carvalho Chehab STV0900_IQ_FORCE_SWAPPED 2059a0bf528SMauro Carvalho Chehab }; 2069a0bf528SMauro Carvalho Chehab 2079a0bf528SMauro Carvalho Chehab enum stv0900_iq_inversion { 2089a0bf528SMauro Carvalho Chehab STV0900_IQ_NORMAL, 2099a0bf528SMauro Carvalho Chehab STV0900_IQ_SWAPPED 2109a0bf528SMauro Carvalho Chehab }; 2119a0bf528SMauro Carvalho Chehab 2129a0bf528SMauro Carvalho Chehab enum fe_stv0900_diseqc_mode { 2139a0bf528SMauro Carvalho Chehab STV0900_22KHZ_Continues = 0, 2149a0bf528SMauro Carvalho Chehab STV0900_DISEQC_2_3_PWM = 2, 2159a0bf528SMauro Carvalho Chehab STV0900_DISEQC_3_3_PWM = 3, 2169a0bf528SMauro Carvalho Chehab STV0900_DISEQC_2_3_ENVELOP = 4, 2179a0bf528SMauro Carvalho Chehab STV0900_DISEQC_3_3_ENVELOP = 5 2189a0bf528SMauro Carvalho Chehab }; 2199a0bf528SMauro Carvalho Chehab 2209a0bf528SMauro Carvalho Chehab enum fe_stv0900_demod_mode { 2219a0bf528SMauro Carvalho Chehab STV0900_SINGLE = 0, 2229a0bf528SMauro Carvalho Chehab STV0900_DUAL 2239a0bf528SMauro Carvalho Chehab }; 2249a0bf528SMauro Carvalho Chehab 2259a0bf528SMauro Carvalho Chehab struct stv0900_init_params{ 2269a0bf528SMauro Carvalho Chehab u32 dmd_ref_clk;/* Reference,Input clock for the demod in Hz */ 2279a0bf528SMauro Carvalho Chehab 2289a0bf528SMauro Carvalho Chehab /* Demodulator Type (single demod or dual demod) */ 2299a0bf528SMauro Carvalho Chehab enum fe_stv0900_demod_mode demod_mode; 2309a0bf528SMauro Carvalho Chehab enum fe_stv0900_rolloff rolloff; 2319a0bf528SMauro Carvalho Chehab enum fe_stv0900_clock_type path1_ts_clock; 2329a0bf528SMauro Carvalho Chehab 2339a0bf528SMauro Carvalho Chehab u8 tun1_maddress; 2349a0bf528SMauro Carvalho Chehab int tuner1_adc; 2359a0bf528SMauro Carvalho Chehab int tuner1_type; 2369a0bf528SMauro Carvalho Chehab 2379a0bf528SMauro Carvalho Chehab /* IQ from the tuner1 to the demod */ 2389a0bf528SMauro Carvalho Chehab enum stv0900_iq_inversion tun1_iq_inv; 2399a0bf528SMauro Carvalho Chehab enum fe_stv0900_clock_type path2_ts_clock; 2409a0bf528SMauro Carvalho Chehab 2419a0bf528SMauro Carvalho Chehab u8 tun2_maddress; 2429a0bf528SMauro Carvalho Chehab int tuner2_adc; 2439a0bf528SMauro Carvalho Chehab int tuner2_type; 2449a0bf528SMauro Carvalho Chehab 2459a0bf528SMauro Carvalho Chehab /* IQ from the tuner2 to the demod */ 2469a0bf528SMauro Carvalho Chehab enum stv0900_iq_inversion tun2_iq_inv; 2479a0bf528SMauro Carvalho Chehab struct stv0900_reg *ts_config; 2489a0bf528SMauro Carvalho Chehab }; 2499a0bf528SMauro Carvalho Chehab 2509a0bf528SMauro Carvalho Chehab struct stv0900_search_params { 2519a0bf528SMauro Carvalho Chehab enum fe_stv0900_demod_num path;/* Path Used demod1 or 2 */ 2529a0bf528SMauro Carvalho Chehab 2539a0bf528SMauro Carvalho Chehab u32 frequency;/* Transponder frequency (in KHz) */ 2549a0bf528SMauro Carvalho Chehab u32 symbol_rate;/* Transponder symbol rate (in bds)*/ 2559a0bf528SMauro Carvalho Chehab u32 search_range;/* Range of the search (in Hz) */ 2569a0bf528SMauro Carvalho Chehab 2579a0bf528SMauro Carvalho Chehab enum fe_stv0900_search_standard standard; 2589a0bf528SMauro Carvalho Chehab enum fe_stv0900_modulation modulation; 2599a0bf528SMauro Carvalho Chehab enum fe_stv0900_fec fec; 2609a0bf528SMauro Carvalho Chehab enum fe_stv0900_modcode modcode; 2619a0bf528SMauro Carvalho Chehab enum fe_stv0900_search_iq iq_inversion; 2629a0bf528SMauro Carvalho Chehab enum fe_stv0900_search_algo search_algo; 2639a0bf528SMauro Carvalho Chehab 2649a0bf528SMauro Carvalho Chehab }; 2659a0bf528SMauro Carvalho Chehab 2669a0bf528SMauro Carvalho Chehab struct stv0900_signal_info { 2679a0bf528SMauro Carvalho Chehab int locked;/* Transponder locked */ 2689a0bf528SMauro Carvalho Chehab u32 frequency;/* Transponder frequency (in KHz) */ 2699a0bf528SMauro Carvalho Chehab u32 symbol_rate;/* Transponder symbol rate (in Mbds) */ 2709a0bf528SMauro Carvalho Chehab 2719a0bf528SMauro Carvalho Chehab enum fe_stv0900_tracking_standard standard; 2729a0bf528SMauro Carvalho Chehab enum fe_stv0900_fec fec; 2739a0bf528SMauro Carvalho Chehab enum fe_stv0900_modcode modcode; 2749a0bf528SMauro Carvalho Chehab enum fe_stv0900_modulation modulation; 2759a0bf528SMauro Carvalho Chehab enum fe_stv0900_pilot pilot; 2769a0bf528SMauro Carvalho Chehab enum fe_stv0900_frame_length frame_len; 2779a0bf528SMauro Carvalho Chehab enum stv0900_iq_inversion spectrum; 2789a0bf528SMauro Carvalho Chehab enum fe_stv0900_rolloff rolloff; 2799a0bf528SMauro Carvalho Chehab 2809a0bf528SMauro Carvalho Chehab s32 Power;/* Power of the RF signal (dBm) */ 2819a0bf528SMauro Carvalho Chehab s32 C_N;/* Carrier to noise ratio (dB x10)*/ 2829a0bf528SMauro Carvalho Chehab u32 BER;/* Bit error rate (x10^7) */ 2839a0bf528SMauro Carvalho Chehab 2849a0bf528SMauro Carvalho Chehab }; 2859a0bf528SMauro Carvalho Chehab 2869a0bf528SMauro Carvalho Chehab struct stv0900_internal{ 2879a0bf528SMauro Carvalho Chehab s32 quartz; 2889a0bf528SMauro Carvalho Chehab s32 mclk; 2899a0bf528SMauro Carvalho Chehab /* manual RollOff for DVBS1/DSS only */ 2909a0bf528SMauro Carvalho Chehab enum fe_stv0900_rolloff rolloff; 2919a0bf528SMauro Carvalho Chehab /* Demodulator use for single demod or for dual demod) */ 2929a0bf528SMauro Carvalho Chehab enum fe_stv0900_demod_mode demod_mode; 2939a0bf528SMauro Carvalho Chehab 2949a0bf528SMauro Carvalho Chehab /*Demods */ 2959a0bf528SMauro Carvalho Chehab s32 freq[2]; 2969a0bf528SMauro Carvalho Chehab s32 bw[2]; 2979a0bf528SMauro Carvalho Chehab s32 symbol_rate[2]; 2989a0bf528SMauro Carvalho Chehab s32 srch_range[2]; 2999a0bf528SMauro Carvalho Chehab /* for software/auto tuner */ 3009a0bf528SMauro Carvalho Chehab int tuner_type[2]; 3019a0bf528SMauro Carvalho Chehab 3029a0bf528SMauro Carvalho Chehab /* algorithm for search Blind, Cold or Warm*/ 3039a0bf528SMauro Carvalho Chehab enum fe_stv0900_search_algo srch_algo[2]; 3049a0bf528SMauro Carvalho Chehab /* search standard: Auto, DVBS1/DSS only or DVBS2 only*/ 3059a0bf528SMauro Carvalho Chehab enum fe_stv0900_search_standard srch_standard[2]; 3069a0bf528SMauro Carvalho Chehab /* inversion search : auto, auto norma first, normal or inverted */ 3079a0bf528SMauro Carvalho Chehab enum fe_stv0900_search_iq srch_iq_inv[2]; 3089a0bf528SMauro Carvalho Chehab enum fe_stv0900_modcode modcode[2]; 3099a0bf528SMauro Carvalho Chehab enum fe_stv0900_modulation modulation[2]; 3109a0bf528SMauro Carvalho Chehab enum fe_stv0900_fec fec[2]; 3119a0bf528SMauro Carvalho Chehab 3129a0bf528SMauro Carvalho Chehab struct stv0900_signal_info result[2]; 3139a0bf528SMauro Carvalho Chehab enum fe_stv0900_error err[2]; 3149a0bf528SMauro Carvalho Chehab 3159a0bf528SMauro Carvalho Chehab 3169a0bf528SMauro Carvalho Chehab struct i2c_adapter *i2c_adap; 3179a0bf528SMauro Carvalho Chehab u8 i2c_addr; 3189a0bf528SMauro Carvalho Chehab u8 clkmode;/* 0 for CLKI, 2 for XTALI */ 3199a0bf528SMauro Carvalho Chehab u8 chip_id; 3209a0bf528SMauro Carvalho Chehab struct stv0900_reg *ts_config; 3219a0bf528SMauro Carvalho Chehab enum fe_stv0900_error errs; 3229a0bf528SMauro Carvalho Chehab int dmds_used; 3239a0bf528SMauro Carvalho Chehab }; 3249a0bf528SMauro Carvalho Chehab 3259a0bf528SMauro Carvalho Chehab /* state for each demod */ 3269a0bf528SMauro Carvalho Chehab struct stv0900_state { 3279a0bf528SMauro Carvalho Chehab /* pointer for internal params, one for each pair of demods */ 3289a0bf528SMauro Carvalho Chehab struct stv0900_internal *internal; 3299a0bf528SMauro Carvalho Chehab struct i2c_adapter *i2c_adap; 3309a0bf528SMauro Carvalho Chehab const struct stv0900_config *config; 3319a0bf528SMauro Carvalho Chehab struct dvb_frontend frontend; 3329a0bf528SMauro Carvalho Chehab int demod; 3339a0bf528SMauro Carvalho Chehab }; 3349a0bf528SMauro Carvalho Chehab 3359a0bf528SMauro Carvalho Chehab extern int stvdebug; 3369a0bf528SMauro Carvalho Chehab 3379a0bf528SMauro Carvalho Chehab extern s32 ge2comp(s32 a, s32 width); 3389a0bf528SMauro Carvalho Chehab 3399a0bf528SMauro Carvalho Chehab extern void stv0900_write_reg(struct stv0900_internal *i_params, 3409a0bf528SMauro Carvalho Chehab u16 reg_addr, u8 reg_data); 3419a0bf528SMauro Carvalho Chehab 3429a0bf528SMauro Carvalho Chehab extern u8 stv0900_read_reg(struct stv0900_internal *i_params, 3439a0bf528SMauro Carvalho Chehab u16 reg_addr); 3449a0bf528SMauro Carvalho Chehab 3459a0bf528SMauro Carvalho Chehab extern void stv0900_write_bits(struct stv0900_internal *i_params, 3469a0bf528SMauro Carvalho Chehab u32 label, u8 val); 3479a0bf528SMauro Carvalho Chehab 3489a0bf528SMauro Carvalho Chehab extern u8 stv0900_get_bits(struct stv0900_internal *i_params, 3499a0bf528SMauro Carvalho Chehab u32 label); 3509a0bf528SMauro Carvalho Chehab 3519a0bf528SMauro Carvalho Chehab extern int stv0900_get_demod_lock(struct stv0900_internal *i_params, 3529a0bf528SMauro Carvalho Chehab enum fe_stv0900_demod_num demod, s32 time_out); 3539a0bf528SMauro Carvalho Chehab extern int stv0900_check_signal_presence(struct stv0900_internal *i_params, 3549a0bf528SMauro Carvalho Chehab enum fe_stv0900_demod_num demod); 3559a0bf528SMauro Carvalho Chehab 3569a0bf528SMauro Carvalho Chehab extern enum fe_stv0900_signal_type stv0900_algo(struct dvb_frontend *fe); 3579a0bf528SMauro Carvalho Chehab 3589a0bf528SMauro Carvalho Chehab extern void stv0900_set_tuner(struct dvb_frontend *fe, u32 frequency, 3599a0bf528SMauro Carvalho Chehab u32 bandwidth); 3609a0bf528SMauro Carvalho Chehab extern void stv0900_set_bandwidth(struct dvb_frontend *fe, u32 bandwidth); 3619a0bf528SMauro Carvalho Chehab 3629a0bf528SMauro Carvalho Chehab extern void stv0900_start_search(struct stv0900_internal *i_params, 3639a0bf528SMauro Carvalho Chehab enum fe_stv0900_demod_num demod); 3649a0bf528SMauro Carvalho Chehab 3659a0bf528SMauro Carvalho Chehab extern u8 stv0900_get_optim_carr_loop(s32 srate, 3669a0bf528SMauro Carvalho Chehab enum fe_stv0900_modcode modcode, 3679a0bf528SMauro Carvalho Chehab s32 pilot, u8 chip_id); 3689a0bf528SMauro Carvalho Chehab 3699a0bf528SMauro Carvalho Chehab extern u8 stv0900_get_optim_short_carr_loop(s32 srate, 3709a0bf528SMauro Carvalho Chehab enum fe_stv0900_modulation modulation, 3719a0bf528SMauro Carvalho Chehab u8 chip_id); 3729a0bf528SMauro Carvalho Chehab 3739a0bf528SMauro Carvalho Chehab extern void stv0900_stop_all_s2_modcod(struct stv0900_internal *i_params, 3749a0bf528SMauro Carvalho Chehab enum fe_stv0900_demod_num demod); 3759a0bf528SMauro Carvalho Chehab 3769a0bf528SMauro Carvalho Chehab extern void stv0900_activate_s2_modcod(struct stv0900_internal *i_params, 3779a0bf528SMauro Carvalho Chehab enum fe_stv0900_demod_num demod); 3789a0bf528SMauro Carvalho Chehab 3799a0bf528SMauro Carvalho Chehab extern void stv0900_activate_s2_modcod_single(struct stv0900_internal *i_params, 3809a0bf528SMauro Carvalho Chehab enum fe_stv0900_demod_num demod); 3819a0bf528SMauro Carvalho Chehab 3829a0bf528SMauro Carvalho Chehab extern enum 3839a0bf528SMauro Carvalho Chehab fe_stv0900_tracking_standard stv0900_get_standard(struct dvb_frontend *fe, 3849a0bf528SMauro Carvalho Chehab enum fe_stv0900_demod_num demod); 3859a0bf528SMauro Carvalho Chehab 3869a0bf528SMauro Carvalho Chehab extern u32 3879a0bf528SMauro Carvalho Chehab stv0900_get_freq_auto(struct stv0900_internal *intp, int demod); 3889a0bf528SMauro Carvalho Chehab 3899a0bf528SMauro Carvalho Chehab extern void 3909a0bf528SMauro Carvalho Chehab stv0900_set_tuner_auto(struct stv0900_internal *intp, u32 Frequency, 3919a0bf528SMauro Carvalho Chehab u32 Bandwidth, int demod); 3929a0bf528SMauro Carvalho Chehab 3939a0bf528SMauro Carvalho Chehab #endif 394