2006-07-30 04:33:44 +08:00
|
|
|
#ifndef DIBX000_COMMON_H
|
|
|
|
#define DIBX000_COMMON_H
|
|
|
|
|
|
|
|
enum dibx000_i2c_interface {
|
2009-08-17 18:01:10 +08:00
|
|
|
DIBX000_I2C_INTERFACE_TUNER = 0,
|
2006-07-30 04:33:44 +08:00
|
|
|
DIBX000_I2C_INTERFACE_GPIO_1_2 = 1,
|
|
|
|
DIBX000_I2C_INTERFACE_GPIO_3_4 = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
struct dibx000_i2c_master {
|
|
|
|
#define DIB3000MC 1
|
|
|
|
#define DIB7000 2
|
|
|
|
#define DIB7000P 11
|
|
|
|
#define DIB7000MC 12
|
2009-08-17 18:01:10 +08:00
|
|
|
#define DIB8000 13
|
2006-07-30 04:33:44 +08:00
|
|
|
u16 device_rev;
|
|
|
|
|
|
|
|
enum dibx000_i2c_interface selected_interface;
|
|
|
|
|
2009-08-17 18:01:10 +08:00
|
|
|
// struct i2c_adapter tuner_i2c_adap;
|
|
|
|
struct i2c_adapter gated_tuner_i2c_adap;
|
2006-07-30 04:33:44 +08:00
|
|
|
|
|
|
|
struct i2c_adapter *i2c_adap;
|
2009-08-17 18:01:10 +08:00
|
|
|
u8 i2c_addr;
|
2006-07-30 04:33:44 +08:00
|
|
|
|
|
|
|
u16 base_reg;
|
|
|
|
};
|
|
|
|
|
2009-08-17 18:01:10 +08:00
|
|
|
extern int dibx000_init_i2c_master(struct dibx000_i2c_master *mst,
|
|
|
|
u16 device_rev, struct i2c_adapter *i2c_adap,
|
|
|
|
u8 i2c_addr);
|
|
|
|
extern struct i2c_adapter *dibx000_get_i2c_adapter(struct dibx000_i2c_master
|
|
|
|
*mst,
|
|
|
|
enum dibx000_i2c_interface
|
|
|
|
intf, int gating);
|
2006-07-30 04:33:44 +08:00
|
|
|
extern void dibx000_exit_i2c_master(struct dibx000_i2c_master *mst);
|
2009-08-17 18:01:10 +08:00
|
|
|
extern void dibx000_reset_i2c_master(struct dibx000_i2c_master *mst);
|
2006-07-30 04:33:44 +08:00
|
|
|
|
2009-12-05 00:27:57 +08:00
|
|
|
extern u32 systime(void);
|
|
|
|
|
2006-07-30 04:33:44 +08:00
|
|
|
#define BAND_LBAND 0x01
|
|
|
|
#define BAND_UHF 0x02
|
|
|
|
#define BAND_VHF 0x04
|
2006-10-18 05:28:14 +08:00
|
|
|
#define BAND_SBAND 0x08
|
2009-12-05 00:27:57 +08:00
|
|
|
#define BAND_FM 0x10
|
|
|
|
#define BAND_CBAND 0x20
|
2006-10-18 05:28:14 +08:00
|
|
|
|
2009-12-07 18:49:40 +08:00
|
|
|
#define BAND_OF_FREQUENCY(freq_kHz) ((freq_kHz) <= 170000 ? BAND_CBAND : \
|
2009-12-05 00:27:57 +08:00
|
|
|
(freq_kHz) <= 115000 ? BAND_FM : \
|
2006-10-18 05:28:14 +08:00
|
|
|
(freq_kHz) <= 250000 ? BAND_VHF : \
|
|
|
|
(freq_kHz) <= 863000 ? BAND_UHF : \
|
|
|
|
(freq_kHz) <= 2000000 ? BAND_LBAND : BAND_SBAND )
|
2006-07-30 04:33:44 +08:00
|
|
|
|
|
|
|
struct dibx000_agc_config {
|
2009-08-17 18:01:10 +08:00
|
|
|
/* defines the capabilities of this AGC-setting - using the BAND_-defines */
|
|
|
|
u8 band_caps;
|
2006-07-30 04:33:44 +08:00
|
|
|
|
|
|
|
u16 setup;
|
|
|
|
|
|
|
|
u16 inv_gain;
|
|
|
|
u16 time_stabiliz;
|
|
|
|
|
2009-08-17 18:01:10 +08:00
|
|
|
u8 alpha_level;
|
2006-07-30 04:33:44 +08:00
|
|
|
u16 thlock;
|
|
|
|
|
2009-08-17 18:01:10 +08:00
|
|
|
u8 wbd_inv;
|
2006-07-30 04:33:44 +08:00
|
|
|
u16 wbd_ref;
|
|
|
|
u8 wbd_sel;
|
|
|
|
u8 wbd_alpha;
|
|
|
|
|
|
|
|
u16 agc1_max;
|
|
|
|
u16 agc1_min;
|
|
|
|
u16 agc2_max;
|
|
|
|
u16 agc2_min;
|
|
|
|
|
|
|
|
u8 agc1_pt1;
|
|
|
|
u8 agc1_pt2;
|
|
|
|
u8 agc1_pt3;
|
|
|
|
|
|
|
|
u8 agc1_slope1;
|
|
|
|
u8 agc1_slope2;
|
|
|
|
|
|
|
|
u8 agc2_pt1;
|
|
|
|
u8 agc2_pt2;
|
|
|
|
|
|
|
|
u8 agc2_slope1;
|
|
|
|
u8 agc2_slope2;
|
|
|
|
|
|
|
|
u8 alpha_mant;
|
|
|
|
u8 alpha_exp;
|
|
|
|
|
|
|
|
u8 beta_mant;
|
|
|
|
u8 beta_exp;
|
|
|
|
|
|
|
|
u8 perform_agc_softsplit;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
u16 min;
|
|
|
|
u16 max;
|
|
|
|
u16 min_thres;
|
|
|
|
u16 max_thres;
|
|
|
|
} split;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct dibx000_bandwidth_config {
|
2009-08-17 18:01:10 +08:00
|
|
|
u32 internal;
|
|
|
|
u32 sampling;
|
2006-07-30 04:33:44 +08:00
|
|
|
|
|
|
|
u8 pll_prediv;
|
|
|
|
u8 pll_ratio;
|
|
|
|
u8 pll_range;
|
|
|
|
u8 pll_reset;
|
|
|
|
u8 pll_bypass;
|
|
|
|
|
|
|
|
u8 enable_refdiv;
|
|
|
|
u8 bypclk_div;
|
|
|
|
u8 IO_CLK_en_core;
|
|
|
|
u8 ADClkSrc;
|
|
|
|
u8 modulo;
|
|
|
|
|
|
|
|
u16 sad_cfg;
|
|
|
|
|
|
|
|
u32 ifreq;
|
|
|
|
u32 timf;
|
2007-07-27 21:08:51 +08:00
|
|
|
|
|
|
|
u32 xtal_hz;
|
2006-07-30 04:33:44 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
enum dibx000_adc_states {
|
|
|
|
DIBX000_SLOW_ADC_ON = 0,
|
|
|
|
DIBX000_SLOW_ADC_OFF,
|
|
|
|
DIBX000_ADC_ON,
|
|
|
|
DIBX000_ADC_OFF,
|
|
|
|
DIBX000_VBG_ENABLE,
|
|
|
|
DIBX000_VBG_DISABLE,
|
|
|
|
};
|
|
|
|
|
2007-07-27 21:08:51 +08:00
|
|
|
#define BANDWIDTH_TO_KHZ(v) ( (v) == BANDWIDTH_8_MHZ ? 8000 : \
|
2006-07-30 04:33:44 +08:00
|
|
|
(v) == BANDWIDTH_7_MHZ ? 7000 : \
|
|
|
|
(v) == BANDWIDTH_6_MHZ ? 6000 : 8000 )
|
|
|
|
|
2008-01-25 18:31:58 +08:00
|
|
|
#define BANDWIDTH_TO_INDEX(v) ( \
|
|
|
|
(v) == 8000 ? BANDWIDTH_8_MHZ : \
|
|
|
|
(v) == 7000 ? BANDWIDTH_7_MHZ : \
|
|
|
|
(v) == 6000 ? BANDWIDTH_6_MHZ : BANDWIDTH_8_MHZ )
|
|
|
|
|
2006-07-30 04:33:44 +08:00
|
|
|
/* Chip output mode. */
|
2007-07-27 21:08:51 +08:00
|
|
|
#define OUTMODE_HIGH_Z 0
|
|
|
|
#define OUTMODE_MPEG2_PAR_GATED_CLK 1
|
|
|
|
#define OUTMODE_MPEG2_PAR_CONT_CLK 2
|
|
|
|
#define OUTMODE_MPEG2_SERIAL 7
|
|
|
|
#define OUTMODE_DIVERSITY 4
|
|
|
|
#define OUTMODE_MPEG2_FIFO 5
|
|
|
|
#define OUTMODE_ANALOG_ADC 6
|
2006-07-30 04:33:44 +08:00
|
|
|
|
2009-12-05 00:27:57 +08:00
|
|
|
enum frontend_tune_state {
|
|
|
|
CT_TUNER_START = 10,
|
|
|
|
CT_TUNER_STEP_0,
|
|
|
|
CT_TUNER_STEP_1,
|
|
|
|
CT_TUNER_STEP_2,
|
|
|
|
CT_TUNER_STEP_3,
|
|
|
|
CT_TUNER_STEP_4,
|
|
|
|
CT_TUNER_STEP_5,
|
|
|
|
CT_TUNER_STEP_6,
|
|
|
|
CT_TUNER_STEP_7,
|
|
|
|
CT_TUNER_STOP,
|
|
|
|
|
|
|
|
CT_AGC_START = 20,
|
|
|
|
CT_AGC_STEP_0,
|
|
|
|
CT_AGC_STEP_1,
|
|
|
|
CT_AGC_STEP_2,
|
|
|
|
CT_AGC_STEP_3,
|
|
|
|
CT_AGC_STEP_4,
|
|
|
|
CT_AGC_STOP,
|
|
|
|
|
|
|
|
CT_DEMOD_START = 30,
|
|
|
|
CT_DEMOD_STEP_1,
|
|
|
|
CT_DEMOD_STEP_2,
|
|
|
|
CT_DEMOD_STEP_3,
|
|
|
|
CT_DEMOD_STEP_4,
|
|
|
|
CT_DEMOD_STEP_5,
|
|
|
|
CT_DEMOD_STEP_6,
|
|
|
|
CT_DEMOD_STEP_7,
|
|
|
|
CT_DEMOD_STEP_8,
|
|
|
|
CT_DEMOD_STEP_9,
|
|
|
|
CT_DEMOD_STEP_10,
|
|
|
|
CT_DEMOD_SEARCH_NEXT = 41,
|
|
|
|
CT_DEMOD_STEP_LOCKED,
|
|
|
|
CT_DEMOD_STOP,
|
|
|
|
|
|
|
|
CT_DONE = 100,
|
|
|
|
CT_SHUTDOWN,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
struct dvb_frontend_parametersContext {
|
|
|
|
#define CHANNEL_STATUS_PARAMETERS_UNKNOWN 0x01
|
|
|
|
#define CHANNEL_STATUS_PARAMETERS_SET 0x02
|
|
|
|
u8 status;
|
|
|
|
u32 tune_time_estimation[2];
|
|
|
|
s32 tps_available;
|
|
|
|
u16 tps[9];
|
|
|
|
};
|
|
|
|
|
|
|
|
#define FE_STATUS_TUNE_FAILED 0
|
|
|
|
#define FE_STATUS_TUNE_TIMED_OUT -1
|
|
|
|
#define FE_STATUS_TUNE_TIME_TOO_SHORT -2
|
|
|
|
#define FE_STATUS_TUNE_PENDING -3
|
|
|
|
#define FE_STATUS_STD_SUCCESS -4
|
|
|
|
#define FE_STATUS_FFT_SUCCESS -5
|
|
|
|
#define FE_STATUS_DEMOD_SUCCESS -6
|
|
|
|
#define FE_STATUS_LOCKED -7
|
|
|
|
#define FE_STATUS_DATA_LOCKED -8
|
|
|
|
|
|
|
|
#define FE_CALLBACK_TIME_NEVER 0xffffffff
|
|
|
|
|
2009-12-07 18:49:40 +08:00
|
|
|
#define ABS(x) ((x < 0) ? (-x) : (x))
|
2009-12-05 00:27:57 +08:00
|
|
|
|
2006-07-30 04:33:44 +08:00
|
|
|
#endif
|