diff options
author | Igor M. Liplianin <liplianin@netup.ru> | 2009-03-03 09:41:39 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:43:04 -0400 |
commit | db7a4843dbd10db48752ded4dba81dfb9f580861 (patch) | |
tree | 518c002d8f85ff32cfa80bf45fd23f3dc2daad8e | |
parent | e2bc99bac5415d4e6d252322c408b5008b0f3485 (diff) |
V4L/DVB (10802): Add more headers for ST STV0900 dual demodulator.
Signed-off-by: Igor M. Liplianin <liplianin@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/dvb/frontends/stv0900_init.h | 439 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/stv0900_priv.h | 430 |
2 files changed, 869 insertions, 0 deletions
diff --git a/drivers/media/dvb/frontends/stv0900_init.h b/drivers/media/dvb/frontends/stv0900_init.h new file mode 100644 index 000000000000..fa8dbe197bd6 --- /dev/null +++ b/drivers/media/dvb/frontends/stv0900_init.h | |||
@@ -0,0 +1,439 @@ | |||
1 | /* | ||
2 | * stv0900_init.h | ||
3 | * | ||
4 | * Driver for ST STV0900 satellite demodulator IC. | ||
5 | * | ||
6 | * Copyright (C) ST Microelectronics. | ||
7 | * Copyright (C) 2009 NetUP Inc. | ||
8 | * Copyright (C) 2009 Igor M. Liplianin <liplianin@netup.ru> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program; if not, write to the Free Software | ||
23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
24 | */ | ||
25 | |||
26 | #ifndef STV0900_INIT_H | ||
27 | #define STV0900_INIT_H | ||
28 | |||
29 | #include "stv0900_priv.h" | ||
30 | |||
31 | /* DVBS2 C/N Look-Up table */ | ||
32 | static const struct stv0900_table stv0900_s2_cn = { | ||
33 | 55, | ||
34 | { | ||
35 | { -30, 13348 }, /*C/N=-3dB*/ | ||
36 | { -20, 12640 }, /*C/N=-2dB*/ | ||
37 | { -10, 11883 }, /*C/N=-1dB*/ | ||
38 | { 0, 11101 }, /*C/N=-0dB*/ | ||
39 | { 5, 10718 }, /*C/N=0.5dB*/ | ||
40 | { 10, 10339 }, /*C/N=1.0dB*/ | ||
41 | { 15, 9947 }, /*C/N=1.5dB*/ | ||
42 | { 20, 9552 }, /*C/N=2.0dB*/ | ||
43 | { 25, 9183 }, /*C/N=2.5dB*/ | ||
44 | { 30, 8799 }, /*C/N=3.0dB*/ | ||
45 | { 35, 8422 }, /*C/N=3.5dB*/ | ||
46 | { 40, 8062 }, /*C/N=4.0dB*/ | ||
47 | { 45, 7707 }, /*C/N=4.5dB*/ | ||
48 | { 50, 7353 }, /*C/N=5.0dB*/ | ||
49 | { 55, 7025 }, /*C/N=5.5dB*/ | ||
50 | { 60, 6684 }, /*C/N=6.0dB*/ | ||
51 | { 65, 6331 }, /*C/N=6.5dB*/ | ||
52 | { 70, 6036 }, /*C/N=7.0dB*/ | ||
53 | { 75, 5727 }, /*C/N=7.5dB*/ | ||
54 | { 80, 5437 }, /*C/N=8.0dB*/ | ||
55 | { 85, 5164 }, /*C/N=8.5dB*/ | ||
56 | { 90, 4902 }, /*C/N=9.0dB*/ | ||
57 | { 95, 4653 }, /*C/N=9.5dB*/ | ||
58 | { 100, 4408 }, /*C/N=10.0dB*/ | ||
59 | { 105, 4187 }, /*C/N=10.5dB*/ | ||
60 | { 110, 3961 }, /*C/N=11.0dB*/ | ||
61 | { 115, 3751 }, /*C/N=11.5dB*/ | ||
62 | { 120, 3558 }, /*C/N=12.0dB*/ | ||
63 | { 125, 3368 }, /*C/N=12.5dB*/ | ||
64 | { 130, 3191 }, /*C/N=13.0dB*/ | ||
65 | { 135, 3017 }, /*C/N=13.5dB*/ | ||
66 | { 140, 2862 }, /*C/N=14.0dB*/ | ||
67 | { 145, 2710 }, /*C/N=14.5dB*/ | ||
68 | { 150, 2565 }, /*C/N=15.0dB*/ | ||
69 | { 160, 2300 }, /*C/N=16.0dB*/ | ||
70 | { 170, 2058 }, /*C/N=17.0dB*/ | ||
71 | { 180, 1849 }, /*C/N=18.0dB*/ | ||
72 | { 190, 1663 }, /*C/N=19.0dB*/ | ||
73 | { 200, 1495 }, /*C/N=20.0dB*/ | ||
74 | { 210, 1349 }, /*C/N=21.0dB*/ | ||
75 | { 220, 1222 }, /*C/N=22.0dB*/ | ||
76 | { 230, 1110 }, /*C/N=23.0dB*/ | ||
77 | { 240, 1011 }, /*C/N=24.0dB*/ | ||
78 | { 250, 925 }, /*C/N=25.0dB*/ | ||
79 | { 260, 853 }, /*C/N=26.0dB*/ | ||
80 | { 270, 789 }, /*C/N=27.0dB*/ | ||
81 | { 280, 734 }, /*C/N=28.0dB*/ | ||
82 | { 290, 690 }, /*C/N=29.0dB*/ | ||
83 | { 300, 650 }, /*C/N=30.0dB*/ | ||
84 | { 310, 619 }, /*C/N=31.0dB*/ | ||
85 | { 320, 593 }, /*C/N=32.0dB*/ | ||
86 | { 330, 571 }, /*C/N=33.0dB*/ | ||
87 | { 400, 498 }, /*C/N=40.0dB*/ | ||
88 | { 450, 484 }, /*C/N=45.0dB*/ | ||
89 | { 500, 481 } /*C/N=50.0dB*/ | ||
90 | } | ||
91 | }; | ||
92 | |||
93 | /* RF level C/N Look-Up table */ | ||
94 | static const struct stv0900_table stv0900_rf = { | ||
95 | 14, | ||
96 | { | ||
97 | { -5, 0xCAA1 }, /*-5dBm*/ | ||
98 | { -10, 0xC229 }, /*-10dBm*/ | ||
99 | { -15, 0xBB08 }, /*-15dBm*/ | ||
100 | { -20, 0xB4BC }, /*-20dBm*/ | ||
101 | { -25, 0xAD5A }, /*-25dBm*/ | ||
102 | { -30, 0xA298 }, /*-30dBm*/ | ||
103 | { -35, 0x98A8 }, /*-35dBm*/ | ||
104 | { -40, 0x8389 }, /*-40dBm*/ | ||
105 | { -45, 0x59BE }, /*-45dBm*/ | ||
106 | { -50, 0x3A14 }, /*-50dBm*/ | ||
107 | { -55, 0x2D11 }, /*-55dBm*/ | ||
108 | { -60, 0x210D }, /*-60dBm*/ | ||
109 | { -65, 0xA14F }, /*-65dBm*/ | ||
110 | { -70, 0x7AA } /*-70dBm*/ | ||
111 | } | ||
112 | }; | ||
113 | |||
114 | struct stv0900_car_loop_optim { | ||
115 | enum fe_stv0900_modcode modcode; | ||
116 | u8 car_loop_pilots_on_2; | ||
117 | u8 car_loop_pilots_off_2; | ||
118 | u8 car_loop_pilots_on_5; | ||
119 | u8 car_loop_pilots_off_5; | ||
120 | u8 car_loop_pilots_on_10; | ||
121 | u8 car_loop_pilots_off_10; | ||
122 | u8 car_loop_pilots_on_20; | ||
123 | u8 car_loop_pilots_off_20; | ||
124 | u8 car_loop_pilots_on_30; | ||
125 | u8 car_loop_pilots_off_30; | ||
126 | |||
127 | }; | ||
128 | |||
129 | struct stv0900_short_frames_car_loop_optim { | ||
130 | enum fe_stv0900_modulation modulation; | ||
131 | u8 car_loop_cut12_2; /* Cut 1.2, SR<=3msps */ | ||
132 | u8 car_loop_cut20_2; /* Cut 2.0, SR<3msps */ | ||
133 | u8 car_loop_cut12_5; /* Cut 1.2, 3<SR<=7msps */ | ||
134 | u8 car_loop_cut20_5; /* Cut 2.0, 3<SR<=7msps */ | ||
135 | u8 car_loop_cut12_10; /* Cut 1.2, 7<SR<=15msps */ | ||
136 | u8 car_loop_cut20_10; /* Cut 2.0, 7<SR<=15msps */ | ||
137 | u8 car_loop_cut12_20; /* Cut 1.2, 10<SR<=25msps */ | ||
138 | u8 car_loop_cut20_20; /* Cut 2.0, 10<SR<=25msps */ | ||
139 | u8 car_loop_cut12_30; /* Cut 1.2, 25<SR<=45msps */ | ||
140 | u8 car_loop_cut20_30; /* Cut 2.0, 10<SR<=45msps */ | ||
141 | |||
142 | }; | ||
143 | |||
144 | /* Cut 1.x Tracking carrier loop carrier QPSK 1/2 to 8PSK 9/10 long Frame */ | ||
145 | static const struct stv0900_car_loop_optim FE_STV0900_S2CarLoop[14] = { | ||
146 | /*Modcod 2MPon 2MPoff 5MPon 5MPoff 10MPon 10MPoff 20MPon 20MPoff 30MPon 30MPoff */ | ||
147 | { STV0900_QPSK_12, 0x1C, 0x0D, 0x1B, 0x2C, 0x3A, 0x1C, 0x2A, 0x3B, 0x2A, 0x1B }, | ||
148 | { STV0900_QPSK_35, 0x2C, 0x0D, 0x2B, 0x2C, 0x3A, 0x0C, 0x3A, 0x2B, 0x2A, 0x0B }, | ||
149 | { STV0900_QPSK_23, 0x2C, 0x0D, 0x2B, 0x2C, 0x0B, 0x0C, 0x3A, 0x1B, 0x2A, 0x3A }, | ||
150 | { STV0900_QPSK_34, 0x3C, 0x0D, 0x3B, 0x1C, 0x0B, 0x3B, 0x3A, 0x0B, 0x2A, 0x3A }, | ||
151 | { STV0900_QPSK_45, 0x3C, 0x0D, 0x3B, 0x1C, 0x0B, 0x3B, 0x3A, 0x0B, 0x2A, 0x3A }, | ||
152 | { STV0900_QPSK_56, 0x0D, 0x0D, 0x3B, 0x1C, 0x0B, 0x3B, 0x3A, 0x0B, 0x2A, 0x3A }, | ||
153 | { STV0900_QPSK_89, 0x0D, 0x0D, 0x3B, 0x1C, 0x1B, 0x3B, 0x3A, 0x0B, 0x2A, 0x3A }, | ||
154 | { STV0900_QPSK_910, 0x1D, 0x0D, 0x3B, 0x1C, 0x1B, 0x3B, 0x3A, 0x0B, 0x2A, 0x3A }, | ||
155 | { STV0900_8PSK_35, 0x29, 0x3B, 0x09, 0x2B, 0x38, 0x0B, 0x18, 0x1A, 0x08, 0x0A }, | ||
156 | { STV0900_8PSK_23, 0x0A, 0x3B, 0x29, 0x2B, 0x19, 0x0B, 0x38, 0x1A, 0x18, 0x0A }, | ||
157 | { STV0900_8PSK_34, 0x3A, 0x3B, 0x2A, 0x2B, 0x39, 0x0B, 0x19, 0x1A, 0x38, 0x0A }, | ||
158 | { STV0900_8PSK_56, 0x1B, 0x3B, 0x0B, 0x2B, 0x1A, 0x0B, 0x39, 0x1A, 0x19, 0x0A }, | ||
159 | { STV0900_8PSK_89, 0x3B, 0x3B, 0x0B, 0x2B, 0x2A, 0x0B, 0x39, 0x1A, 0x29, 0x39 }, | ||
160 | { STV0900_8PSK_910, 0x3B, 0x3B, 0x0B, 0x2B, 0x2A, 0x0B, 0x39, 0x1A, 0x29, 0x39 } | ||
161 | }; | ||
162 | |||
163 | |||
164 | /* Cut 2.0 Tracking carrier loop carrier QPSK 1/2 to 8PSK 9/10 long Frame */ | ||
165 | static const struct stv0900_car_loop_optim FE_STV0900_S2CarLoopCut20[14] = { | ||
166 | /* Modcod 2MPon 2MPoff 5MPon 5MPoff 10MPon 10MPoff 20MPon 20MPoff 30MPon 30MPoff */ | ||
167 | { STV0900_QPSK_12, 0x1F, 0x3F, 0x1E, 0x3F, 0x3D, 0x1F, 0x3D, 0x3E, 0x3D, 0x1E }, | ||
168 | { STV0900_QPSK_35, 0x2F, 0x3F, 0x2E, 0x2F, 0x3D, 0x0F, 0x0E, 0x2E, 0x3D, 0x0E }, | ||
169 | { STV0900_QPSK_23, 0x2F, 0x3F, 0x2E, 0x2F, 0x0E, 0x0F, 0x0E, 0x1E, 0x3D, 0x3D }, | ||
170 | { STV0900_QPSK_34, 0x3F, 0x3F, 0x3E, 0x1F, 0x0E, 0x3E, 0x0E, 0x1E, 0x3D, 0x3D }, | ||
171 | { STV0900_QPSK_45, 0x3F, 0x3F, 0x3E, 0x1F, 0x0E, 0x3E, 0x0E, 0x1E, 0x3D, 0x3D }, | ||
172 | { STV0900_QPSK_56, 0x3F, 0x3F, 0x3E, 0x1F, 0x0E, 0x3E, 0x0E, 0x1E, 0x3D, 0x3D }, | ||
173 | { STV0900_QPSK_89, 0x3F, 0x3F, 0x3E, 0x1F, 0x1E, 0x3E, 0x0E, 0x1E, 0x3D, 0x3D }, | ||
174 | { STV0900_QPSK_910, 0x3F, 0x3F, 0x3E, 0x1F, 0x1E, 0x3E, 0x0E, 0x1E, 0x3D, 0x3D }, | ||
175 | { STV0900_8PSK_35, 0x3c, 0x0c, 0x1c, 0x3b, 0x0c, 0x3b, 0x2b, 0x2b, 0x1b, 0x2b }, | ||
176 | { STV0900_8PSK_23, 0x1d, 0x0c, 0x3c, 0x0c, 0x2c, 0x3b, 0x0c, 0x2b, 0x2b, 0x2b }, | ||
177 | { STV0900_8PSK_34, 0x0e, 0x1c, 0x3d, 0x0c, 0x0d, 0x3b, 0x2c, 0x3b, 0x0c, 0x2b }, | ||
178 | { STV0900_8PSK_56, 0x2e, 0x3e, 0x1e, 0x2e, 0x2d, 0x1e, 0x3c, 0x2d, 0x2c, 0x1d }, | ||
179 | { STV0900_8PSK_89, 0x3e, 0x3e, 0x1e, 0x2e, 0x3d, 0x1e, 0x0d, 0x2d, 0x3c, 0x1d }, | ||
180 | { STV0900_8PSK_910, 0x3e, 0x3e, 0x1e, 0x2e, 0x3d, 0x1e, 0x1d, 0x2d, 0x0d, 0x1d } | ||
181 | }; | ||
182 | |||
183 | |||
184 | |||
185 | /* Cut 2.0 Tracking carrier loop carrier 16APSK 2/3 to 32APSK 9/10 long Frame */ | ||
186 | static const struct stv0900_car_loop_optim FE_STV0900_S2APSKCarLoopCut20[11] = { | ||
187 | /* Modcod 2MPon 2MPoff 5MPon 5MPoff 10MPon 10MPoff 20MPon 20MPoff 30MPon 30MPoff */ | ||
188 | { STV0900_16APSK_23, 0x0C, 0x0C, 0x0C, 0x0C, 0x1D, 0x0C, 0x3C, 0x0C, 0x2C, 0x0C }, | ||
189 | { STV0900_16APSK_34, 0x0C, 0x0C, 0x0C, 0x0C, 0x0E, 0x0C, 0x2D, 0x0C, 0x1D, 0x0C }, | ||
190 | { STV0900_16APSK_45, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x0C, 0x3D, 0x0C, 0x2D, 0x0C }, | ||
191 | { STV0900_16APSK_56, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x0C, 0x3D, 0x0C, 0x2D, 0x0C }, | ||
192 | { STV0900_16APSK_89, 0x0C, 0x0C, 0x0C, 0x0C, 0x2E, 0x0C, 0x0E, 0x0C, 0x3D, 0x0C }, | ||
193 | { STV0900_16APSK_910, 0x0C, 0x0C, 0x0C, 0x0C, 0x2E, 0x0C, 0x0E, 0x0C, 0x3D, 0x0C }, | ||
194 | { STV0900_32APSK_34, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C }, | ||
195 | { STV0900_32APSK_45, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C }, | ||
196 | { STV0900_32APSK_56, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C }, | ||
197 | { STV0900_32APSK_89, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C }, | ||
198 | { STV0900_32APSK_910, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C } | ||
199 | }; | ||
200 | |||
201 | |||
202 | /* Cut 2.0 Tracking carrier loop carrier QPSK 1/4 to QPSK 2/5 long Frame */ | ||
203 | static const struct stv0900_car_loop_optim FE_STV0900_S2LowQPCarLoopCut20[3] = { | ||
204 | /* Modcod 2MPon 2MPoff 5MPon 5MPoff 10MPon 10MPoff 20MPon 20MPoff 30MPon 30MPoff */ | ||
205 | { STV0900_QPSK_14, 0x0F, 0x3F, 0x0E, 0x3F, 0x2D, 0x2F, 0x2D, 0x1F, 0x3D, 0x3E }, | ||
206 | { STV0900_QPSK_13, 0x0F, 0x3F, 0x0E, 0x3F, 0x2D, 0x2F, 0x3D, 0x0F, 0x3D, 0x2E }, | ||
207 | { STV0900_QPSK_25, 0x1F, 0x3F, 0x1E, 0x3F, 0x3D, 0x1F, 0x3D, 0x3E, 0x3D, 0x2E } | ||
208 | }; | ||
209 | |||
210 | |||
211 | /* Cut 2.0 Tracking carrier loop carrier short Frame, cut 1.2 and 2.0 */ | ||
212 | static const struct stv0900_short_frames_car_loop_optim FE_STV0900_S2ShortCarLoop[4] = { | ||
213 | /*Mod 2M_cut1.2 2M_cut2.0 5M_cut1.2 5M_cut2.0 10M_cut1.2 10M_cut2.0 20M_cut1.2 20M_cut2.0 30M_cut1.2 30M_cut2.0 */ | ||
214 | { STV0900_QPSK, 0x3C, 0x2F, 0x2B, 0x2E, 0x0B, 0x0E, 0x3A, 0x0E, 0x2A, 0x3D }, | ||
215 | { STV0900_8PSK, 0x0B, 0x3E, 0x2A, 0x0E, 0x0A, 0x2D, 0x19, 0x0D, 0x09, 0x3C }, | ||
216 | { STV0900_16APSK, 0x1B, 0x1E, 0x1B, 0x1E, 0x1B, 0x1E, 0x3A, 0x3D, 0x2A, 0x2D }, | ||
217 | { STV0900_32APSK, 0x1B, 0x1E, 0x1B, 0x1E, 0x1B, 0x1E, 0x3A, 0x3D, 0x2A, 0x2D } | ||
218 | }; | ||
219 | |||
220 | static const u16 STV0900_InitVal[180][2] = { | ||
221 | { R0900_OUTCFG , 0x00 }, | ||
222 | { R0900_MODECFG , 0xff }, | ||
223 | { R0900_AGCRF1CFG , 0x11 }, | ||
224 | { R0900_AGCRF2CFG , 0x13 }, | ||
225 | { R0900_TSGENERAL1X , 0x14 }, | ||
226 | { R0900_TSTTNR2 , 0x21 }, | ||
227 | { R0900_TSTTNR4 , 0x21 }, | ||
228 | { R0900_P2_DISTXCTL , 0x22 }, | ||
229 | { R0900_P2_F22TX , 0xc0 }, | ||
230 | { R0900_P2_F22RX , 0xc0 }, | ||
231 | { R0900_P2_DISRXCTL , 0x00 }, | ||
232 | { R0900_P2_TNRSTEPS , 0x87 }, | ||
233 | { R0900_P2_TNRGAIN , 0x09 }, | ||
234 | { R0900_P2_DMDCFGMD , 0xF9 }, | ||
235 | { R0900_P2_DEMOD , 0x08 }, | ||
236 | { R0900_P2_DMDCFG3 , 0xc4 }, | ||
237 | { R0900_P2_CARFREQ , 0xed }, | ||
238 | { R0900_P2_TNRCFG2 , 0x02 }, | ||
239 | { R0900_P2_TNRCFG3 , 0x02 }, | ||
240 | { R0900_P2_LDT , 0xd0 }, | ||
241 | { R0900_P2_LDT2 , 0xb8 }, | ||
242 | { R0900_P2_TMGCFG , 0xd2 }, | ||
243 | { R0900_P2_TMGTHRISE , 0x20 }, | ||
244 | { R0900_P2_TMGTHFALL , 0x00 }, | ||
245 | { R0900_P2_FECSPY , 0x88 }, | ||
246 | { R0900_P2_FSPYDATA , 0x3a }, | ||
247 | { R0900_P2_FBERCPT4 , 0x00 }, | ||
248 | { R0900_P2_FSPYBER , 0x10 }, | ||
249 | { R0900_P2_ERRCTRL1 , 0x35 }, | ||
250 | { R0900_P2_ERRCTRL2 , 0xc1 }, | ||
251 | { R0900_P2_CFRICFG , 0xf8 }, | ||
252 | { R0900_P2_NOSCFG , 0x1c }, | ||
253 | { R0900_P2_DMDT0M , 0x20 }, | ||
254 | { R0900_P2_CORRELMANT , 0x70 }, | ||
255 | { R0900_P2_CORRELABS , 0x88 }, | ||
256 | { R0900_P2_AGC2O , 0x5b }, | ||
257 | { R0900_P2_AGC2REF , 0x38 }, | ||
258 | { R0900_P2_CARCFG , 0xe4 }, | ||
259 | { R0900_P2_ACLC , 0x1A }, | ||
260 | { R0900_P2_BCLC , 0x09 }, | ||
261 | { R0900_P2_CARHDR , 0x08 }, | ||
262 | { R0900_P2_KREFTMG , 0xc1 }, | ||
263 | { R0900_P2_SFRUPRATIO , 0xf0 }, | ||
264 | { R0900_P2_SFRLOWRATIO , 0x70 }, | ||
265 | { R0900_P2_SFRSTEP , 0x58 }, | ||
266 | { R0900_P2_TMGCFG2 , 0x01 }, | ||
267 | { R0900_P2_CAR2CFG , 0x26 }, | ||
268 | { R0900_P2_BCLC2S2Q , 0x86 }, | ||
269 | { R0900_P2_BCLC2S28 , 0x86 }, | ||
270 | { R0900_P2_SMAPCOEF7 , 0x77 }, | ||
271 | { R0900_P2_SMAPCOEF6 , 0x85 }, | ||
272 | { R0900_P2_SMAPCOEF5 , 0x77 }, | ||
273 | { R0900_P2_TSCFGL , 0x20 }, | ||
274 | { R0900_P2_DMDCFG2 , 0x3b }, | ||
275 | { R0900_P2_MODCODLST0 , 0xff }, | ||
276 | { R0900_P2_MODCODLST1 , 0xff }, | ||
277 | { R0900_P2_MODCODLST2 , 0xff }, | ||
278 | { R0900_P2_MODCODLST3 , 0xff }, | ||
279 | { R0900_P2_MODCODLST4 , 0xff }, | ||
280 | { R0900_P2_MODCODLST5 , 0xff }, | ||
281 | { R0900_P2_MODCODLST6 , 0xff }, | ||
282 | { R0900_P2_MODCODLST7 , 0xcc }, | ||
283 | { R0900_P2_MODCODLST8 , 0xcc }, | ||
284 | { R0900_P2_MODCODLST9 , 0xcc }, | ||
285 | { R0900_P2_MODCODLSTA , 0xcc }, | ||
286 | { R0900_P2_MODCODLSTB , 0xcc }, | ||
287 | { R0900_P2_MODCODLSTC , 0xcc }, | ||
288 | { R0900_P2_MODCODLSTD , 0xcc }, | ||
289 | { R0900_P2_MODCODLSTE , 0xcc }, | ||
290 | { R0900_P2_MODCODLSTF , 0xcf }, | ||
291 | { R0900_P1_DISTXCTL , 0x22 }, | ||
292 | { R0900_P1_F22TX , 0xc0 }, | ||
293 | { R0900_P1_F22RX , 0xc0 }, | ||
294 | { R0900_P1_DISRXCTL , 0x00 }, | ||
295 | { R0900_P1_TNRSTEPS , 0x87 }, | ||
296 | { R0900_P1_TNRGAIN , 0x09 }, | ||
297 | { R0900_P1_DMDCFGMD , 0xf9 }, | ||
298 | { R0900_P1_DEMOD , 0x08 }, | ||
299 | { R0900_P1_DMDCFG3 , 0xc4 }, | ||
300 | { R0900_P1_DMDT0M , 0x20 }, | ||
301 | { R0900_P1_CARFREQ , 0xed }, | ||
302 | { R0900_P1_TNRCFG2 , 0x82 }, | ||
303 | { R0900_P1_TNRCFG3 , 0x02 }, | ||
304 | { R0900_P1_LDT , 0xd0 }, | ||
305 | { R0900_P1_LDT2 , 0xb8 }, | ||
306 | { R0900_P1_TMGCFG , 0xd2 }, | ||
307 | { R0900_P1_TMGTHRISE , 0x20 }, | ||
308 | { R0900_P1_TMGTHFALL , 0x00 }, | ||
309 | { R0900_P1_SFRUPRATIO , 0xf0 }, | ||
310 | { R0900_P1_SFRLOWRATIO , 0x70 }, | ||
311 | { R0900_P1_TSCFGL , 0x20 }, | ||
312 | { R0900_P1_FECSPY , 0x88 }, | ||
313 | { R0900_P1_FSPYDATA , 0x3a }, | ||
314 | { R0900_P1_FBERCPT4 , 0x00 }, | ||
315 | { R0900_P1_FSPYBER , 0x10 }, | ||
316 | { R0900_P1_ERRCTRL1 , 0x35 }, | ||
317 | { R0900_P1_ERRCTRL2 , 0xc1 }, | ||
318 | { R0900_P1_CFRICFG , 0xf8 }, | ||
319 | { R0900_P1_NOSCFG , 0x1c }, | ||
320 | { R0900_P1_CORRELMANT , 0x70 }, | ||
321 | { R0900_P1_CORRELABS , 0x88 }, | ||
322 | { R0900_P1_AGC2O , 0x5b }, | ||
323 | { R0900_P1_AGC2REF , 0x38 }, | ||
324 | { R0900_P1_CARCFG , 0xe4 }, | ||
325 | { R0900_P1_ACLC , 0x1A }, | ||
326 | { R0900_P1_BCLC , 0x09 }, | ||
327 | { R0900_P1_CARHDR , 0x08 }, | ||
328 | { R0900_P1_KREFTMG , 0xc1 }, | ||
329 | { R0900_P1_SFRSTEP , 0x58 }, | ||
330 | { R0900_P1_TMGCFG2 , 0x01 }, | ||
331 | { R0900_P1_CAR2CFG , 0x26 }, | ||
332 | { R0900_P1_BCLC2S2Q , 0x86 }, | ||
333 | { R0900_P1_BCLC2S28 , 0x86 }, | ||
334 | { R0900_P1_SMAPCOEF7 , 0x77 }, | ||
335 | { R0900_P1_SMAPCOEF6 , 0x85 }, | ||
336 | { R0900_P1_SMAPCOEF5 , 0x77 }, | ||
337 | { R0900_P1_DMDCFG2 , 0x3b }, | ||
338 | { R0900_P1_MODCODLST0 , 0xff }, | ||
339 | { R0900_P1_MODCODLST1 , 0xff }, | ||
340 | { R0900_P1_MODCODLST2 , 0xff }, | ||
341 | { R0900_P1_MODCODLST3 , 0xff }, | ||
342 | { R0900_P1_MODCODLST4 , 0xff }, | ||
343 | { R0900_P1_MODCODLST5 , 0xff }, | ||
344 | { R0900_P1_MODCODLST6 , 0xff }, | ||
345 | { R0900_P1_MODCODLST7 , 0xcc }, | ||
346 | { R0900_P1_MODCODLST8 , 0xcc }, | ||
347 | { R0900_P1_MODCODLST9 , 0xcc }, | ||
348 | { R0900_P1_MODCODLSTA , 0xcc }, | ||
349 | { R0900_P1_MODCODLSTB , 0xcc }, | ||
350 | { R0900_P1_MODCODLSTC , 0xcc }, | ||
351 | { R0900_P1_MODCODLSTD , 0xcc }, | ||
352 | { R0900_P1_MODCODLSTE , 0xcc }, | ||
353 | { R0900_P1_MODCODLSTF , 0xcf }, | ||
354 | { R0900_GENCFG , 0x1d }, | ||
355 | { R0900_NBITER_NF4 , 0x37 }, | ||
356 | { R0900_NBITER_NF5 , 0x29 }, | ||
357 | { R0900_NBITER_NF6 , 0x37 }, | ||
358 | { R0900_NBITER_NF7 , 0x33 }, | ||
359 | { R0900_NBITER_NF8 , 0x31 }, | ||
360 | { R0900_NBITER_NF9 , 0x2f }, | ||
361 | { R0900_NBITER_NF10 , 0x39 }, | ||
362 | { R0900_NBITER_NF11 , 0x3a }, | ||
363 | { R0900_NBITER_NF12 , 0x29 }, | ||
364 | { R0900_NBITER_NF13 , 0x37 }, | ||
365 | { R0900_NBITER_NF14 , 0x33 }, | ||
366 | { R0900_NBITER_NF15 , 0x2f }, | ||
367 | { R0900_NBITER_NF16 , 0x39 }, | ||
368 | { R0900_NBITER_NF17 , 0x3a }, | ||
369 | { R0900_NBITERNOERR , 0x04 }, | ||
370 | { R0900_GAINLLR_NF4 , 0x0C }, | ||
371 | { R0900_GAINLLR_NF5 , 0x0F }, | ||
372 | { R0900_GAINLLR_NF6 , 0x11 }, | ||
373 | { R0900_GAINLLR_NF7 , 0x14 }, | ||
374 | { R0900_GAINLLR_NF8 , 0x17 }, | ||
375 | { R0900_GAINLLR_NF9 , 0x19 }, | ||
376 | { R0900_GAINLLR_NF10 , 0x20 }, | ||
377 | { R0900_GAINLLR_NF11 , 0x21 }, | ||
378 | { R0900_GAINLLR_NF12 , 0x0D }, | ||
379 | { R0900_GAINLLR_NF13 , 0x0F }, | ||
380 | { R0900_GAINLLR_NF14 , 0x13 }, | ||
381 | { R0900_GAINLLR_NF15 , 0x1A }, | ||
382 | { R0900_GAINLLR_NF16 , 0x1F }, | ||
383 | { R0900_GAINLLR_NF17 , 0x21 }, | ||
384 | { R0900_RCCFGH , 0x20 }, | ||
385 | { R0900_P1_FECM , 0x01 }, /*disable DSS modes*/ | ||
386 | { R0900_P2_FECM , 0x01 }, /*disable DSS modes*/ | ||
387 | { R0900_P1_PRVIT , 0x2F }, /*disable puncture rate 6/7*/ | ||
388 | { R0900_P2_PRVIT , 0x2F }, /*disable puncture rate 6/7*/ | ||
389 | { R0900_STROUT1CFG , 0x4c }, | ||
390 | { R0900_STROUT2CFG , 0x4c }, | ||
391 | { R0900_CLKOUT1CFG , 0x50 }, | ||
392 | { R0900_CLKOUT2CFG , 0x50 }, | ||
393 | { R0900_DPN1CFG , 0x4a }, | ||
394 | { R0900_DPN2CFG , 0x4a }, | ||
395 | { R0900_DATA71CFG , 0x52 }, | ||
396 | { R0900_DATA72CFG , 0x52 }, | ||
397 | { R0900_P1_TSCFGM , 0xc0 }, | ||
398 | { R0900_P2_TSCFGM , 0xc0 }, | ||
399 | { R0900_P1_TSSPEED , 0x40 }, | ||
400 | { R0900_P2_TSSPEED , 0x40 }, | ||
401 | }; | ||
402 | |||
403 | static const u16 STV0900_Cut20_AddOnVal[32][2] = { | ||
404 | { R0900_P2_DMDCFG3 , 0xe8 }, | ||
405 | { R0900_P2_DMDCFG4 , 0x10 }, | ||
406 | { R0900_P2_CARFREQ , 0x38 }, | ||
407 | { R0900_P2_CARHDR , 0x20 }, | ||
408 | { R0900_P2_KREFTMG , 0x5a }, | ||
409 | { R0900_P2_SMAPCOEF7 , 0x06 }, | ||
410 | { R0900_P2_SMAPCOEF6 , 0x00 }, | ||
411 | { R0900_P2_SMAPCOEF5 , 0x04 }, | ||
412 | { R0900_P2_NOSCFG , 0x0c }, | ||
413 | { R0900_P1_DMDCFG3 , 0xe8 }, | ||
414 | { R0900_P1_DMDCFG4 , 0x10 }, | ||
415 | { R0900_P1_CARFREQ , 0x38 }, | ||
416 | { R0900_P1_CARHDR , 0x20 }, | ||
417 | { R0900_P1_KREFTMG , 0x5a }, | ||
418 | { R0900_P1_SMAPCOEF7 , 0x06 }, | ||
419 | { R0900_P1_SMAPCOEF6 , 0x00 }, | ||
420 | { R0900_P1_SMAPCOEF5 , 0x04 }, | ||
421 | { R0900_P1_NOSCFG , 0x0c }, | ||
422 | { R0900_GAINLLR_NF4 , 0x21 }, | ||
423 | { R0900_GAINLLR_NF5 , 0x21 }, | ||
424 | { R0900_GAINLLR_NF6 , 0x20 }, | ||
425 | { R0900_GAINLLR_NF7 , 0x1F }, | ||
426 | { R0900_GAINLLR_NF8 , 0x1E }, | ||
427 | { R0900_GAINLLR_NF9 , 0x1E }, | ||
428 | { R0900_GAINLLR_NF10 , 0x1D }, | ||
429 | { R0900_GAINLLR_NF11 , 0x1B }, | ||
430 | { R0900_GAINLLR_NF12 , 0x20 }, | ||
431 | { R0900_GAINLLR_NF13 , 0x20 }, | ||
432 | { R0900_GAINLLR_NF14 , 0x20 }, | ||
433 | { R0900_GAINLLR_NF15 , 0x20 }, | ||
434 | { R0900_GAINLLR_NF16 , 0x20 }, | ||
435 | { R0900_GAINLLR_NF17 , 0x21 } | ||
436 | |||
437 | }; | ||
438 | |||
439 | #endif | ||
diff --git a/drivers/media/dvb/frontends/stv0900_priv.h b/drivers/media/dvb/frontends/stv0900_priv.h new file mode 100644 index 000000000000..28350fbeb08d --- /dev/null +++ b/drivers/media/dvb/frontends/stv0900_priv.h | |||
@@ -0,0 +1,430 @@ | |||
1 | /* | ||
2 | * stv0900_priv.h | ||
3 | * | ||
4 | * Driver for ST STV0900 satellite demodulator IC. | ||
5 | * | ||
6 | * Copyright (C) ST Microelectronics. | ||
7 | * Copyright (C) 2009 NetUP Inc. | ||
8 | * Copyright (C) 2009 Igor M. Liplianin <liplianin@netup.ru> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program; if not, write to the Free Software | ||
23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
24 | */ | ||
25 | |||
26 | #ifndef STV0900_PRIV_H | ||
27 | #define STV0900_PRIV_H | ||
28 | |||
29 | #include <linux/i2c.h> | ||
30 | |||
31 | #define ABS(X) ((X) < 0 ? (-1 * (X)) : (X)) | ||
32 | #define INRANGE(X, Y, Z) ((((X) <= (Y)) && ((Y) <= (Z))) \ | ||
33 | || (((Z) <= (Y)) && ((Y) <= (X))) ? 1 : 0) | ||
34 | |||
35 | #ifndef MAKEWORD | ||
36 | #define MAKEWORD(X, Y) (((X) << 8) + (Y)) | ||
37 | #endif | ||
38 | |||
39 | #define LSB(X) (((X) & 0xFF)) | ||
40 | #define MSB(Y) (((Y) >> 8) & 0xFF) | ||
41 | |||
42 | #ifndef TRUE | ||
43 | #define TRUE (1 == 1) | ||
44 | #endif | ||
45 | #ifndef FALSE | ||
46 | #define FALSE (!TRUE) | ||
47 | #endif | ||
48 | |||
49 | #define dmd_reg(a, b, c) \ | ||
50 | do { \ | ||
51 | a = 0; \ | ||
52 | switch (demod) { \ | ||
53 | case STV0900_DEMOD_1: \ | ||
54 | default: \ | ||
55 | a = b; \ | ||
56 | break; \ | ||
57 | case STV0900_DEMOD_2: \ | ||
58 | a = c; \ | ||
59 | break; \ | ||
60 | } \ | ||
61 | } while (0) | ||
62 | |||
63 | #define dmd_choose(a, b) (demod = STV0900_DEMOD_2 ? b : a)) | ||
64 | |||
65 | extern int debug; | ||
66 | |||
67 | #define dprintk(args...) \ | ||
68 | do { \ | ||
69 | if (debug) \ | ||
70 | printk(KERN_DEBUG args); \ | ||
71 | } while (0) | ||
72 | |||
73 | #define STV0900_MAXLOOKUPSIZE 500 | ||
74 | #define STV0900_BLIND_SEARCH_AGC2_TH 700 | ||
75 | |||
76 | /* One point of the lookup table */ | ||
77 | struct stv000_lookpoint { | ||
78 | s32 realval;/* real value */ | ||
79 | s32 regval;/* binary value */ | ||
80 | }; | ||
81 | |||
82 | /* Lookup table definition */ | ||
83 | struct stv0900_table{ | ||
84 | s32 size;/* Size of the lookup table */ | ||
85 | struct stv000_lookpoint table[STV0900_MAXLOOKUPSIZE];/* Lookup table */ | ||
86 | }; | ||
87 | |||
88 | enum fe_stv0900_error { | ||
89 | STV0900_NO_ERROR = 0, | ||
90 | STV0900_INVALID_HANDLE, | ||
91 | STV0900_BAD_PARAMETER, | ||
92 | STV0900_I2C_ERROR, | ||
93 | STV0900_SEARCH_FAILED, | ||
94 | }; | ||
95 | |||
96 | enum fe_stv0900_clock_type { | ||
97 | STV0900_USE_REGISTERS_DEFAULT, | ||
98 | STV0900_SERIAL_PUNCT_CLOCK,/*Serial punctured clock */ | ||
99 | STV0900_SERIAL_CONT_CLOCK,/*Serial continues clock */ | ||
100 | STV0900_PARALLEL_PUNCT_CLOCK,/*Parallel punctured clock */ | ||
101 | STV0900_DVBCI_CLOCK/*Parallel continues clock : DVBCI */ | ||
102 | }; | ||
103 | |||
104 | enum fe_stv0900_search_state { | ||
105 | STV0900_SEARCH = 0, | ||
106 | STV0900_PLH_DETECTED, | ||
107 | STV0900_DVBS2_FOUND, | ||
108 | STV0900_DVBS_FOUND | ||
109 | |||
110 | }; | ||
111 | |||
112 | enum fe_stv0900_ldpc_state { | ||
113 | STV0900_PATH1_OFF_PATH2_OFF = 0, | ||
114 | STV0900_PATH1_ON_PATH2_OFF = 1, | ||
115 | STV0900_PATH1_OFF_PATH2_ON = 2, | ||
116 | STV0900_PATH1_ON_PATH2_ON = 3 | ||
117 | }; | ||
118 | |||
119 | enum fe_stv0900_signal_type { | ||
120 | STV0900_NOAGC1 = 0, | ||
121 | STV0900_AGC1OK, | ||
122 | STV0900_NOTIMING, | ||
123 | STV0900_ANALOGCARRIER, | ||
124 | STV0900_TIMINGOK, | ||
125 | STV0900_NOAGC2, | ||
126 | STV0900_AGC2OK, | ||
127 | STV0900_NOCARRIER, | ||
128 | STV0900_CARRIEROK, | ||
129 | STV0900_NODATA, | ||
130 | STV0900_DATAOK, | ||
131 | STV0900_OUTOFRANGE, | ||
132 | STV0900_RANGEOK | ||
133 | }; | ||
134 | |||
135 | enum fe_stv0900_demod_num { | ||
136 | STV0900_DEMOD_1, | ||
137 | STV0900_DEMOD_2 | ||
138 | }; | ||
139 | |||
140 | enum fe_stv0900_tracking_standard { | ||
141 | STV0900_DVBS1_STANDARD,/* Found Standard*/ | ||
142 | STV0900_DVBS2_STANDARD, | ||
143 | STV0900_DSS_STANDARD, | ||
144 | STV0900_TURBOCODE_STANDARD, | ||
145 | STV0900_UNKNOWN_STANDARD | ||
146 | }; | ||
147 | |||
148 | enum fe_stv0900_search_standard { | ||
149 | STV0900_AUTO_SEARCH, | ||
150 | STV0900_SEARCH_DVBS1,/* Search Standard*/ | ||
151 | STV0900_SEARCH_DVBS2, | ||
152 | STV0900_SEARCH_DSS, | ||
153 | STV0900_SEARCH_TURBOCODE | ||
154 | }; | ||
155 | |||
156 | enum fe_stv0900_search_algo { | ||
157 | STV0900_BLIND_SEARCH,/* offset freq and SR are Unknown */ | ||
158 | STV0900_COLD_START,/* only the SR is known */ | ||
159 | STV0900_WARM_START/* offset freq and SR are known */ | ||
160 | }; | ||
161 | |||
162 | enum fe_stv0900_modulation { | ||
163 | STV0900_QPSK, | ||
164 | STV0900_8PSK, | ||
165 | STV0900_16APSK, | ||
166 | STV0900_32APSK, | ||
167 | STV0900_UNKNOWN | ||
168 | }; | ||
169 | |||
170 | enum fe_stv0900_modcode { | ||
171 | STV0900_DUMMY_PLF, | ||
172 | STV0900_QPSK_14, | ||
173 | STV0900_QPSK_13, | ||
174 | STV0900_QPSK_25, | ||
175 | STV0900_QPSK_12, | ||
176 | STV0900_QPSK_35, | ||
177 | STV0900_QPSK_23, | ||
178 | STV0900_QPSK_34, | ||
179 | STV0900_QPSK_45, | ||
180 | STV0900_QPSK_56, | ||
181 | STV0900_QPSK_89, | ||
182 | STV0900_QPSK_910, | ||
183 | STV0900_8PSK_35, | ||
184 | STV0900_8PSK_23, | ||
185 | STV0900_8PSK_34, | ||
186 | STV0900_8PSK_56, | ||
187 | STV0900_8PSK_89, | ||
188 | STV0900_8PSK_910, | ||
189 | STV0900_16APSK_23, | ||
190 | STV0900_16APSK_34, | ||
191 | STV0900_16APSK_45, | ||
192 | STV0900_16APSK_56, | ||
193 | STV0900_16APSK_89, | ||
194 | STV0900_16APSK_910, | ||
195 | STV0900_32APSK_34, | ||
196 | STV0900_32APSK_45, | ||
197 | STV0900_32APSK_56, | ||
198 | STV0900_32APSK_89, | ||
199 | STV0900_32APSK_910, | ||
200 | STV0900_MODCODE_UNKNOWN | ||
201 | }; | ||
202 | |||
203 | enum fe_stv0900_fec {/*DVBS1, DSS and turbo code puncture rate*/ | ||
204 | STV0900_FEC_1_2 = 0, | ||
205 | STV0900_FEC_2_3, | ||
206 | STV0900_FEC_3_4, | ||
207 | STV0900_FEC_4_5,/*for turbo code only*/ | ||
208 | STV0900_FEC_5_6, | ||
209 | STV0900_FEC_6_7,/*for DSS only */ | ||
210 | STV0900_FEC_7_8, | ||
211 | STV0900_FEC_8_9,/*for turbo code only*/ | ||
212 | STV0900_FEC_UNKNOWN | ||
213 | }; | ||
214 | |||
215 | enum fe_stv0900_frame_length { | ||
216 | STV0900_LONG_FRAME, | ||
217 | STV0900_SHORT_FRAME | ||
218 | }; | ||
219 | |||
220 | enum fe_stv0900_pilot { | ||
221 | STV0900_PILOTS_OFF, | ||
222 | STV0900_PILOTS_ON | ||
223 | }; | ||
224 | |||
225 | enum fe_stv0900_rolloff { | ||
226 | STV0900_35, | ||
227 | STV0900_25, | ||
228 | STV0900_20 | ||
229 | }; | ||
230 | |||
231 | enum fe_stv0900_search_iq { | ||
232 | STV0900_IQ_AUTO, | ||
233 | STV0900_IQ_AUTO_NORMAL_FIRST, | ||
234 | STV0900_IQ_FORCE_NORMAL, | ||
235 | STV0900_IQ_FORCE_SWAPPED | ||
236 | }; | ||
237 | |||
238 | enum stv0900_iq_inversion { | ||
239 | STV0900_IQ_NORMAL, | ||
240 | STV0900_IQ_SWAPPED | ||
241 | }; | ||
242 | |||
243 | enum fe_stv0900_diseqc_mode { | ||
244 | STV0900_22KHZ_Continues = 0, | ||
245 | STV0900_DISEQC_2_3_PWM = 2, | ||
246 | STV0900_DISEQC_3_3_PWM = 3, | ||
247 | STV0900_DISEQC_2_3_ENVELOP = 4, | ||
248 | STV0900_DISEQC_3_3_ENVELOP = 5 | ||
249 | }; | ||
250 | |||
251 | enum fe_stv0900_demod_mode { | ||
252 | STV0900_SINGLE = 0, | ||
253 | STV0900_DUAL | ||
254 | }; | ||
255 | |||
256 | struct stv0900_init_params{ | ||
257 | u32 dmd_ref_clk;/* Refrence,Input clock for the demod in Hz */ | ||
258 | |||
259 | /* Demodulator Type (single demod or dual demod) */ | ||
260 | enum fe_stv0900_demod_mode demod_mode; | ||
261 | enum fe_stv0900_rolloff rolloff; | ||
262 | enum fe_stv0900_clock_type path1_ts_clock; | ||
263 | |||
264 | u8 tun1_maddress; | ||
265 | int tuner1_adc; | ||
266 | |||
267 | /* IQ from the tuner1 to the demod */ | ||
268 | enum stv0900_iq_inversion tun1_iq_inversion; | ||
269 | enum fe_stv0900_clock_type path2_ts_clock; | ||
270 | |||
271 | u8 tun2_maddress; | ||
272 | int tuner2_adc; | ||
273 | |||
274 | /* IQ from the tuner2 to the demod */ | ||
275 | enum stv0900_iq_inversion tun2_iq_inversion; | ||
276 | }; | ||
277 | |||
278 | struct stv0900_search_params { | ||
279 | enum fe_stv0900_demod_num path;/* Path Used demod1 or 2 */ | ||
280 | |||
281 | u32 frequency;/* Transponder frequency (in KHz) */ | ||
282 | u32 symbol_rate;/* Transponder symbol rate (in bds)*/ | ||
283 | u32 search_range;/* Range of the search (in Hz) */ | ||
284 | |||
285 | enum fe_stv0900_search_standard standard; | ||
286 | enum fe_stv0900_modulation modulation; | ||
287 | enum fe_stv0900_fec fec; | ||
288 | enum fe_stv0900_modcode modcode; | ||
289 | enum fe_stv0900_search_iq iq_inversion; | ||
290 | enum fe_stv0900_search_algo search_algo; | ||
291 | |||
292 | }; | ||
293 | |||
294 | struct stv0900_signal_info { | ||
295 | int locked;/* Transponder locked */ | ||
296 | u32 frequency;/* Transponder frequency (in KHz) */ | ||
297 | u32 symbol_rate;/* Transponder symbol rate (in Mbds) */ | ||
298 | |||
299 | enum fe_stv0900_tracking_standard standard; | ||
300 | enum fe_stv0900_fec fec; | ||
301 | enum fe_stv0900_modcode modcode; | ||
302 | enum fe_stv0900_modulation modulation; | ||
303 | enum fe_stv0900_pilot pilot; | ||
304 | enum fe_stv0900_frame_length frame_length; | ||
305 | enum stv0900_iq_inversion spectrum; | ||
306 | enum fe_stv0900_rolloff rolloff; | ||
307 | |||
308 | s32 Power;/* Power of the RF signal (dBm) */ | ||
309 | s32 C_N;/* Carrier to noise ratio (dB x10)*/ | ||
310 | u32 BER;/* Bit error rate (x10^7) */ | ||
311 | |||
312 | }; | ||
313 | |||
314 | struct stv0900_internal{ | ||
315 | s32 quartz; | ||
316 | s32 mclk; | ||
317 | /* manual RollOff for DVBS1/DSS only */ | ||
318 | enum fe_stv0900_rolloff rolloff; | ||
319 | /* Demodulator use for single demod or for dual demod) */ | ||
320 | enum fe_stv0900_demod_mode demod_mode; | ||
321 | |||
322 | /*Demod 1*/ | ||
323 | s32 tuner1_freq; | ||
324 | s32 tuner1_bw; | ||
325 | s32 dmd1_symbol_rate; | ||
326 | s32 dmd1_srch_range; | ||
327 | |||
328 | /* algorithm for search Blind, Cold or Warm*/ | ||
329 | enum fe_stv0900_search_algo dmd1_srch_algo; | ||
330 | /* search standard: Auto, DVBS1/DSS only or DVBS2 only*/ | ||
331 | enum fe_stv0900_search_standard dmd1_srch_standard; | ||
332 | /* inversion search : auto, auto norma first, normal or inverted */ | ||
333 | enum fe_stv0900_search_iq dmd1_srch_iq_inv; | ||
334 | enum fe_stv0900_modcode dmd1_modcode; | ||
335 | enum fe_stv0900_modulation dmd1_modulation; | ||
336 | enum fe_stv0900_fec dmd1_fec; | ||
337 | |||
338 | struct stv0900_signal_info dmd1_rslts; | ||
339 | enum fe_stv0900_signal_type dmd1_state; | ||
340 | |||
341 | enum fe_stv0900_error dmd1_err; | ||
342 | |||
343 | /*Demod 2*/ | ||
344 | s32 tuner2_freq; | ||
345 | s32 tuner2_bw; | ||
346 | s32 dmd2_symbol_rate; | ||
347 | s32 dmd2_srch_range; | ||
348 | |||
349 | enum fe_stv0900_search_algo dmd2_srch_algo; | ||
350 | enum fe_stv0900_search_standard dmd2_srch_stndrd; | ||
351 | /* inversion search : auto, auto normal first, normal or inverted */ | ||
352 | enum fe_stv0900_search_iq dmd2_srch_iq_inv; | ||
353 | enum fe_stv0900_modcode dmd2_modcode; | ||
354 | enum fe_stv0900_modulation dmd2_modulation; | ||
355 | enum fe_stv0900_fec dmd2_fec; | ||
356 | |||
357 | /* results of the search*/ | ||
358 | struct stv0900_signal_info dmd2_rslts; | ||
359 | /* current state of the search algorithm */ | ||
360 | enum fe_stv0900_signal_type dmd2_state; | ||
361 | |||
362 | enum fe_stv0900_error dmd2_err; | ||
363 | |||
364 | struct i2c_adapter *i2c_adap; | ||
365 | u8 i2c_addr; | ||
366 | u8 clkmode;/* 0 for CLKI, 2 for XTALI */ | ||
367 | u8 chip_id; | ||
368 | enum fe_stv0900_error errs; | ||
369 | int dmds_used; | ||
370 | }; | ||
371 | |||
372 | /* state for each demod */ | ||
373 | struct stv0900_state { | ||
374 | /* pointer for internal params, one for each pair of demods */ | ||
375 | struct stv0900_internal *internal; | ||
376 | struct i2c_adapter *i2c_adap; | ||
377 | const struct stv0900_config *config; | ||
378 | struct dvb_frontend frontend; | ||
379 | int demod; | ||
380 | }; | ||
381 | |||
382 | extern s32 ge2comp(s32 a, s32 width); | ||
383 | |||
384 | extern void stv0900_write_reg(struct stv0900_internal *i_params, | ||
385 | u16 reg_addr, u8 reg_data); | ||
386 | |||
387 | extern u8 stv0900_read_reg(struct stv0900_internal *i_params, | ||
388 | u16 reg_addr); | ||
389 | |||
390 | extern void stv0900_write_bits(struct stv0900_internal *i_params, | ||
391 | u32 label, u8 val); | ||
392 | |||
393 | extern u8 stv0900_get_bits(struct stv0900_internal *i_params, | ||
394 | u32 label); | ||
395 | |||
396 | extern int stv0900_get_demod_lock(struct stv0900_internal *i_params, | ||
397 | enum fe_stv0900_demod_num demod, s32 time_out); | ||
398 | extern int stv0900_check_signal_presence(struct stv0900_internal *i_params, | ||
399 | enum fe_stv0900_demod_num demod); | ||
400 | |||
401 | extern enum fe_stv0900_signal_type stv0900_algo(struct dvb_frontend *fe); | ||
402 | |||
403 | extern void stv0900_set_tuner(struct dvb_frontend *fe, u32 frequency, | ||
404 | u32 bandwidth); | ||
405 | extern void stv0900_set_bandwidth(struct dvb_frontend *fe, u32 bandwidth); | ||
406 | |||
407 | extern void stv0900_start_search(struct stv0900_internal *i_params, | ||
408 | enum fe_stv0900_demod_num demod); | ||
409 | |||
410 | extern u8 stv0900_get_optim_carr_loop(s32 srate, | ||
411 | enum fe_stv0900_modcode modcode, | ||
412 | s32 pilot, u8 chip_id); | ||
413 | |||
414 | extern u8 stv0900_get_optim_short_carr_loop(s32 srate, | ||
415 | enum fe_stv0900_modulation modulation, | ||
416 | u8 chip_id); | ||
417 | |||
418 | extern void stv0900_stop_all_s2_modcod(struct stv0900_internal *i_params, | ||
419 | enum fe_stv0900_demod_num demod); | ||
420 | |||
421 | extern void stv0900_activate_s2_modcode(struct stv0900_internal *i_params, | ||
422 | enum fe_stv0900_demod_num demod); | ||
423 | |||
424 | extern void stv0900_activate_s2_modcode_single(struct stv0900_internal *i_params, | ||
425 | enum fe_stv0900_demod_num demod); | ||
426 | |||
427 | extern enum fe_stv0900_tracking_standard stv0900_get_standard(struct dvb_frontend *fe, | ||
428 | enum fe_stv0900_demod_num demod); | ||
429 | |||
430 | #endif | ||