1 | #ifndef __FI1236_H__
|
---|
2 | #define __FI1236_H__
|
---|
3 |
|
---|
4 | #include "xf86i2c.h"
|
---|
5 |
|
---|
6 | /* why someone has defined NUM someplace else is beyoung me.. */
|
---|
7 | #undef NUM
|
---|
8 |
|
---|
9 | typedef struct {
|
---|
10 | CARD32 fcar; /* 16 * fcar_Mhz */
|
---|
11 | CARD32 min_freq; /* 16 * min_freq_Mhz */
|
---|
12 | CARD32 max_freq; /* 16 * max_freq_Mhz */
|
---|
13 |
|
---|
14 | CARD32 threshold1; /* 16 * Value_Mhz */
|
---|
15 | CARD32 threshold2; /* 16 * Value_Mhz */
|
---|
16 |
|
---|
17 | CARD8 band_low;
|
---|
18 | CARD8 band_mid;
|
---|
19 | CARD8 band_high;
|
---|
20 | CARD8 control;
|
---|
21 | } FI1236_parameters;
|
---|
22 |
|
---|
23 |
|
---|
24 | typedef struct {
|
---|
25 | /* what we want */
|
---|
26 | /* all frequencies are in Mhz */
|
---|
27 | double f_rf; /* frequency to tune to */
|
---|
28 | double f_if1; /* first intermediate frequency */
|
---|
29 | double f_if2; /* second intermediate frequency */
|
---|
30 | double f_ref; /* reference frequency */
|
---|
31 | double f_ifbw; /* bandwidth */
|
---|
32 | double f_step; /* step */
|
---|
33 |
|
---|
34 | /* what we compute */
|
---|
35 | double f_lo1;
|
---|
36 | double f_lo2;
|
---|
37 | int LO1I;
|
---|
38 | int LO2I;
|
---|
39 | int SEL;
|
---|
40 | int STEP;
|
---|
41 | int NUM;
|
---|
42 | } MT2032_parameters;
|
---|
43 |
|
---|
44 | typedef struct {
|
---|
45 | I2CDevRec d;
|
---|
46 | int type;
|
---|
47 |
|
---|
48 | void* afc_source; /* The AFC source may be another chip like TDA988x */
|
---|
49 |
|
---|
50 | int afc_delta;
|
---|
51 | CARD32 original_frequency;
|
---|
52 | Bool afc_timer_installed;
|
---|
53 | int afc_count;
|
---|
54 | int last_afc_hint;
|
---|
55 |
|
---|
56 | double video_if;
|
---|
57 | FI1236_parameters parm;
|
---|
58 | int xogc; /* for MT2032 */
|
---|
59 |
|
---|
60 | struct {
|
---|
61 | CARD8 div1;
|
---|
62 | CARD8 div2;
|
---|
63 | CARD8 control;
|
---|
64 | CARD8 band;
|
---|
65 | CARD8 aux; /* this is for MK3 tuners */
|
---|
66 | } tuner_data;
|
---|
67 | } FI1236Rec, *FI1236Ptr;
|
---|
68 |
|
---|
69 | #define TUNER_TYPE_FI1236 0
|
---|
70 | #define TUNER_TYPE_FI1216 1
|
---|
71 | #define TUNER_TYPE_TEMIC_FN5AL 2
|
---|
72 | #define TUNER_TYPE_MT2032 3
|
---|
73 | #define TUNER_TYPE_FI1246 4
|
---|
74 | #define TUNER_TYPE_FI1256 5
|
---|
75 | #define TUNER_TYPE_FI1236W 6
|
---|
76 | #define TUNER_TYPE_FM1216ME 7
|
---|
77 |
|
---|
78 | #define FI1236_ADDR(a) ((a)->d.SlaveAddr)
|
---|
79 |
|
---|
80 | #define FI1236_ADDR_1 0xC6
|
---|
81 | #define FI1236_ADDR_2 0xC0
|
---|
82 |
|
---|
83 | #define TUNER_TUNED 0
|
---|
84 | #define TUNER_JUST_BELOW 1
|
---|
85 | #define TUNER_JUST_ABOVE -1
|
---|
86 | #define TUNER_OFF 4
|
---|
87 | #define TUNER_STILL_TUNING 5
|
---|
88 |
|
---|
89 |
|
---|
90 | FI1236Ptr Detect_FI1236(I2CBusPtr b, I2CSlaveAddr addr);
|
---|
91 | void FI1236_set_tuner_type(FI1236Ptr f, int type);
|
---|
92 | void TUNER_set_frequency(FI1236Ptr f, CARD32 frequency);
|
---|
93 | void FI1236_tune(FI1236Ptr f, CARD32 frequency);
|
---|
94 | int FI1236_AFC(FI1236Ptr f);
|
---|
95 | int TUNER_get_afc_hint(FI1236Ptr f);
|
---|
96 | void fi1236_dump_status(FI1236Ptr f);
|
---|
97 |
|
---|
98 | #define FI1236SymbolsList \
|
---|
99 | "Detect_FI1236", \
|
---|
100 | "FI1236_set_tuner_type", \
|
---|
101 | "TUNER_set_frequency"
|
---|
102 |
|
---|
103 | #define xf86_Detect_FI1236 ((FI1236Ptr (*)(I2CBusPtr, I2CSlaveAddr))LoaderSymbol("Detect_FI1236"))
|
---|
104 | #define xf86_FI1236_set_tuner_type ((void (*)(FI1236Ptr, int))LoaderSymbol("FI1236_set_tuner_type"))
|
---|
105 | #define xf86_TUNER_set_frequency ((void (*)(FI1236Ptr, CARD32))LoaderSymbol("TUNER_set_frequency"))
|
---|
106 | #define xf86_FI1236_AFC ((int (*)(FI1236Ptr))LoaderSymbol("FI1236_AFC"))
|
---|
107 | #define xf86_TUNER_get_afc_hint ((int (*)(FI1236Ptr))LoaderSymbol("TUNER_get_afc_hint"))
|
---|
108 | #define xf86_fi1236_dump_status ((void (*)(FI1236Ptr))LoaderSymbol("fi1236_dump_status"))
|
---|
109 |
|
---|
110 | #endif
|
---|