19a0bf528SMauro Carvalho Chehab #include "drxk_map.h" 29a0bf528SMauro Carvalho Chehab 39a0bf528SMauro Carvalho Chehab #define DRXK_VERSION_MAJOR 0 49a0bf528SMauro Carvalho Chehab #define DRXK_VERSION_MINOR 9 59a0bf528SMauro Carvalho Chehab #define DRXK_VERSION_PATCH 4300 69a0bf528SMauro Carvalho Chehab 79a0bf528SMauro Carvalho Chehab #define HI_I2C_DELAY 42 89a0bf528SMauro Carvalho Chehab #define HI_I2C_BRIDGE_DELAY 350 99a0bf528SMauro Carvalho Chehab #define DRXK_MAX_RETRIES 100 109a0bf528SMauro Carvalho Chehab 119a0bf528SMauro Carvalho Chehab #define DRIVER_4400 1 129a0bf528SMauro Carvalho Chehab 139a0bf528SMauro Carvalho Chehab #define DRXX_JTAGID 0x039210D9 149a0bf528SMauro Carvalho Chehab #define DRXX_J_JTAGID 0x239310D9 159a0bf528SMauro Carvalho Chehab #define DRXX_K_JTAGID 0x039210D9 169a0bf528SMauro Carvalho Chehab 179a0bf528SMauro Carvalho Chehab #define DRX_UNKNOWN 254 189a0bf528SMauro Carvalho Chehab #define DRX_AUTO 255 199a0bf528SMauro Carvalho Chehab 209a0bf528SMauro Carvalho Chehab #define DRX_SCU_READY 0 219a0bf528SMauro Carvalho Chehab #define DRXK_MAX_WAITTIME (200) 229a0bf528SMauro Carvalho Chehab #define SCU_RESULT_OK 0 239a0bf528SMauro Carvalho Chehab #define SCU_RESULT_SIZE -4 249a0bf528SMauro Carvalho Chehab #define SCU_RESULT_INVPAR -3 259a0bf528SMauro Carvalho Chehab #define SCU_RESULT_UNKSTD -2 269a0bf528SMauro Carvalho Chehab #define SCU_RESULT_UNKCMD -1 279a0bf528SMauro Carvalho Chehab 289a0bf528SMauro Carvalho Chehab #ifndef DRXK_OFDM_TR_SHUTDOWN_TIMEOUT 299a0bf528SMauro Carvalho Chehab #define DRXK_OFDM_TR_SHUTDOWN_TIMEOUT (200) 309a0bf528SMauro Carvalho Chehab #endif 319a0bf528SMauro Carvalho Chehab 329a0bf528SMauro Carvalho Chehab #define DRXK_8VSB_MPEG_BIT_RATE 19392658UL /*bps*/ 339a0bf528SMauro Carvalho Chehab #define DRXK_DVBT_MPEG_BIT_RATE 32000000UL /*bps*/ 349a0bf528SMauro Carvalho Chehab #define DRXK_QAM16_MPEG_BIT_RATE 27000000UL /*bps*/ 359a0bf528SMauro Carvalho Chehab #define DRXK_QAM32_MPEG_BIT_RATE 33000000UL /*bps*/ 369a0bf528SMauro Carvalho Chehab #define DRXK_QAM64_MPEG_BIT_RATE 40000000UL /*bps*/ 379a0bf528SMauro Carvalho Chehab #define DRXK_QAM128_MPEG_BIT_RATE 46000000UL /*bps*/ 389a0bf528SMauro Carvalho Chehab #define DRXK_QAM256_MPEG_BIT_RATE 52000000UL /*bps*/ 399a0bf528SMauro Carvalho Chehab #define DRXK_MAX_MPEG_BIT_RATE 52000000UL /*bps*/ 409a0bf528SMauro Carvalho Chehab 419a0bf528SMauro Carvalho Chehab #define IQM_CF_OUT_ENA_OFDM__M 0x4 429a0bf528SMauro Carvalho Chehab #define IQM_FS_ADJ_SEL_B_QAM 0x1 439a0bf528SMauro Carvalho Chehab #define IQM_FS_ADJ_SEL_B_OFF 0x0 449a0bf528SMauro Carvalho Chehab #define IQM_FS_ADJ_SEL_B_VSB 0x2 459a0bf528SMauro Carvalho Chehab #define IQM_RC_ADJ_SEL_B_OFF 0x0 469a0bf528SMauro Carvalho Chehab #define IQM_RC_ADJ_SEL_B_QAM 0x1 479a0bf528SMauro Carvalho Chehab #define IQM_RC_ADJ_SEL_B_VSB 0x2 489a0bf528SMauro Carvalho Chehab 49cd7a67a4SMauro Carvalho Chehab enum operation_mode { 509a0bf528SMauro Carvalho Chehab OM_NONE, 519a0bf528SMauro Carvalho Chehab OM_QAM_ITU_A, 529a0bf528SMauro Carvalho Chehab OM_QAM_ITU_B, 539a0bf528SMauro Carvalho Chehab OM_QAM_ITU_C, 549a0bf528SMauro Carvalho Chehab OM_DVBT 559a0bf528SMauro Carvalho Chehab }; 569a0bf528SMauro Carvalho Chehab 57cd7a67a4SMauro Carvalho Chehab enum drx_power_mode { 589a0bf528SMauro Carvalho Chehab DRX_POWER_UP = 0, 599a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_1, 609a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_2, 619a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_3, 629a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_4, 639a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_5, 649a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_6, 659a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_7, 669a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_8, 679a0bf528SMauro Carvalho Chehab 689a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_9, 699a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_10, 709a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_11, 719a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_12, 729a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_13, 739a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_14, 749a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_15, 759a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_16, 769a0bf528SMauro Carvalho Chehab DRX_POWER_DOWN = 255 779a0bf528SMauro Carvalho Chehab }; 789a0bf528SMauro Carvalho Chehab 799a0bf528SMauro Carvalho Chehab 809a0bf528SMauro Carvalho Chehab /** /brief Intermediate power mode for DRXK, power down OFDM clock domain */ 819a0bf528SMauro Carvalho Chehab #ifndef DRXK_POWER_DOWN_OFDM 829a0bf528SMauro Carvalho Chehab #define DRXK_POWER_DOWN_OFDM DRX_POWER_MODE_1 839a0bf528SMauro Carvalho Chehab #endif 849a0bf528SMauro Carvalho Chehab 859a0bf528SMauro Carvalho Chehab /** /brief Intermediate power mode for DRXK, power down core (sysclk) */ 869a0bf528SMauro Carvalho Chehab #ifndef DRXK_POWER_DOWN_CORE 879a0bf528SMauro Carvalho Chehab #define DRXK_POWER_DOWN_CORE DRX_POWER_MODE_9 889a0bf528SMauro Carvalho Chehab #endif 899a0bf528SMauro Carvalho Chehab 909a0bf528SMauro Carvalho Chehab /** /brief Intermediate power mode for DRXK, power down pll (only osc runs) */ 919a0bf528SMauro Carvalho Chehab #ifndef DRXK_POWER_DOWN_PLL 929a0bf528SMauro Carvalho Chehab #define DRXK_POWER_DOWN_PLL DRX_POWER_MODE_10 939a0bf528SMauro Carvalho Chehab #endif 949a0bf528SMauro Carvalho Chehab 959a0bf528SMauro Carvalho Chehab 96cd7a67a4SMauro Carvalho Chehab enum agc_ctrl_mode { DRXK_AGC_CTRL_AUTO = 0, DRXK_AGC_CTRL_USER, DRXK_AGC_CTRL_OFF }; 97cd7a67a4SMauro Carvalho Chehab enum e_drxk_state { 989a0bf528SMauro Carvalho Chehab DRXK_UNINITIALIZED = 0, 999a0bf528SMauro Carvalho Chehab DRXK_STOPPED, 1009a0bf528SMauro Carvalho Chehab DRXK_DTV_STARTED, 1019a0bf528SMauro Carvalho Chehab DRXK_ATV_STARTED, 1029a0bf528SMauro Carvalho Chehab DRXK_POWERED_DOWN, 1039a0bf528SMauro Carvalho Chehab DRXK_NO_DEV /* If drxk init failed */ 1049a0bf528SMauro Carvalho Chehab }; 1059a0bf528SMauro Carvalho Chehab 106cd7a67a4SMauro Carvalho Chehab enum e_drxk_coef_array_index { 1079a0bf528SMauro Carvalho Chehab DRXK_COEF_IDX_MN = 0, 1089a0bf528SMauro Carvalho Chehab DRXK_COEF_IDX_FM , 1099a0bf528SMauro Carvalho Chehab DRXK_COEF_IDX_L , 1109a0bf528SMauro Carvalho Chehab DRXK_COEF_IDX_LP , 1119a0bf528SMauro Carvalho Chehab DRXK_COEF_IDX_BG , 1129a0bf528SMauro Carvalho Chehab DRXK_COEF_IDX_DK , 1139a0bf528SMauro Carvalho Chehab DRXK_COEF_IDX_I , 1149a0bf528SMauro Carvalho Chehab DRXK_COEF_IDX_MAX 1159a0bf528SMauro Carvalho Chehab }; 116cd7a67a4SMauro Carvalho Chehab enum e_drxk_sif_attenuation { 1179a0bf528SMauro Carvalho Chehab DRXK_SIF_ATTENUATION_0DB, 1189a0bf528SMauro Carvalho Chehab DRXK_SIF_ATTENUATION_3DB, 1199a0bf528SMauro Carvalho Chehab DRXK_SIF_ATTENUATION_6DB, 1209a0bf528SMauro Carvalho Chehab DRXK_SIF_ATTENUATION_9DB 1219a0bf528SMauro Carvalho Chehab }; 122cd7a67a4SMauro Carvalho Chehab enum e_drxk_constellation { 1239a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_BPSK = 0, 1249a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_QPSK, 1259a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_PSK8, 1269a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_QAM16, 1279a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_QAM32, 1289a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_QAM64, 1299a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_QAM128, 1309a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_QAM256, 1319a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_QAM512, 1329a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_QAM1024, 1339a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_UNKNOWN = DRX_UNKNOWN, 1349a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_AUTO = DRX_AUTO 1359a0bf528SMauro Carvalho Chehab }; 136cd7a67a4SMauro Carvalho Chehab enum e_drxk_interleave_mode { 1379a0bf528SMauro Carvalho Chehab DRXK_QAM_I12_J17 = 16, 1389a0bf528SMauro Carvalho Chehab DRXK_QAM_I_UNKNOWN = DRX_UNKNOWN 1399a0bf528SMauro Carvalho Chehab }; 1409a0bf528SMauro Carvalho Chehab enum { 1419a0bf528SMauro Carvalho Chehab DRXK_SPIN_A1 = 0, 1429a0bf528SMauro Carvalho Chehab DRXK_SPIN_A2, 1439a0bf528SMauro Carvalho Chehab DRXK_SPIN_A3, 1449a0bf528SMauro Carvalho Chehab DRXK_SPIN_UNKNOWN 1459a0bf528SMauro Carvalho Chehab }; 1469a0bf528SMauro Carvalho Chehab 147cd7a67a4SMauro Carvalho Chehab enum drxk_cfg_dvbt_sqi_speed { 1489a0bf528SMauro Carvalho Chehab DRXK_DVBT_SQI_SPEED_FAST = 0, 1499a0bf528SMauro Carvalho Chehab DRXK_DVBT_SQI_SPEED_MEDIUM, 1509a0bf528SMauro Carvalho Chehab DRXK_DVBT_SQI_SPEED_SLOW, 1519a0bf528SMauro Carvalho Chehab DRXK_DVBT_SQI_SPEED_UNKNOWN = DRX_UNKNOWN 1529a0bf528SMauro Carvalho Chehab } ; 1539a0bf528SMauro Carvalho Chehab 154cd7a67a4SMauro Carvalho Chehab enum drx_fftmode_t { 1559a0bf528SMauro Carvalho Chehab DRX_FFTMODE_2K = 0, 1569a0bf528SMauro Carvalho Chehab DRX_FFTMODE_4K, 1579a0bf528SMauro Carvalho Chehab DRX_FFTMODE_8K, 1589a0bf528SMauro Carvalho Chehab DRX_FFTMODE_UNKNOWN = DRX_UNKNOWN, 1599a0bf528SMauro Carvalho Chehab DRX_FFTMODE_AUTO = DRX_AUTO 1609a0bf528SMauro Carvalho Chehab }; 1619a0bf528SMauro Carvalho Chehab 162cd7a67a4SMauro Carvalho Chehab enum drxmpeg_str_width_t { 1639a0bf528SMauro Carvalho Chehab DRX_MPEG_STR_WIDTH_1, 1649a0bf528SMauro Carvalho Chehab DRX_MPEG_STR_WIDTH_8 1659a0bf528SMauro Carvalho Chehab }; 1669a0bf528SMauro Carvalho Chehab 167cd7a67a4SMauro Carvalho Chehab enum drx_qam_lock_range_t { 1689a0bf528SMauro Carvalho Chehab DRX_QAM_LOCKRANGE_NORMAL, 1699a0bf528SMauro Carvalho Chehab DRX_QAM_LOCKRANGE_EXTENDED 1709a0bf528SMauro Carvalho Chehab }; 1719a0bf528SMauro Carvalho Chehab 172cd7a67a4SMauro Carvalho Chehab struct drxk_cfg_dvbt_echo_thres_t { 1739a0bf528SMauro Carvalho Chehab u16 threshold; 174cd7a67a4SMauro Carvalho Chehab enum drx_fftmode_t fft_mode; 1759a0bf528SMauro Carvalho Chehab } ; 1769a0bf528SMauro Carvalho Chehab 177cd7a67a4SMauro Carvalho Chehab struct s_cfg_agc { 178cd7a67a4SMauro Carvalho Chehab enum agc_ctrl_mode ctrl_mode; /* off, user, auto */ 179cd7a67a4SMauro Carvalho Chehab u16 output_level; /* range dependent on AGC */ 180cd7a67a4SMauro Carvalho Chehab u16 min_output_level; /* range dependent on AGC */ 181cd7a67a4SMauro Carvalho Chehab u16 max_output_level; /* range dependent on AGC */ 1829a0bf528SMauro Carvalho Chehab u16 speed; /* range dependent on AGC */ 1839a0bf528SMauro Carvalho Chehab u16 top; /* rf-agc take over point */ 184cd7a67a4SMauro Carvalho Chehab u16 cut_off_current; /* rf-agc is accelerated if output current 1859a0bf528SMauro Carvalho Chehab is below cut-off current */ 186cd7a67a4SMauro Carvalho Chehab u16 ingain_tgt_max; 187cd7a67a4SMauro Carvalho Chehab u16 fast_clip_ctrl_delay; 1889a0bf528SMauro Carvalho Chehab }; 1899a0bf528SMauro Carvalho Chehab 190cd7a67a4SMauro Carvalho Chehab struct s_cfg_pre_saw { 1919a0bf528SMauro Carvalho Chehab u16 reference; /* pre SAW reference value, range 0 .. 31 */ 192cd7a67a4SMauro Carvalho Chehab bool use_pre_saw; /* TRUE algorithms must use pre SAW sense */ 1939a0bf528SMauro Carvalho Chehab }; 1949a0bf528SMauro Carvalho Chehab 195cd7a67a4SMauro Carvalho Chehab struct drxk_ofdm_sc_cmd_t { 1969a0bf528SMauro Carvalho Chehab u16 cmd; /**< Command number */ 1979a0bf528SMauro Carvalho Chehab u16 subcmd; /**< Sub-command parameter*/ 1989a0bf528SMauro Carvalho Chehab u16 param0; /**< General purpous param */ 1999a0bf528SMauro Carvalho Chehab u16 param1; /**< General purpous param */ 2009a0bf528SMauro Carvalho Chehab u16 param2; /**< General purpous param */ 2019a0bf528SMauro Carvalho Chehab u16 param3; /**< General purpous param */ 2029a0bf528SMauro Carvalho Chehab u16 param4; /**< General purpous param */ 2039a0bf528SMauro Carvalho Chehab }; 2049a0bf528SMauro Carvalho Chehab 2059a0bf528SMauro Carvalho Chehab struct drxk_state { 2069a0bf528SMauro Carvalho Chehab struct dvb_frontend frontend; 2079a0bf528SMauro Carvalho Chehab struct dtv_frontend_properties props; 2089a0bf528SMauro Carvalho Chehab struct device *dev; 2099a0bf528SMauro Carvalho Chehab 2109a0bf528SMauro Carvalho Chehab struct i2c_adapter *i2c; 2119a0bf528SMauro Carvalho Chehab u8 demod_address; 2129a0bf528SMauro Carvalho Chehab void *priv; 2139a0bf528SMauro Carvalho Chehab 2149a0bf528SMauro Carvalho Chehab struct mutex mutex; 2159a0bf528SMauro Carvalho Chehab 216cd7a67a4SMauro Carvalho Chehab u32 m_instance; /**< Channel 1,2,3 or 4 */ 2179a0bf528SMauro Carvalho Chehab 218cd7a67a4SMauro Carvalho Chehab int m_chunk_size; 219cd7a67a4SMauro Carvalho Chehab u8 chunk[256]; 2209a0bf528SMauro Carvalho Chehab 221cd7a67a4SMauro Carvalho Chehab bool m_has_lna; 222cd7a67a4SMauro Carvalho Chehab bool m_has_dvbt; 223cd7a67a4SMauro Carvalho Chehab bool m_has_dvbc; 224cd7a67a4SMauro Carvalho Chehab bool m_has_audio; 225cd7a67a4SMauro Carvalho Chehab bool m_has_atv; 226cd7a67a4SMauro Carvalho Chehab bool m_has_oob; 227cd7a67a4SMauro Carvalho Chehab bool m_has_sawsw; /* TRUE if mat_tx is available */ 228cd7a67a4SMauro Carvalho Chehab bool m_has_gpio1; /* TRUE if mat_rx is available */ 229cd7a67a4SMauro Carvalho Chehab bool m_has_gpio2; /* TRUE if GPIO is available */ 230cd7a67a4SMauro Carvalho Chehab bool m_has_irqn; /* TRUE if IRQN is available */ 231cd7a67a4SMauro Carvalho Chehab u16 m_osc_clock_freq; 232cd7a67a4SMauro Carvalho Chehab u16 m_hi_cfg_timing_div; 233cd7a67a4SMauro Carvalho Chehab u16 m_hi_cfg_bridge_delay; 234cd7a67a4SMauro Carvalho Chehab u16 m_hi_cfg_wake_up_key; 235cd7a67a4SMauro Carvalho Chehab u16 m_hi_cfg_timeout; 236cd7a67a4SMauro Carvalho Chehab u16 m_hi_cfg_ctrl; 237cd7a67a4SMauro Carvalho Chehab s32 m_sys_clock_freq; /**< system clock frequency in kHz */ 2389a0bf528SMauro Carvalho Chehab 239cd7a67a4SMauro Carvalho Chehab enum e_drxk_state m_drxk_state; /**< State of Drxk (init,stopped,started) */ 240cd7a67a4SMauro Carvalho Chehab enum operation_mode m_operation_mode; /**< digital standards */ 241cd7a67a4SMauro Carvalho Chehab struct s_cfg_agc m_vsb_rf_agc_cfg; /**< settings for VSB RF-AGC */ 242cd7a67a4SMauro Carvalho Chehab struct s_cfg_agc m_vsb_if_agc_cfg; /**< settings for VSB IF-AGC */ 243cd7a67a4SMauro Carvalho Chehab u16 m_vsb_pga_cfg; /**< settings for VSB PGA */ 244cd7a67a4SMauro Carvalho Chehab struct s_cfg_pre_saw m_vsb_pre_saw_cfg; /**< settings for pre SAW sense */ 2459a0bf528SMauro Carvalho Chehab s32 m_Quality83percent; /**< MER level (*0.1 dB) for 83% quality indication */ 2469a0bf528SMauro Carvalho Chehab s32 m_Quality93percent; /**< MER level (*0.1 dB) for 93% quality indication */ 247cd7a67a4SMauro Carvalho Chehab bool m_smart_ant_inverted; 248cd7a67a4SMauro Carvalho Chehab bool m_b_debug_enable_bridge; 249cd7a67a4SMauro Carvalho Chehab bool m_b_p_down_open_bridge; /**< only open DRXK bridge before power-down once it has been accessed */ 250cd7a67a4SMauro Carvalho Chehab bool m_b_power_down; /**< Power down when not used */ 2519a0bf528SMauro Carvalho Chehab 252cd7a67a4SMauro Carvalho Chehab u32 m_iqm_fs_rate_ofs; /**< frequency shift as written to DRXK register (28bit fixpoint) */ 2539a0bf528SMauro Carvalho Chehab 254cd7a67a4SMauro Carvalho Chehab bool m_enable_mpeg_output; /**< If TRUE, enable MPEG output */ 255cd7a67a4SMauro Carvalho Chehab bool m_insert_rs_byte; /**< If TRUE, insert RS byte */ 256cd7a67a4SMauro Carvalho Chehab bool m_enable_parallel; /**< If TRUE, parallel out otherwise serial */ 257cd7a67a4SMauro Carvalho Chehab bool m_invert_data; /**< If TRUE, invert DATA signals */ 258cd7a67a4SMauro Carvalho Chehab bool m_invert_err; /**< If TRUE, invert ERR signal */ 259cd7a67a4SMauro Carvalho Chehab bool m_invert_str; /**< If TRUE, invert STR signals */ 260cd7a67a4SMauro Carvalho Chehab bool m_invert_val; /**< If TRUE, invert VAL signals */ 261cd7a67a4SMauro Carvalho Chehab bool m_invert_clk; /**< If TRUE, invert CLK signals */ 262cd7a67a4SMauro Carvalho Chehab bool m_dvbc_static_clk; 263cd7a67a4SMauro Carvalho Chehab bool m_dvbt_static_clk; /**< If TRUE, static MPEG clockrate will 2649a0bf528SMauro Carvalho Chehab be used, otherwise clockrate will 2659a0bf528SMauro Carvalho Chehab adapt to the bitrate of the TS */ 266cd7a67a4SMauro Carvalho Chehab u32 m_dvbt_bitrate; 267cd7a67a4SMauro Carvalho Chehab u32 m_dvbc_bitrate; 2689a0bf528SMauro Carvalho Chehab 269cd7a67a4SMauro Carvalho Chehab u8 m_ts_data_strength; 270cd7a67a4SMauro Carvalho Chehab u8 m_ts_clockk_strength; 2719a0bf528SMauro Carvalho Chehab 2729a0bf528SMauro Carvalho Chehab bool m_itut_annex_c; /* If true, uses ITU-T DVB-C Annex C, instead of Annex A */ 2739a0bf528SMauro Carvalho Chehab 274cd7a67a4SMauro Carvalho Chehab enum drxmpeg_str_width_t m_width_str; /**< MPEG start width */ 275cd7a67a4SMauro Carvalho Chehab u32 m_mpeg_ts_static_bitrate; /**< Maximum bitrate in b/s in case 2769a0bf528SMauro Carvalho Chehab static clockrate is selected */ 2779a0bf528SMauro Carvalho Chehab 278cd7a67a4SMauro Carvalho Chehab /* LARGE_INTEGER m_startTime; */ /**< Contains the time of the last demod start */ 279cd7a67a4SMauro Carvalho Chehab s32 m_mpeg_lock_time_out; /**< WaitForLockStatus Timeout (counts from start time) */ 280cd7a67a4SMauro Carvalho Chehab s32 m_demod_lock_time_out; /**< WaitForLockStatus Timeout (counts from start time) */ 2819a0bf528SMauro Carvalho Chehab 282cd7a67a4SMauro Carvalho Chehab bool m_disable_te_ihandling; 2839a0bf528SMauro Carvalho Chehab 284cd7a67a4SMauro Carvalho Chehab bool m_rf_agc_pol; 285cd7a67a4SMauro Carvalho Chehab bool m_if_agc_pol; 2869a0bf528SMauro Carvalho Chehab 287cd7a67a4SMauro Carvalho Chehab struct s_cfg_agc m_atv_rf_agc_cfg; /**< settings for ATV RF-AGC */ 288cd7a67a4SMauro Carvalho Chehab struct s_cfg_agc m_atv_if_agc_cfg; /**< settings for ATV IF-AGC */ 289cd7a67a4SMauro Carvalho Chehab struct s_cfg_pre_saw m_atv_pre_saw_cfg; /**< settings for ATV pre SAW sense */ 290cd7a67a4SMauro Carvalho Chehab bool m_phase_correction_bypass; 291cd7a67a4SMauro Carvalho Chehab s16 m_atv_top_vid_peak; 292cd7a67a4SMauro Carvalho Chehab u16 m_atv_top_noise_th; 293cd7a67a4SMauro Carvalho Chehab enum e_drxk_sif_attenuation m_sif_attenuation; 294cd7a67a4SMauro Carvalho Chehab bool m_enable_cvbs_output; 295cd7a67a4SMauro Carvalho Chehab bool m_enable_sif_output; 296cd7a67a4SMauro Carvalho Chehab bool m_b_mirror_freq_spect; 297cd7a67a4SMauro Carvalho Chehab enum e_drxk_constellation m_constellation; /**< constellation type of the channel */ 298cd7a67a4SMauro Carvalho Chehab u32 m_curr_symbol_rate; /**< Current QAM symbol rate */ 299cd7a67a4SMauro Carvalho Chehab struct s_cfg_agc m_qam_rf_agc_cfg; /**< settings for QAM RF-AGC */ 300cd7a67a4SMauro Carvalho Chehab struct s_cfg_agc m_qam_if_agc_cfg; /**< settings for QAM IF-AGC */ 301cd7a67a4SMauro Carvalho Chehab u16 m_qam_pga_cfg; /**< settings for QAM PGA */ 302cd7a67a4SMauro Carvalho Chehab struct s_cfg_pre_saw m_qam_pre_saw_cfg; /**< settings for QAM pre SAW sense */ 303cd7a67a4SMauro Carvalho Chehab enum e_drxk_interleave_mode m_qam_interleave_mode; /**< QAM Interleave mode */ 304cd7a67a4SMauro Carvalho Chehab u16 m_fec_rs_plen; 305cd7a67a4SMauro Carvalho Chehab u16 m_fec_rs_prescale; 3069a0bf528SMauro Carvalho Chehab 307cd7a67a4SMauro Carvalho Chehab enum drxk_cfg_dvbt_sqi_speed m_sqi_speed; 3089a0bf528SMauro Carvalho Chehab 309cd7a67a4SMauro Carvalho Chehab u16 m_gpio; 310cd7a67a4SMauro Carvalho Chehab u16 m_gpio_cfg; 3119a0bf528SMauro Carvalho Chehab 312cd7a67a4SMauro Carvalho Chehab struct s_cfg_agc m_dvbt_rf_agc_cfg; /**< settings for QAM RF-AGC */ 313cd7a67a4SMauro Carvalho Chehab struct s_cfg_agc m_dvbt_if_agc_cfg; /**< settings for QAM IF-AGC */ 314cd7a67a4SMauro Carvalho Chehab struct s_cfg_pre_saw m_dvbt_pre_saw_cfg; /**< settings for QAM pre SAW sense */ 3159a0bf528SMauro Carvalho Chehab 316cd7a67a4SMauro Carvalho Chehab u16 m_agcfast_clip_ctrl_delay; 317cd7a67a4SMauro Carvalho Chehab bool m_adc_comp_passed; 3189a0bf528SMauro Carvalho Chehab u16 m_adcCompCoef[64]; 319cd7a67a4SMauro Carvalho Chehab u16 m_adc_state; 3209a0bf528SMauro Carvalho Chehab 3219a0bf528SMauro Carvalho Chehab u8 *m_microcode; 3229a0bf528SMauro Carvalho Chehab int m_microcode_length; 323cd7a67a4SMauro Carvalho Chehab bool m_drxk_a3_rom_code; 324cd7a67a4SMauro Carvalho Chehab bool m_drxk_a3_patch_code; 3259a0bf528SMauro Carvalho Chehab 3269a0bf528SMauro Carvalho Chehab bool m_rfmirror; 327cd7a67a4SMauro Carvalho Chehab u8 m_device_spin; 328cd7a67a4SMauro Carvalho Chehab u32 m_iqm_rc_rate; 3299a0bf528SMauro Carvalho Chehab 330cd7a67a4SMauro Carvalho Chehab enum drx_power_mode m_current_power_mode; 3319a0bf528SMauro Carvalho Chehab 3329a0bf528SMauro Carvalho Chehab /* when true, avoids other devices to use the I2C bus */ 3339a0bf528SMauro Carvalho Chehab bool drxk_i2c_exclusive_lock; 3349a0bf528SMauro Carvalho Chehab 3359a0bf528SMauro Carvalho Chehab /* 3369a0bf528SMauro Carvalho Chehab * Configurable parameters at the driver. They stores the values found 3379a0bf528SMauro Carvalho Chehab * at struct drxk_config. 3389a0bf528SMauro Carvalho Chehab */ 3399a0bf528SMauro Carvalho Chehab 340cd7a67a4SMauro Carvalho Chehab u16 uio_mask; /* Bits used by UIO */ 3419a0bf528SMauro Carvalho Chehab 3429a0bf528SMauro Carvalho Chehab bool enable_merr_cfg; 3439a0bf528SMauro Carvalho Chehab bool single_master; 3449a0bf528SMauro Carvalho Chehab bool no_i2c_bridge; 3459a0bf528SMauro Carvalho Chehab bool antenna_dvbt; 3469a0bf528SMauro Carvalho Chehab u16 antenna_gpio; 3479a0bf528SMauro Carvalho Chehab 3488f3741e0SMauro Carvalho Chehab fe_status_t fe_status; 3498f3741e0SMauro Carvalho Chehab 3509a0bf528SMauro Carvalho Chehab /* Firmware */ 3519a0bf528SMauro Carvalho Chehab const char *microcode_name; 3529a0bf528SMauro Carvalho Chehab struct completion fw_wait_load; 3539a0bf528SMauro Carvalho Chehab const struct firmware *fw; 3549a0bf528SMauro Carvalho Chehab int qam_demod_parameter_count; 3559a0bf528SMauro Carvalho Chehab }; 3569a0bf528SMauro Carvalho Chehab 3579a0bf528SMauro Carvalho Chehab #define NEVER_LOCK 0 3589a0bf528SMauro Carvalho Chehab #define NOT_LOCKED 1 3599a0bf528SMauro Carvalho Chehab #define DEMOD_LOCK 2 3609a0bf528SMauro Carvalho Chehab #define FEC_LOCK 3 3619a0bf528SMauro Carvalho Chehab #define MPEG_LOCK 4 3629a0bf528SMauro Carvalho Chehab 363