18c2ecf20Sopenharmony_ci
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci  Copyright (c), 2004-2005,2007-2010 Trident Microsystems, Inc.
48c2ecf20Sopenharmony_ci  All rights reserved.
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci  Redistribution and use in source and binary forms, with or without
78c2ecf20Sopenharmony_ci  modification, are permitted provided that the following conditions are met:
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci  * Redistributions of source code must retain the above copyright notice,
108c2ecf20Sopenharmony_ci    this list of conditions and the following disclaimer.
118c2ecf20Sopenharmony_ci  * Redistributions in binary form must reproduce the above copyright notice,
128c2ecf20Sopenharmony_ci    this list of conditions and the following disclaimer in the documentation
138c2ecf20Sopenharmony_ci	and/or other materials provided with the distribution.
148c2ecf20Sopenharmony_ci  * Neither the name of Trident Microsystems nor Hauppauge Computer Works
158c2ecf20Sopenharmony_ci    nor the names of its contributors may be used to endorse or promote
168c2ecf20Sopenharmony_ci	products derived from this software without specific prior written
178c2ecf20Sopenharmony_ci	permission.
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
208c2ecf20Sopenharmony_ci  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
218c2ecf20Sopenharmony_ci  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
228c2ecf20Sopenharmony_ci  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
238c2ecf20Sopenharmony_ci  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
248c2ecf20Sopenharmony_ci  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
258c2ecf20Sopenharmony_ci  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
268c2ecf20Sopenharmony_ci  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
278c2ecf20Sopenharmony_ci  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
288c2ecf20Sopenharmony_ci  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
298c2ecf20Sopenharmony_ci  POSSIBILITY OF SUCH DAMAGE.
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci DRXJ specific header file
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci Authors: Dragan Savic, Milos Nikolic, Mihajlo Katona, Tao Ding, Paul Janssen
348c2ecf20Sopenharmony_ci*/
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#ifndef __DRXJ_H__
378c2ecf20Sopenharmony_ci#define __DRXJ_H__
388c2ecf20Sopenharmony_ci/*-------------------------------------------------------------------------
398c2ecf20Sopenharmony_ciINCLUDES
408c2ecf20Sopenharmony_ci-------------------------------------------------------------------------*/
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#include "drx_driver.h"
438c2ecf20Sopenharmony_ci#include "drx_dap_fasi.h"
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci/* Check DRX-J specific dap condition */
468c2ecf20Sopenharmony_ci/* Multi master mode and short addr format only will not work.
478c2ecf20Sopenharmony_ci   RMW, CRC reset, broadcast and switching back to single master mode
488c2ecf20Sopenharmony_ci   cannot be done with short addr only in multi master mode. */
498c2ecf20Sopenharmony_ci#if ((DRXDAP_SINGLE_MASTER == 0) && (DRXDAPFASI_LONG_ADDR_ALLOWED == 0))
508c2ecf20Sopenharmony_ci#error "Multi master mode and short addressing only is an illegal combination"
518c2ecf20Sopenharmony_ci	*;			/* Generate a fatal compiler error to make sure it stops here,
528c2ecf20Sopenharmony_ci				   this is necessary because not all compilers stop after a #error. */
538c2ecf20Sopenharmony_ci#endif
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci/*-------------------------------------------------------------------------
568c2ecf20Sopenharmony_ciTYPEDEFS
578c2ecf20Sopenharmony_ci-------------------------------------------------------------------------*/
588c2ecf20Sopenharmony_ci/*============================================================================*/
598c2ecf20Sopenharmony_ci/*============================================================================*/
608c2ecf20Sopenharmony_ci/*== code support ============================================================*/
618c2ecf20Sopenharmony_ci/*============================================================================*/
628c2ecf20Sopenharmony_ci/*============================================================================*/
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci/*============================================================================*/
658c2ecf20Sopenharmony_ci/*============================================================================*/
668c2ecf20Sopenharmony_ci/*== SCU cmd if  =============================================================*/
678c2ecf20Sopenharmony_ci/*============================================================================*/
688c2ecf20Sopenharmony_ci/*============================================================================*/
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci	struct drxjscu_cmd {
718c2ecf20Sopenharmony_ci		u16 command;
728c2ecf20Sopenharmony_ci			/*< Command number */
738c2ecf20Sopenharmony_ci		u16 parameter_len;
748c2ecf20Sopenharmony_ci			/*< Data length in byte */
758c2ecf20Sopenharmony_ci		u16 result_len;
768c2ecf20Sopenharmony_ci			/*< result length in byte */
778c2ecf20Sopenharmony_ci		u16 *parameter;
788c2ecf20Sopenharmony_ci			/*< General purpous param */
798c2ecf20Sopenharmony_ci		u16 *result;
808c2ecf20Sopenharmony_ci			/*< General purpous param */};
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci/*============================================================================*/
838c2ecf20Sopenharmony_ci/*============================================================================*/
848c2ecf20Sopenharmony_ci/*== CTRL CFG related data structures ========================================*/
858c2ecf20Sopenharmony_ci/*============================================================================*/
868c2ecf20Sopenharmony_ci/*============================================================================*/
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci/* extra intermediate lock state for VSB,QAM,NTSC */
898c2ecf20Sopenharmony_ci#define DRXJ_DEMOD_LOCK       (DRX_LOCK_STATE_1)
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci/* OOB lock states */
928c2ecf20Sopenharmony_ci#define DRXJ_OOB_AGC_LOCK     (DRX_LOCK_STATE_1)	/* analog gain control lock */
938c2ecf20Sopenharmony_ci#define DRXJ_OOB_SYNC_LOCK    (DRX_LOCK_STATE_2)	/* digital gain control lock */
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci/* Intermediate powermodes for DRXJ */
968c2ecf20Sopenharmony_ci#define DRXJ_POWER_DOWN_MAIN_PATH   DRX_POWER_MODE_8
978c2ecf20Sopenharmony_ci#define DRXJ_POWER_DOWN_CORE        DRX_POWER_MODE_9
988c2ecf20Sopenharmony_ci#define DRXJ_POWER_DOWN_PLL         DRX_POWER_MODE_10
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci/* supstition for GPIO FNC mux */
1018c2ecf20Sopenharmony_ci#define APP_O                 (0x0000)
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci/*#define DRX_CTRL_BASE         (0x0000)*/
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci#define DRXJ_CTRL_CFG_BASE    (0x1000)
1068c2ecf20Sopenharmony_ci	enum drxj_cfg_type {
1078c2ecf20Sopenharmony_ci		DRXJ_CFG_AGC_RF = DRXJ_CTRL_CFG_BASE,
1088c2ecf20Sopenharmony_ci		DRXJ_CFG_AGC_IF,
1098c2ecf20Sopenharmony_ci		DRXJ_CFG_AGC_INTERNAL,
1108c2ecf20Sopenharmony_ci		DRXJ_CFG_PRE_SAW,
1118c2ecf20Sopenharmony_ci		DRXJ_CFG_AFE_GAIN,
1128c2ecf20Sopenharmony_ci		DRXJ_CFG_SYMBOL_CLK_OFFSET,
1138c2ecf20Sopenharmony_ci		DRXJ_CFG_ACCUM_CR_RS_CW_ERR,
1148c2ecf20Sopenharmony_ci		DRXJ_CFG_FEC_MERS_SEQ_COUNT,
1158c2ecf20Sopenharmony_ci		DRXJ_CFG_OOB_MISC,
1168c2ecf20Sopenharmony_ci		DRXJ_CFG_SMART_ANT,
1178c2ecf20Sopenharmony_ci		DRXJ_CFG_OOB_PRE_SAW,
1188c2ecf20Sopenharmony_ci		DRXJ_CFG_VSB_MISC,
1198c2ecf20Sopenharmony_ci		DRXJ_CFG_RESET_PACKET_ERR,
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci		/* ATV (FM) */
1228c2ecf20Sopenharmony_ci		DRXJ_CFG_ATV_OUTPUT,	/* also for FM (SIF control) but not likely */
1238c2ecf20Sopenharmony_ci		DRXJ_CFG_ATV_MISC,
1248c2ecf20Sopenharmony_ci		DRXJ_CFG_ATV_EQU_COEF,
1258c2ecf20Sopenharmony_ci		DRXJ_CFG_ATV_AGC_STATUS,	/* also for FM ( IF,RF, audioAGC ) */
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci		DRXJ_CFG_MPEG_OUTPUT_MISC,
1288c2ecf20Sopenharmony_ci		DRXJ_CFG_HW_CFG,
1298c2ecf20Sopenharmony_ci		DRXJ_CFG_OOB_LO_POW,
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci		DRXJ_CFG_MAX	/* dummy, never to be used */};
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci/*
1348c2ecf20Sopenharmony_ci* /struct enum drxj_cfg_smart_ant_io * smart antenna i/o.
1358c2ecf20Sopenharmony_ci*/
1368c2ecf20Sopenharmony_cienum drxj_cfg_smart_ant_io {
1378c2ecf20Sopenharmony_ci	DRXJ_SMT_ANT_OUTPUT = 0,
1388c2ecf20Sopenharmony_ci	DRXJ_SMT_ANT_INPUT
1398c2ecf20Sopenharmony_ci};
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci/*
1428c2ecf20Sopenharmony_ci* /struct struct drxj_cfg_smart_ant * Set smart antenna.
1438c2ecf20Sopenharmony_ci*/
1448c2ecf20Sopenharmony_ci	struct drxj_cfg_smart_ant {
1458c2ecf20Sopenharmony_ci		enum drxj_cfg_smart_ant_io io;
1468c2ecf20Sopenharmony_ci		u16 ctrl_data;
1478c2ecf20Sopenharmony_ci	};
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci/*
1508c2ecf20Sopenharmony_ci* /struct DRXJAGCSTATUS_t
1518c2ecf20Sopenharmony_ci* AGC status information from the DRXJ-IQM-AF.
1528c2ecf20Sopenharmony_ci*/
1538c2ecf20Sopenharmony_cistruct drxj_agc_status {
1548c2ecf20Sopenharmony_ci	u16 IFAGC;
1558c2ecf20Sopenharmony_ci	u16 RFAGC;
1568c2ecf20Sopenharmony_ci	u16 digital_agc;
1578c2ecf20Sopenharmony_ci};
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci/* DRXJ_CFG_AGC_RF, DRXJ_CFG_AGC_IF */
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci/*
1628c2ecf20Sopenharmony_ci* /struct enum drxj_agc_ctrl_mode * Available AGCs modes in the DRXJ.
1638c2ecf20Sopenharmony_ci*/
1648c2ecf20Sopenharmony_ci	enum drxj_agc_ctrl_mode {
1658c2ecf20Sopenharmony_ci		DRX_AGC_CTRL_AUTO = 0,
1668c2ecf20Sopenharmony_ci		DRX_AGC_CTRL_USER,
1678c2ecf20Sopenharmony_ci		DRX_AGC_CTRL_OFF};
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci/*
1708c2ecf20Sopenharmony_ci* /struct struct drxj_cfg_agc * Generic interface for all AGCs present on the DRXJ.
1718c2ecf20Sopenharmony_ci*/
1728c2ecf20Sopenharmony_ci	struct drxj_cfg_agc {
1738c2ecf20Sopenharmony_ci		enum drx_standard standard;	/* standard for which these settings apply */
1748c2ecf20Sopenharmony_ci		enum drxj_agc_ctrl_mode ctrl_mode;	/* off, user, auto          */
1758c2ecf20Sopenharmony_ci		u16 output_level;	/* range dependent on AGC   */
1768c2ecf20Sopenharmony_ci		u16 min_output_level;	/* range dependent on AGC   */
1778c2ecf20Sopenharmony_ci		u16 max_output_level;	/* range dependent on AGC   */
1788c2ecf20Sopenharmony_ci		u16 speed;	/* range dependent on AGC   */
1798c2ecf20Sopenharmony_ci		u16 top;	/* rf-agc take over point   */
1808c2ecf20Sopenharmony_ci		u16 cut_off_current;	/* rf-agc is accelerated if output current
1818c2ecf20Sopenharmony_ci					   is below cut-off current                */};
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci/* DRXJ_CFG_PRE_SAW */
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_ci/*
1868c2ecf20Sopenharmony_ci* /struct struct drxj_cfg_pre_saw * Interface to configure pre SAW sense.
1878c2ecf20Sopenharmony_ci*/
1888c2ecf20Sopenharmony_ci	struct drxj_cfg_pre_saw {
1898c2ecf20Sopenharmony_ci		enum drx_standard standard;	/* standard to which these settings apply */
1908c2ecf20Sopenharmony_ci		u16 reference;	/* pre SAW reference value, range 0 .. 31 */
1918c2ecf20Sopenharmony_ci		bool use_pre_saw;	/* true algorithms must use pre SAW sense */};
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci/* DRXJ_CFG_AFE_GAIN */
1948c2ecf20Sopenharmony_ci
1958c2ecf20Sopenharmony_ci/*
1968c2ecf20Sopenharmony_ci* /struct struct drxj_cfg_afe_gain * Interface to configure gain of AFE (LNA + PGA).
1978c2ecf20Sopenharmony_ci*/
1988c2ecf20Sopenharmony_ci	struct drxj_cfg_afe_gain {
1998c2ecf20Sopenharmony_ci		enum drx_standard standard;	/* standard to which these settings apply */
2008c2ecf20Sopenharmony_ci		u16 gain;	/* gain in 0.1 dB steps, DRXJ range 140 .. 335 */};
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_ci/*
2038c2ecf20Sopenharmony_ci* /struct drxjrs_errors
2048c2ecf20Sopenharmony_ci* Available failure information in DRXJ_FEC_RS.
2058c2ecf20Sopenharmony_ci*
2068c2ecf20Sopenharmony_ci* Container for errors that are received in the most recently finished measurement period
2078c2ecf20Sopenharmony_ci*
2088c2ecf20Sopenharmony_ci*/
2098c2ecf20Sopenharmony_ci	struct drxjrs_errors {
2108c2ecf20Sopenharmony_ci		u16 nr_bit_errors;
2118c2ecf20Sopenharmony_ci				/*< no of pre RS bit errors          */
2128c2ecf20Sopenharmony_ci		u16 nr_symbol_errors;
2138c2ecf20Sopenharmony_ci				/*< no of pre RS symbol errors       */
2148c2ecf20Sopenharmony_ci		u16 nr_packet_errors;
2158c2ecf20Sopenharmony_ci				/*< no of pre RS packet errors       */
2168c2ecf20Sopenharmony_ci		u16 nr_failures;
2178c2ecf20Sopenharmony_ci				/*< no of post RS failures to decode */
2188c2ecf20Sopenharmony_ci		u16 nr_snc_par_fail_count;
2198c2ecf20Sopenharmony_ci				/*< no of post RS bit erros          */
2208c2ecf20Sopenharmony_ci	};
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_ci/*
2238c2ecf20Sopenharmony_ci* /struct struct drxj_cfg_vsb_misc * symbol error rate
2248c2ecf20Sopenharmony_ci*/
2258c2ecf20Sopenharmony_ci	struct drxj_cfg_vsb_misc {
2268c2ecf20Sopenharmony_ci		u32 symb_error;
2278c2ecf20Sopenharmony_ci			      /*< symbol error rate sps */};
2288c2ecf20Sopenharmony_ci
2298c2ecf20Sopenharmony_ci/*
2308c2ecf20Sopenharmony_ci* /enum enum drxj_mpeg_output_clock_rate * Mpeg output clock rate.
2318c2ecf20Sopenharmony_ci*
2328c2ecf20Sopenharmony_ci*/
2338c2ecf20Sopenharmony_ci	enum drxj_mpeg_start_width {
2348c2ecf20Sopenharmony_ci		DRXJ_MPEG_START_WIDTH_1CLKCYC,
2358c2ecf20Sopenharmony_ci		DRXJ_MPEG_START_WIDTH_8CLKCYC};
2368c2ecf20Sopenharmony_ci
2378c2ecf20Sopenharmony_ci/*
2388c2ecf20Sopenharmony_ci* /enum enum drxj_mpeg_output_clock_rate * Mpeg output clock rate.
2398c2ecf20Sopenharmony_ci*
2408c2ecf20Sopenharmony_ci*/
2418c2ecf20Sopenharmony_ci	enum drxj_mpeg_output_clock_rate {
2428c2ecf20Sopenharmony_ci		DRXJ_MPEGOUTPUT_CLOCK_RATE_AUTO,
2438c2ecf20Sopenharmony_ci		DRXJ_MPEGOUTPUT_CLOCK_RATE_75973K,
2448c2ecf20Sopenharmony_ci		DRXJ_MPEGOUTPUT_CLOCK_RATE_50625K,
2458c2ecf20Sopenharmony_ci		DRXJ_MPEGOUTPUT_CLOCK_RATE_37968K,
2468c2ecf20Sopenharmony_ci		DRXJ_MPEGOUTPUT_CLOCK_RATE_30375K,
2478c2ecf20Sopenharmony_ci		DRXJ_MPEGOUTPUT_CLOCK_RATE_25313K,
2488c2ecf20Sopenharmony_ci		DRXJ_MPEGOUTPUT_CLOCK_RATE_21696K};
2498c2ecf20Sopenharmony_ci
2508c2ecf20Sopenharmony_ci/*
2518c2ecf20Sopenharmony_ci* /struct DRXJCfgMisc_t
2528c2ecf20Sopenharmony_ci* Change TEI bit of MPEG output
2538c2ecf20Sopenharmony_ci* reverse MPEG output bit order
2548c2ecf20Sopenharmony_ci* set MPEG output clock rate
2558c2ecf20Sopenharmony_ci*/
2568c2ecf20Sopenharmony_ci	struct drxj_cfg_mpeg_output_misc {
2578c2ecf20Sopenharmony_ci		bool disable_tei_handling;	      /*< if true pass (not change) TEI bit */
2588c2ecf20Sopenharmony_ci		bool bit_reverse_mpeg_outout;	      /*< if true, parallel: msb on MD0; serial: lsb out first */
2598c2ecf20Sopenharmony_ci		enum drxj_mpeg_output_clock_rate mpeg_output_clock_rate;
2608c2ecf20Sopenharmony_ci						      /*< set MPEG output clock rate that overwirtes the derived one from symbol rate */
2618c2ecf20Sopenharmony_ci		enum drxj_mpeg_start_width mpeg_start_width;  /*< set MPEG output start width */};
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ci/*
2648c2ecf20Sopenharmony_ci* /enum enum drxj_xtal_freq * Supported external crystal reference frequency.
2658c2ecf20Sopenharmony_ci*/
2668c2ecf20Sopenharmony_ci	enum drxj_xtal_freq {
2678c2ecf20Sopenharmony_ci		DRXJ_XTAL_FREQ_RSVD,
2688c2ecf20Sopenharmony_ci		DRXJ_XTAL_FREQ_27MHZ,
2698c2ecf20Sopenharmony_ci		DRXJ_XTAL_FREQ_20P25MHZ,
2708c2ecf20Sopenharmony_ci		DRXJ_XTAL_FREQ_4MHZ};
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_ci/*
2738c2ecf20Sopenharmony_ci* /enum enum drxj_xtal_freq * Supported external crystal reference frequency.
2748c2ecf20Sopenharmony_ci*/
2758c2ecf20Sopenharmony_ci	enum drxji2c_speed {
2768c2ecf20Sopenharmony_ci		DRXJ_I2C_SPEED_400KBPS,
2778c2ecf20Sopenharmony_ci		DRXJ_I2C_SPEED_100KBPS};
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ci/*
2808c2ecf20Sopenharmony_ci* /struct struct drxj_cfg_hw_cfg * Get hw configuration, such as crystal reference frequency, I2C speed, etc...
2818c2ecf20Sopenharmony_ci*/
2828c2ecf20Sopenharmony_ci	struct drxj_cfg_hw_cfg {
2838c2ecf20Sopenharmony_ci		enum drxj_xtal_freq xtal_freq;
2848c2ecf20Sopenharmony_ci				   /*< crystal reference frequency */
2858c2ecf20Sopenharmony_ci		enum drxji2c_speed i2c_speed;
2868c2ecf20Sopenharmony_ci				   /*< 100 or 400 kbps */};
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_ci/*
2898c2ecf20Sopenharmony_ci *  DRXJ_CFG_ATV_MISC
2908c2ecf20Sopenharmony_ci */
2918c2ecf20Sopenharmony_ci	struct drxj_cfg_atv_misc {
2928c2ecf20Sopenharmony_ci		s16 peak_filter;	/* -8 .. 15 */
2938c2ecf20Sopenharmony_ci		u16 noise_filter;	/* 0 .. 15 */};
2948c2ecf20Sopenharmony_ci
2958c2ecf20Sopenharmony_ci/*
2968c2ecf20Sopenharmony_ci *  struct drxj_cfg_oob_misc */
2978c2ecf20Sopenharmony_ci#define   DRXJ_OOB_STATE_RESET                                        0x0
2988c2ecf20Sopenharmony_ci#define   DRXJ_OOB_STATE_AGN_HUNT                                     0x1
2998c2ecf20Sopenharmony_ci#define   DRXJ_OOB_STATE_DGN_HUNT                                     0x2
3008c2ecf20Sopenharmony_ci#define   DRXJ_OOB_STATE_AGC_HUNT                                     0x3
3018c2ecf20Sopenharmony_ci#define   DRXJ_OOB_STATE_FRQ_HUNT                                     0x4
3028c2ecf20Sopenharmony_ci#define   DRXJ_OOB_STATE_PHA_HUNT                                     0x8
3038c2ecf20Sopenharmony_ci#define   DRXJ_OOB_STATE_TIM_HUNT                                     0x10
3048c2ecf20Sopenharmony_ci#define   DRXJ_OOB_STATE_EQU_HUNT                                     0x20
3058c2ecf20Sopenharmony_ci#define   DRXJ_OOB_STATE_EQT_HUNT                                     0x30
3068c2ecf20Sopenharmony_ci#define   DRXJ_OOB_STATE_SYNC                                         0x40
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_cistruct drxj_cfg_oob_misc {
3098c2ecf20Sopenharmony_ci	struct drxj_agc_status agc;
3108c2ecf20Sopenharmony_ci	bool eq_lock;
3118c2ecf20Sopenharmony_ci	bool sym_timing_lock;
3128c2ecf20Sopenharmony_ci	bool phase_lock;
3138c2ecf20Sopenharmony_ci	bool freq_lock;
3148c2ecf20Sopenharmony_ci	bool dig_gain_lock;
3158c2ecf20Sopenharmony_ci	bool ana_gain_lock;
3168c2ecf20Sopenharmony_ci	u8 state;
3178c2ecf20Sopenharmony_ci};
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci/*
3208c2ecf20Sopenharmony_ci *  Index of in array of coef
3218c2ecf20Sopenharmony_ci */
3228c2ecf20Sopenharmony_ci	enum drxj_cfg_oob_lo_power {
3238c2ecf20Sopenharmony_ci		DRXJ_OOB_LO_POW_MINUS0DB = 0,
3248c2ecf20Sopenharmony_ci		DRXJ_OOB_LO_POW_MINUS5DB,
3258c2ecf20Sopenharmony_ci		DRXJ_OOB_LO_POW_MINUS10DB,
3268c2ecf20Sopenharmony_ci		DRXJ_OOB_LO_POW_MINUS15DB,
3278c2ecf20Sopenharmony_ci		DRXJ_OOB_LO_POW_MAX};
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci/*
3308c2ecf20Sopenharmony_ci *  DRXJ_CFG_ATV_EQU_COEF
3318c2ecf20Sopenharmony_ci */
3328c2ecf20Sopenharmony_ci	struct drxj_cfg_atv_equ_coef {
3338c2ecf20Sopenharmony_ci		s16 coef0;	/* -256 .. 255 */
3348c2ecf20Sopenharmony_ci		s16 coef1;	/* -256 .. 255 */
3358c2ecf20Sopenharmony_ci		s16 coef2;	/* -256 .. 255 */
3368c2ecf20Sopenharmony_ci		s16 coef3;	/* -256 .. 255 */};
3378c2ecf20Sopenharmony_ci
3388c2ecf20Sopenharmony_ci/*
3398c2ecf20Sopenharmony_ci *  Index of in array of coef
3408c2ecf20Sopenharmony_ci */
3418c2ecf20Sopenharmony_ci	enum drxj_coef_array_index {
3428c2ecf20Sopenharmony_ci		DRXJ_COEF_IDX_MN = 0,
3438c2ecf20Sopenharmony_ci		DRXJ_COEF_IDX_FM,
3448c2ecf20Sopenharmony_ci		DRXJ_COEF_IDX_L,
3458c2ecf20Sopenharmony_ci		DRXJ_COEF_IDX_LP,
3468c2ecf20Sopenharmony_ci		DRXJ_COEF_IDX_BG,
3478c2ecf20Sopenharmony_ci		DRXJ_COEF_IDX_DK,
3488c2ecf20Sopenharmony_ci		DRXJ_COEF_IDX_I,
3498c2ecf20Sopenharmony_ci		DRXJ_COEF_IDX_MAX};
3508c2ecf20Sopenharmony_ci
3518c2ecf20Sopenharmony_ci/*
3528c2ecf20Sopenharmony_ci *  DRXJ_CFG_ATV_OUTPUT
3538c2ecf20Sopenharmony_ci */
3548c2ecf20Sopenharmony_ci
3558c2ecf20Sopenharmony_ci/*
3568c2ecf20Sopenharmony_ci* /enum DRXJAttenuation_t
3578c2ecf20Sopenharmony_ci* Attenuation setting for SIF AGC.
3588c2ecf20Sopenharmony_ci*
3598c2ecf20Sopenharmony_ci*/
3608c2ecf20Sopenharmony_ci	enum drxjsif_attenuation {
3618c2ecf20Sopenharmony_ci		DRXJ_SIF_ATTENUATION_0DB,
3628c2ecf20Sopenharmony_ci		DRXJ_SIF_ATTENUATION_3DB,
3638c2ecf20Sopenharmony_ci		DRXJ_SIF_ATTENUATION_6DB,
3648c2ecf20Sopenharmony_ci		DRXJ_SIF_ATTENUATION_9DB};
3658c2ecf20Sopenharmony_ci
3668c2ecf20Sopenharmony_ci/*
3678c2ecf20Sopenharmony_ci* /struct struct drxj_cfg_atv_output * SIF attenuation setting.
3688c2ecf20Sopenharmony_ci*
3698c2ecf20Sopenharmony_ci*/
3708c2ecf20Sopenharmony_cistruct drxj_cfg_atv_output {
3718c2ecf20Sopenharmony_ci	bool enable_cvbs_output;	/* true= enabled */
3728c2ecf20Sopenharmony_ci	bool enable_sif_output;	/* true= enabled */
3738c2ecf20Sopenharmony_ci	enum drxjsif_attenuation sif_attenuation;
3748c2ecf20Sopenharmony_ci};
3758c2ecf20Sopenharmony_ci
3768c2ecf20Sopenharmony_ci/*
3778c2ecf20Sopenharmony_ci   DRXJ_CFG_ATV_AGC_STATUS (get only)
3788c2ecf20Sopenharmony_ci*/
3798c2ecf20Sopenharmony_ci/* TODO : AFE interface not yet finished, subject to change */
3808c2ecf20Sopenharmony_ci	struct drxj_cfg_atv_agc_status {
3818c2ecf20Sopenharmony_ci		u16 rf_agc_gain;	/* 0 .. 877 uA */
3828c2ecf20Sopenharmony_ci		u16 if_agc_gain;	/* 0 .. 877  uA */
3838c2ecf20Sopenharmony_ci		s16 video_agc_gain;	/* -75 .. 1972 in 0.1 dB steps */
3848c2ecf20Sopenharmony_ci		s16 audio_agc_gain;	/* -4 .. 1020 in 0.1 dB steps */
3858c2ecf20Sopenharmony_ci		u16 rf_agc_loop_gain;	/* 0 .. 7 */
3868c2ecf20Sopenharmony_ci		u16 if_agc_loop_gain;	/* 0 .. 7 */
3878c2ecf20Sopenharmony_ci		u16 video_agc_loop_gain;	/* 0 .. 7 */};
3888c2ecf20Sopenharmony_ci
3898c2ecf20Sopenharmony_ci/*============================================================================*/
3908c2ecf20Sopenharmony_ci/*============================================================================*/
3918c2ecf20Sopenharmony_ci/*== CTRL related data structures ============================================*/
3928c2ecf20Sopenharmony_ci/*============================================================================*/
3938c2ecf20Sopenharmony_ci/*============================================================================*/
3948c2ecf20Sopenharmony_ci
3958c2ecf20Sopenharmony_ci/* NONE */
3968c2ecf20Sopenharmony_ci
3978c2ecf20Sopenharmony_ci/*============================================================================*/
3988c2ecf20Sopenharmony_ci/*============================================================================*/
3998c2ecf20Sopenharmony_ci
4008c2ecf20Sopenharmony_ci/*========================================*/
4018c2ecf20Sopenharmony_ci/*
4028c2ecf20Sopenharmony_ci* /struct struct drxj_data * DRXJ specific attributes.
4038c2ecf20Sopenharmony_ci*
4048c2ecf20Sopenharmony_ci* Global data container for DRXJ specific data.
4058c2ecf20Sopenharmony_ci*
4068c2ecf20Sopenharmony_ci*/
4078c2ecf20Sopenharmony_ci	struct drxj_data {
4088c2ecf20Sopenharmony_ci		/* device capabilities (determined during drx_open()) */
4098c2ecf20Sopenharmony_ci		bool has_lna;		  /*< true if LNA (aka PGA) present */
4108c2ecf20Sopenharmony_ci		bool has_oob;		  /*< true if OOB supported */
4118c2ecf20Sopenharmony_ci		bool has_ntsc;		  /*< true if NTSC supported */
4128c2ecf20Sopenharmony_ci		bool has_btsc;		  /*< true if BTSC supported */
4138c2ecf20Sopenharmony_ci		bool has_smatx;	  /*< true if mat_tx is available */
4148c2ecf20Sopenharmony_ci		bool has_smarx;	  /*< true if mat_rx is available */
4158c2ecf20Sopenharmony_ci		bool has_gpio;		  /*< true if GPIO is available */
4168c2ecf20Sopenharmony_ci		bool has_irqn;		  /*< true if IRQN is available */
4178c2ecf20Sopenharmony_ci		/* A1/A2/A... */
4188c2ecf20Sopenharmony_ci		u8 mfx;		  /*< metal fix */
4198c2ecf20Sopenharmony_ci
4208c2ecf20Sopenharmony_ci		/* tuner settings */
4218c2ecf20Sopenharmony_ci		bool mirror_freq_spect_oob;/*< tuner inversion (true = tuner mirrors the signal */
4228c2ecf20Sopenharmony_ci
4238c2ecf20Sopenharmony_ci		/* standard/channel settings */
4248c2ecf20Sopenharmony_ci		enum drx_standard standard;	  /*< current standard information                     */
4258c2ecf20Sopenharmony_ci		enum drx_modulation constellation;
4268c2ecf20Sopenharmony_ci					  /*< current constellation                            */
4278c2ecf20Sopenharmony_ci		s32 frequency; /*< center signal frequency in KHz                   */
4288c2ecf20Sopenharmony_ci		enum drx_bandwidth curr_bandwidth;
4298c2ecf20Sopenharmony_ci					  /*< current channel bandwidth                        */
4308c2ecf20Sopenharmony_ci		enum drx_mirror mirror;	  /*< current channel mirror                           */
4318c2ecf20Sopenharmony_ci
4328c2ecf20Sopenharmony_ci		/* signal quality information */
4338c2ecf20Sopenharmony_ci		u32 fec_bits_desired;	  /*< BER accounting period                            */
4348c2ecf20Sopenharmony_ci		u16 fec_vd_plen;	  /*< no of trellis symbols: VD SER measurement period */
4358c2ecf20Sopenharmony_ci		u16 qam_vd_prescale;	  /*< Viterbi Measurement Prescale                     */
4368c2ecf20Sopenharmony_ci		u16 qam_vd_period;	  /*< Viterbi Measurement period                       */
4378c2ecf20Sopenharmony_ci		u16 fec_rs_plen;	  /*< defines RS BER measurement period                */
4388c2ecf20Sopenharmony_ci		u16 fec_rs_prescale;	  /*< ReedSolomon Measurement Prescale                 */
4398c2ecf20Sopenharmony_ci		u16 fec_rs_period;	  /*< ReedSolomon Measurement period                   */
4408c2ecf20Sopenharmony_ci		bool reset_pkt_err_acc;	  /*< Set a flag to reset accumulated packet error     */
4418c2ecf20Sopenharmony_ci		u16 pkt_err_acc_start;	  /*< Set a flag to reset accumulated packet error     */
4428c2ecf20Sopenharmony_ci
4438c2ecf20Sopenharmony_ci		/* HI configuration */
4448c2ecf20Sopenharmony_ci		u16 hi_cfg_timing_div;	  /*< HI Configure() parameter 2                       */
4458c2ecf20Sopenharmony_ci		u16 hi_cfg_bridge_delay;	  /*< HI Configure() parameter 3                       */
4468c2ecf20Sopenharmony_ci		u16 hi_cfg_wake_up_key;	  /*< HI Configure() parameter 4                       */
4478c2ecf20Sopenharmony_ci		u16 hi_cfg_ctrl;	  /*< HI Configure() parameter 5                       */
4488c2ecf20Sopenharmony_ci		u16 hi_cfg_transmit;	  /*< HI Configure() parameter 6                       */
4498c2ecf20Sopenharmony_ci
4508c2ecf20Sopenharmony_ci		/* UIO configuration */
4518c2ecf20Sopenharmony_ci		enum drxuio_mode uio_sma_rx_mode;/*< current mode of SmaRx pin                        */
4528c2ecf20Sopenharmony_ci		enum drxuio_mode uio_sma_tx_mode;/*< current mode of SmaTx pin                        */
4538c2ecf20Sopenharmony_ci		enum drxuio_mode uio_gpio_mode; /*< current mode of ASEL pin                         */
4548c2ecf20Sopenharmony_ci		enum drxuio_mode uio_irqn_mode; /*< current mode of IRQN pin                         */
4558c2ecf20Sopenharmony_ci
4568c2ecf20Sopenharmony_ci		/* IQM fs frequecy shift and inversion */
4578c2ecf20Sopenharmony_ci		u32 iqm_fs_rate_ofs;	   /*< frequency shifter setting after setchannel      */
4588c2ecf20Sopenharmony_ci		bool pos_image;	   /*< True: positive image                            */
4598c2ecf20Sopenharmony_ci		/* IQM RC frequecy shift */
4608c2ecf20Sopenharmony_ci		u32 iqm_rc_rate_ofs;	   /*< frequency shifter setting after setchannel      */
4618c2ecf20Sopenharmony_ci
4628c2ecf20Sopenharmony_ci		/* ATV configuration */
4638c2ecf20Sopenharmony_ci		u32 atv_cfg_changed_flags; /*< flag: flags cfg changes */
4648c2ecf20Sopenharmony_ci		s16 atv_top_equ0[DRXJ_COEF_IDX_MAX];	     /*< shadow of ATV_TOP_EQU0__A */
4658c2ecf20Sopenharmony_ci		s16 atv_top_equ1[DRXJ_COEF_IDX_MAX];	     /*< shadow of ATV_TOP_EQU1__A */
4668c2ecf20Sopenharmony_ci		s16 atv_top_equ2[DRXJ_COEF_IDX_MAX];	     /*< shadow of ATV_TOP_EQU2__A */
4678c2ecf20Sopenharmony_ci		s16 atv_top_equ3[DRXJ_COEF_IDX_MAX];	     /*< shadow of ATV_TOP_EQU3__A */
4688c2ecf20Sopenharmony_ci		bool phase_correction_bypass;/*< flag: true=bypass */
4698c2ecf20Sopenharmony_ci		s16 atv_top_vid_peak;	  /*< shadow of ATV_TOP_VID_PEAK__A */
4708c2ecf20Sopenharmony_ci		u16 atv_top_noise_th;	  /*< shadow of ATV_TOP_NOISE_TH__A */
4718c2ecf20Sopenharmony_ci		bool enable_cvbs_output;  /*< flag CVBS output enable */
4728c2ecf20Sopenharmony_ci		bool enable_sif_output;	  /*< flag SIF output enable */
4738c2ecf20Sopenharmony_ci		 enum drxjsif_attenuation sif_attenuation;
4748c2ecf20Sopenharmony_ci					  /*< current SIF att setting */
4758c2ecf20Sopenharmony_ci		/* Agc configuration for QAM and VSB */
4768c2ecf20Sopenharmony_ci		struct drxj_cfg_agc qam_rf_agc_cfg; /*< qam RF AGC config */
4778c2ecf20Sopenharmony_ci		struct drxj_cfg_agc qam_if_agc_cfg; /*< qam IF AGC config */
4788c2ecf20Sopenharmony_ci		struct drxj_cfg_agc vsb_rf_agc_cfg; /*< vsb RF AGC config */
4798c2ecf20Sopenharmony_ci		struct drxj_cfg_agc vsb_if_agc_cfg; /*< vsb IF AGC config */
4808c2ecf20Sopenharmony_ci
4818c2ecf20Sopenharmony_ci		/* PGA gain configuration for QAM and VSB */
4828c2ecf20Sopenharmony_ci		u16 qam_pga_cfg;	  /*< qam PGA config */
4838c2ecf20Sopenharmony_ci		u16 vsb_pga_cfg;	  /*< vsb PGA config */
4848c2ecf20Sopenharmony_ci
4858c2ecf20Sopenharmony_ci		/* Pre SAW configuration for QAM and VSB */
4868c2ecf20Sopenharmony_ci		struct drxj_cfg_pre_saw qam_pre_saw_cfg;
4878c2ecf20Sopenharmony_ci					  /*< qam pre SAW config */
4888c2ecf20Sopenharmony_ci		struct drxj_cfg_pre_saw vsb_pre_saw_cfg;
4898c2ecf20Sopenharmony_ci					  /*< qam pre SAW config */
4908c2ecf20Sopenharmony_ci
4918c2ecf20Sopenharmony_ci		/* Version information */
4928c2ecf20Sopenharmony_ci		char v_text[2][12];	  /*< allocated text versions */
4938c2ecf20Sopenharmony_ci		struct drx_version v_version[2]; /*< allocated versions structs */
4948c2ecf20Sopenharmony_ci		struct drx_version_list v_list_elements[2];
4958c2ecf20Sopenharmony_ci					  /*< allocated version list */
4968c2ecf20Sopenharmony_ci
4978c2ecf20Sopenharmony_ci		/* smart antenna configuration */
4988c2ecf20Sopenharmony_ci		bool smart_ant_inverted;
4998c2ecf20Sopenharmony_ci
5008c2ecf20Sopenharmony_ci		/* Tracking filter setting for OOB */
5018c2ecf20Sopenharmony_ci		u16 oob_trk_filter_cfg[8];
5028c2ecf20Sopenharmony_ci		bool oob_power_on;
5038c2ecf20Sopenharmony_ci
5048c2ecf20Sopenharmony_ci		/* MPEG static bitrate setting */
5058c2ecf20Sopenharmony_ci		u32 mpeg_ts_static_bitrate;  /*< bitrate static MPEG output */
5068c2ecf20Sopenharmony_ci		bool disable_te_ihandling;  /*< MPEG TS TEI handling */
5078c2ecf20Sopenharmony_ci		bool bit_reverse_mpeg_outout;/*< MPEG output bit order */
5088c2ecf20Sopenharmony_ci		 enum drxj_mpeg_output_clock_rate mpeg_output_clock_rate;
5098c2ecf20Sopenharmony_ci					    /*< MPEG output clock rate */
5108c2ecf20Sopenharmony_ci		 enum drxj_mpeg_start_width mpeg_start_width;
5118c2ecf20Sopenharmony_ci					    /*< MPEG Start width */
5128c2ecf20Sopenharmony_ci
5138c2ecf20Sopenharmony_ci		/* Pre SAW & Agc configuration for ATV */
5148c2ecf20Sopenharmony_ci		struct drxj_cfg_pre_saw atv_pre_saw_cfg;
5158c2ecf20Sopenharmony_ci					  /*< atv pre SAW config */
5168c2ecf20Sopenharmony_ci		struct drxj_cfg_agc atv_rf_agc_cfg; /*< atv RF AGC config */
5178c2ecf20Sopenharmony_ci		struct drxj_cfg_agc atv_if_agc_cfg; /*< atv IF AGC config */
5188c2ecf20Sopenharmony_ci		u16 atv_pga_cfg;	  /*< atv pga config    */
5198c2ecf20Sopenharmony_ci
5208c2ecf20Sopenharmony_ci		u32 curr_symbol_rate;
5218c2ecf20Sopenharmony_ci
5228c2ecf20Sopenharmony_ci		/* pin-safe mode */
5238c2ecf20Sopenharmony_ci		bool pdr_safe_mode;	    /*< PDR safe mode activated      */
5248c2ecf20Sopenharmony_ci		u16 pdr_safe_restore_val_gpio;
5258c2ecf20Sopenharmony_ci		u16 pdr_safe_restore_val_v_sync;
5268c2ecf20Sopenharmony_ci		u16 pdr_safe_restore_val_sma_rx;
5278c2ecf20Sopenharmony_ci		u16 pdr_safe_restore_val_sma_tx;
5288c2ecf20Sopenharmony_ci
5298c2ecf20Sopenharmony_ci		/* OOB pre-saw value */
5308c2ecf20Sopenharmony_ci		u16 oob_pre_saw;
5318c2ecf20Sopenharmony_ci		enum drxj_cfg_oob_lo_power oob_lo_pow;
5328c2ecf20Sopenharmony_ci
5338c2ecf20Sopenharmony_ci		struct drx_aud_data aud_data;
5348c2ecf20Sopenharmony_ci				    /*< audio storage                  */};
5358c2ecf20Sopenharmony_ci
5368c2ecf20Sopenharmony_ci/*-------------------------------------------------------------------------
5378c2ecf20Sopenharmony_ciAccess MACROS
5388c2ecf20Sopenharmony_ci-------------------------------------------------------------------------*/
5398c2ecf20Sopenharmony_ci/*
5408c2ecf20Sopenharmony_ci* \brief Compilable references to attributes
5418c2ecf20Sopenharmony_ci* \param d pointer to demod instance
5428c2ecf20Sopenharmony_ci*
5438c2ecf20Sopenharmony_ci* Used as main reference to an attribute field.
5448c2ecf20Sopenharmony_ci* Can be used by both macro implementation and function implementation.
5458c2ecf20Sopenharmony_ci* These macros are defined to avoid duplication of code in macro and function
5468c2ecf20Sopenharmony_ci* definitions that handle access of demod common or extended attributes.
5478c2ecf20Sopenharmony_ci*
5488c2ecf20Sopenharmony_ci*/
5498c2ecf20Sopenharmony_ci
5508c2ecf20Sopenharmony_ci#define DRXJ_ATTR_BTSC_DETECT(d)                       \
5518c2ecf20Sopenharmony_ci			(((struct drxj_data *)(d)->my_ext_attr)->aud_data.btsc_detect)
5528c2ecf20Sopenharmony_ci
5538c2ecf20Sopenharmony_ci/*-------------------------------------------------------------------------
5548c2ecf20Sopenharmony_ciDEFINES
5558c2ecf20Sopenharmony_ci-------------------------------------------------------------------------*/
5568c2ecf20Sopenharmony_ci
5578c2ecf20Sopenharmony_ci/*
5588c2ecf20Sopenharmony_ci* \def DRXJ_NTSC_CARRIER_FREQ_OFFSET
5598c2ecf20Sopenharmony_ci* \brief Offset from picture carrier to centre frequency in kHz, in RF domain
5608c2ecf20Sopenharmony_ci*
5618c2ecf20Sopenharmony_ci* For NTSC standard.
5628c2ecf20Sopenharmony_ci* NTSC channels are listed by their picture carrier frequency (Fpc).
5638c2ecf20Sopenharmony_ci* The function DRX_CTRL_SET_CHANNEL requires the centre frequency as input.
5648c2ecf20Sopenharmony_ci* In case the tuner module is not used the DRX-J requires that the tuner is
5658c2ecf20Sopenharmony_ci* tuned to the centre frequency of the channel:
5668c2ecf20Sopenharmony_ci*
5678c2ecf20Sopenharmony_ci* Fcentre = Fpc + DRXJ_NTSC_CARRIER_FREQ_OFFSET
5688c2ecf20Sopenharmony_ci*
5698c2ecf20Sopenharmony_ci*/
5708c2ecf20Sopenharmony_ci#define DRXJ_NTSC_CARRIER_FREQ_OFFSET           ((s32)(1750))
5718c2ecf20Sopenharmony_ci
5728c2ecf20Sopenharmony_ci/*
5738c2ecf20Sopenharmony_ci* \def DRXJ_PAL_SECAM_BG_CARRIER_FREQ_OFFSET
5748c2ecf20Sopenharmony_ci* \brief Offset from picture carrier to centre frequency in kHz, in RF domain
5758c2ecf20Sopenharmony_ci*
5768c2ecf20Sopenharmony_ci* For PAL/SECAM - BG standard. This define is needed in case the tuner module
5778c2ecf20Sopenharmony_ci* is NOT used. PAL/SECAM channels are listed by their picture carrier frequency (Fpc).
5788c2ecf20Sopenharmony_ci* The DRX-J requires that the tuner is tuned to:
5798c2ecf20Sopenharmony_ci* Fpc + DRXJ_PAL_SECAM_BG_CARRIER_FREQ_OFFSET
5808c2ecf20Sopenharmony_ci*
5818c2ecf20Sopenharmony_ci* In case the tuner module is used the drxdriver takes care of this.
5828c2ecf20Sopenharmony_ci* In case the tuner module is NOT used the application programmer must take
5838c2ecf20Sopenharmony_ci* care of this.
5848c2ecf20Sopenharmony_ci*
5858c2ecf20Sopenharmony_ci*/
5868c2ecf20Sopenharmony_ci#define DRXJ_PAL_SECAM_BG_CARRIER_FREQ_OFFSET   ((s32)(2375))
5878c2ecf20Sopenharmony_ci
5888c2ecf20Sopenharmony_ci/*
5898c2ecf20Sopenharmony_ci* \def DRXJ_PAL_SECAM_DKIL_CARRIER_FREQ_OFFSET
5908c2ecf20Sopenharmony_ci* \brief Offset from picture carrier to centre frequency in kHz, in RF domain
5918c2ecf20Sopenharmony_ci*
5928c2ecf20Sopenharmony_ci* For PAL/SECAM - DK, I, L standards. This define is needed in case the tuner module
5938c2ecf20Sopenharmony_ci* is NOT used. PAL/SECAM channels are listed by their picture carrier frequency (Fpc).
5948c2ecf20Sopenharmony_ci* The DRX-J requires that the tuner is tuned to:
5958c2ecf20Sopenharmony_ci* Fpc + DRXJ_PAL_SECAM_DKIL_CARRIER_FREQ_OFFSET
5968c2ecf20Sopenharmony_ci*
5978c2ecf20Sopenharmony_ci* In case the tuner module is used the drxdriver takes care of this.
5988c2ecf20Sopenharmony_ci* In case the tuner module is NOT used the application programmer must take
5998c2ecf20Sopenharmony_ci* care of this.
6008c2ecf20Sopenharmony_ci*
6018c2ecf20Sopenharmony_ci*/
6028c2ecf20Sopenharmony_ci#define DRXJ_PAL_SECAM_DKIL_CARRIER_FREQ_OFFSET ((s32)(2775))
6038c2ecf20Sopenharmony_ci
6048c2ecf20Sopenharmony_ci/*
6058c2ecf20Sopenharmony_ci* \def DRXJ_PAL_SECAM_LP_CARRIER_FREQ_OFFSET
6068c2ecf20Sopenharmony_ci* \brief Offset from picture carrier to centre frequency in kHz, in RF domain
6078c2ecf20Sopenharmony_ci*
6088c2ecf20Sopenharmony_ci* For PAL/SECAM - LP standard. This define is needed in case the tuner module
6098c2ecf20Sopenharmony_ci* is NOT used. PAL/SECAM channels are listed by their picture carrier frequency (Fpc).
6108c2ecf20Sopenharmony_ci* The DRX-J requires that the tuner is tuned to:
6118c2ecf20Sopenharmony_ci* Fpc + DRXJ_PAL_SECAM_LP_CARRIER_FREQ_OFFSET
6128c2ecf20Sopenharmony_ci*
6138c2ecf20Sopenharmony_ci* In case the tuner module is used the drxdriver takes care of this.
6148c2ecf20Sopenharmony_ci* In case the tuner module is NOT used the application programmer must take
6158c2ecf20Sopenharmony_ci* care of this.
6168c2ecf20Sopenharmony_ci*/
6178c2ecf20Sopenharmony_ci#define DRXJ_PAL_SECAM_LP_CARRIER_FREQ_OFFSET   ((s32)(-3255))
6188c2ecf20Sopenharmony_ci
6198c2ecf20Sopenharmony_ci/*
6208c2ecf20Sopenharmony_ci* \def DRXJ_FM_CARRIER_FREQ_OFFSET
6218c2ecf20Sopenharmony_ci* \brief Offset from sound carrier to centre frequency in kHz, in RF domain
6228c2ecf20Sopenharmony_ci*
6238c2ecf20Sopenharmony_ci* For FM standard.
6248c2ecf20Sopenharmony_ci* FM channels are listed by their sound carrier frequency (Fsc).
6258c2ecf20Sopenharmony_ci* The function DRX_CTRL_SET_CHANNEL requires the Ffm frequency (see below) as
6268c2ecf20Sopenharmony_ci* input.
6278c2ecf20Sopenharmony_ci* In case the tuner module is not used the DRX-J requires that the tuner is
6288c2ecf20Sopenharmony_ci* tuned to the Ffm frequency of the channel.
6298c2ecf20Sopenharmony_ci*
6308c2ecf20Sopenharmony_ci* Ffm = Fsc + DRXJ_FM_CARRIER_FREQ_OFFSET
6318c2ecf20Sopenharmony_ci*
6328c2ecf20Sopenharmony_ci*/
6338c2ecf20Sopenharmony_ci#define DRXJ_FM_CARRIER_FREQ_OFFSET             ((s32)(-3000))
6348c2ecf20Sopenharmony_ci
6358c2ecf20Sopenharmony_ci/* Revision types -------------------------------------------------------*/
6368c2ecf20Sopenharmony_ci
6378c2ecf20Sopenharmony_ci#define DRXJ_TYPE_ID (0x3946000DUL)
6388c2ecf20Sopenharmony_ci
6398c2ecf20Sopenharmony_ci/* Macros ---------------------------------------------------------------*/
6408c2ecf20Sopenharmony_ci
6418c2ecf20Sopenharmony_ci/* Convert OOB lock status to string */
6428c2ecf20Sopenharmony_ci#define DRXJ_STR_OOB_LOCKSTATUS(x) ( \
6438c2ecf20Sopenharmony_ci	(x == DRX_NEVER_LOCK) ? "Never" : \
6448c2ecf20Sopenharmony_ci	(x == DRX_NOT_LOCKED) ? "No" : \
6458c2ecf20Sopenharmony_ci	(x == DRX_LOCKED) ? "Locked" : \
6468c2ecf20Sopenharmony_ci	(x == DRX_LOCK_STATE_1) ? "AGC lock" : \
6478c2ecf20Sopenharmony_ci	(x == DRX_LOCK_STATE_2) ? "sync lock" : \
6488c2ecf20Sopenharmony_ci	"(Invalid)")
6498c2ecf20Sopenharmony_ci
6508c2ecf20Sopenharmony_ci#endif				/* __DRXJ_H__ */
651