18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#include "drxk_map.h" 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#define DRXK_VERSION_MAJOR 0 58c2ecf20Sopenharmony_ci#define DRXK_VERSION_MINOR 9 68c2ecf20Sopenharmony_ci#define DRXK_VERSION_PATCH 4300 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#define HI_I2C_DELAY 42 98c2ecf20Sopenharmony_ci#define HI_I2C_BRIDGE_DELAY 350 108c2ecf20Sopenharmony_ci#define DRXK_MAX_RETRIES 100 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#define DRIVER_4400 1 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#define DRXX_JTAGID 0x039210D9 158c2ecf20Sopenharmony_ci#define DRXX_J_JTAGID 0x239310D9 168c2ecf20Sopenharmony_ci#define DRXX_K_JTAGID 0x039210D9 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#define DRX_UNKNOWN 254 198c2ecf20Sopenharmony_ci#define DRX_AUTO 255 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#define DRX_SCU_READY 0 228c2ecf20Sopenharmony_ci#define DRXK_MAX_WAITTIME (200) 238c2ecf20Sopenharmony_ci#define SCU_RESULT_OK 0 248c2ecf20Sopenharmony_ci#define SCU_RESULT_SIZE -4 258c2ecf20Sopenharmony_ci#define SCU_RESULT_INVPAR -3 268c2ecf20Sopenharmony_ci#define SCU_RESULT_UNKSTD -2 278c2ecf20Sopenharmony_ci#define SCU_RESULT_UNKCMD -1 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#ifndef DRXK_OFDM_TR_SHUTDOWN_TIMEOUT 308c2ecf20Sopenharmony_ci#define DRXK_OFDM_TR_SHUTDOWN_TIMEOUT (200) 318c2ecf20Sopenharmony_ci#endif 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci#define DRXK_8VSB_MPEG_BIT_RATE 19392658UL /*bps*/ 348c2ecf20Sopenharmony_ci#define DRXK_DVBT_MPEG_BIT_RATE 32000000UL /*bps*/ 358c2ecf20Sopenharmony_ci#define DRXK_QAM16_MPEG_BIT_RATE 27000000UL /*bps*/ 368c2ecf20Sopenharmony_ci#define DRXK_QAM32_MPEG_BIT_RATE 33000000UL /*bps*/ 378c2ecf20Sopenharmony_ci#define DRXK_QAM64_MPEG_BIT_RATE 40000000UL /*bps*/ 388c2ecf20Sopenharmony_ci#define DRXK_QAM128_MPEG_BIT_RATE 46000000UL /*bps*/ 398c2ecf20Sopenharmony_ci#define DRXK_QAM256_MPEG_BIT_RATE 52000000UL /*bps*/ 408c2ecf20Sopenharmony_ci#define DRXK_MAX_MPEG_BIT_RATE 52000000UL /*bps*/ 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#define IQM_CF_OUT_ENA_OFDM__M 0x4 438c2ecf20Sopenharmony_ci#define IQM_FS_ADJ_SEL_B_QAM 0x1 448c2ecf20Sopenharmony_ci#define IQM_FS_ADJ_SEL_B_OFF 0x0 458c2ecf20Sopenharmony_ci#define IQM_FS_ADJ_SEL_B_VSB 0x2 468c2ecf20Sopenharmony_ci#define IQM_RC_ADJ_SEL_B_OFF 0x0 478c2ecf20Sopenharmony_ci#define IQM_RC_ADJ_SEL_B_QAM 0x1 488c2ecf20Sopenharmony_ci#define IQM_RC_ADJ_SEL_B_VSB 0x2 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_cienum operation_mode { 518c2ecf20Sopenharmony_ci OM_NONE, 528c2ecf20Sopenharmony_ci OM_QAM_ITU_A, 538c2ecf20Sopenharmony_ci OM_QAM_ITU_B, 548c2ecf20Sopenharmony_ci OM_QAM_ITU_C, 558c2ecf20Sopenharmony_ci OM_DVBT 568c2ecf20Sopenharmony_ci}; 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_cienum drx_power_mode { 598c2ecf20Sopenharmony_ci DRX_POWER_UP = 0, 608c2ecf20Sopenharmony_ci DRX_POWER_MODE_1, 618c2ecf20Sopenharmony_ci DRX_POWER_MODE_2, 628c2ecf20Sopenharmony_ci DRX_POWER_MODE_3, 638c2ecf20Sopenharmony_ci DRX_POWER_MODE_4, 648c2ecf20Sopenharmony_ci DRX_POWER_MODE_5, 658c2ecf20Sopenharmony_ci DRX_POWER_MODE_6, 668c2ecf20Sopenharmony_ci DRX_POWER_MODE_7, 678c2ecf20Sopenharmony_ci DRX_POWER_MODE_8, 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci DRX_POWER_MODE_9, 708c2ecf20Sopenharmony_ci DRX_POWER_MODE_10, 718c2ecf20Sopenharmony_ci DRX_POWER_MODE_11, 728c2ecf20Sopenharmony_ci DRX_POWER_MODE_12, 738c2ecf20Sopenharmony_ci DRX_POWER_MODE_13, 748c2ecf20Sopenharmony_ci DRX_POWER_MODE_14, 758c2ecf20Sopenharmony_ci DRX_POWER_MODE_15, 768c2ecf20Sopenharmony_ci DRX_POWER_MODE_16, 778c2ecf20Sopenharmony_ci DRX_POWER_DOWN = 255 788c2ecf20Sopenharmony_ci}; 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci/* Intermediate power mode for DRXK, power down OFDM clock domain */ 828c2ecf20Sopenharmony_ci#ifndef DRXK_POWER_DOWN_OFDM 838c2ecf20Sopenharmony_ci#define DRXK_POWER_DOWN_OFDM DRX_POWER_MODE_1 848c2ecf20Sopenharmony_ci#endif 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci/* Intermediate power mode for DRXK, power down core (sysclk) */ 878c2ecf20Sopenharmony_ci#ifndef DRXK_POWER_DOWN_CORE 888c2ecf20Sopenharmony_ci#define DRXK_POWER_DOWN_CORE DRX_POWER_MODE_9 898c2ecf20Sopenharmony_ci#endif 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci/* Intermediate power mode for DRXK, power down pll (only osc runs) */ 928c2ecf20Sopenharmony_ci#ifndef DRXK_POWER_DOWN_PLL 938c2ecf20Sopenharmony_ci#define DRXK_POWER_DOWN_PLL DRX_POWER_MODE_10 948c2ecf20Sopenharmony_ci#endif 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_cienum agc_ctrl_mode { 988c2ecf20Sopenharmony_ci DRXK_AGC_CTRL_AUTO = 0, 998c2ecf20Sopenharmony_ci DRXK_AGC_CTRL_USER, 1008c2ecf20Sopenharmony_ci DRXK_AGC_CTRL_OFF 1018c2ecf20Sopenharmony_ci}; 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_cienum e_drxk_state { 1048c2ecf20Sopenharmony_ci DRXK_UNINITIALIZED = 0, 1058c2ecf20Sopenharmony_ci DRXK_STOPPED, 1068c2ecf20Sopenharmony_ci DRXK_DTV_STARTED, 1078c2ecf20Sopenharmony_ci DRXK_ATV_STARTED, 1088c2ecf20Sopenharmony_ci DRXK_POWERED_DOWN, 1098c2ecf20Sopenharmony_ci DRXK_NO_DEV /* If drxk init failed */ 1108c2ecf20Sopenharmony_ci}; 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_cienum e_drxk_coef_array_index { 1138c2ecf20Sopenharmony_ci DRXK_COEF_IDX_MN = 0, 1148c2ecf20Sopenharmony_ci DRXK_COEF_IDX_FM , 1158c2ecf20Sopenharmony_ci DRXK_COEF_IDX_L , 1168c2ecf20Sopenharmony_ci DRXK_COEF_IDX_LP , 1178c2ecf20Sopenharmony_ci DRXK_COEF_IDX_BG , 1188c2ecf20Sopenharmony_ci DRXK_COEF_IDX_DK , 1198c2ecf20Sopenharmony_ci DRXK_COEF_IDX_I , 1208c2ecf20Sopenharmony_ci DRXK_COEF_IDX_MAX 1218c2ecf20Sopenharmony_ci}; 1228c2ecf20Sopenharmony_cienum e_drxk_sif_attenuation { 1238c2ecf20Sopenharmony_ci DRXK_SIF_ATTENUATION_0DB, 1248c2ecf20Sopenharmony_ci DRXK_SIF_ATTENUATION_3DB, 1258c2ecf20Sopenharmony_ci DRXK_SIF_ATTENUATION_6DB, 1268c2ecf20Sopenharmony_ci DRXK_SIF_ATTENUATION_9DB 1278c2ecf20Sopenharmony_ci}; 1288c2ecf20Sopenharmony_cienum e_drxk_constellation { 1298c2ecf20Sopenharmony_ci DRX_CONSTELLATION_BPSK = 0, 1308c2ecf20Sopenharmony_ci DRX_CONSTELLATION_QPSK, 1318c2ecf20Sopenharmony_ci DRX_CONSTELLATION_PSK8, 1328c2ecf20Sopenharmony_ci DRX_CONSTELLATION_QAM16, 1338c2ecf20Sopenharmony_ci DRX_CONSTELLATION_QAM32, 1348c2ecf20Sopenharmony_ci DRX_CONSTELLATION_QAM64, 1358c2ecf20Sopenharmony_ci DRX_CONSTELLATION_QAM128, 1368c2ecf20Sopenharmony_ci DRX_CONSTELLATION_QAM256, 1378c2ecf20Sopenharmony_ci DRX_CONSTELLATION_QAM512, 1388c2ecf20Sopenharmony_ci DRX_CONSTELLATION_QAM1024, 1398c2ecf20Sopenharmony_ci DRX_CONSTELLATION_UNKNOWN = DRX_UNKNOWN, 1408c2ecf20Sopenharmony_ci DRX_CONSTELLATION_AUTO = DRX_AUTO 1418c2ecf20Sopenharmony_ci}; 1428c2ecf20Sopenharmony_cienum e_drxk_interleave_mode { 1438c2ecf20Sopenharmony_ci DRXK_QAM_I12_J17 = 16, 1448c2ecf20Sopenharmony_ci DRXK_QAM_I_UNKNOWN = DRX_UNKNOWN 1458c2ecf20Sopenharmony_ci}; 1468c2ecf20Sopenharmony_cienum { 1478c2ecf20Sopenharmony_ci DRXK_SPIN_A1 = 0, 1488c2ecf20Sopenharmony_ci DRXK_SPIN_A2, 1498c2ecf20Sopenharmony_ci DRXK_SPIN_A3, 1508c2ecf20Sopenharmony_ci DRXK_SPIN_UNKNOWN 1518c2ecf20Sopenharmony_ci}; 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_cienum drxk_cfg_dvbt_sqi_speed { 1548c2ecf20Sopenharmony_ci DRXK_DVBT_SQI_SPEED_FAST = 0, 1558c2ecf20Sopenharmony_ci DRXK_DVBT_SQI_SPEED_MEDIUM, 1568c2ecf20Sopenharmony_ci DRXK_DVBT_SQI_SPEED_SLOW, 1578c2ecf20Sopenharmony_ci DRXK_DVBT_SQI_SPEED_UNKNOWN = DRX_UNKNOWN 1588c2ecf20Sopenharmony_ci} ; 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_cienum drx_fftmode_t { 1618c2ecf20Sopenharmony_ci DRX_FFTMODE_2K = 0, 1628c2ecf20Sopenharmony_ci DRX_FFTMODE_4K, 1638c2ecf20Sopenharmony_ci DRX_FFTMODE_8K, 1648c2ecf20Sopenharmony_ci DRX_FFTMODE_UNKNOWN = DRX_UNKNOWN, 1658c2ecf20Sopenharmony_ci DRX_FFTMODE_AUTO = DRX_AUTO 1668c2ecf20Sopenharmony_ci}; 1678c2ecf20Sopenharmony_ci 1688c2ecf20Sopenharmony_cienum drxmpeg_str_width_t { 1698c2ecf20Sopenharmony_ci DRX_MPEG_STR_WIDTH_1, 1708c2ecf20Sopenharmony_ci DRX_MPEG_STR_WIDTH_8 1718c2ecf20Sopenharmony_ci}; 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_cienum drx_qam_lock_range_t { 1748c2ecf20Sopenharmony_ci DRX_QAM_LOCKRANGE_NORMAL, 1758c2ecf20Sopenharmony_ci DRX_QAM_LOCKRANGE_EXTENDED 1768c2ecf20Sopenharmony_ci}; 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_cistruct drxk_cfg_dvbt_echo_thres_t { 1798c2ecf20Sopenharmony_ci u16 threshold; 1808c2ecf20Sopenharmony_ci enum drx_fftmode_t fft_mode; 1818c2ecf20Sopenharmony_ci} ; 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_cistruct s_cfg_agc { 1848c2ecf20Sopenharmony_ci enum agc_ctrl_mode ctrl_mode; /* off, user, auto */ 1858c2ecf20Sopenharmony_ci u16 output_level; /* range dependent on AGC */ 1868c2ecf20Sopenharmony_ci u16 min_output_level; /* range dependent on AGC */ 1878c2ecf20Sopenharmony_ci u16 max_output_level; /* range dependent on AGC */ 1888c2ecf20Sopenharmony_ci u16 speed; /* range dependent on AGC */ 1898c2ecf20Sopenharmony_ci u16 top; /* rf-agc take over point */ 1908c2ecf20Sopenharmony_ci u16 cut_off_current; /* rf-agc is accelerated if output current 1918c2ecf20Sopenharmony_ci is below cut-off current */ 1928c2ecf20Sopenharmony_ci u16 ingain_tgt_max; 1938c2ecf20Sopenharmony_ci u16 fast_clip_ctrl_delay; 1948c2ecf20Sopenharmony_ci}; 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_cistruct s_cfg_pre_saw { 1978c2ecf20Sopenharmony_ci u16 reference; /* pre SAW reference value, range 0 .. 31 */ 1988c2ecf20Sopenharmony_ci bool use_pre_saw; /* TRUE algorithms must use pre SAW sense */ 1998c2ecf20Sopenharmony_ci}; 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_cistruct drxk_ofdm_sc_cmd_t { 2028c2ecf20Sopenharmony_ci u16 cmd; /* Command number */ 2038c2ecf20Sopenharmony_ci u16 subcmd; /* Sub-command parameter*/ 2048c2ecf20Sopenharmony_ci u16 param0; /* General purpous param */ 2058c2ecf20Sopenharmony_ci u16 param1; /* General purpous param */ 2068c2ecf20Sopenharmony_ci u16 param2; /* General purpous param */ 2078c2ecf20Sopenharmony_ci u16 param3; /* General purpous param */ 2088c2ecf20Sopenharmony_ci u16 param4; /* General purpous param */ 2098c2ecf20Sopenharmony_ci}; 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_cistruct drxk_state { 2128c2ecf20Sopenharmony_ci struct dvb_frontend frontend; 2138c2ecf20Sopenharmony_ci struct dtv_frontend_properties props; 2148c2ecf20Sopenharmony_ci struct device *dev; 2158c2ecf20Sopenharmony_ci 2168c2ecf20Sopenharmony_ci struct i2c_adapter *i2c; 2178c2ecf20Sopenharmony_ci u8 demod_address; 2188c2ecf20Sopenharmony_ci void *priv; 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_ci struct mutex mutex; 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_ci u32 m_instance; /* Channel 1,2,3 or 4 */ 2238c2ecf20Sopenharmony_ci 2248c2ecf20Sopenharmony_ci int m_chunk_size; 2258c2ecf20Sopenharmony_ci u8 chunk[256]; 2268c2ecf20Sopenharmony_ci 2278c2ecf20Sopenharmony_ci bool m_has_lna; 2288c2ecf20Sopenharmony_ci bool m_has_dvbt; 2298c2ecf20Sopenharmony_ci bool m_has_dvbc; 2308c2ecf20Sopenharmony_ci bool m_has_audio; 2318c2ecf20Sopenharmony_ci bool m_has_atv; 2328c2ecf20Sopenharmony_ci bool m_has_oob; 2338c2ecf20Sopenharmony_ci bool m_has_sawsw; /* TRUE if mat_tx is available */ 2348c2ecf20Sopenharmony_ci bool m_has_gpio1; /* TRUE if mat_rx is available */ 2358c2ecf20Sopenharmony_ci bool m_has_gpio2; /* TRUE if GPIO is available */ 2368c2ecf20Sopenharmony_ci bool m_has_irqn; /* TRUE if IRQN is available */ 2378c2ecf20Sopenharmony_ci u16 m_osc_clock_freq; 2388c2ecf20Sopenharmony_ci u16 m_hi_cfg_timing_div; 2398c2ecf20Sopenharmony_ci u16 m_hi_cfg_bridge_delay; 2408c2ecf20Sopenharmony_ci u16 m_hi_cfg_wake_up_key; 2418c2ecf20Sopenharmony_ci u16 m_hi_cfg_timeout; 2428c2ecf20Sopenharmony_ci u16 m_hi_cfg_ctrl; 2438c2ecf20Sopenharmony_ci s32 m_sys_clock_freq; /* system clock frequency in kHz */ 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci enum e_drxk_state m_drxk_state; /* State of Drxk (init,stopped,started) */ 2468c2ecf20Sopenharmony_ci enum operation_mode m_operation_mode; /* digital standards */ 2478c2ecf20Sopenharmony_ci struct s_cfg_agc m_vsb_rf_agc_cfg; /* settings for VSB RF-AGC */ 2488c2ecf20Sopenharmony_ci struct s_cfg_agc m_vsb_if_agc_cfg; /* settings for VSB IF-AGC */ 2498c2ecf20Sopenharmony_ci u16 m_vsb_pga_cfg; /* settings for VSB PGA */ 2508c2ecf20Sopenharmony_ci struct s_cfg_pre_saw m_vsb_pre_saw_cfg; /* settings for pre SAW sense */ 2518c2ecf20Sopenharmony_ci s32 m_Quality83percent; /* MER level (*0.1 dB) for 83% quality indication */ 2528c2ecf20Sopenharmony_ci s32 m_Quality93percent; /* MER level (*0.1 dB) for 93% quality indication */ 2538c2ecf20Sopenharmony_ci bool m_smart_ant_inverted; 2548c2ecf20Sopenharmony_ci bool m_b_debug_enable_bridge; 2558c2ecf20Sopenharmony_ci bool m_b_p_down_open_bridge; /* only open DRXK bridge before power-down once it has been accessed */ 2568c2ecf20Sopenharmony_ci bool m_b_power_down; /* Power down when not used */ 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_ci u32 m_iqm_fs_rate_ofs; /* frequency shift as written to DRXK register (28bit fixpoint) */ 2598c2ecf20Sopenharmony_ci 2608c2ecf20Sopenharmony_ci bool m_enable_mpeg_output; /* If TRUE, enable MPEG output */ 2618c2ecf20Sopenharmony_ci bool m_insert_rs_byte; /* If TRUE, insert RS byte */ 2628c2ecf20Sopenharmony_ci bool m_enable_parallel; /* If TRUE, parallel out otherwise serial */ 2638c2ecf20Sopenharmony_ci bool m_invert_data; /* If TRUE, invert DATA signals */ 2648c2ecf20Sopenharmony_ci bool m_invert_err; /* If TRUE, invert ERR signal */ 2658c2ecf20Sopenharmony_ci bool m_invert_str; /* If TRUE, invert STR signals */ 2668c2ecf20Sopenharmony_ci bool m_invert_val; /* If TRUE, invert VAL signals */ 2678c2ecf20Sopenharmony_ci bool m_invert_clk; /* If TRUE, invert CLK signals */ 2688c2ecf20Sopenharmony_ci bool m_dvbc_static_clk; 2698c2ecf20Sopenharmony_ci bool m_dvbt_static_clk; /* If TRUE, static MPEG clockrate will 2708c2ecf20Sopenharmony_ci be used, otherwise clockrate will 2718c2ecf20Sopenharmony_ci adapt to the bitrate of the TS */ 2728c2ecf20Sopenharmony_ci u32 m_dvbt_bitrate; 2738c2ecf20Sopenharmony_ci u32 m_dvbc_bitrate; 2748c2ecf20Sopenharmony_ci 2758c2ecf20Sopenharmony_ci u8 m_ts_data_strength; 2768c2ecf20Sopenharmony_ci u8 m_ts_clockk_strength; 2778c2ecf20Sopenharmony_ci 2788c2ecf20Sopenharmony_ci bool m_itut_annex_c; /* If true, uses ITU-T DVB-C Annex C, instead of Annex A */ 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_ci enum drxmpeg_str_width_t m_width_str; /* MPEG start width */ 2818c2ecf20Sopenharmony_ci u32 m_mpeg_ts_static_bitrate; /* Maximum bitrate in b/s in case 2828c2ecf20Sopenharmony_ci static clockrate is selected */ 2838c2ecf20Sopenharmony_ci 2848c2ecf20Sopenharmony_ci /* LARGE_INTEGER m_startTime; */ /* Contains the time of the last demod start */ 2858c2ecf20Sopenharmony_ci s32 m_mpeg_lock_time_out; /* WaitForLockStatus Timeout (counts from start time) */ 2868c2ecf20Sopenharmony_ci s32 m_demod_lock_time_out; /* WaitForLockStatus Timeout (counts from start time) */ 2878c2ecf20Sopenharmony_ci 2888c2ecf20Sopenharmony_ci bool m_disable_te_ihandling; 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_ci bool m_rf_agc_pol; 2918c2ecf20Sopenharmony_ci bool m_if_agc_pol; 2928c2ecf20Sopenharmony_ci 2938c2ecf20Sopenharmony_ci struct s_cfg_agc m_atv_rf_agc_cfg; /* settings for ATV RF-AGC */ 2948c2ecf20Sopenharmony_ci struct s_cfg_agc m_atv_if_agc_cfg; /* settings for ATV IF-AGC */ 2958c2ecf20Sopenharmony_ci struct s_cfg_pre_saw m_atv_pre_saw_cfg; /* settings for ATV pre SAW sense */ 2968c2ecf20Sopenharmony_ci bool m_phase_correction_bypass; 2978c2ecf20Sopenharmony_ci s16 m_atv_top_vid_peak; 2988c2ecf20Sopenharmony_ci u16 m_atv_top_noise_th; 2998c2ecf20Sopenharmony_ci enum e_drxk_sif_attenuation m_sif_attenuation; 3008c2ecf20Sopenharmony_ci bool m_enable_cvbs_output; 3018c2ecf20Sopenharmony_ci bool m_enable_sif_output; 3028c2ecf20Sopenharmony_ci bool m_b_mirror_freq_spect; 3038c2ecf20Sopenharmony_ci enum e_drxk_constellation m_constellation; /* constellation type of the channel */ 3048c2ecf20Sopenharmony_ci u32 m_curr_symbol_rate; /* Current QAM symbol rate */ 3058c2ecf20Sopenharmony_ci struct s_cfg_agc m_qam_rf_agc_cfg; /* settings for QAM RF-AGC */ 3068c2ecf20Sopenharmony_ci struct s_cfg_agc m_qam_if_agc_cfg; /* settings for QAM IF-AGC */ 3078c2ecf20Sopenharmony_ci u16 m_qam_pga_cfg; /* settings for QAM PGA */ 3088c2ecf20Sopenharmony_ci struct s_cfg_pre_saw m_qam_pre_saw_cfg; /* settings for QAM pre SAW sense */ 3098c2ecf20Sopenharmony_ci enum e_drxk_interleave_mode m_qam_interleave_mode; /* QAM Interleave mode */ 3108c2ecf20Sopenharmony_ci u16 m_fec_rs_plen; 3118c2ecf20Sopenharmony_ci u16 m_fec_rs_prescale; 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_ci enum drxk_cfg_dvbt_sqi_speed m_sqi_speed; 3148c2ecf20Sopenharmony_ci 3158c2ecf20Sopenharmony_ci u16 m_gpio; 3168c2ecf20Sopenharmony_ci u16 m_gpio_cfg; 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_ci struct s_cfg_agc m_dvbt_rf_agc_cfg; /* settings for QAM RF-AGC */ 3198c2ecf20Sopenharmony_ci struct s_cfg_agc m_dvbt_if_agc_cfg; /* settings for QAM IF-AGC */ 3208c2ecf20Sopenharmony_ci struct s_cfg_pre_saw m_dvbt_pre_saw_cfg; /* settings for QAM pre SAW sense */ 3218c2ecf20Sopenharmony_ci 3228c2ecf20Sopenharmony_ci u16 m_agcfast_clip_ctrl_delay; 3238c2ecf20Sopenharmony_ci bool m_adc_comp_passed; 3248c2ecf20Sopenharmony_ci u16 m_adcCompCoef[64]; 3258c2ecf20Sopenharmony_ci u16 m_adc_state; 3268c2ecf20Sopenharmony_ci 3278c2ecf20Sopenharmony_ci u8 *m_microcode; 3288c2ecf20Sopenharmony_ci int m_microcode_length; 3298c2ecf20Sopenharmony_ci bool m_drxk_a3_rom_code; 3308c2ecf20Sopenharmony_ci bool m_drxk_a3_patch_code; 3318c2ecf20Sopenharmony_ci 3328c2ecf20Sopenharmony_ci bool m_rfmirror; 3338c2ecf20Sopenharmony_ci u8 m_device_spin; 3348c2ecf20Sopenharmony_ci u32 m_iqm_rc_rate; 3358c2ecf20Sopenharmony_ci 3368c2ecf20Sopenharmony_ci enum drx_power_mode m_current_power_mode; 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_ci /* when true, avoids other devices to use the I2C bus */ 3398c2ecf20Sopenharmony_ci bool drxk_i2c_exclusive_lock; 3408c2ecf20Sopenharmony_ci 3418c2ecf20Sopenharmony_ci /* 3428c2ecf20Sopenharmony_ci * Configurable parameters at the driver. They stores the values found 3438c2ecf20Sopenharmony_ci * at struct drxk_config. 3448c2ecf20Sopenharmony_ci */ 3458c2ecf20Sopenharmony_ci 3468c2ecf20Sopenharmony_ci u16 uio_mask; /* Bits used by UIO */ 3478c2ecf20Sopenharmony_ci 3488c2ecf20Sopenharmony_ci bool enable_merr_cfg; 3498c2ecf20Sopenharmony_ci bool single_master; 3508c2ecf20Sopenharmony_ci bool no_i2c_bridge; 3518c2ecf20Sopenharmony_ci bool antenna_dvbt; 3528c2ecf20Sopenharmony_ci u16 antenna_gpio; 3538c2ecf20Sopenharmony_ci 3548c2ecf20Sopenharmony_ci enum fe_status fe_status; 3558c2ecf20Sopenharmony_ci 3568c2ecf20Sopenharmony_ci /* Firmware */ 3578c2ecf20Sopenharmony_ci const char *microcode_name; 3588c2ecf20Sopenharmony_ci struct completion fw_wait_load; 3598c2ecf20Sopenharmony_ci const struct firmware *fw; 3608c2ecf20Sopenharmony_ci int qam_demod_parameter_count; 3618c2ecf20Sopenharmony_ci}; 3628c2ecf20Sopenharmony_ci 3638c2ecf20Sopenharmony_ci#define NEVER_LOCK 0 3648c2ecf20Sopenharmony_ci#define NOT_LOCKED 1 3658c2ecf20Sopenharmony_ci#define DEMOD_LOCK 2 3668c2ecf20Sopenharmony_ci#define FEC_LOCK 3 3678c2ecf20Sopenharmony_ci#define MPEG_LOCK 4 3688c2ecf20Sopenharmony_ci 369