1 #ifndef DIBX000_COMMON_H
2 #define DIBX000_COMMON_H
4 enum dibx000_i2c_interface
{
5 DIBX000_I2C_INTERFACE_TUNER
= 0,
6 DIBX000_I2C_INTERFACE_GPIO_1_2
= 1,
7 DIBX000_I2C_INTERFACE_GPIO_3_4
= 2,
8 DIBX000_I2C_INTERFACE_GPIO_6_7
= 3
11 struct dibx000_i2c_master
{
19 enum dibx000_i2c_interface selected_interface
;
21 // struct i2c_adapter tuner_i2c_adap;
22 struct i2c_adapter gated_tuner_i2c_adap
;
23 struct i2c_adapter master_i2c_adap_gpio12
;
24 struct i2c_adapter master_i2c_adap_gpio34
;
25 struct i2c_adapter master_i2c_adap_gpio67
;
27 struct i2c_adapter
*i2c_adap
;
33 extern int dibx000_init_i2c_master(struct dibx000_i2c_master
*mst
,
34 u16 device_rev
, struct i2c_adapter
*i2c_adap
,
36 extern struct i2c_adapter
*dibx000_get_i2c_adapter(struct dibx000_i2c_master
38 enum dibx000_i2c_interface
40 extern void dibx000_exit_i2c_master(struct dibx000_i2c_master
*mst
);
41 extern void dibx000_reset_i2c_master(struct dibx000_i2c_master
*mst
);
42 extern int dibx000_i2c_set_speed(struct i2c_adapter
*i2c_adap
, u16 speed
);
44 extern u32
systime(void);
46 #define BAND_LBAND 0x01
49 #define BAND_SBAND 0x08
51 #define BAND_CBAND 0x20
53 #define BAND_OF_FREQUENCY(freq_kHz) ( (freq_kHz) <= 170000 ? BAND_CBAND : \
54 (freq_kHz) <= 115000 ? BAND_FM : \
55 (freq_kHz) <= 250000 ? BAND_VHF : \
56 (freq_kHz) <= 863000 ? BAND_UHF : \
57 (freq_kHz) <= 2000000 ? BAND_LBAND : BAND_SBAND )
59 struct dibx000_agc_config
{
60 /* defines the capabilities of this AGC-setting - using the BAND_-defines */
100 u8 perform_agc_softsplit
;
110 struct dibx000_bandwidth_config
{
134 enum dibx000_adc_states
{
135 DIBX000_SLOW_ADC_ON
= 0,
136 DIBX000_SLOW_ADC_OFF
,
143 #define BANDWIDTH_TO_KHZ(v) ( (v) == BANDWIDTH_8_MHZ ? 8000 : \
144 (v) == BANDWIDTH_7_MHZ ? 7000 : \
145 (v) == BANDWIDTH_6_MHZ ? 6000 : 8000 )
147 #define BANDWIDTH_TO_INDEX(v) ( \
148 (v) == 8000 ? BANDWIDTH_8_MHZ : \
149 (v) == 7000 ? BANDWIDTH_7_MHZ : \
150 (v) == 6000 ? BANDWIDTH_6_MHZ : BANDWIDTH_8_MHZ )
152 /* Chip output mode. */
153 #define OUTMODE_HIGH_Z 0
154 #define OUTMODE_MPEG2_PAR_GATED_CLK 1
155 #define OUTMODE_MPEG2_PAR_CONT_CLK 2
156 #define OUTMODE_MPEG2_SERIAL 7
157 #define OUTMODE_DIVERSITY 4
158 #define OUTMODE_MPEG2_FIFO 5
159 #define OUTMODE_ANALOG_ADC 6
161 enum frontend_tune_state
{
192 CT_DEMOD_SEARCH_NEXT
= 41,
193 CT_DEMOD_STEP_LOCKED
,
201 struct dvb_frontend_parametersContext
{
202 #define CHANNEL_STATUS_PARAMETERS_UNKNOWN 0x01
203 #define CHANNEL_STATUS_PARAMETERS_SET 0x02
205 u32 tune_time_estimation
[2];
210 #define FE_STATUS_TUNE_FAILED 0
211 #define FE_STATUS_TUNE_TIMED_OUT -1
212 #define FE_STATUS_TUNE_TIME_TOO_SHORT -2
213 #define FE_STATUS_TUNE_PENDING -3
214 #define FE_STATUS_STD_SUCCESS -4
215 #define FE_STATUS_FFT_SUCCESS -5
216 #define FE_STATUS_DEMOD_SUCCESS -6
217 #define FE_STATUS_LOCKED -7
218 #define FE_STATUS_DATA_LOCKED -8
220 #define FE_CALLBACK_TIME_NEVER 0xffffffff
222 #define ABS(x) ((x<0)?(-x):(x))
224 #define DATA_BUS_ACCESS_MODE_8BIT 0x01
225 #define DATA_BUS_ACCESS_MODE_16BIT 0x02
226 #define DATA_BUS_ACCESS_MODE_NO_ADDRESS_INCREMENT 0x10
228 struct dibGPIOFunction
{
229 #define BOARD_GPIO_COMPONENT_BUS_ADAPTER 1
230 #define BOARD_GPIO_COMPONENT_DEMOD 2
233 #define BOARD_GPIO_FUNCTION_BOARD_ON 1
234 #define BOARD_GPIO_FUNCTION_BOARD_OFF 2
235 #define BOARD_GPIO_FUNCTION_COMPONENT_ON 3
236 #define BOARD_GPIO_FUNCTION_COMPONENT_OFF 4
237 #define BOARD_GPIO_FUNCTION_SUBBAND_PWM 5
238 #define BOARD_GPIO_FUNCTION_SUBBAND_GPIO 6
241 /* mask, direction and value are used specify which GPIO to change GPIO0
242 * is LSB and possible GPIO31 is MSB. The same bit-position as in the
243 * mask is used for the direction and the value. Direction == 1 is OUT,
244 * 0 == IN. For direction "OUT" value is either 1 or 0, for direction IN
245 * value has no meaning.
247 * In case of BOARD_GPIO_FUNCTION_PWM mask is giving the GPIO to be
248 * used to do the PWM. Direction gives the PWModulator to be used.
249 * Value gives the PWM value in device-dependent scale.
256 #define MAX_NB_SUBBANDS 8
257 struct dibSubbandSelection
{
258 u8 size
; /* Actual number of subbands. */
261 struct dibGPIOFunction gpio
;
262 } subband
[MAX_NB_SUBBANDS
];
265 #define DEMOD_TIMF_SET 0x00
266 #define DEMOD_TIMF_GET 0x01
267 #define DEMOD_TIMF_UPDATE 0x02