blob: 423d1a79b9636012223645786dc5a7862db28c21 [file] [log] [blame]
Mauro Carvalho Chehab223c7b02011-07-20 19:48:59 -03001#ifndef __MT2063_H__
2#define __MT2063_H__
3
4#include <linux/dvb/frontend.h>
5#include "dvb_frontend.h"
6
7//context of mt2063_errordef.h <Henry> ======================================
8//#################################################################
9//=================================================================
10
11/*
12** Note to users: DO NOT EDIT THIS FILE
13**
14** If you wish to rename any of the "user defined" bits,
15** it should be done in the user file that includes this
16** source file (e.g. mt_userdef.h)
17**
18*/
19
20
21
22#define MT2063_ERROR (1 << 31)
23#define MT2063_USER_ERROR (1 << 30)
24
25/* Macro to be used to check for errors */
26#define MT2063_IS_ERROR(s) (((s) >> 30) != 0)
27#define MT2063_NO_ERROR(s) (((s) >> 30) == 0)
28
29
30#define MT2063_OK (0x00000000)
31
32/* Unknown error */
33#define MT2063_UNKNOWN (0x80000001)
34
35/* Error: Upconverter PLL is not locked */
36#define MT2063_UPC_UNLOCK (0x80000002)
37
38/* Error: Downconverter PLL is not locked */
39#define MT2063_DNC_UNLOCK (0x80000004)
40
41/* Error: Two-wire serial bus communications error */
42#define MT2063_COMM_ERR (0x80000008)
43
44/* Error: Tuner handle passed to function was invalid */
45#define MT2063_INV_HANDLE (0x80000010)
46
47/* Error: Function argument is invalid (out of range) */
48#define MT2063_ARG_RANGE (0x80000020)
49
50/* Error: Function argument (ptr to return value) was NULL */
51#define MT2063_ARG_NULL (0x80000040)
52
53/* Error: Attempt to open more than MT_TUNER_CNT tuners */
54#define MT2063_TUNER_CNT_ERR (0x80000080)
55
56/* Error: Tuner Part Code / Rev Code mismatches expected value */
57#define MT2063_TUNER_ID_ERR (0x80000100)
58
59/* Error: Tuner Initialization failure */
60#define MT2063_TUNER_INIT_ERR (0x80000200)
61
62#define MT2063_TUNER_OPEN_ERR (0x80000400)
63
64/* User-definable fields (see mt_userdef.h) */
65#define MT2063_USER_DEFINED1 (0x00001000)
66#define MT2063_USER_DEFINED2 (0x00002000)
67#define MT2063_USER_DEFINED3 (0x00004000)
68#define MT2063_USER_DEFINED4 (0x00008000)
69#define MT2063_USER_MASK (0x4000f000)
70#define MT2063_USER_SHIFT (12)
71
72/* Info: Mask of bits used for # of LO-related spurs that were avoided during tuning */
73#define MT2063_SPUR_CNT_MASK (0x001f0000)
74#define MT2063_SPUR_SHIFT (16)
75
76/* Info: Tuner timeout waiting for condition */
77#define MT2063_TUNER_TIMEOUT (0x00400000)
78
79/* Info: Unavoidable LO-related spur may be present in the output */
80#define MT2063_SPUR_PRESENT_ERR (0x00800000)
81
82/* Info: Tuner input frequency is out of range */
83#define MT2063_FIN_RANGE (0x01000000)
84
85/* Info: Tuner output frequency is out of range */
86#define MT2063_FOUT_RANGE (0x02000000)
87
88/* Info: Upconverter frequency is out of range (may be reason for MT_UPC_UNLOCK) */
89#define MT2063_UPC_RANGE (0x04000000)
90
91/* Info: Downconverter frequency is out of range (may be reason for MT_DPC_UNLOCK) */
92#define MT2063_DNC_RANGE (0x08000000)
93
94//end of mt2063_errordef.h
95//=================================================================
96//#################################################################
97//=================================================================
98
99//context of mt2063_userdef.h <Henry> ======================================
100//#################################################################
101//=================================================================
102/*
103** Data Types
104*/
105#define MT2060_CNT 10
106
107typedef unsigned char U8Data; /* type corresponds to 8 bits */
108typedef unsigned int UData_t; /* type must be at least 32 bits */
109typedef int SData_t; /* type must be at least 32 bits */
110typedef void * Handle_t; /* memory pointer type */
111//typedef double FData_t; /* floating point data type */
112
113#define MAX_UDATA (4294967295) /* max value storable in UData_t */
114
115/*
116** Define an MTxxxx_CNT macro for each type of tuner that will be built
117** into your application (e.g., MT2121, MT2060). MT_TUNER_CNT
118** must be set to the SUM of all of the MTxxxx_CNT macros.
119**
120** #define MT2050_CNT (1)
121** #define MT2060_CNT (1)
122** #define MT2111_CNT (1)
123** #define MT2121_CNT (3)
124*/
125
126#define MT2063_CNT (1)
127
128#if !defined( MT2063_TUNER_CNT )
129#define MT2063_TUNER_CNT (1) /* total num of MicroTuner tuners */
130#endif
131#define MT2063_I2C (0xC0)
132
133UData_t MT2063_WriteSub(Handle_t hUserData,
134 UData_t addr,
135 U8Data subAddress,
136 U8Data *pData,
137 UData_t cnt);
138
139
140UData_t MT2063_ReadSub(Handle_t hUserData,
141 UData_t addr,
142 U8Data subAddress,
143 U8Data *pData,
144 UData_t cnt);
145
146
147void MT2063_Sleep(Handle_t hUserData,
148 UData_t nMinDelayTime);
149
150
151#if defined(MT2060_CNT)
152#if MT2060_CNT > 0
153UData_t MT2060_TunerGain(Handle_t hUserData,
154 SData_t* pMeas);
155#endif
156#endif
157//end of mt2063_userdef.h
158//=================================================================
159//#################################################################
160//=================================================================
161
162
163//context of mt2063_spruavoid.h <Henry> ======================================
164//#################################################################
165//=================================================================
166/*
167** Constant defining the version of the following structure
168** and therefore the API for this code.
169**
170** When compiling the tuner driver, the preprocessor will
171** check against this version number to make sure that
172** it matches the version that the tuner driver knows about.
173*/
174/* Version 010201 => 1.21 */
175#define MT2063_AVOID_SPURS_INFO_VERSION 010201
176
177
178/* DECT Frequency Avoidance */
179#define MT2063_DECT_AVOID_US_FREQS 0x00000001
180
181#define MT2063_DECT_AVOID_EURO_FREQS 0x00000002
182
183#define MT2063_EXCLUDE_US_DECT_FREQUENCIES(s) (((s) & MT2063_DECT_AVOID_US_FREQS) != 0)
184
185#define MT2063_EXCLUDE_EURO_DECT_FREQUENCIES(s) (((s) & MT2063_DECT_AVOID_EURO_FREQS) != 0)
186
187
188enum MT2063_DECT_Avoid_Type
189{
190 MT2063_NO_DECT_AVOIDANCE = 0, /* Do not create DECT exclusion zones. */
191 MT2063_AVOID_US_DECT = MT2063_DECT_AVOID_US_FREQS, /* Avoid US DECT frequencies. */
192 MT2063_AVOID_EURO_DECT = MT2063_DECT_AVOID_EURO_FREQS, /* Avoid European DECT frequencies. */
193 MT2063_AVOID_BOTH /* Avoid both regions. Not typically used. */
194
195} ;
196
197
198#define MT2063_MAX_ZONES 48
199
200struct MT2063_ExclZone_t;
201
202struct MT2063_ExclZone_t
203{
204 UData_t min_;
205 UData_t max_;
206 struct MT2063_ExclZone_t* next_;
207};
208
209/*
210** Structure of data needed for Spur Avoidance
211*/
212struct MT2063_AvoidSpursData_t
213{
214 UData_t nAS_Algorithm;
215 UData_t f_ref;
216 UData_t f_in;
217 UData_t f_LO1;
218 UData_t f_if1_Center;
219 UData_t f_if1_Request;
220 UData_t f_if1_bw;
221 UData_t f_LO2;
222 UData_t f_out;
223 UData_t f_out_bw;
224 UData_t f_LO1_Step;
225 UData_t f_LO2_Step;
226 UData_t f_LO1_FracN_Avoid;
227 UData_t f_LO2_FracN_Avoid;
228 UData_t f_zif_bw;
229 UData_t f_min_LO_Separation;
230 UData_t maxH1;
231 UData_t maxH2;
232 enum MT2063_DECT_Avoid_Type avoidDECT;
233 UData_t bSpurPresent;
234 UData_t bSpurAvoided;
235 UData_t nSpursFound;
236 UData_t nZones;
237 struct MT2063_ExclZone_t* freeZones;
238 struct MT2063_ExclZone_t* usedZones;
239 struct MT2063_ExclZone_t MT2063_ExclZones[MT2063_MAX_ZONES];
240};
241
242UData_t MT2063_RegisterTuner(struct MT2063_AvoidSpursData_t* pAS_Info);
243
244void MT2063_UnRegisterTuner(struct MT2063_AvoidSpursData_t* pAS_Info);
245
246void MT2063_ResetExclZones(struct MT2063_AvoidSpursData_t* pAS_Info);
247
248void MT2063_AddExclZone(struct MT2063_AvoidSpursData_t* pAS_Info,
249 UData_t f_min,
250 UData_t f_max);
251
252UData_t MT2063_ChooseFirstIF(struct MT2063_AvoidSpursData_t* pAS_Info);
253
254UData_t MT2063_AvoidSpurs(Handle_t h,
255 struct MT2063_AvoidSpursData_t* pAS_Info);
256
257UData_t MT2063_AvoidSpursVersion(void);
258
259//end of mt2063_spuravoid.h
260//=================================================================
261//#################################################################
262//=================================================================
263
264
265/*
266** Values returned by the MT2063's on-chip temperature sensor
267** to be read/written.
268*/
269enum MT2063_Temperature
270{
271 MT2063_T_0C = 0, /* Temperature approx 0C */
272 MT2063_T_10C, /* Temperature approx 10C */
273 MT2063_T_20C, /* Temperature approx 20C */
274 MT2063_T_30C, /* Temperature approx 30C */
275 MT2063_T_40C, /* Temperature approx 40C */
276 MT2063_T_50C, /* Temperature approx 50C */
277 MT2063_T_60C, /* Temperature approx 60C */
278 MT2063_T_70C, /* Temperature approx 70C */
279 MT2063_T_80C, /* Temperature approx 80C */
280 MT2063_T_90C, /* Temperature approx 90C */
281 MT2063_T_100C, /* Temperature approx 100C */
282 MT2063_T_110C, /* Temperature approx 110C */
283 MT2063_T_120C, /* Temperature approx 120C */
284 MT2063_T_130C, /* Temperature approx 130C */
285 MT2063_T_140C, /* Temperature approx 140C */
286 MT2063_T_150C, /* Temperature approx 150C */
287};
288
289
290/*
291** Parameters for selecting GPIO bits
292*/
293enum MT2063_GPIO_Attr
294{
295 MT2063_GPIO_IN,
296 MT2063_GPIO_DIR,
297 MT2063_GPIO_OUT,
298};
299
300enum MT2063_GPIO_ID
301{
302 MT2063_GPIO0,
303 MT2063_GPIO1,
304 MT2063_GPIO2,
305};
306
307
308/*
309** Parameter for function MT2063_SetExtSRO that specifies the external
310** SRO drive frequency.
311**
312** MT2063_EXT_SRO_OFF is the power-up default value.
313*/
314enum MT2063_Ext_SRO
315{
316 MT2063_EXT_SRO_OFF, /* External SRO drive off */
317 MT2063_EXT_SRO_BY_4, /* External SRO drive divide by 4 */
318 MT2063_EXT_SRO_BY_2, /* External SRO drive divide by 2 */
319 MT2063_EXT_SRO_BY_1 /* External SRO drive divide by 1 */
320};
321
322
323/*
324** Parameter for function MT2063_SetPowerMask that specifies the power down
325** of various sections of the MT2063.
326*/
327enum MT2063_Mask_Bits
328{
329 MT2063_REG_SD = 0x0040, /* Shutdown regulator */
330 MT2063_SRO_SD = 0x0020, /* Shutdown SRO */
331 MT2063_AFC_SD = 0x0010, /* Shutdown AFC A/D */
332 MT2063_PD_SD = 0x0002, /* Enable power detector shutdown */
333 MT2063_PDADC_SD = 0x0001, /* Enable power detector A/D shutdown */
334 MT2063_VCO_SD = 0x8000, /* Enable VCO shutdown */
335 MT2063_LTX_SD = 0x4000, /* Enable LTX shutdown */
336 MT2063_LT1_SD = 0x2000, /* Enable LT1 shutdown */
337 MT2063_LNA_SD = 0x1000, /* Enable LNA shutdown */
338 MT2063_UPC_SD = 0x0800, /* Enable upconverter shutdown */
339 MT2063_DNC_SD = 0x0400, /* Enable downconverter shutdown */
340 MT2063_VGA_SD = 0x0200, /* Enable VGA shutdown */
341 MT2063_AMP_SD = 0x0100, /* Enable AMP shutdown */
342 MT2063_ALL_SD = 0xFF73, /* All shutdown bits for this tuner */
343 MT2063_NONE_SD = 0x0000 /* No shutdown bits */
344};
345
346
347/*
348** Parameter for function MT2063_GetParam & MT2063_SetParam that
349** specifies the tuning algorithm parameter to be read/written.
350*/
351enum MT2063_Param
352{
353 /* tuner address set by MT2063_Open() */
354 MT2063_IC_ADDR,
355
356 /* max number of MT2063 tuners set by MT_TUNER_CNT in mt_userdef.h */
357 MT2063_MAX_OPEN,
358
359 /* current number of open MT2063 tuners set by MT2063_Open() */
360 MT2063_NUM_OPEN,
361
362 /* crystal frequency (default: 16000000 Hz) */
363 MT2063_SRO_FREQ,
364
365 /* min tuning step size (default: 50000 Hz) */
366 MT2063_STEPSIZE,
367
368 /* input center frequency set by MT2063_Tune() */
369 MT2063_INPUT_FREQ,
370
371 /* LO1 Frequency set by MT2063_Tune() */
372 MT2063_LO1_FREQ,
373
374 /* LO1 minimum step size (default: 250000 Hz) */
375 MT2063_LO1_STEPSIZE,
376
377 /* LO1 FracN keep-out region (default: 999999 Hz) */
378 MT2063_LO1_FRACN_AVOID_PARAM,
379
380 /* Current 1st IF in use set by MT2063_Tune() */
381 MT2063_IF1_ACTUAL,
382
383 /* Requested 1st IF set by MT2063_Tune() */
384 MT2063_IF1_REQUEST,
385
386 /* Center of 1st IF SAW filter (default: 1218000000 Hz) */
387 MT2063_IF1_CENTER,
388
389 /* Bandwidth of 1st IF SAW filter (default: 20000000 Hz) */
390 MT2063_IF1_BW,
391
392 /* zero-IF bandwidth (default: 2000000 Hz) */
393 MT2063_ZIF_BW,
394
395 /* LO2 Frequency set by MT2063_Tune() */
396 MT2063_LO2_FREQ,
397
398 /* LO2 minimum step size (default: 50000 Hz) */
399 MT2063_LO2_STEPSIZE,
400
401 /* LO2 FracN keep-out region (default: 374999 Hz) */
402 MT2063_LO2_FRACN_AVOID,
403
404 /* output center frequency set by MT2063_Tune() */
405 MT2063_OUTPUT_FREQ,
406
407 /* output bandwidth set by MT2063_Tune() */
408 MT2063_OUTPUT_BW,
409
410 /* min inter-tuner LO separation (default: 1000000 Hz) */
411 MT2063_LO_SEPARATION,
412
413 /* ID of avoid-spurs algorithm in use compile-time constant */
414 MT2063_AS_ALG,
415
416 /* max # of intra-tuner harmonics (default: 15) */
417 MT2063_MAX_HARM1,
418
419 /* max # of inter-tuner harmonics (default: 7) */
420 MT2063_MAX_HARM2,
421
422 /* # of 1st IF exclusion zones used set by MT2063_Tune() */
423 MT2063_EXCL_ZONES,
424
425 /* # of spurs found/avoided set by MT2063_Tune() */
426 MT2063_NUM_SPURS,
427
428 /* >0 spurs avoided set by MT2063_Tune() */
429 MT2063_SPUR_AVOIDED,
430
431 /* >0 spurs in output (mathematically) set by MT2063_Tune() */
432 MT2063_SPUR_PRESENT,
433
434 /* Receiver Mode for some parameters. 1 is DVB-T */
435 MT2063_RCVR_MODE,
436
437 /* directly set LNA attenuation, parameter is value to set */
438 MT2063_ACLNA,
439
440 /* maximum LNA attenuation, parameter is value to set */
441 MT2063_ACLNA_MAX,
442
443 /* directly set ATN attenuation. Paremeter is value to set. */
444 MT2063_ACRF,
445
446 /* maxium ATN attenuation. Paremeter is value to set. */
447 MT2063_ACRF_MAX,
448
449 /* directly set FIF attenuation. Paremeter is value to set. */
450 MT2063_ACFIF,
451
452 /* maxium FIF attenuation. Paremeter is value to set. */
453 MT2063_ACFIF_MAX,
454
455 /* LNA Rin */
456 MT2063_LNA_RIN,
457
458 /* Power Detector LNA level target */
459 MT2063_LNA_TGT,
460
461 /* Power Detector 1 level */
462 MT2063_PD1,
463
464 /* Power Detector 1 level target */
465 MT2063_PD1_TGT,
466
467 /* Power Detector 2 level */
468 MT2063_PD2,
469
470 /* Power Detector 2 level target */
471 MT2063_PD2_TGT,
472
473 /* Selects, which DNC is activ */
474 MT2063_DNC_OUTPUT_ENABLE,
475
476 /* VGA gain code */
477 MT2063_VGAGC,
478
479 /* VGA bias current */
480 MT2063_VGAOI,
481
482 /* TAGC, determins the speed of the AGC */
483 MT2063_TAGC,
484
485 /* AMP gain code */
486 MT2063_AMPGC,
487
488 /* Control setting to avoid DECT freqs (default: MT_AVOID_BOTH) */
489 MT2063_AVOID_DECT,
490
491 /* Cleartune filter selection: 0 - by IC (default), 1 - by software */
492 MT2063_CTFILT_SW,
493
494 MT2063_EOP /* last entry in enumerated list */
495
496};
497
498
499/*
500** Parameter for selecting tuner mode
501*/
502enum MT2063_RCVR_MODES
503{
504 MT2063_CABLE_QAM = 0, /* Digital cable */
505 MT2063_CABLE_ANALOG, /* Analog cable */
506 MT2063_OFFAIR_COFDM, /* Digital offair */
507 MT2063_OFFAIR_COFDM_SAWLESS, /* Digital offair without SAW */
508 MT2063_OFFAIR_ANALOG, /* Analog offair */
509 MT2063_OFFAIR_8VSB, /* Analog offair */
510 MT2063_NUM_RCVR_MODES
511};
512
513
514/*
515** Possible values for MT2063_DNC_OUTPUT
516*/
517enum MT2063_DNC_Output_Enable{
518 MT2063_DNC_NONE = 0,
519 MT2063_DNC_1,
520 MT2063_DNC_2,
521 MT2063_DNC_BOTH
522};
523
524/*
525** Two-wire serial bus subaddresses of the tuner registers.
526** Also known as the tuner's register addresses.
527*/
528enum MT2063_Register_Offsets
529{
530 MT2063_REG_PART_REV = 0, /* 0x00: Part/Rev Code */
531 MT2063_REG_LO1CQ_1, /* 0x01: LO1C Queued Byte 1 */
532 MT2063_REG_LO1CQ_2, /* 0x02: LO1C Queued Byte 2 */
533 MT2063_REG_LO2CQ_1, /* 0x03: LO2C Queued Byte 1 */
534 MT2063_REG_LO2CQ_2, /* 0x04: LO2C Queued Byte 2 */
535 MT2063_REG_LO2CQ_3, /* 0x05: LO2C Queued Byte 3 */
536 MT2063_REG_RSVD_06, /* 0x06: Reserved */
537 MT2063_REG_LO_STATUS, /* 0x07: LO Status */
538 MT2063_REG_FIFFC, /* 0x08: FIFF Center */
539 MT2063_REG_CLEARTUNE, /* 0x09: ClearTune Filter */
540 MT2063_REG_ADC_OUT, /* 0x0A: ADC_OUT */
541 MT2063_REG_LO1C_1, /* 0x0B: LO1C Byte 1 */
542 MT2063_REG_LO1C_2, /* 0x0C: LO1C Byte 2 */
543 MT2063_REG_LO2C_1, /* 0x0D: LO2C Byte 1 */
544 MT2063_REG_LO2C_2, /* 0x0E: LO2C Byte 2 */
545 MT2063_REG_LO2C_3, /* 0x0F: LO2C Byte 3 */
546 MT2063_REG_RSVD_10, /* 0x10: Reserved */
547 MT2063_REG_PWR_1, /* 0x11: PWR Byte 1 */
548 MT2063_REG_PWR_2, /* 0x12: PWR Byte 2 */
549 MT2063_REG_TEMP_STATUS, /* 0x13: Temp Status */
550 MT2063_REG_XO_STATUS, /* 0x14: Crystal Status */
551 MT2063_REG_RF_STATUS, /* 0x15: RF Attn Status */
552 MT2063_REG_FIF_STATUS, /* 0x16: FIF Attn Status */
553 MT2063_REG_LNA_OV, /* 0x17: LNA Attn Override */
554 MT2063_REG_RF_OV, /* 0x18: RF Attn Override */
555 MT2063_REG_FIF_OV, /* 0x19: FIF Attn Override */
556 MT2063_REG_LNA_TGT, /* 0x1A: Reserved */
557 MT2063_REG_PD1_TGT, /* 0x1B: Pwr Det 1 Target */
558 MT2063_REG_PD2_TGT, /* 0x1C: Pwr Det 2 Target */
559 MT2063_REG_RSVD_1D, /* 0x1D: Reserved */
560 MT2063_REG_RSVD_1E, /* 0x1E: Reserved */
561 MT2063_REG_RSVD_1F, /* 0x1F: Reserved */
562 MT2063_REG_RSVD_20, /* 0x20: Reserved */
563 MT2063_REG_BYP_CTRL, /* 0x21: Bypass Control */
564 MT2063_REG_RSVD_22, /* 0x22: Reserved */
565 MT2063_REG_RSVD_23, /* 0x23: Reserved */
566 MT2063_REG_RSVD_24, /* 0x24: Reserved */
567 MT2063_REG_RSVD_25, /* 0x25: Reserved */
568 MT2063_REG_RSVD_26, /* 0x26: Reserved */
569 MT2063_REG_RSVD_27, /* 0x27: Reserved */
570 MT2063_REG_FIFF_CTRL, /* 0x28: FIFF Control */
571 MT2063_REG_FIFF_OFFSET, /* 0x29: FIFF Offset */
572 MT2063_REG_CTUNE_CTRL, /* 0x2A: Reserved */
573 MT2063_REG_CTUNE_OV, /* 0x2B: Reserved */
574 MT2063_REG_CTRL_2C, /* 0x2C: Reserved */
575 MT2063_REG_FIFF_CTRL2, /* 0x2D: Fiff Control */
576 MT2063_REG_RSVD_2E, /* 0x2E: Reserved */
577 MT2063_REG_DNC_GAIN, /* 0x2F: DNC Control */
578 MT2063_REG_VGA_GAIN, /* 0x30: VGA Gain Ctrl */
579 MT2063_REG_RSVD_31, /* 0x31: Reserved */
580 MT2063_REG_TEMP_SEL, /* 0x32: Temperature Selection */
581 MT2063_REG_RSVD_33, /* 0x33: Reserved */
582 MT2063_REG_RSVD_34, /* 0x34: Reserved */
583 MT2063_REG_RSVD_35, /* 0x35: Reserved */
584 MT2063_REG_RSVD_36, /* 0x36: Reserved */
585 MT2063_REG_RSVD_37, /* 0x37: Reserved */
586 MT2063_REG_RSVD_38, /* 0x38: Reserved */
587 MT2063_REG_RSVD_39, /* 0x39: Reserved */
588 MT2063_REG_RSVD_3A, /* 0x3A: Reserved */
589 MT2063_REG_RSVD_3B, /* 0x3B: Reserved */
590 MT2063_REG_RSVD_3C, /* 0x3C: Reserved */
591 MT2063_REG_END_REGS
592};
593
594struct MT2063_Info_t
595{
596 Handle_t handle;
597 Handle_t hUserData;
598 UData_t address;
599 UData_t version;
600 UData_t tuner_id;
601 struct MT2063_AvoidSpursData_t AS_Data;
602 UData_t f_IF1_actual;
603 UData_t rcvr_mode;
604 UData_t ctfilt_sw;
605 UData_t CTFiltMax[31];
606 UData_t num_regs;
607 U8Data reg[MT2063_REG_END_REGS];
608} ;
609typedef struct MT2063_Info_t* pMT2063_Info_t;
610
611enum MTTune_atv_standard{
612 MTTUNEA_UNKNOWN = 0,
613 MTTUNEA_PAL_B,
614 MTTUNEA_PAL_G,
615 MTTUNEA_PAL_I,
616 MTTUNEA_PAL_L,
617 MTTUNEA_PAL_MN,
618 MTTUNEA_PAL_DK,
619 MTTUNEA_DIGITAL,
620 MTTUNEA_FMRADIO,
621 MTTUNEA_DVBC,
622 MTTUNEA_DVBT
623};
624
625/* ====== Functions which are declared in MT2063.c File ======= */
626
627UData_t MT2063_Open(UData_t MT2063_Addr,
628 Handle_t* hMT2063,
629 Handle_t hUserData);
630
631
632UData_t MT2063_Close(Handle_t hMT2063);
633
634UData_t MT2063_Tune(Handle_t h,
635 UData_t f_in); /* RF input center frequency */
636
637UData_t MT2063_GetGPIO(Handle_t h, enum MT2063_GPIO_ID gpio_id, enum MT2063_GPIO_Attr attr, UData_t* value);
638
639
640UData_t MT2063_GetLocked(Handle_t h);
641
642
643UData_t MT2063_GetParam(Handle_t h,
644 enum MT2063_Param param,
645 UData_t* pValue);
646
647
648UData_t MT2063_GetReg(Handle_t h,
649 U8Data reg,
650 U8Data* val);
651
652
653UData_t MT2063_GetTemp(Handle_t h, enum MT2063_Temperature* value);
654
655
656UData_t MT2063_GetUserData(Handle_t h,
657 Handle_t* hUserData);
658
659UData_t MT2063_ReInit(Handle_t h);
660
661
662UData_t MT2063_SetGPIO(Handle_t h, enum MT2063_GPIO_ID gpio_id, enum MT2063_GPIO_Attr attr, UData_t value);
663
664UData_t MT2063_SetParam(Handle_t h,
665 enum MT2063_Param param,
666 UData_t nValue);
667
668
669UData_t MT2063_SetPowerMaskBits(Handle_t h, enum MT2063_Mask_Bits Bits);
670
671UData_t MT2063_ClearPowerMaskBits(Handle_t h, enum MT2063_Mask_Bits Bits);
672
673UData_t MT2063_GetPowerMaskBits(Handle_t h, enum MT2063_Mask_Bits *Bits);
674
675UData_t MT2063_EnableExternalShutdown(Handle_t h, U8Data Enabled);
676
677UData_t MT2063_SoftwareShutdown(Handle_t h, U8Data Shutdown);
678
679UData_t MT2063_SetExtSRO(Handle_t h, enum MT2063_Ext_SRO Ext_SRO_Setting);
680
681UData_t MT2063_SetReg(Handle_t h,
682 U8Data reg,
683 U8Data val);
684
685UData_t MT_Tune_atv(Handle_t h, UData_t f_in,UData_t bw_in, enum MTTune_atv_standard tv_type);
686
687
688
689struct mt2063_config {
690 u8 tuner_address;
691 u32 refclock;
692};
693
694struct mt2063_state {
695 struct i2c_adapter *i2c;
696
697 const struct mt2063_config *config;
698 struct dvb_tuner_ops ops;
699 struct dvb_frontend *frontend;
700 struct tuner_state status;
701 const struct MT2063_Info_t *MT2063_ht;
702 enum Bool_t MT2063_init;
703
704 enum MTTune_atv_standard tv_type;
705 u32 frequency;
706 u32 srate;
707 u32 bandwidth;
708 u32 reference;
709};
710
711#if defined(CONFIG_DVB_MT2063) || (defined(CONFIG_DVB_MT2063_MODULE) && defined(MODULE))
712
713extern struct dvb_frontend *mt2063_attach(struct dvb_frontend *fe,
714 struct mt2063_config *config,
715 struct i2c_adapter *i2c);
716
717#else
718
719static inline struct dvb_frontend *mt2063_attach(struct dvb_frontend *fe,
720 struct mt2063_config *config,
721 struct i2c_adapter *i2c)
722{
723 printk(KERN_WARNING "%s: Driver disabled by Kconfig\n", __func__);
724 return NULL;
725}
726
727#endif //CONFIG_DVB_MT2063
728
729#endif //__MT2063_H__