1b3ce3a83SMauro Carvalho Chehab 2ca3355a9SDevin Heitmueller /* 3ca3355a9SDevin Heitmueller Copyright (c), 2004-2005,2007-2010 Trident Microsystems, Inc. 4ca3355a9SDevin Heitmueller All rights reserved. 5ca3355a9SDevin Heitmueller 6ca3355a9SDevin Heitmueller Redistribution and use in source and binary forms, with or without 7ca3355a9SDevin Heitmueller modification, are permitted provided that the following conditions are met: 8ca3355a9SDevin Heitmueller 9ca3355a9SDevin Heitmueller * Redistributions of source code must retain the above copyright notice, 10ca3355a9SDevin Heitmueller this list of conditions and the following disclaimer. 11ca3355a9SDevin Heitmueller * Redistributions in binary form must reproduce the above copyright notice, 12ca3355a9SDevin Heitmueller this list of conditions and the following disclaimer in the documentation 13ca3355a9SDevin Heitmueller and/or other materials provided with the distribution. 14ca3355a9SDevin Heitmueller * Neither the name of Trident Microsystems nor Hauppauge Computer Works 15ca3355a9SDevin Heitmueller nor the names of its contributors may be used to endorse or promote 16ca3355a9SDevin Heitmueller products derived from this software without specific prior written 17ca3355a9SDevin Heitmueller permission. 18ca3355a9SDevin Heitmueller 19ca3355a9SDevin Heitmueller THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20ca3355a9SDevin Heitmueller AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21ca3355a9SDevin Heitmueller IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22ca3355a9SDevin Heitmueller ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 23ca3355a9SDevin Heitmueller LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24ca3355a9SDevin Heitmueller CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25ca3355a9SDevin Heitmueller SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26ca3355a9SDevin Heitmueller INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27ca3355a9SDevin Heitmueller CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28ca3355a9SDevin Heitmueller ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29ca3355a9SDevin Heitmueller POSSIBILITY OF SUCH DAMAGE. 30ca3355a9SDevin Heitmueller 312f1f7333SMauro Carvalho Chehab DRXJ specific header file 322f1f7333SMauro Carvalho Chehab 332f1f7333SMauro Carvalho Chehab Authors: Dragan Savic, Milos Nikolic, Mihajlo Katona, Tao Ding, Paul Janssen 3438b2df95SDevin Heitmueller */ 3538b2df95SDevin Heitmueller 3638b2df95SDevin Heitmueller #ifndef __DRXJ_H__ 3738b2df95SDevin Heitmueller #define __DRXJ_H__ 3838b2df95SDevin Heitmueller /*------------------------------------------------------------------------- 3938b2df95SDevin Heitmueller INCLUDES 4038b2df95SDevin Heitmueller -------------------------------------------------------------------------*/ 4138b2df95SDevin Heitmueller 4238b2df95SDevin Heitmueller #include "drx_driver.h" 4338b2df95SDevin Heitmueller #include "drx_dap_fasi.h" 4438b2df95SDevin Heitmueller 4538b2df95SDevin Heitmueller /* Check DRX-J specific dap condition */ 4638b2df95SDevin Heitmueller /* Multi master mode and short addr format only will not work. 4738b2df95SDevin Heitmueller RMW, CRC reset, broadcast and switching back to single master mode 4838b2df95SDevin Heitmueller cannot be done with short addr only in multi master mode. */ 4938b2df95SDevin Heitmueller #if ((DRXDAP_SINGLE_MASTER == 0) && (DRXDAPFASI_LONG_ADDR_ALLOWED == 0)) 5038b2df95SDevin Heitmueller #error "Multi master mode and short addressing only is an illegal combination" 5138b2df95SDevin Heitmueller *; /* Generate a fatal compiler error to make sure it stops here, 52868c9a17SMauro Carvalho Chehab this is necessary because not all compilers stop after a #error. */ 5338b2df95SDevin Heitmueller #endif 5438b2df95SDevin Heitmueller 5538b2df95SDevin Heitmueller /*------------------------------------------------------------------------- 5638b2df95SDevin Heitmueller TYPEDEFS 5738b2df95SDevin Heitmueller -------------------------------------------------------------------------*/ 5838b2df95SDevin Heitmueller /*============================================================================*/ 5938b2df95SDevin Heitmueller /*============================================================================*/ 6038b2df95SDevin Heitmueller /*== code support ============================================================*/ 6138b2df95SDevin Heitmueller /*============================================================================*/ 6238b2df95SDevin Heitmueller /*============================================================================*/ 6338b2df95SDevin Heitmueller 6438b2df95SDevin Heitmueller /*============================================================================*/ 6538b2df95SDevin Heitmueller /*============================================================================*/ 6638b2df95SDevin Heitmueller /*== SCU cmd if =============================================================*/ 6738b2df95SDevin Heitmueller /*============================================================================*/ 6838b2df95SDevin Heitmueller /*============================================================================*/ 6938b2df95SDevin Heitmueller 70b3ce3a83SMauro Carvalho Chehab struct drxjscu_cmd { 7143a431e4SMauro Carvalho Chehab u16 command; 72b95b0c98SMauro Carvalho Chehab /*< Command number */ 7357afe2f0SMauro Carvalho Chehab u16 parameter_len; 74b95b0c98SMauro Carvalho Chehab /*< Data length in byte */ 7557afe2f0SMauro Carvalho Chehab u16 result_len; 76b95b0c98SMauro Carvalho Chehab /*< result length in byte */ 7743a431e4SMauro Carvalho Chehab u16 *parameter; 78*afccc0bbSwengjianfeng /*< General purpose param */ 7943a431e4SMauro Carvalho Chehab u16 *result; 80*afccc0bbSwengjianfeng /*< General purpose param */}; 8138b2df95SDevin Heitmueller 8238b2df95SDevin Heitmueller /*============================================================================*/ 8338b2df95SDevin Heitmueller /*============================================================================*/ 8438b2df95SDevin Heitmueller /*== CTRL CFG related data structures ========================================*/ 8538b2df95SDevin Heitmueller /*============================================================================*/ 8638b2df95SDevin Heitmueller /*============================================================================*/ 8738b2df95SDevin Heitmueller 8838b2df95SDevin Heitmueller /* extra intermediate lock state for VSB,QAM,NTSC */ 8938b2df95SDevin Heitmueller #define DRXJ_DEMOD_LOCK (DRX_LOCK_STATE_1) 9038b2df95SDevin Heitmueller 9138b2df95SDevin Heitmueller /* OOB lock states */ 9238b2df95SDevin Heitmueller #define DRXJ_OOB_AGC_LOCK (DRX_LOCK_STATE_1) /* analog gain control lock */ 9338b2df95SDevin Heitmueller #define DRXJ_OOB_SYNC_LOCK (DRX_LOCK_STATE_2) /* digital gain control lock */ 9438b2df95SDevin Heitmueller 9538b2df95SDevin Heitmueller /* Intermediate powermodes for DRXJ */ 9638b2df95SDevin Heitmueller #define DRXJ_POWER_DOWN_MAIN_PATH DRX_POWER_MODE_8 9738b2df95SDevin Heitmueller #define DRXJ_POWER_DOWN_CORE DRX_POWER_MODE_9 9838b2df95SDevin Heitmueller #define DRXJ_POWER_DOWN_PLL DRX_POWER_MODE_10 9938b2df95SDevin Heitmueller 10038b2df95SDevin Heitmueller /* supstition for GPIO FNC mux */ 10138b2df95SDevin Heitmueller #define APP_O (0x0000) 10238b2df95SDevin Heitmueller 10338b2df95SDevin Heitmueller /*#define DRX_CTRL_BASE (0x0000)*/ 10438b2df95SDevin Heitmueller 10538b2df95SDevin Heitmueller #define DRXJ_CTRL_CFG_BASE (0x1000) 106b3ce3a83SMauro Carvalho Chehab enum drxj_cfg_type { 10738b2df95SDevin Heitmueller DRXJ_CFG_AGC_RF = DRXJ_CTRL_CFG_BASE, 10838b2df95SDevin Heitmueller DRXJ_CFG_AGC_IF, 10938b2df95SDevin Heitmueller DRXJ_CFG_AGC_INTERNAL, 11038b2df95SDevin Heitmueller DRXJ_CFG_PRE_SAW, 11138b2df95SDevin Heitmueller DRXJ_CFG_AFE_GAIN, 11238b2df95SDevin Heitmueller DRXJ_CFG_SYMBOL_CLK_OFFSET, 11338b2df95SDevin Heitmueller DRXJ_CFG_ACCUM_CR_RS_CW_ERR, 11438b2df95SDevin Heitmueller DRXJ_CFG_FEC_MERS_SEQ_COUNT, 11538b2df95SDevin Heitmueller DRXJ_CFG_OOB_MISC, 11638b2df95SDevin Heitmueller DRXJ_CFG_SMART_ANT, 11738b2df95SDevin Heitmueller DRXJ_CFG_OOB_PRE_SAW, 11838b2df95SDevin Heitmueller DRXJ_CFG_VSB_MISC, 11938b2df95SDevin Heitmueller DRXJ_CFG_RESET_PACKET_ERR, 12038b2df95SDevin Heitmueller 12138b2df95SDevin Heitmueller /* ATV (FM) */ 12238b2df95SDevin Heitmueller DRXJ_CFG_ATV_OUTPUT, /* also for FM (SIF control) but not likely */ 12338b2df95SDevin Heitmueller DRXJ_CFG_ATV_MISC, 12438b2df95SDevin Heitmueller DRXJ_CFG_ATV_EQU_COEF, 12538b2df95SDevin Heitmueller DRXJ_CFG_ATV_AGC_STATUS, /* also for FM ( IF,RF, audioAGC ) */ 12638b2df95SDevin Heitmueller 12738b2df95SDevin Heitmueller DRXJ_CFG_MPEG_OUTPUT_MISC, 12838b2df95SDevin Heitmueller DRXJ_CFG_HW_CFG, 12938b2df95SDevin Heitmueller DRXJ_CFG_OOB_LO_POW, 13038b2df95SDevin Heitmueller 131b3ce3a83SMauro Carvalho Chehab DRXJ_CFG_MAX /* dummy, never to be used */}; 13238b2df95SDevin Heitmueller 133b95b0c98SMauro Carvalho Chehab /* 134*afccc0bbSwengjianfeng * /enum drxj_cfg_smart_ant_io * smart antenna i/o. 13538b2df95SDevin Heitmueller */ 136b3ce3a83SMauro Carvalho Chehab enum drxj_cfg_smart_ant_io { 13738b2df95SDevin Heitmueller DRXJ_SMT_ANT_OUTPUT = 0, 13838b2df95SDevin Heitmueller DRXJ_SMT_ANT_INPUT 139b3ce3a83SMauro Carvalho Chehab }; 14038b2df95SDevin Heitmueller 141b95b0c98SMauro Carvalho Chehab /* 142*afccc0bbSwengjianfeng * /struct drxj_cfg_smart_ant * Set smart antenna. 14338b2df95SDevin Heitmueller */ 144b3ce3a83SMauro Carvalho Chehab struct drxj_cfg_smart_ant { 145b3ce3a83SMauro Carvalho Chehab enum drxj_cfg_smart_ant_io io; 14657afe2f0SMauro Carvalho Chehab u16 ctrl_data; 147b3ce3a83SMauro Carvalho Chehab }; 14838b2df95SDevin Heitmueller 149b95b0c98SMauro Carvalho Chehab /* 15038b2df95SDevin Heitmueller * /struct DRXJAGCSTATUS_t 15138b2df95SDevin Heitmueller * AGC status information from the DRXJ-IQM-AF. 15238b2df95SDevin Heitmueller */ 153b3ce3a83SMauro Carvalho Chehab struct drxj_agc_status { 15443a431e4SMauro Carvalho Chehab u16 IFAGC; 15543a431e4SMauro Carvalho Chehab u16 RFAGC; 15657afe2f0SMauro Carvalho Chehab u16 digital_agc; 157b3ce3a83SMauro Carvalho Chehab }; 15838b2df95SDevin Heitmueller 15938b2df95SDevin Heitmueller /* DRXJ_CFG_AGC_RF, DRXJ_CFG_AGC_IF */ 16038b2df95SDevin Heitmueller 161b95b0c98SMauro Carvalho Chehab /* 162*afccc0bbSwengjianfeng * /enum drxj_agc_ctrl_mode * Available AGCs modes in the DRXJ. 16338b2df95SDevin Heitmueller */ 164b3ce3a83SMauro Carvalho Chehab enum drxj_agc_ctrl_mode { 16538b2df95SDevin Heitmueller DRX_AGC_CTRL_AUTO = 0, 16638b2df95SDevin Heitmueller DRX_AGC_CTRL_USER, 167b3ce3a83SMauro Carvalho Chehab DRX_AGC_CTRL_OFF}; 16838b2df95SDevin Heitmueller 169b95b0c98SMauro Carvalho Chehab /* 170*afccc0bbSwengjianfeng * /struct drxj_cfg_agc * Generic interface for all AGCs present on the DRXJ. 17138b2df95SDevin Heitmueller */ 172b3ce3a83SMauro Carvalho Chehab struct drxj_cfg_agc { 17361263c75SMauro Carvalho Chehab enum drx_standard standard; /* standard for which these settings apply */ 174b3ce3a83SMauro Carvalho Chehab enum drxj_agc_ctrl_mode ctrl_mode; /* off, user, auto */ 17557afe2f0SMauro Carvalho Chehab u16 output_level; /* range dependent on AGC */ 17657afe2f0SMauro Carvalho Chehab u16 min_output_level; /* range dependent on AGC */ 17757afe2f0SMauro Carvalho Chehab u16 max_output_level; /* range dependent on AGC */ 17843a431e4SMauro Carvalho Chehab u16 speed; /* range dependent on AGC */ 17943a431e4SMauro Carvalho Chehab u16 top; /* rf-agc take over point */ 18057afe2f0SMauro Carvalho Chehab u16 cut_off_current; /* rf-agc is accelerated if output current 181b3ce3a83SMauro Carvalho Chehab is below cut-off current */}; 18238b2df95SDevin Heitmueller 18338b2df95SDevin Heitmueller /* DRXJ_CFG_PRE_SAW */ 18438b2df95SDevin Heitmueller 185b95b0c98SMauro Carvalho Chehab /* 186*afccc0bbSwengjianfeng * /struct drxj_cfg_pre_saw * Interface to configure pre SAW sense. 18738b2df95SDevin Heitmueller */ 188b3ce3a83SMauro Carvalho Chehab struct drxj_cfg_pre_saw { 18961263c75SMauro Carvalho Chehab enum drx_standard standard; /* standard to which these settings apply */ 19043a431e4SMauro Carvalho Chehab u16 reference; /* pre SAW reference value, range 0 .. 31 */ 191b3ce3a83SMauro Carvalho Chehab bool use_pre_saw; /* true algorithms must use pre SAW sense */}; 19238b2df95SDevin Heitmueller 19338b2df95SDevin Heitmueller /* DRXJ_CFG_AFE_GAIN */ 19438b2df95SDevin Heitmueller 195b95b0c98SMauro Carvalho Chehab /* 196*afccc0bbSwengjianfeng * /struct drxj_cfg_afe_gain * Interface to configure gain of AFE (LNA + PGA). 19738b2df95SDevin Heitmueller */ 198b3ce3a83SMauro Carvalho Chehab struct drxj_cfg_afe_gain { 19961263c75SMauro Carvalho Chehab enum drx_standard standard; /* standard to which these settings apply */ 200b3ce3a83SMauro Carvalho Chehab u16 gain; /* gain in 0.1 dB steps, DRXJ range 140 .. 335 */}; 20138b2df95SDevin Heitmueller 202b95b0c98SMauro Carvalho Chehab /* 203b3ce3a83SMauro Carvalho Chehab * /struct drxjrs_errors 20438b2df95SDevin Heitmueller * Available failure information in DRXJ_FEC_RS. 20538b2df95SDevin Heitmueller * 206868c9a17SMauro Carvalho Chehab * Container for errors that are received in the most recently finished measurement period 20738b2df95SDevin Heitmueller * 20838b2df95SDevin Heitmueller */ 209b3ce3a83SMauro Carvalho Chehab struct drxjrs_errors { 21057afe2f0SMauro Carvalho Chehab u16 nr_bit_errors; 211b95b0c98SMauro Carvalho Chehab /*< no of pre RS bit errors */ 21257afe2f0SMauro Carvalho Chehab u16 nr_symbol_errors; 213b95b0c98SMauro Carvalho Chehab /*< no of pre RS symbol errors */ 21457afe2f0SMauro Carvalho Chehab u16 nr_packet_errors; 215b95b0c98SMauro Carvalho Chehab /*< no of pre RS packet errors */ 21657afe2f0SMauro Carvalho Chehab u16 nr_failures; 217b95b0c98SMauro Carvalho Chehab /*< no of post RS failures to decode */ 21857afe2f0SMauro Carvalho Chehab u16 nr_snc_par_fail_count; 219b95b0c98SMauro Carvalho Chehab /*< no of post RS bit erros */ 220b3ce3a83SMauro Carvalho Chehab }; 22138b2df95SDevin Heitmueller 222b95b0c98SMauro Carvalho Chehab /* 223*afccc0bbSwengjianfeng * /struct drxj_cfg_vsb_misc * symbol error rate 22438b2df95SDevin Heitmueller */ 225b3ce3a83SMauro Carvalho Chehab struct drxj_cfg_vsb_misc { 22657afe2f0SMauro Carvalho Chehab u32 symb_error; 227b95b0c98SMauro Carvalho Chehab /*< symbol error rate sps */}; 22838b2df95SDevin Heitmueller 229b95b0c98SMauro Carvalho Chehab /* 230*afccc0bbSwengjianfeng * /enum drxj_mpeg_output_clock_rate * Mpeg output clock rate. 23138b2df95SDevin Heitmueller * 23238b2df95SDevin Heitmueller */ 233b3ce3a83SMauro Carvalho Chehab enum drxj_mpeg_start_width { 23438b2df95SDevin Heitmueller DRXJ_MPEG_START_WIDTH_1CLKCYC, 235b3ce3a83SMauro Carvalho Chehab DRXJ_MPEG_START_WIDTH_8CLKCYC}; 23638b2df95SDevin Heitmueller 237b95b0c98SMauro Carvalho Chehab /* 238*afccc0bbSwengjianfeng * /enum drxj_mpeg_output_clock_rate * Mpeg output clock rate. 23938b2df95SDevin Heitmueller * 24038b2df95SDevin Heitmueller */ 241b3ce3a83SMauro Carvalho Chehab enum drxj_mpeg_output_clock_rate { 24238b2df95SDevin Heitmueller DRXJ_MPEGOUTPUT_CLOCK_RATE_AUTO, 24338b2df95SDevin Heitmueller DRXJ_MPEGOUTPUT_CLOCK_RATE_75973K, 24438b2df95SDevin Heitmueller DRXJ_MPEGOUTPUT_CLOCK_RATE_50625K, 24538b2df95SDevin Heitmueller DRXJ_MPEGOUTPUT_CLOCK_RATE_37968K, 24638b2df95SDevin Heitmueller DRXJ_MPEGOUTPUT_CLOCK_RATE_30375K, 24738b2df95SDevin Heitmueller DRXJ_MPEGOUTPUT_CLOCK_RATE_25313K, 248b3ce3a83SMauro Carvalho Chehab DRXJ_MPEGOUTPUT_CLOCK_RATE_21696K}; 24938b2df95SDevin Heitmueller 250b95b0c98SMauro Carvalho Chehab /* 25138b2df95SDevin Heitmueller * /struct DRXJCfgMisc_t 25238b2df95SDevin Heitmueller * Change TEI bit of MPEG output 25338b2df95SDevin Heitmueller * reverse MPEG output bit order 25438b2df95SDevin Heitmueller * set MPEG output clock rate 25538b2df95SDevin Heitmueller */ 256b3ce3a83SMauro Carvalho Chehab struct drxj_cfg_mpeg_output_misc { 257b95b0c98SMauro Carvalho Chehab bool disable_tei_handling; /*< if true pass (not change) TEI bit */ 258b95b0c98SMauro Carvalho Chehab bool bit_reverse_mpeg_outout; /*< if true, parallel: msb on MD0; serial: lsb out first */ 259b3ce3a83SMauro Carvalho Chehab enum drxj_mpeg_output_clock_rate mpeg_output_clock_rate; 260b95b0c98SMauro Carvalho Chehab /*< set MPEG output clock rate that overwirtes the derived one from symbol rate */ 261b95b0c98SMauro Carvalho Chehab enum drxj_mpeg_start_width mpeg_start_width; /*< set MPEG output start width */}; 26238b2df95SDevin Heitmueller 263b95b0c98SMauro Carvalho Chehab /* 264*afccc0bbSwengjianfeng * /enum drxj_xtal_freq * Supported external crystal reference frequency. 26538b2df95SDevin Heitmueller */ 266b3ce3a83SMauro Carvalho Chehab enum drxj_xtal_freq { 26738b2df95SDevin Heitmueller DRXJ_XTAL_FREQ_RSVD, 26838b2df95SDevin Heitmueller DRXJ_XTAL_FREQ_27MHZ, 26938b2df95SDevin Heitmueller DRXJ_XTAL_FREQ_20P25MHZ, 270b3ce3a83SMauro Carvalho Chehab DRXJ_XTAL_FREQ_4MHZ}; 27138b2df95SDevin Heitmueller 272b95b0c98SMauro Carvalho Chehab /* 273*afccc0bbSwengjianfeng * /enum drxj_xtal_freq * Supported external crystal reference frequency. 27438b2df95SDevin Heitmueller */ 275b3ce3a83SMauro Carvalho Chehab enum drxji2c_speed { 27638b2df95SDevin Heitmueller DRXJ_I2C_SPEED_400KBPS, 277b3ce3a83SMauro Carvalho Chehab DRXJ_I2C_SPEED_100KBPS}; 27838b2df95SDevin Heitmueller 279b95b0c98SMauro Carvalho Chehab /* 280*afccc0bbSwengjianfeng * /struct drxj_cfg_hw_cfg * Get hw configuration, such as crystal 281*afccc0bbSwengjianfeng * reference frequency, I2C speed, etc... 28238b2df95SDevin Heitmueller */ 283b3ce3a83SMauro Carvalho Chehab struct drxj_cfg_hw_cfg { 284b3ce3a83SMauro Carvalho Chehab enum drxj_xtal_freq xtal_freq; 285b95b0c98SMauro Carvalho Chehab /*< crystal reference frequency */ 286b3ce3a83SMauro Carvalho Chehab enum drxji2c_speed i2c_speed; 287b95b0c98SMauro Carvalho Chehab /*< 100 or 400 kbps */}; 28838b2df95SDevin Heitmueller 28938b2df95SDevin Heitmueller /* 29038b2df95SDevin Heitmueller * DRXJ_CFG_ATV_MISC 29138b2df95SDevin Heitmueller */ 292b3ce3a83SMauro Carvalho Chehab struct drxj_cfg_atv_misc { 29357afe2f0SMauro Carvalho Chehab s16 peak_filter; /* -8 .. 15 */ 294b3ce3a83SMauro Carvalho Chehab u16 noise_filter; /* 0 .. 15 */}; 29538b2df95SDevin Heitmueller 29638b2df95SDevin Heitmueller /* 297b3ce3a83SMauro Carvalho Chehab * struct drxj_cfg_oob_misc */ 29838b2df95SDevin Heitmueller #define DRXJ_OOB_STATE_RESET 0x0 29938b2df95SDevin Heitmueller #define DRXJ_OOB_STATE_AGN_HUNT 0x1 30038b2df95SDevin Heitmueller #define DRXJ_OOB_STATE_DGN_HUNT 0x2 30138b2df95SDevin Heitmueller #define DRXJ_OOB_STATE_AGC_HUNT 0x3 30238b2df95SDevin Heitmueller #define DRXJ_OOB_STATE_FRQ_HUNT 0x4 30338b2df95SDevin Heitmueller #define DRXJ_OOB_STATE_PHA_HUNT 0x8 30438b2df95SDevin Heitmueller #define DRXJ_OOB_STATE_TIM_HUNT 0x10 30538b2df95SDevin Heitmueller #define DRXJ_OOB_STATE_EQU_HUNT 0x20 30638b2df95SDevin Heitmueller #define DRXJ_OOB_STATE_EQT_HUNT 0x30 30738b2df95SDevin Heitmueller #define DRXJ_OOB_STATE_SYNC 0x40 30838b2df95SDevin Heitmueller 309b3ce3a83SMauro Carvalho Chehab struct drxj_cfg_oob_misc { 310b3ce3a83SMauro Carvalho Chehab struct drxj_agc_status agc; 31157afe2f0SMauro Carvalho Chehab bool eq_lock; 31257afe2f0SMauro Carvalho Chehab bool sym_timing_lock; 31357afe2f0SMauro Carvalho Chehab bool phase_lock; 31457afe2f0SMauro Carvalho Chehab bool freq_lock; 31557afe2f0SMauro Carvalho Chehab bool dig_gain_lock; 31657afe2f0SMauro Carvalho Chehab bool ana_gain_lock; 31743a431e4SMauro Carvalho Chehab u8 state; 318b3ce3a83SMauro Carvalho Chehab }; 31938b2df95SDevin Heitmueller 32038b2df95SDevin Heitmueller /* 32138b2df95SDevin Heitmueller * Index of in array of coef 32238b2df95SDevin Heitmueller */ 323b3ce3a83SMauro Carvalho Chehab enum drxj_cfg_oob_lo_power { 32438b2df95SDevin Heitmueller DRXJ_OOB_LO_POW_MINUS0DB = 0, 32538b2df95SDevin Heitmueller DRXJ_OOB_LO_POW_MINUS5DB, 32638b2df95SDevin Heitmueller DRXJ_OOB_LO_POW_MINUS10DB, 32738b2df95SDevin Heitmueller DRXJ_OOB_LO_POW_MINUS15DB, 328b3ce3a83SMauro Carvalho Chehab DRXJ_OOB_LO_POW_MAX}; 32938b2df95SDevin Heitmueller 33038b2df95SDevin Heitmueller /* 33138b2df95SDevin Heitmueller * DRXJ_CFG_ATV_EQU_COEF 33238b2df95SDevin Heitmueller */ 333b3ce3a83SMauro Carvalho Chehab struct drxj_cfg_atv_equ_coef { 33443a431e4SMauro Carvalho Chehab s16 coef0; /* -256 .. 255 */ 33543a431e4SMauro Carvalho Chehab s16 coef1; /* -256 .. 255 */ 33643a431e4SMauro Carvalho Chehab s16 coef2; /* -256 .. 255 */ 337b3ce3a83SMauro Carvalho Chehab s16 coef3; /* -256 .. 255 */}; 33838b2df95SDevin Heitmueller 33938b2df95SDevin Heitmueller /* 34038b2df95SDevin Heitmueller * Index of in array of coef 34138b2df95SDevin Heitmueller */ 342b3ce3a83SMauro Carvalho Chehab enum drxj_coef_array_index { 34338b2df95SDevin Heitmueller DRXJ_COEF_IDX_MN = 0, 34438b2df95SDevin Heitmueller DRXJ_COEF_IDX_FM, 34538b2df95SDevin Heitmueller DRXJ_COEF_IDX_L, 34638b2df95SDevin Heitmueller DRXJ_COEF_IDX_LP, 34738b2df95SDevin Heitmueller DRXJ_COEF_IDX_BG, 34838b2df95SDevin Heitmueller DRXJ_COEF_IDX_DK, 34938b2df95SDevin Heitmueller DRXJ_COEF_IDX_I, 350b3ce3a83SMauro Carvalho Chehab DRXJ_COEF_IDX_MAX}; 35138b2df95SDevin Heitmueller 35238b2df95SDevin Heitmueller /* 35338b2df95SDevin Heitmueller * DRXJ_CFG_ATV_OUTPUT 35438b2df95SDevin Heitmueller */ 35538b2df95SDevin Heitmueller 356b95b0c98SMauro Carvalho Chehab /* 35738b2df95SDevin Heitmueller * /enum DRXJAttenuation_t 35838b2df95SDevin Heitmueller * Attenuation setting for SIF AGC. 35938b2df95SDevin Heitmueller * 36038b2df95SDevin Heitmueller */ 361b3ce3a83SMauro Carvalho Chehab enum drxjsif_attenuation { 36238b2df95SDevin Heitmueller DRXJ_SIF_ATTENUATION_0DB, 36338b2df95SDevin Heitmueller DRXJ_SIF_ATTENUATION_3DB, 36438b2df95SDevin Heitmueller DRXJ_SIF_ATTENUATION_6DB, 365b3ce3a83SMauro Carvalho Chehab DRXJ_SIF_ATTENUATION_9DB}; 36638b2df95SDevin Heitmueller 367b95b0c98SMauro Carvalho Chehab /* 368*afccc0bbSwengjianfeng * /struct drxj_cfg_atv_output * SIF attenuation setting. 36938b2df95SDevin Heitmueller * 37038b2df95SDevin Heitmueller */ 371b3ce3a83SMauro Carvalho Chehab struct drxj_cfg_atv_output { 37257afe2f0SMauro Carvalho Chehab bool enable_cvbs_output; /* true= enabled */ 37357afe2f0SMauro Carvalho Chehab bool enable_sif_output; /* true= enabled */ 374b3ce3a83SMauro Carvalho Chehab enum drxjsif_attenuation sif_attenuation; 375b3ce3a83SMauro Carvalho Chehab }; 37638b2df95SDevin Heitmueller 37738b2df95SDevin Heitmueller /* 37838b2df95SDevin Heitmueller DRXJ_CFG_ATV_AGC_STATUS (get only) 37938b2df95SDevin Heitmueller */ 38038b2df95SDevin Heitmueller /* TODO : AFE interface not yet finished, subject to change */ 381b3ce3a83SMauro Carvalho Chehab struct drxj_cfg_atv_agc_status { 38257afe2f0SMauro Carvalho Chehab u16 rf_agc_gain; /* 0 .. 877 uA */ 38357afe2f0SMauro Carvalho Chehab u16 if_agc_gain; /* 0 .. 877 uA */ 38457afe2f0SMauro Carvalho Chehab s16 video_agc_gain; /* -75 .. 1972 in 0.1 dB steps */ 38557afe2f0SMauro Carvalho Chehab s16 audio_agc_gain; /* -4 .. 1020 in 0.1 dB steps */ 38657afe2f0SMauro Carvalho Chehab u16 rf_agc_loop_gain; /* 0 .. 7 */ 38757afe2f0SMauro Carvalho Chehab u16 if_agc_loop_gain; /* 0 .. 7 */ 388b3ce3a83SMauro Carvalho Chehab u16 video_agc_loop_gain; /* 0 .. 7 */}; 38938b2df95SDevin Heitmueller 39038b2df95SDevin Heitmueller /*============================================================================*/ 39138b2df95SDevin Heitmueller /*============================================================================*/ 39238b2df95SDevin Heitmueller /*== CTRL related data structures ============================================*/ 39338b2df95SDevin Heitmueller /*============================================================================*/ 39438b2df95SDevin Heitmueller /*============================================================================*/ 39538b2df95SDevin Heitmueller 39638b2df95SDevin Heitmueller /* NONE */ 39738b2df95SDevin Heitmueller 39838b2df95SDevin Heitmueller /*============================================================================*/ 39938b2df95SDevin Heitmueller /*============================================================================*/ 40038b2df95SDevin Heitmueller 40138b2df95SDevin Heitmueller /*========================================*/ 402b95b0c98SMauro Carvalho Chehab /* 403b3ce3a83SMauro Carvalho Chehab * /struct struct drxj_data * DRXJ specific attributes. 40438b2df95SDevin Heitmueller * 40538b2df95SDevin Heitmueller * Global data container for DRXJ specific data. 40638b2df95SDevin Heitmueller * 40738b2df95SDevin Heitmueller */ 408b3ce3a83SMauro Carvalho Chehab struct drxj_data { 409868c9a17SMauro Carvalho Chehab /* device capabilities (determined during drx_open()) */ 410b95b0c98SMauro Carvalho Chehab bool has_lna; /*< true if LNA (aka PGA) present */ 411b95b0c98SMauro Carvalho Chehab bool has_oob; /*< true if OOB supported */ 412b95b0c98SMauro Carvalho Chehab bool has_ntsc; /*< true if NTSC supported */ 413b95b0c98SMauro Carvalho Chehab bool has_btsc; /*< true if BTSC supported */ 414b95b0c98SMauro Carvalho Chehab bool has_smatx; /*< true if mat_tx is available */ 415b95b0c98SMauro Carvalho Chehab bool has_smarx; /*< true if mat_rx is available */ 416b95b0c98SMauro Carvalho Chehab bool has_gpio; /*< true if GPIO is available */ 417b95b0c98SMauro Carvalho Chehab bool has_irqn; /*< true if IRQN is available */ 41838b2df95SDevin Heitmueller /* A1/A2/A... */ 419b95b0c98SMauro Carvalho Chehab u8 mfx; /*< metal fix */ 42038b2df95SDevin Heitmueller 42138b2df95SDevin Heitmueller /* tuner settings */ 422b95b0c98SMauro Carvalho Chehab bool mirror_freq_spect_oob;/*< tuner inversion (true = tuner mirrors the signal */ 42338b2df95SDevin Heitmueller 42438b2df95SDevin Heitmueller /* standard/channel settings */ 425b95b0c98SMauro Carvalho Chehab enum drx_standard standard; /*< current standard information */ 42661263c75SMauro Carvalho Chehab enum drx_modulation constellation; 427b95b0c98SMauro Carvalho Chehab /*< current constellation */ 428b95b0c98SMauro Carvalho Chehab s32 frequency; /*< center signal frequency in KHz */ 42957afe2f0SMauro Carvalho Chehab enum drx_bandwidth curr_bandwidth; 430b95b0c98SMauro Carvalho Chehab /*< current channel bandwidth */ 431b95b0c98SMauro Carvalho Chehab enum drx_mirror mirror; /*< current channel mirror */ 43238b2df95SDevin Heitmueller 43338b2df95SDevin Heitmueller /* signal quality information */ 434b95b0c98SMauro Carvalho Chehab u32 fec_bits_desired; /*< BER accounting period */ 435b95b0c98SMauro Carvalho Chehab u16 fec_vd_plen; /*< no of trellis symbols: VD SER measurement period */ 436b95b0c98SMauro Carvalho Chehab u16 qam_vd_prescale; /*< Viterbi Measurement Prescale */ 437b95b0c98SMauro Carvalho Chehab u16 qam_vd_period; /*< Viterbi Measurement period */ 438b95b0c98SMauro Carvalho Chehab u16 fec_rs_plen; /*< defines RS BER measurement period */ 439b95b0c98SMauro Carvalho Chehab u16 fec_rs_prescale; /*< ReedSolomon Measurement Prescale */ 440b95b0c98SMauro Carvalho Chehab u16 fec_rs_period; /*< ReedSolomon Measurement period */ 441b95b0c98SMauro Carvalho Chehab bool reset_pkt_err_acc; /*< Set a flag to reset accumulated packet error */ 442b95b0c98SMauro Carvalho Chehab u16 pkt_err_acc_start; /*< Set a flag to reset accumulated packet error */ 44338b2df95SDevin Heitmueller 44438b2df95SDevin Heitmueller /* HI configuration */ 445b95b0c98SMauro Carvalho Chehab u16 hi_cfg_timing_div; /*< HI Configure() parameter 2 */ 446b95b0c98SMauro Carvalho Chehab u16 hi_cfg_bridge_delay; /*< HI Configure() parameter 3 */ 447b95b0c98SMauro Carvalho Chehab u16 hi_cfg_wake_up_key; /*< HI Configure() parameter 4 */ 448b95b0c98SMauro Carvalho Chehab u16 hi_cfg_ctrl; /*< HI Configure() parameter 5 */ 449b95b0c98SMauro Carvalho Chehab u16 hi_cfg_transmit; /*< HI Configure() parameter 6 */ 45038b2df95SDevin Heitmueller 4512c149601SMasahiro Yamada /* UIO configuration */ 452b95b0c98SMauro Carvalho Chehab enum drxuio_mode uio_sma_rx_mode;/*< current mode of SmaRx pin */ 453b95b0c98SMauro Carvalho Chehab enum drxuio_mode uio_sma_tx_mode;/*< current mode of SmaTx pin */ 454b95b0c98SMauro Carvalho Chehab enum drxuio_mode uio_gpio_mode; /*< current mode of ASEL pin */ 455b95b0c98SMauro Carvalho Chehab enum drxuio_mode uio_irqn_mode; /*< current mode of IRQN pin */ 45638b2df95SDevin Heitmueller 457*afccc0bbSwengjianfeng /* IQM fs frequency shift and inversion */ 458b95b0c98SMauro Carvalho Chehab u32 iqm_fs_rate_ofs; /*< frequency shifter setting after setchannel */ 459868c9a17SMauro Carvalho Chehab bool pos_image; /*< True: positive image */ 460*afccc0bbSwengjianfeng /* IQM RC frequency shift */ 461b95b0c98SMauro Carvalho Chehab u32 iqm_rc_rate_ofs; /*< frequency shifter setting after setchannel */ 46238b2df95SDevin Heitmueller 4632c149601SMasahiro Yamada /* ATV configuration */ 464b95b0c98SMauro Carvalho Chehab u32 atv_cfg_changed_flags; /*< flag: flags cfg changes */ 465b95b0c98SMauro Carvalho Chehab s16 atv_top_equ0[DRXJ_COEF_IDX_MAX]; /*< shadow of ATV_TOP_EQU0__A */ 466b95b0c98SMauro Carvalho Chehab s16 atv_top_equ1[DRXJ_COEF_IDX_MAX]; /*< shadow of ATV_TOP_EQU1__A */ 467b95b0c98SMauro Carvalho Chehab s16 atv_top_equ2[DRXJ_COEF_IDX_MAX]; /*< shadow of ATV_TOP_EQU2__A */ 468b95b0c98SMauro Carvalho Chehab s16 atv_top_equ3[DRXJ_COEF_IDX_MAX]; /*< shadow of ATV_TOP_EQU3__A */ 469b95b0c98SMauro Carvalho Chehab bool phase_correction_bypass;/*< flag: true=bypass */ 470b95b0c98SMauro Carvalho Chehab s16 atv_top_vid_peak; /*< shadow of ATV_TOP_VID_PEAK__A */ 471b95b0c98SMauro Carvalho Chehab u16 atv_top_noise_th; /*< shadow of ATV_TOP_NOISE_TH__A */ 472868c9a17SMauro Carvalho Chehab bool enable_cvbs_output; /*< flag CVBS output enable */ 473868c9a17SMauro Carvalho Chehab bool enable_sif_output; /*< flag SIF output enable */ 474b3ce3a83SMauro Carvalho Chehab enum drxjsif_attenuation sif_attenuation; 475b95b0c98SMauro Carvalho Chehab /*< current SIF att setting */ 47638b2df95SDevin Heitmueller /* Agc configuration for QAM and VSB */ 477b95b0c98SMauro Carvalho Chehab struct drxj_cfg_agc qam_rf_agc_cfg; /*< qam RF AGC config */ 478b95b0c98SMauro Carvalho Chehab struct drxj_cfg_agc qam_if_agc_cfg; /*< qam IF AGC config */ 479b95b0c98SMauro Carvalho Chehab struct drxj_cfg_agc vsb_rf_agc_cfg; /*< vsb RF AGC config */ 480b95b0c98SMauro Carvalho Chehab struct drxj_cfg_agc vsb_if_agc_cfg; /*< vsb IF AGC config */ 48138b2df95SDevin Heitmueller 48238b2df95SDevin Heitmueller /* PGA gain configuration for QAM and VSB */ 483b95b0c98SMauro Carvalho Chehab u16 qam_pga_cfg; /*< qam PGA config */ 484b95b0c98SMauro Carvalho Chehab u16 vsb_pga_cfg; /*< vsb PGA config */ 48538b2df95SDevin Heitmueller 48638b2df95SDevin Heitmueller /* Pre SAW configuration for QAM and VSB */ 487b3ce3a83SMauro Carvalho Chehab struct drxj_cfg_pre_saw qam_pre_saw_cfg; 488b95b0c98SMauro Carvalho Chehab /*< qam pre SAW config */ 489b3ce3a83SMauro Carvalho Chehab struct drxj_cfg_pre_saw vsb_pre_saw_cfg; 490b95b0c98SMauro Carvalho Chehab /*< qam pre SAW config */ 49138b2df95SDevin Heitmueller 49238b2df95SDevin Heitmueller /* Version information */ 493b95b0c98SMauro Carvalho Chehab char v_text[2][12]; /*< allocated text versions */ 494b95b0c98SMauro Carvalho Chehab struct drx_version v_version[2]; /*< allocated versions structs */ 4951bfc9e15SMauro Carvalho Chehab struct drx_version_list v_list_elements[2]; 496b95b0c98SMauro Carvalho Chehab /*< allocated version list */ 49738b2df95SDevin Heitmueller 49838b2df95SDevin Heitmueller /* smart antenna configuration */ 49957afe2f0SMauro Carvalho Chehab bool smart_ant_inverted; 50038b2df95SDevin Heitmueller 50138b2df95SDevin Heitmueller /* Tracking filter setting for OOB */ 50257afe2f0SMauro Carvalho Chehab u16 oob_trk_filter_cfg[8]; 50357afe2f0SMauro Carvalho Chehab bool oob_power_on; 50438b2df95SDevin Heitmueller 50538b2df95SDevin Heitmueller /* MPEG static bitrate setting */ 506b95b0c98SMauro Carvalho Chehab u32 mpeg_ts_static_bitrate; /*< bitrate static MPEG output */ 507b95b0c98SMauro Carvalho Chehab bool disable_te_ihandling; /*< MPEG TS TEI handling */ 508b95b0c98SMauro Carvalho Chehab bool bit_reverse_mpeg_outout;/*< MPEG output bit order */ 509b3ce3a83SMauro Carvalho Chehab enum drxj_mpeg_output_clock_rate mpeg_output_clock_rate; 510b95b0c98SMauro Carvalho Chehab /*< MPEG output clock rate */ 511b3ce3a83SMauro Carvalho Chehab enum drxj_mpeg_start_width mpeg_start_width; 512b95b0c98SMauro Carvalho Chehab /*< MPEG Start width */ 51338b2df95SDevin Heitmueller 51438b2df95SDevin Heitmueller /* Pre SAW & Agc configuration for ATV */ 515b3ce3a83SMauro Carvalho Chehab struct drxj_cfg_pre_saw atv_pre_saw_cfg; 516b95b0c98SMauro Carvalho Chehab /*< atv pre SAW config */ 517b95b0c98SMauro Carvalho Chehab struct drxj_cfg_agc atv_rf_agc_cfg; /*< atv RF AGC config */ 518b95b0c98SMauro Carvalho Chehab struct drxj_cfg_agc atv_if_agc_cfg; /*< atv IF AGC config */ 519b95b0c98SMauro Carvalho Chehab u16 atv_pga_cfg; /*< atv pga config */ 52038b2df95SDevin Heitmueller 52157afe2f0SMauro Carvalho Chehab u32 curr_symbol_rate; 52238b2df95SDevin Heitmueller 52338b2df95SDevin Heitmueller /* pin-safe mode */ 524b95b0c98SMauro Carvalho Chehab bool pdr_safe_mode; /*< PDR safe mode activated */ 52557afe2f0SMauro Carvalho Chehab u16 pdr_safe_restore_val_gpio; 52657afe2f0SMauro Carvalho Chehab u16 pdr_safe_restore_val_v_sync; 52757afe2f0SMauro Carvalho Chehab u16 pdr_safe_restore_val_sma_rx; 52857afe2f0SMauro Carvalho Chehab u16 pdr_safe_restore_val_sma_tx; 52938b2df95SDevin Heitmueller 53038b2df95SDevin Heitmueller /* OOB pre-saw value */ 53157afe2f0SMauro Carvalho Chehab u16 oob_pre_saw; 532b3ce3a83SMauro Carvalho Chehab enum drxj_cfg_oob_lo_power oob_lo_pow; 53338b2df95SDevin Heitmueller 5341bfc9e15SMauro Carvalho Chehab struct drx_aud_data aud_data; 535b95b0c98SMauro Carvalho Chehab /*< audio storage */}; 53638b2df95SDevin Heitmueller 53738b2df95SDevin Heitmueller /*------------------------------------------------------------------------- 53838b2df95SDevin Heitmueller Access MACROS 53938b2df95SDevin Heitmueller -------------------------------------------------------------------------*/ 540b95b0c98SMauro Carvalho Chehab /* 54138b2df95SDevin Heitmueller * \brief Compilable references to attributes 54238b2df95SDevin Heitmueller * \param d pointer to demod instance 54338b2df95SDevin Heitmueller * 54438b2df95SDevin Heitmueller * Used as main reference to an attribute field. 54538b2df95SDevin Heitmueller * Can be used by both macro implementation and function implementation. 54638b2df95SDevin Heitmueller * These macros are defined to avoid duplication of code in macro and function 54738b2df95SDevin Heitmueller * definitions that handle access of demod common or extended attributes. 54838b2df95SDevin Heitmueller * 54938b2df95SDevin Heitmueller */ 55038b2df95SDevin Heitmueller 55138b2df95SDevin Heitmueller #define DRXJ_ATTR_BTSC_DETECT(d) \ 552b3ce3a83SMauro Carvalho Chehab (((struct drxj_data *)(d)->my_ext_attr)->aud_data.btsc_detect) 55338b2df95SDevin Heitmueller 55438b2df95SDevin Heitmueller /*------------------------------------------------------------------------- 55538b2df95SDevin Heitmueller DEFINES 55638b2df95SDevin Heitmueller -------------------------------------------------------------------------*/ 55738b2df95SDevin Heitmueller 558b95b0c98SMauro Carvalho Chehab /* 55938b2df95SDevin Heitmueller * \def DRXJ_NTSC_CARRIER_FREQ_OFFSET 56038b2df95SDevin Heitmueller * \brief Offset from picture carrier to centre frequency in kHz, in RF domain 56138b2df95SDevin Heitmueller * 56238b2df95SDevin Heitmueller * For NTSC standard. 56338b2df95SDevin Heitmueller * NTSC channels are listed by their picture carrier frequency (Fpc). 56438b2df95SDevin Heitmueller * The function DRX_CTRL_SET_CHANNEL requires the centre frequency as input. 56538b2df95SDevin Heitmueller * In case the tuner module is not used the DRX-J requires that the tuner is 56638b2df95SDevin Heitmueller * tuned to the centre frequency of the channel: 56738b2df95SDevin Heitmueller * 56838b2df95SDevin Heitmueller * Fcentre = Fpc + DRXJ_NTSC_CARRIER_FREQ_OFFSET 56938b2df95SDevin Heitmueller * 57038b2df95SDevin Heitmueller */ 57173f7065bSMauro Carvalho Chehab #define DRXJ_NTSC_CARRIER_FREQ_OFFSET ((s32)(1750)) 57238b2df95SDevin Heitmueller 573b95b0c98SMauro Carvalho Chehab /* 57438b2df95SDevin Heitmueller * \def DRXJ_PAL_SECAM_BG_CARRIER_FREQ_OFFSET 57538b2df95SDevin Heitmueller * \brief Offset from picture carrier to centre frequency in kHz, in RF domain 57638b2df95SDevin Heitmueller * 57738b2df95SDevin Heitmueller * For PAL/SECAM - BG standard. This define is needed in case the tuner module 57838b2df95SDevin Heitmueller * is NOT used. PAL/SECAM channels are listed by their picture carrier frequency (Fpc). 57938b2df95SDevin Heitmueller * The DRX-J requires that the tuner is tuned to: 58038b2df95SDevin Heitmueller * Fpc + DRXJ_PAL_SECAM_BG_CARRIER_FREQ_OFFSET 58138b2df95SDevin Heitmueller * 58238b2df95SDevin Heitmueller * In case the tuner module is used the drxdriver takes care of this. 58338b2df95SDevin Heitmueller * In case the tuner module is NOT used the application programmer must take 58438b2df95SDevin Heitmueller * care of this. 58538b2df95SDevin Heitmueller * 58638b2df95SDevin Heitmueller */ 58773f7065bSMauro Carvalho Chehab #define DRXJ_PAL_SECAM_BG_CARRIER_FREQ_OFFSET ((s32)(2375)) 58838b2df95SDevin Heitmueller 589b95b0c98SMauro Carvalho Chehab /* 59038b2df95SDevin Heitmueller * \def DRXJ_PAL_SECAM_DKIL_CARRIER_FREQ_OFFSET 59138b2df95SDevin Heitmueller * \brief Offset from picture carrier to centre frequency in kHz, in RF domain 59238b2df95SDevin Heitmueller * 59338b2df95SDevin Heitmueller * For PAL/SECAM - DK, I, L standards. This define is needed in case the tuner module 59438b2df95SDevin Heitmueller * is NOT used. PAL/SECAM channels are listed by their picture carrier frequency (Fpc). 59538b2df95SDevin Heitmueller * The DRX-J requires that the tuner is tuned to: 59638b2df95SDevin Heitmueller * Fpc + DRXJ_PAL_SECAM_DKIL_CARRIER_FREQ_OFFSET 59738b2df95SDevin Heitmueller * 59838b2df95SDevin Heitmueller * In case the tuner module is used the drxdriver takes care of this. 59938b2df95SDevin Heitmueller * In case the tuner module is NOT used the application programmer must take 60038b2df95SDevin Heitmueller * care of this. 60138b2df95SDevin Heitmueller * 60238b2df95SDevin Heitmueller */ 60373f7065bSMauro Carvalho Chehab #define DRXJ_PAL_SECAM_DKIL_CARRIER_FREQ_OFFSET ((s32)(2775)) 60438b2df95SDevin Heitmueller 605b95b0c98SMauro Carvalho Chehab /* 60638b2df95SDevin Heitmueller * \def DRXJ_PAL_SECAM_LP_CARRIER_FREQ_OFFSET 60738b2df95SDevin Heitmueller * \brief Offset from picture carrier to centre frequency in kHz, in RF domain 60838b2df95SDevin Heitmueller * 60938b2df95SDevin Heitmueller * For PAL/SECAM - LP standard. This define is needed in case the tuner module 61038b2df95SDevin Heitmueller * is NOT used. PAL/SECAM channels are listed by their picture carrier frequency (Fpc). 61138b2df95SDevin Heitmueller * The DRX-J requires that the tuner is tuned to: 61238b2df95SDevin Heitmueller * Fpc + DRXJ_PAL_SECAM_LP_CARRIER_FREQ_OFFSET 61338b2df95SDevin Heitmueller * 61438b2df95SDevin Heitmueller * In case the tuner module is used the drxdriver takes care of this. 61538b2df95SDevin Heitmueller * In case the tuner module is NOT used the application programmer must take 61638b2df95SDevin Heitmueller * care of this. 61738b2df95SDevin Heitmueller */ 61873f7065bSMauro Carvalho Chehab #define DRXJ_PAL_SECAM_LP_CARRIER_FREQ_OFFSET ((s32)(-3255)) 61938b2df95SDevin Heitmueller 620b95b0c98SMauro Carvalho Chehab /* 62138b2df95SDevin Heitmueller * \def DRXJ_FM_CARRIER_FREQ_OFFSET 62238b2df95SDevin Heitmueller * \brief Offset from sound carrier to centre frequency in kHz, in RF domain 62338b2df95SDevin Heitmueller * 62438b2df95SDevin Heitmueller * For FM standard. 62538b2df95SDevin Heitmueller * FM channels are listed by their sound carrier frequency (Fsc). 62638b2df95SDevin Heitmueller * The function DRX_CTRL_SET_CHANNEL requires the Ffm frequency (see below) as 62738b2df95SDevin Heitmueller * input. 62838b2df95SDevin Heitmueller * In case the tuner module is not used the DRX-J requires that the tuner is 62938b2df95SDevin Heitmueller * tuned to the Ffm frequency of the channel. 63038b2df95SDevin Heitmueller * 63138b2df95SDevin Heitmueller * Ffm = Fsc + DRXJ_FM_CARRIER_FREQ_OFFSET 63238b2df95SDevin Heitmueller * 63338b2df95SDevin Heitmueller */ 63473f7065bSMauro Carvalho Chehab #define DRXJ_FM_CARRIER_FREQ_OFFSET ((s32)(-3000)) 63538b2df95SDevin Heitmueller 63638b2df95SDevin Heitmueller /* Revision types -------------------------------------------------------*/ 63738b2df95SDevin Heitmueller 63838b2df95SDevin Heitmueller #define DRXJ_TYPE_ID (0x3946000DUL) 63938b2df95SDevin Heitmueller 64038b2df95SDevin Heitmueller /* Macros ---------------------------------------------------------------*/ 64138b2df95SDevin Heitmueller 64238b2df95SDevin Heitmueller /* Convert OOB lock status to string */ 64338b2df95SDevin Heitmueller #define DRXJ_STR_OOB_LOCKSTATUS(x) ( \ 64438b2df95SDevin Heitmueller (x == DRX_NEVER_LOCK) ? "Never" : \ 64538b2df95SDevin Heitmueller (x == DRX_NOT_LOCKED) ? "No" : \ 64638b2df95SDevin Heitmueller (x == DRX_LOCKED) ? "Locked" : \ 64738b2df95SDevin Heitmueller (x == DRX_LOCK_STATE_1) ? "AGC lock" : \ 64838b2df95SDevin Heitmueller (x == DRX_LOCK_STATE_2) ? "sync lock" : \ 64938b2df95SDevin Heitmueller "(Invalid)") 65038b2df95SDevin Heitmueller 65138b2df95SDevin Heitmueller #endif /* __DRXJ_H__ */ 652