1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 29a0bf528SMauro Carvalho Chehab #include "drxk_map.h" 39a0bf528SMauro Carvalho Chehab 49a0bf528SMauro Carvalho Chehab #define DRXK_VERSION_MAJOR 0 59a0bf528SMauro Carvalho Chehab #define DRXK_VERSION_MINOR 9 69a0bf528SMauro Carvalho Chehab #define DRXK_VERSION_PATCH 4300 79a0bf528SMauro Carvalho Chehab 89a0bf528SMauro Carvalho Chehab #define HI_I2C_DELAY 42 99a0bf528SMauro Carvalho Chehab #define HI_I2C_BRIDGE_DELAY 350 109a0bf528SMauro Carvalho Chehab #define DRXK_MAX_RETRIES 100 119a0bf528SMauro Carvalho Chehab 129a0bf528SMauro Carvalho Chehab #define DRIVER_4400 1 139a0bf528SMauro Carvalho Chehab 149a0bf528SMauro Carvalho Chehab #define DRXX_JTAGID 0x039210D9 159a0bf528SMauro Carvalho Chehab #define DRXX_J_JTAGID 0x239310D9 169a0bf528SMauro Carvalho Chehab #define DRXX_K_JTAGID 0x039210D9 179a0bf528SMauro Carvalho Chehab 189a0bf528SMauro Carvalho Chehab #define DRX_UNKNOWN 254 199a0bf528SMauro Carvalho Chehab #define DRX_AUTO 255 209a0bf528SMauro Carvalho Chehab 219a0bf528SMauro Carvalho Chehab #define DRX_SCU_READY 0 229a0bf528SMauro Carvalho Chehab #define DRXK_MAX_WAITTIME (200) 239a0bf528SMauro Carvalho Chehab #define SCU_RESULT_OK 0 249a0bf528SMauro Carvalho Chehab #define SCU_RESULT_SIZE -4 259a0bf528SMauro Carvalho Chehab #define SCU_RESULT_INVPAR -3 269a0bf528SMauro Carvalho Chehab #define SCU_RESULT_UNKSTD -2 279a0bf528SMauro Carvalho Chehab #define SCU_RESULT_UNKCMD -1 289a0bf528SMauro Carvalho Chehab 299a0bf528SMauro Carvalho Chehab #ifndef DRXK_OFDM_TR_SHUTDOWN_TIMEOUT 309a0bf528SMauro Carvalho Chehab #define DRXK_OFDM_TR_SHUTDOWN_TIMEOUT (200) 319a0bf528SMauro Carvalho Chehab #endif 329a0bf528SMauro Carvalho Chehab 339a0bf528SMauro Carvalho Chehab #define DRXK_8VSB_MPEG_BIT_RATE 19392658UL /*bps*/ 349a0bf528SMauro Carvalho Chehab #define DRXK_DVBT_MPEG_BIT_RATE 32000000UL /*bps*/ 359a0bf528SMauro Carvalho Chehab #define DRXK_QAM16_MPEG_BIT_RATE 27000000UL /*bps*/ 369a0bf528SMauro Carvalho Chehab #define DRXK_QAM32_MPEG_BIT_RATE 33000000UL /*bps*/ 379a0bf528SMauro Carvalho Chehab #define DRXK_QAM64_MPEG_BIT_RATE 40000000UL /*bps*/ 389a0bf528SMauro Carvalho Chehab #define DRXK_QAM128_MPEG_BIT_RATE 46000000UL /*bps*/ 399a0bf528SMauro Carvalho Chehab #define DRXK_QAM256_MPEG_BIT_RATE 52000000UL /*bps*/ 409a0bf528SMauro Carvalho Chehab #define DRXK_MAX_MPEG_BIT_RATE 52000000UL /*bps*/ 419a0bf528SMauro Carvalho Chehab 429a0bf528SMauro Carvalho Chehab #define IQM_CF_OUT_ENA_OFDM__M 0x4 439a0bf528SMauro Carvalho Chehab #define IQM_FS_ADJ_SEL_B_QAM 0x1 449a0bf528SMauro Carvalho Chehab #define IQM_FS_ADJ_SEL_B_OFF 0x0 459a0bf528SMauro Carvalho Chehab #define IQM_FS_ADJ_SEL_B_VSB 0x2 469a0bf528SMauro Carvalho Chehab #define IQM_RC_ADJ_SEL_B_OFF 0x0 479a0bf528SMauro Carvalho Chehab #define IQM_RC_ADJ_SEL_B_QAM 0x1 489a0bf528SMauro Carvalho Chehab #define IQM_RC_ADJ_SEL_B_VSB 0x2 499a0bf528SMauro Carvalho Chehab 50cd7a67a4SMauro Carvalho Chehab enum operation_mode { 519a0bf528SMauro Carvalho Chehab OM_NONE, 529a0bf528SMauro Carvalho Chehab OM_QAM_ITU_A, 539a0bf528SMauro Carvalho Chehab OM_QAM_ITU_B, 549a0bf528SMauro Carvalho Chehab OM_QAM_ITU_C, 559a0bf528SMauro Carvalho Chehab OM_DVBT 569a0bf528SMauro Carvalho Chehab }; 579a0bf528SMauro Carvalho Chehab 58cd7a67a4SMauro Carvalho Chehab enum drx_power_mode { 599a0bf528SMauro Carvalho Chehab DRX_POWER_UP = 0, 609a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_1, 619a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_2, 629a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_3, 639a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_4, 649a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_5, 659a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_6, 669a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_7, 679a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_8, 689a0bf528SMauro Carvalho Chehab 699a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_9, 709a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_10, 719a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_11, 729a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_12, 739a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_13, 749a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_14, 759a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_15, 769a0bf528SMauro Carvalho Chehab DRX_POWER_MODE_16, 779a0bf528SMauro Carvalho Chehab DRX_POWER_DOWN = 255 789a0bf528SMauro Carvalho Chehab }; 799a0bf528SMauro Carvalho Chehab 809a0bf528SMauro Carvalho Chehab 8157b8b003SMauro Carvalho Chehab /* Intermediate power mode for DRXK, power down OFDM clock domain */ 829a0bf528SMauro Carvalho Chehab #ifndef DRXK_POWER_DOWN_OFDM 839a0bf528SMauro Carvalho Chehab #define DRXK_POWER_DOWN_OFDM DRX_POWER_MODE_1 849a0bf528SMauro Carvalho Chehab #endif 859a0bf528SMauro Carvalho Chehab 8657b8b003SMauro Carvalho Chehab /* Intermediate power mode for DRXK, power down core (sysclk) */ 879a0bf528SMauro Carvalho Chehab #ifndef DRXK_POWER_DOWN_CORE 889a0bf528SMauro Carvalho Chehab #define DRXK_POWER_DOWN_CORE DRX_POWER_MODE_9 899a0bf528SMauro Carvalho Chehab #endif 909a0bf528SMauro Carvalho Chehab 9157b8b003SMauro Carvalho Chehab /* Intermediate power mode for DRXK, power down pll (only osc runs) */ 929a0bf528SMauro Carvalho Chehab #ifndef DRXK_POWER_DOWN_PLL 939a0bf528SMauro Carvalho Chehab #define DRXK_POWER_DOWN_PLL DRX_POWER_MODE_10 949a0bf528SMauro Carvalho Chehab #endif 959a0bf528SMauro Carvalho Chehab 969a0bf528SMauro Carvalho Chehab 97d5687ab5SMauro Carvalho Chehab enum agc_ctrl_mode { 98d5687ab5SMauro Carvalho Chehab DRXK_AGC_CTRL_AUTO = 0, 99d5687ab5SMauro Carvalho Chehab DRXK_AGC_CTRL_USER, 100d5687ab5SMauro Carvalho Chehab DRXK_AGC_CTRL_OFF 101d5687ab5SMauro Carvalho Chehab }; 102d5687ab5SMauro Carvalho Chehab 103cd7a67a4SMauro Carvalho Chehab enum e_drxk_state { 1049a0bf528SMauro Carvalho Chehab DRXK_UNINITIALIZED = 0, 1059a0bf528SMauro Carvalho Chehab DRXK_STOPPED, 1069a0bf528SMauro Carvalho Chehab DRXK_DTV_STARTED, 1079a0bf528SMauro Carvalho Chehab DRXK_ATV_STARTED, 1089a0bf528SMauro Carvalho Chehab DRXK_POWERED_DOWN, 1099a0bf528SMauro Carvalho Chehab DRXK_NO_DEV /* If drxk init failed */ 1109a0bf528SMauro Carvalho Chehab }; 1119a0bf528SMauro Carvalho Chehab 112cd7a67a4SMauro Carvalho Chehab enum e_drxk_coef_array_index { 1139a0bf528SMauro Carvalho Chehab DRXK_COEF_IDX_MN = 0, 1149a0bf528SMauro Carvalho Chehab DRXK_COEF_IDX_FM , 1159a0bf528SMauro Carvalho Chehab DRXK_COEF_IDX_L , 1169a0bf528SMauro Carvalho Chehab DRXK_COEF_IDX_LP , 1179a0bf528SMauro Carvalho Chehab DRXK_COEF_IDX_BG , 1189a0bf528SMauro Carvalho Chehab DRXK_COEF_IDX_DK , 1199a0bf528SMauro Carvalho Chehab DRXK_COEF_IDX_I , 1209a0bf528SMauro Carvalho Chehab DRXK_COEF_IDX_MAX 1219a0bf528SMauro Carvalho Chehab }; 122cd7a67a4SMauro Carvalho Chehab enum e_drxk_sif_attenuation { 1239a0bf528SMauro Carvalho Chehab DRXK_SIF_ATTENUATION_0DB, 1249a0bf528SMauro Carvalho Chehab DRXK_SIF_ATTENUATION_3DB, 1259a0bf528SMauro Carvalho Chehab DRXK_SIF_ATTENUATION_6DB, 1269a0bf528SMauro Carvalho Chehab DRXK_SIF_ATTENUATION_9DB 1279a0bf528SMauro Carvalho Chehab }; 128cd7a67a4SMauro Carvalho Chehab enum e_drxk_constellation { 1299a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_BPSK = 0, 1309a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_QPSK, 1319a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_PSK8, 1329a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_QAM16, 1339a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_QAM32, 1349a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_QAM64, 1359a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_QAM128, 1369a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_QAM256, 1379a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_QAM512, 1389a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_QAM1024, 1399a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_UNKNOWN = DRX_UNKNOWN, 1409a0bf528SMauro Carvalho Chehab DRX_CONSTELLATION_AUTO = DRX_AUTO 1419a0bf528SMauro Carvalho Chehab }; 142cd7a67a4SMauro Carvalho Chehab enum e_drxk_interleave_mode { 1439a0bf528SMauro Carvalho Chehab DRXK_QAM_I12_J17 = 16, 1449a0bf528SMauro Carvalho Chehab DRXK_QAM_I_UNKNOWN = DRX_UNKNOWN 1459a0bf528SMauro Carvalho Chehab }; 1469a0bf528SMauro Carvalho Chehab enum { 1479a0bf528SMauro Carvalho Chehab DRXK_SPIN_A1 = 0, 1489a0bf528SMauro Carvalho Chehab DRXK_SPIN_A2, 1499a0bf528SMauro Carvalho Chehab DRXK_SPIN_A3, 1509a0bf528SMauro Carvalho Chehab DRXK_SPIN_UNKNOWN 1519a0bf528SMauro Carvalho Chehab }; 1529a0bf528SMauro Carvalho Chehab 153cd7a67a4SMauro Carvalho Chehab enum drxk_cfg_dvbt_sqi_speed { 1549a0bf528SMauro Carvalho Chehab DRXK_DVBT_SQI_SPEED_FAST = 0, 1559a0bf528SMauro Carvalho Chehab DRXK_DVBT_SQI_SPEED_MEDIUM, 1569a0bf528SMauro Carvalho Chehab DRXK_DVBT_SQI_SPEED_SLOW, 1579a0bf528SMauro Carvalho Chehab DRXK_DVBT_SQI_SPEED_UNKNOWN = DRX_UNKNOWN 1589a0bf528SMauro Carvalho Chehab } ; 1599a0bf528SMauro Carvalho Chehab 160cd7a67a4SMauro Carvalho Chehab enum drx_fftmode_t { 1619a0bf528SMauro Carvalho Chehab DRX_FFTMODE_2K = 0, 1629a0bf528SMauro Carvalho Chehab DRX_FFTMODE_4K, 1639a0bf528SMauro Carvalho Chehab DRX_FFTMODE_8K, 1649a0bf528SMauro Carvalho Chehab DRX_FFTMODE_UNKNOWN = DRX_UNKNOWN, 1659a0bf528SMauro Carvalho Chehab DRX_FFTMODE_AUTO = DRX_AUTO 1669a0bf528SMauro Carvalho Chehab }; 1679a0bf528SMauro Carvalho Chehab 168cd7a67a4SMauro Carvalho Chehab enum drxmpeg_str_width_t { 1699a0bf528SMauro Carvalho Chehab DRX_MPEG_STR_WIDTH_1, 1709a0bf528SMauro Carvalho Chehab DRX_MPEG_STR_WIDTH_8 1719a0bf528SMauro Carvalho Chehab }; 1729a0bf528SMauro Carvalho Chehab 173cd7a67a4SMauro Carvalho Chehab enum drx_qam_lock_range_t { 1749a0bf528SMauro Carvalho Chehab DRX_QAM_LOCKRANGE_NORMAL, 1759a0bf528SMauro Carvalho Chehab DRX_QAM_LOCKRANGE_EXTENDED 1769a0bf528SMauro Carvalho Chehab }; 1779a0bf528SMauro Carvalho Chehab 178cd7a67a4SMauro Carvalho Chehab struct drxk_cfg_dvbt_echo_thres_t { 1799a0bf528SMauro Carvalho Chehab u16 threshold; 180cd7a67a4SMauro Carvalho Chehab enum drx_fftmode_t fft_mode; 1819a0bf528SMauro Carvalho Chehab } ; 1829a0bf528SMauro Carvalho Chehab 183cd7a67a4SMauro Carvalho Chehab struct s_cfg_agc { 184cd7a67a4SMauro Carvalho Chehab enum agc_ctrl_mode ctrl_mode; /* off, user, auto */ 185cd7a67a4SMauro Carvalho Chehab u16 output_level; /* range dependent on AGC */ 186cd7a67a4SMauro Carvalho Chehab u16 min_output_level; /* range dependent on AGC */ 187cd7a67a4SMauro Carvalho Chehab u16 max_output_level; /* range dependent on AGC */ 1889a0bf528SMauro Carvalho Chehab u16 speed; /* range dependent on AGC */ 1899a0bf528SMauro Carvalho Chehab u16 top; /* rf-agc take over point */ 190cd7a67a4SMauro Carvalho Chehab u16 cut_off_current; /* rf-agc is accelerated if output current 1919a0bf528SMauro Carvalho Chehab is below cut-off current */ 192cd7a67a4SMauro Carvalho Chehab u16 ingain_tgt_max; 193cd7a67a4SMauro Carvalho Chehab u16 fast_clip_ctrl_delay; 1949a0bf528SMauro Carvalho Chehab }; 1959a0bf528SMauro Carvalho Chehab 196cd7a67a4SMauro Carvalho Chehab struct s_cfg_pre_saw { 1979a0bf528SMauro Carvalho Chehab u16 reference; /* pre SAW reference value, range 0 .. 31 */ 198cd7a67a4SMauro Carvalho Chehab bool use_pre_saw; /* TRUE algorithms must use pre SAW sense */ 1999a0bf528SMauro Carvalho Chehab }; 2009a0bf528SMauro Carvalho Chehab 201cd7a67a4SMauro Carvalho Chehab struct drxk_ofdm_sc_cmd_t { 20257b8b003SMauro Carvalho Chehab u16 cmd; /* Command number */ 20357b8b003SMauro Carvalho Chehab u16 subcmd; /* Sub-command parameter*/ 20457b8b003SMauro Carvalho Chehab u16 param0; /* General purpous param */ 20557b8b003SMauro Carvalho Chehab u16 param1; /* General purpous param */ 20657b8b003SMauro Carvalho Chehab u16 param2; /* General purpous param */ 20757b8b003SMauro Carvalho Chehab u16 param3; /* General purpous param */ 20857b8b003SMauro Carvalho Chehab u16 param4; /* General purpous param */ 2099a0bf528SMauro Carvalho Chehab }; 2109a0bf528SMauro Carvalho Chehab 2119a0bf528SMauro Carvalho Chehab struct drxk_state { 2129a0bf528SMauro Carvalho Chehab struct dvb_frontend frontend; 2139a0bf528SMauro Carvalho Chehab struct dtv_frontend_properties props; 2149a0bf528SMauro Carvalho Chehab struct device *dev; 2159a0bf528SMauro Carvalho Chehab 2169a0bf528SMauro Carvalho Chehab struct i2c_adapter *i2c; 2179a0bf528SMauro Carvalho Chehab u8 demod_address; 2189a0bf528SMauro Carvalho Chehab void *priv; 2199a0bf528SMauro Carvalho Chehab 2209a0bf528SMauro Carvalho Chehab struct mutex mutex; 2219a0bf528SMauro Carvalho Chehab 22257b8b003SMauro Carvalho Chehab u32 m_instance; /* Channel 1,2,3 or 4 */ 2239a0bf528SMauro Carvalho Chehab 224cd7a67a4SMauro Carvalho Chehab int m_chunk_size; 225cd7a67a4SMauro Carvalho Chehab u8 chunk[256]; 2269a0bf528SMauro Carvalho Chehab 227cd7a67a4SMauro Carvalho Chehab bool m_has_lna; 228cd7a67a4SMauro Carvalho Chehab bool m_has_dvbt; 229cd7a67a4SMauro Carvalho Chehab bool m_has_dvbc; 230cd7a67a4SMauro Carvalho Chehab bool m_has_audio; 231cd7a67a4SMauro Carvalho Chehab bool m_has_atv; 232cd7a67a4SMauro Carvalho Chehab bool m_has_oob; 233cd7a67a4SMauro Carvalho Chehab bool m_has_sawsw; /* TRUE if mat_tx is available */ 234cd7a67a4SMauro Carvalho Chehab bool m_has_gpio1; /* TRUE if mat_rx is available */ 235cd7a67a4SMauro Carvalho Chehab bool m_has_gpio2; /* TRUE if GPIO is available */ 236cd7a67a4SMauro Carvalho Chehab bool m_has_irqn; /* TRUE if IRQN is available */ 237cd7a67a4SMauro Carvalho Chehab u16 m_osc_clock_freq; 238cd7a67a4SMauro Carvalho Chehab u16 m_hi_cfg_timing_div; 239cd7a67a4SMauro Carvalho Chehab u16 m_hi_cfg_bridge_delay; 240cd7a67a4SMauro Carvalho Chehab u16 m_hi_cfg_wake_up_key; 241cd7a67a4SMauro Carvalho Chehab u16 m_hi_cfg_timeout; 242cd7a67a4SMauro Carvalho Chehab u16 m_hi_cfg_ctrl; 24357b8b003SMauro Carvalho Chehab s32 m_sys_clock_freq; /* system clock frequency in kHz */ 2449a0bf528SMauro Carvalho Chehab 24557b8b003SMauro Carvalho Chehab enum e_drxk_state m_drxk_state; /* State of Drxk (init,stopped,started) */ 24657b8b003SMauro Carvalho Chehab enum operation_mode m_operation_mode; /* digital standards */ 24757b8b003SMauro Carvalho Chehab struct s_cfg_agc m_vsb_rf_agc_cfg; /* settings for VSB RF-AGC */ 24857b8b003SMauro Carvalho Chehab struct s_cfg_agc m_vsb_if_agc_cfg; /* settings for VSB IF-AGC */ 24957b8b003SMauro Carvalho Chehab u16 m_vsb_pga_cfg; /* settings for VSB PGA */ 25057b8b003SMauro Carvalho Chehab struct s_cfg_pre_saw m_vsb_pre_saw_cfg; /* settings for pre SAW sense */ 25157b8b003SMauro Carvalho Chehab s32 m_Quality83percent; /* MER level (*0.1 dB) for 83% quality indication */ 25257b8b003SMauro Carvalho Chehab s32 m_Quality93percent; /* MER level (*0.1 dB) for 93% quality indication */ 253cd7a67a4SMauro Carvalho Chehab bool m_smart_ant_inverted; 254cd7a67a4SMauro Carvalho Chehab bool m_b_debug_enable_bridge; 25557b8b003SMauro Carvalho Chehab bool m_b_p_down_open_bridge; /* only open DRXK bridge before power-down once it has been accessed */ 25657b8b003SMauro Carvalho Chehab bool m_b_power_down; /* Power down when not used */ 2579a0bf528SMauro Carvalho Chehab 25857b8b003SMauro Carvalho Chehab u32 m_iqm_fs_rate_ofs; /* frequency shift as written to DRXK register (28bit fixpoint) */ 2599a0bf528SMauro Carvalho Chehab 26057b8b003SMauro Carvalho Chehab bool m_enable_mpeg_output; /* If TRUE, enable MPEG output */ 26157b8b003SMauro Carvalho Chehab bool m_insert_rs_byte; /* If TRUE, insert RS byte */ 26257b8b003SMauro Carvalho Chehab bool m_enable_parallel; /* If TRUE, parallel out otherwise serial */ 26357b8b003SMauro Carvalho Chehab bool m_invert_data; /* If TRUE, invert DATA signals */ 26457b8b003SMauro Carvalho Chehab bool m_invert_err; /* If TRUE, invert ERR signal */ 26557b8b003SMauro Carvalho Chehab bool m_invert_str; /* If TRUE, invert STR signals */ 26657b8b003SMauro Carvalho Chehab bool m_invert_val; /* If TRUE, invert VAL signals */ 26757b8b003SMauro Carvalho Chehab bool m_invert_clk; /* If TRUE, invert CLK signals */ 268cd7a67a4SMauro Carvalho Chehab bool m_dvbc_static_clk; 26957b8b003SMauro Carvalho Chehab bool m_dvbt_static_clk; /* If TRUE, static MPEG clockrate will 2709a0bf528SMauro Carvalho Chehab be used, otherwise clockrate will 2719a0bf528SMauro Carvalho Chehab adapt to the bitrate of the TS */ 272cd7a67a4SMauro Carvalho Chehab u32 m_dvbt_bitrate; 273cd7a67a4SMauro Carvalho Chehab u32 m_dvbc_bitrate; 2749a0bf528SMauro Carvalho Chehab 275cd7a67a4SMauro Carvalho Chehab u8 m_ts_data_strength; 276cd7a67a4SMauro Carvalho Chehab u8 m_ts_clockk_strength; 2779a0bf528SMauro Carvalho Chehab 2789a0bf528SMauro Carvalho Chehab bool m_itut_annex_c; /* If true, uses ITU-T DVB-C Annex C, instead of Annex A */ 2799a0bf528SMauro Carvalho Chehab 28057b8b003SMauro Carvalho Chehab enum drxmpeg_str_width_t m_width_str; /* MPEG start width */ 28157b8b003SMauro Carvalho Chehab u32 m_mpeg_ts_static_bitrate; /* Maximum bitrate in b/s in case 2829a0bf528SMauro Carvalho Chehab static clockrate is selected */ 2839a0bf528SMauro Carvalho Chehab 28457b8b003SMauro Carvalho Chehab /* LARGE_INTEGER m_startTime; */ /* Contains the time of the last demod start */ 28557b8b003SMauro Carvalho Chehab s32 m_mpeg_lock_time_out; /* WaitForLockStatus Timeout (counts from start time) */ 28657b8b003SMauro Carvalho Chehab s32 m_demod_lock_time_out; /* WaitForLockStatus Timeout (counts from start time) */ 2879a0bf528SMauro Carvalho Chehab 288cd7a67a4SMauro Carvalho Chehab bool m_disable_te_ihandling; 2899a0bf528SMauro Carvalho Chehab 290cd7a67a4SMauro Carvalho Chehab bool m_rf_agc_pol; 291cd7a67a4SMauro Carvalho Chehab bool m_if_agc_pol; 2929a0bf528SMauro Carvalho Chehab 29357b8b003SMauro Carvalho Chehab struct s_cfg_agc m_atv_rf_agc_cfg; /* settings for ATV RF-AGC */ 29457b8b003SMauro Carvalho Chehab struct s_cfg_agc m_atv_if_agc_cfg; /* settings for ATV IF-AGC */ 29557b8b003SMauro Carvalho Chehab struct s_cfg_pre_saw m_atv_pre_saw_cfg; /* settings for ATV pre SAW sense */ 296cd7a67a4SMauro Carvalho Chehab bool m_phase_correction_bypass; 297cd7a67a4SMauro Carvalho Chehab s16 m_atv_top_vid_peak; 298cd7a67a4SMauro Carvalho Chehab u16 m_atv_top_noise_th; 299cd7a67a4SMauro Carvalho Chehab enum e_drxk_sif_attenuation m_sif_attenuation; 300cd7a67a4SMauro Carvalho Chehab bool m_enable_cvbs_output; 301cd7a67a4SMauro Carvalho Chehab bool m_enable_sif_output; 302cd7a67a4SMauro Carvalho Chehab bool m_b_mirror_freq_spect; 30357b8b003SMauro Carvalho Chehab enum e_drxk_constellation m_constellation; /* constellation type of the channel */ 30457b8b003SMauro Carvalho Chehab u32 m_curr_symbol_rate; /* Current QAM symbol rate */ 30557b8b003SMauro Carvalho Chehab struct s_cfg_agc m_qam_rf_agc_cfg; /* settings for QAM RF-AGC */ 30657b8b003SMauro Carvalho Chehab struct s_cfg_agc m_qam_if_agc_cfg; /* settings for QAM IF-AGC */ 30757b8b003SMauro Carvalho Chehab u16 m_qam_pga_cfg; /* settings for QAM PGA */ 30857b8b003SMauro Carvalho Chehab struct s_cfg_pre_saw m_qam_pre_saw_cfg; /* settings for QAM pre SAW sense */ 30957b8b003SMauro Carvalho Chehab enum e_drxk_interleave_mode m_qam_interleave_mode; /* QAM Interleave mode */ 310cd7a67a4SMauro Carvalho Chehab u16 m_fec_rs_plen; 311cd7a67a4SMauro Carvalho Chehab u16 m_fec_rs_prescale; 3129a0bf528SMauro Carvalho Chehab 313cd7a67a4SMauro Carvalho Chehab enum drxk_cfg_dvbt_sqi_speed m_sqi_speed; 3149a0bf528SMauro Carvalho Chehab 315cd7a67a4SMauro Carvalho Chehab u16 m_gpio; 316cd7a67a4SMauro Carvalho Chehab u16 m_gpio_cfg; 3179a0bf528SMauro Carvalho Chehab 31857b8b003SMauro Carvalho Chehab struct s_cfg_agc m_dvbt_rf_agc_cfg; /* settings for QAM RF-AGC */ 31957b8b003SMauro Carvalho Chehab struct s_cfg_agc m_dvbt_if_agc_cfg; /* settings for QAM IF-AGC */ 32057b8b003SMauro Carvalho Chehab struct s_cfg_pre_saw m_dvbt_pre_saw_cfg; /* settings for QAM pre SAW sense */ 3219a0bf528SMauro Carvalho Chehab 322cd7a67a4SMauro Carvalho Chehab u16 m_agcfast_clip_ctrl_delay; 323cd7a67a4SMauro Carvalho Chehab bool m_adc_comp_passed; 3249a0bf528SMauro Carvalho Chehab u16 m_adcCompCoef[64]; 325cd7a67a4SMauro Carvalho Chehab u16 m_adc_state; 3269a0bf528SMauro Carvalho Chehab 3279a0bf528SMauro Carvalho Chehab u8 *m_microcode; 3289a0bf528SMauro Carvalho Chehab int m_microcode_length; 329cd7a67a4SMauro Carvalho Chehab bool m_drxk_a3_rom_code; 330cd7a67a4SMauro Carvalho Chehab bool m_drxk_a3_patch_code; 3319a0bf528SMauro Carvalho Chehab 3329a0bf528SMauro Carvalho Chehab bool m_rfmirror; 333cd7a67a4SMauro Carvalho Chehab u8 m_device_spin; 334cd7a67a4SMauro Carvalho Chehab u32 m_iqm_rc_rate; 3359a0bf528SMauro Carvalho Chehab 336cd7a67a4SMauro Carvalho Chehab enum drx_power_mode m_current_power_mode; 3379a0bf528SMauro Carvalho Chehab 3389a0bf528SMauro Carvalho Chehab /* when true, avoids other devices to use the I2C bus */ 3399a0bf528SMauro Carvalho Chehab bool drxk_i2c_exclusive_lock; 3409a0bf528SMauro Carvalho Chehab 3419a0bf528SMauro Carvalho Chehab /* 3429a0bf528SMauro Carvalho Chehab * Configurable parameters at the driver. They stores the values found 3439a0bf528SMauro Carvalho Chehab * at struct drxk_config. 3449a0bf528SMauro Carvalho Chehab */ 3459a0bf528SMauro Carvalho Chehab 346cd7a67a4SMauro Carvalho Chehab u16 uio_mask; /* Bits used by UIO */ 3479a0bf528SMauro Carvalho Chehab 3489a0bf528SMauro Carvalho Chehab bool enable_merr_cfg; 3499a0bf528SMauro Carvalho Chehab bool single_master; 3509a0bf528SMauro Carvalho Chehab bool no_i2c_bridge; 3519a0bf528SMauro Carvalho Chehab bool antenna_dvbt; 3529a0bf528SMauro Carvalho Chehab u16 antenna_gpio; 3539a0bf528SMauro Carvalho Chehab 3540df289a2SMauro Carvalho Chehab enum fe_status fe_status; 3558f3741e0SMauro Carvalho Chehab 3569a0bf528SMauro Carvalho Chehab /* Firmware */ 3579a0bf528SMauro Carvalho Chehab const char *microcode_name; 3589a0bf528SMauro Carvalho Chehab struct completion fw_wait_load; 3599a0bf528SMauro Carvalho Chehab const struct firmware *fw; 3609a0bf528SMauro Carvalho Chehab int qam_demod_parameter_count; 3619a0bf528SMauro Carvalho Chehab }; 3629a0bf528SMauro Carvalho Chehab 3639a0bf528SMauro Carvalho Chehab #define NEVER_LOCK 0 3649a0bf528SMauro Carvalho Chehab #define NOT_LOCKED 1 3659a0bf528SMauro Carvalho Chehab #define DEMOD_LOCK 2 3669a0bf528SMauro Carvalho Chehab #define FEC_LOCK 3 3679a0bf528SMauro Carvalho Chehab #define MPEG_LOCK 4 3689a0bf528SMauro Carvalho Chehab 369