aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorIgor M. Liplianin <liplianin@netup.ru>2009-11-06 21:07:56 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-05 15:41:25 -0500
commit46960eea9c0f7abb3a0a65276939762b97eac337 (patch)
tree33aa976a87b5fde3aad05e12e184210cae03c81a /drivers
parent502cd96d5b0714e0ab022766014f58b0684699a8 (diff)
V4L/DVB (13338): stv0900: big rework to support cut 3.0.
Patch 1 of 4. Also patch changes logic to prevent code repetitions and big indents. It makes checkpatch silent :) Signed-off-by: Igor M. Liplianin <liplianin@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb/frontends/stv0900_init.h257
-rw-r--r--drivers/media/dvb/frontends/stv0900_priv.h81
2 files changed, 224 insertions, 114 deletions
diff --git a/drivers/media/dvb/frontends/stv0900_init.h b/drivers/media/dvb/frontends/stv0900_init.h
index ff388b47a4e3..b684df9995d8 100644
--- a/drivers/media/dvb/frontends/stv0900_init.h
+++ b/drivers/media/dvb/frontends/stv0900_init.h
@@ -141,85 +141,228 @@ struct stv0900_short_frames_car_loop_optim {
141 141
142}; 142};
143 143
144struct stv0900_short_frames_car_loop_optim_vs_mod {
145 enum fe_stv0900_modulation modulation;
146 u8 car_loop_2; /* SR<3msps */
147 u8 car_loop_5; /* 3<SR<=7msps */
148 u8 car_loop_10; /* 7<SR<=15msps */
149 u8 car_loop_20; /* 10<SR<=25msps */
150 u8 car_loop_30; /* 10<SR<=45msps */
151};
152
144/* Cut 1.x Tracking carrier loop carrier QPSK 1/2 to 8PSK 9/10 long Frame */ 153/* Cut 1.x Tracking carrier loop carrier QPSK 1/2 to 8PSK 9/10 long Frame */
145static const struct stv0900_car_loop_optim FE_STV0900_S2CarLoop[14] = { 154static const struct stv0900_car_loop_optim FE_STV0900_S2CarLoop[14] = {
146 /*Modcod 2MPon 2MPoff 5MPon 5MPoff 10MPon 10MPoff 20MPon 20MPoff 30MPon 30MPoff */ 155 /*Modcod 2MPon 2MPoff 5MPon 5MPoff 10MPon
147 { STV0900_QPSK_12, 0x1C, 0x0D, 0x1B, 0x2C, 0x3A, 0x1C, 0x2A, 0x3B, 0x2A, 0x1B }, 156 10MPoff 20MPon 20MPoff 30MPon 30MPoff */
148 { STV0900_QPSK_35, 0x2C, 0x0D, 0x2B, 0x2C, 0x3A, 0x0C, 0x3A, 0x2B, 0x2A, 0x0B }, 157 { STV0900_QPSK_12, 0x1C, 0x0D, 0x1B, 0x2C, 0x3A,
149 { STV0900_QPSK_23, 0x2C, 0x0D, 0x2B, 0x2C, 0x0B, 0x0C, 0x3A, 0x1B, 0x2A, 0x3A }, 158 0x1C, 0x2A, 0x3B, 0x2A, 0x1B },
150 { STV0900_QPSK_34, 0x3C, 0x0D, 0x3B, 0x1C, 0x0B, 0x3B, 0x3A, 0x0B, 0x2A, 0x3A }, 159 { STV0900_QPSK_35, 0x2C, 0x0D, 0x2B, 0x2C, 0x3A,
151 { STV0900_QPSK_45, 0x3C, 0x0D, 0x3B, 0x1C, 0x0B, 0x3B, 0x3A, 0x0B, 0x2A, 0x3A }, 160 0x0C, 0x3A, 0x2B, 0x2A, 0x0B },
152 { STV0900_QPSK_56, 0x0D, 0x0D, 0x3B, 0x1C, 0x0B, 0x3B, 0x3A, 0x0B, 0x2A, 0x3A }, 161 { STV0900_QPSK_23, 0x2C, 0x0D, 0x2B, 0x2C, 0x0B,
153 { STV0900_QPSK_89, 0x0D, 0x0D, 0x3B, 0x1C, 0x1B, 0x3B, 0x3A, 0x0B, 0x2A, 0x3A }, 162 0x0C, 0x3A, 0x1B, 0x2A, 0x3A },
154 { STV0900_QPSK_910, 0x1D, 0x0D, 0x3B, 0x1C, 0x1B, 0x3B, 0x3A, 0x0B, 0x2A, 0x3A }, 163 { STV0900_QPSK_34, 0x3C, 0x0D, 0x3B, 0x1C, 0x0B,
155 { STV0900_8PSK_35, 0x29, 0x3B, 0x09, 0x2B, 0x38, 0x0B, 0x18, 0x1A, 0x08, 0x0A }, 164 0x3B, 0x3A, 0x0B, 0x2A, 0x3A },
156 { STV0900_8PSK_23, 0x0A, 0x3B, 0x29, 0x2B, 0x19, 0x0B, 0x38, 0x1A, 0x18, 0x0A }, 165 { STV0900_QPSK_45, 0x3C, 0x0D, 0x3B, 0x1C, 0x0B,
157 { STV0900_8PSK_34, 0x3A, 0x3B, 0x2A, 0x2B, 0x39, 0x0B, 0x19, 0x1A, 0x38, 0x0A }, 166 0x3B, 0x3A, 0x0B, 0x2A, 0x3A },
158 { STV0900_8PSK_56, 0x1B, 0x3B, 0x0B, 0x2B, 0x1A, 0x0B, 0x39, 0x1A, 0x19, 0x0A }, 167 { STV0900_QPSK_56, 0x0D, 0x0D, 0x3B, 0x1C, 0x0B,
159 { STV0900_8PSK_89, 0x3B, 0x3B, 0x0B, 0x2B, 0x2A, 0x0B, 0x39, 0x1A, 0x29, 0x39 }, 168 0x3B, 0x3A, 0x0B, 0x2A, 0x3A },
160 { STV0900_8PSK_910, 0x3B, 0x3B, 0x0B, 0x2B, 0x2A, 0x0B, 0x39, 0x1A, 0x29, 0x39 } 169 { STV0900_QPSK_89, 0x0D, 0x0D, 0x3B, 0x1C, 0x1B,
170 0x3B, 0x3A, 0x0B, 0x2A, 0x3A },
171 { STV0900_QPSK_910, 0x1D, 0x0D, 0x3B, 0x1C, 0x1B,
172 0x3B, 0x3A, 0x0B, 0x2A, 0x3A },
173 { STV0900_8PSK_35, 0x29, 0x3B, 0x09, 0x2B, 0x38,
174 0x0B, 0x18, 0x1A, 0x08, 0x0A },
175 { STV0900_8PSK_23, 0x0A, 0x3B, 0x29, 0x2B, 0x19,
176 0x0B, 0x38, 0x1A, 0x18, 0x0A },
177 { STV0900_8PSK_34, 0x3A, 0x3B, 0x2A, 0x2B, 0x39,
178 0x0B, 0x19, 0x1A, 0x38, 0x0A },
179 { STV0900_8PSK_56, 0x1B, 0x3B, 0x0B, 0x2B, 0x1A,
180 0x0B, 0x39, 0x1A, 0x19, 0x0A },
181 { STV0900_8PSK_89, 0x3B, 0x3B, 0x0B, 0x2B, 0x2A,
182 0x0B, 0x39, 0x1A, 0x29, 0x39 },
183 { STV0900_8PSK_910, 0x3B, 0x3B, 0x0B, 0x2B, 0x2A,
184 0x0B, 0x39, 0x1A, 0x29, 0x39 }
161}; 185};
162 186
163 187
164/* Cut 2.0 Tracking carrier loop carrier QPSK 1/2 to 8PSK 9/10 long Frame */ 188/* Cut 2.0 Tracking carrier loop carrier QPSK 1/2 to 8PSK 9/10 long Frame */
165static const struct stv0900_car_loop_optim FE_STV0900_S2CarLoopCut20[14] = { 189static const struct stv0900_car_loop_optim FE_STV0900_S2CarLoopCut20[14] = {
166 /* Modcod 2MPon 2MPoff 5MPon 5MPoff 10MPon 10MPoff 20MPon 20MPoff 30MPon 30MPoff */ 190 /* Modcod 2MPon 2MPoff 5MPon 5MPoff 10MPon
167 { STV0900_QPSK_12, 0x1F, 0x3F, 0x1E, 0x3F, 0x3D, 0x1F, 0x3D, 0x3E, 0x3D, 0x1E }, 191 10MPoff 20MPon 20MPoff 30MPon 30MPoff */
168 { STV0900_QPSK_35, 0x2F, 0x3F, 0x2E, 0x2F, 0x3D, 0x0F, 0x0E, 0x2E, 0x3D, 0x0E }, 192 { STV0900_QPSK_12, 0x1F, 0x3F, 0x1E, 0x3F, 0x3D,
169 { STV0900_QPSK_23, 0x2F, 0x3F, 0x2E, 0x2F, 0x0E, 0x0F, 0x0E, 0x1E, 0x3D, 0x3D }, 193 0x1F, 0x3D, 0x3E, 0x3D, 0x1E },
170 { STV0900_QPSK_34, 0x3F, 0x3F, 0x3E, 0x1F, 0x0E, 0x3E, 0x0E, 0x1E, 0x3D, 0x3D }, 194 { STV0900_QPSK_35, 0x2F, 0x3F, 0x2E, 0x2F, 0x3D,
171 { STV0900_QPSK_45, 0x3F, 0x3F, 0x3E, 0x1F, 0x0E, 0x3E, 0x0E, 0x1E, 0x3D, 0x3D }, 195 0x0F, 0x0E, 0x2E, 0x3D, 0x0E },
172 { STV0900_QPSK_56, 0x3F, 0x3F, 0x3E, 0x1F, 0x0E, 0x3E, 0x0E, 0x1E, 0x3D, 0x3D }, 196 { STV0900_QPSK_23, 0x2F, 0x3F, 0x2E, 0x2F, 0x0E,
173 { STV0900_QPSK_89, 0x3F, 0x3F, 0x3E, 0x1F, 0x1E, 0x3E, 0x0E, 0x1E, 0x3D, 0x3D }, 197 0x0F, 0x0E, 0x1E, 0x3D, 0x3D },
174 { STV0900_QPSK_910, 0x3F, 0x3F, 0x3E, 0x1F, 0x1E, 0x3E, 0x0E, 0x1E, 0x3D, 0x3D }, 198 { STV0900_QPSK_34, 0x3F, 0x3F, 0x3E, 0x1F, 0x0E,
175 { STV0900_8PSK_35, 0x3c, 0x0c, 0x1c, 0x3b, 0x0c, 0x3b, 0x2b, 0x2b, 0x1b, 0x2b }, 199 0x3E, 0x0E, 0x1E, 0x3D, 0x3D },
176 { STV0900_8PSK_23, 0x1d, 0x0c, 0x3c, 0x0c, 0x2c, 0x3b, 0x0c, 0x2b, 0x2b, 0x2b }, 200 { STV0900_QPSK_45, 0x3F, 0x3F, 0x3E, 0x1F, 0x0E,
177 { STV0900_8PSK_34, 0x0e, 0x1c, 0x3d, 0x0c, 0x0d, 0x3b, 0x2c, 0x3b, 0x0c, 0x2b }, 201 0x3E, 0x0E, 0x1E, 0x3D, 0x3D },
178 { STV0900_8PSK_56, 0x2e, 0x3e, 0x1e, 0x2e, 0x2d, 0x1e, 0x3c, 0x2d, 0x2c, 0x1d }, 202 { STV0900_QPSK_56, 0x3F, 0x3F, 0x3E, 0x1F, 0x0E,
179 { STV0900_8PSK_89, 0x3e, 0x3e, 0x1e, 0x2e, 0x3d, 0x1e, 0x0d, 0x2d, 0x3c, 0x1d }, 203 0x3E, 0x0E, 0x1E, 0x3D, 0x3D },
180 { STV0900_8PSK_910, 0x3e, 0x3e, 0x1e, 0x2e, 0x3d, 0x1e, 0x1d, 0x2d, 0x0d, 0x1d } 204 { STV0900_QPSK_89, 0x3F, 0x3F, 0x3E, 0x1F, 0x1E,
205 0x3E, 0x0E, 0x1E, 0x3D, 0x3D },
206 { STV0900_QPSK_910, 0x3F, 0x3F, 0x3E, 0x1F, 0x1E,
207 0x3E, 0x0E, 0x1E, 0x3D, 0x3D },
208 { STV0900_8PSK_35, 0x3c, 0x0c, 0x1c, 0x3b, 0x0c,
209 0x3b, 0x2b, 0x2b, 0x1b, 0x2b },
210 { STV0900_8PSK_23, 0x1d, 0x0c, 0x3c, 0x0c, 0x2c,
211 0x3b, 0x0c, 0x2b, 0x2b, 0x2b },
212 { STV0900_8PSK_34, 0x0e, 0x1c, 0x3d, 0x0c, 0x0d,
213 0x3b, 0x2c, 0x3b, 0x0c, 0x2b },
214 { STV0900_8PSK_56, 0x2e, 0x3e, 0x1e, 0x2e, 0x2d,
215 0x1e, 0x3c, 0x2d, 0x2c, 0x1d },
216 { STV0900_8PSK_89, 0x3e, 0x3e, 0x1e, 0x2e, 0x3d,
217 0x1e, 0x0d, 0x2d, 0x3c, 0x1d },
218 { STV0900_8PSK_910, 0x3e, 0x3e, 0x1e, 0x2e, 0x3d,
219 0x1e, 0x1d, 0x2d, 0x0d, 0x1d },
181}; 220};
182 221
183 222
184 223
185/* Cut 2.0 Tracking carrier loop carrier 16APSK 2/3 to 32APSK 9/10 long Frame */ 224/* Cut 2.0 Tracking carrier loop carrier 16APSK 2/3 to 32APSK 9/10 long Frame */
186static const struct stv0900_car_loop_optim FE_STV0900_S2APSKCarLoopCut20[11] = { 225static const struct stv0900_car_loop_optim FE_STV0900_S2APSKCarLoopCut20[11] = {
187 /* Modcod 2MPon 2MPoff 5MPon 5MPoff 10MPon 10MPoff 20MPon 20MPoff 30MPon 30MPoff */ 226 /* Modcod 2MPon 2MPoff 5MPon 5MPoff 10MPon
188 { STV0900_16APSK_23, 0x0C, 0x0C, 0x0C, 0x0C, 0x1D, 0x0C, 0x3C, 0x0C, 0x2C, 0x0C }, 227 10MPoff 20MPon 20MPoff 30MPon 30MPoff */
189 { STV0900_16APSK_34, 0x0C, 0x0C, 0x0C, 0x0C, 0x0E, 0x0C, 0x2D, 0x0C, 0x1D, 0x0C }, 228 { STV0900_16APSK_23, 0x0C, 0x0C, 0x0C, 0x0C, 0x1D,
190 { STV0900_16APSK_45, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x0C, 0x3D, 0x0C, 0x2D, 0x0C }, 229 0x0C, 0x3C, 0x0C, 0x2C, 0x0C },
191 { STV0900_16APSK_56, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x0C, 0x3D, 0x0C, 0x2D, 0x0C }, 230 { STV0900_16APSK_34, 0x0C, 0x0C, 0x0C, 0x0C, 0x0E,
192 { STV0900_16APSK_89, 0x0C, 0x0C, 0x0C, 0x0C, 0x2E, 0x0C, 0x0E, 0x0C, 0x3D, 0x0C }, 231 0x0C, 0x2D, 0x0C, 0x1D, 0x0C },
193 { STV0900_16APSK_910, 0x0C, 0x0C, 0x0C, 0x0C, 0x2E, 0x0C, 0x0E, 0x0C, 0x3D, 0x0C }, 232 { STV0900_16APSK_45, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E,
194 { STV0900_32APSK_34, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C }, 233 0x0C, 0x3D, 0x0C, 0x2D, 0x0C },
195 { STV0900_32APSK_45, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C }, 234 { STV0900_16APSK_56, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E,
196 { STV0900_32APSK_56, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C }, 235 0x0C, 0x3D, 0x0C, 0x2D, 0x0C },
197 { STV0900_32APSK_89, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C }, 236 { STV0900_16APSK_89, 0x0C, 0x0C, 0x0C, 0x0C, 0x2E,
198 { STV0900_32APSK_910, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C } 237 0x0C, 0x0E, 0x0C, 0x3D, 0x0C },
238 { STV0900_16APSK_910, 0x0C, 0x0C, 0x0C, 0x0C, 0x2E,
239 0x0C, 0x0E, 0x0C, 0x3D, 0x0C },
240 { STV0900_32APSK_34, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C,
241 0x0C, 0x0C, 0x0C, 0x0C, 0x0C },
242 { STV0900_32APSK_45, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C,
243 0x0C, 0x0C, 0x0C, 0x0C, 0x0C },
244 { STV0900_32APSK_56, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C,
245 0x0C, 0x0C, 0x0C, 0x0C, 0x0C },
246 { STV0900_32APSK_89, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C,
247 0x0C, 0x0C, 0x0C, 0x0C, 0x0C },
248 { STV0900_32APSK_910, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C,
249 0x0C, 0x0C, 0x0C, 0x0C, 0x0C },
199}; 250};
200 251
201 252
202/* Cut 2.0 Tracking carrier loop carrier QPSK 1/4 to QPSK 2/5 long Frame */ 253/* Cut 2.0 Tracking carrier loop carrier QPSK 1/4 to QPSK 2/5 long Frame */
203static const struct stv0900_car_loop_optim FE_STV0900_S2LowQPCarLoopCut20[3] = { 254static const struct stv0900_car_loop_optim FE_STV0900_S2LowQPCarLoopCut20[3] = {
204 /* Modcod 2MPon 2MPoff 5MPon 5MPoff 10MPon 10MPoff 20MPon 20MPoff 30MPon 30MPoff */ 255 /* Modcod 2MPon 2MPoff 5MPon 5MPoff 10MPon
205 { STV0900_QPSK_14, 0x0F, 0x3F, 0x0E, 0x3F, 0x2D, 0x2F, 0x2D, 0x1F, 0x3D, 0x3E }, 256 10MPoff 20MPon 20MPoff 30MPon 30MPoff */
206 { STV0900_QPSK_13, 0x0F, 0x3F, 0x0E, 0x3F, 0x2D, 0x2F, 0x3D, 0x0F, 0x3D, 0x2E }, 257 { STV0900_QPSK_14, 0x0F, 0x3F, 0x0E, 0x3F, 0x2D,
207 { STV0900_QPSK_25, 0x1F, 0x3F, 0x1E, 0x3F, 0x3D, 0x1F, 0x3D, 0x3E, 0x3D, 0x2E } 258 0x2F, 0x2D, 0x1F, 0x3D, 0x3E },
259 { STV0900_QPSK_13, 0x0F, 0x3F, 0x0E, 0x3F, 0x2D,
260 0x2F, 0x3D, 0x0F, 0x3D, 0x2E },
261 { STV0900_QPSK_25, 0x1F, 0x3F, 0x1E, 0x3F, 0x3D,
262 0x1F, 0x3D, 0x3E, 0x3D, 0x2E }
208}; 263};
209 264
210 265
211/* Cut 2.0 Tracking carrier loop carrier short Frame, cut 1.2 and 2.0 */ 266/* Cut 2.0 Tracking carrier loop carrier short Frame, cut 1.2 and 2.0 */
212static const struct stv0900_short_frames_car_loop_optim FE_STV0900_S2ShortCarLoop[4] = { 267static const
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 */ 268struct stv0900_short_frames_car_loop_optim FE_STV0900_S2ShortCarLoop[4] = {
214 { STV0900_QPSK, 0x3C, 0x2F, 0x2B, 0x2E, 0x0B, 0x0E, 0x3A, 0x0E, 0x2A, 0x3D }, 269 /*Mod 2Mcut1.2 2Mcut2.0 5Mcut1.2 5Mcut2.0 10Mcut1.2
215 { STV0900_8PSK, 0x0B, 0x3E, 0x2A, 0x0E, 0x0A, 0x2D, 0x19, 0x0D, 0x09, 0x3C }, 270 10Mcut2.0 20Mcut1.2 20M_cut2.0 30Mcut1.2 30Mcut2.0*/
216 { STV0900_16APSK, 0x1B, 0x1E, 0x1B, 0x1E, 0x1B, 0x1E, 0x3A, 0x3D, 0x2A, 0x2D }, 271 { STV0900_QPSK, 0x3C, 0x2F, 0x2B, 0x2E, 0x0B,
217 { STV0900_32APSK, 0x1B, 0x1E, 0x1B, 0x1E, 0x1B, 0x1E, 0x3A, 0x3D, 0x2A, 0x2D } 272 0x0E, 0x3A, 0x0E, 0x2A, 0x3D },
273 { STV0900_8PSK, 0x0B, 0x3E, 0x2A, 0x0E, 0x0A,
274 0x2D, 0x19, 0x0D, 0x09, 0x3C },
275 { STV0900_16APSK, 0x1B, 0x1E, 0x1B, 0x1E, 0x1B,
276 0x1E, 0x3A, 0x3D, 0x2A, 0x2D },
277 { STV0900_32APSK, 0x1B, 0x1E, 0x1B, 0x1E, 0x1B,
278 0x1E, 0x3A, 0x3D, 0x2A, 0x2D }
279};
280
281static const struct stv0900_car_loop_optim FE_STV0900_S2CarLoopCut30[14] = {
282 /*Modcod 2MPon 2MPoff 5MPon 5MPoff 10MPon
283 10MPoff 20MPon 20MPoff 30MPon 30MPoff */
284 { STV0900_QPSK_12, 0x3C, 0x2C, 0x0C, 0x2C, 0x1B,
285 0x2C, 0x1B, 0x1C, 0x0B, 0x3B },
286 { STV0900_QPSK_35, 0x0D, 0x0D, 0x0C, 0x0D, 0x1B,
287 0x3C, 0x1B, 0x1C, 0x0B, 0x3B },
288 { STV0900_QPSK_23, 0x1D, 0x0D, 0x0C, 0x1D, 0x2B,
289 0x3C, 0x1B, 0x1C, 0x0B, 0x3B },
290 { STV0900_QPSK_34, 0x1D, 0x1D, 0x0C, 0x1D, 0x2B,
291 0x3C, 0x1B, 0x1C, 0x0B, 0x3B },
292 { STV0900_QPSK_45, 0x2D, 0x1D, 0x1C, 0x1D, 0x2B,
293 0x3C, 0x2B, 0x0C, 0x1B, 0x3B },
294 { STV0900_QPSK_56, 0x2D, 0x1D, 0x1C, 0x1D, 0x2B,
295 0x3C, 0x2B, 0x0C, 0x1B, 0x3B },
296 { STV0900_QPSK_89, 0x3D, 0x2D, 0x1C, 0x1D, 0x3B,
297 0x3C, 0x2B, 0x0C, 0x1B, 0x3B },
298 { STV0900_QPSK_910, 0x3D, 0x2D, 0x1C, 0x1D, 0x3B,
299 0x3C, 0x2B, 0x0C, 0x1B, 0x3B },
300 { STV0900_8PSK_35, 0x39, 0x19, 0x39, 0x19, 0x19,
301 0x19, 0x19, 0x19, 0x09, 0x19 },
302 { STV0900_8PSK_23, 0x2A, 0x39, 0x1A, 0x0A, 0x39,
303 0x0A, 0x29, 0x39, 0x29, 0x0A },
304 { STV0900_8PSK_34, 0x0B, 0x3A, 0x0B, 0x0B, 0x3A,
305 0x1B, 0x1A, 0x0B, 0x1A, 0x3A },
306 { STV0900_8PSK_56, 0x0C, 0x1B, 0x3B, 0x2B, 0x1B,
307 0x3B, 0x3A, 0x3B, 0x3A, 0x1B },
308 { STV0900_8PSK_89, 0x2C, 0x2C, 0x2C, 0x1C, 0x2B,
309 0x0C, 0x0B, 0x3B, 0x0B, 0x1B },
310 { STV0900_8PSK_910, 0x2C, 0x3C, 0x2C, 0x1C, 0x3B,
311 0x1C, 0x0B, 0x3B, 0x0B, 0x1B }
312};
313
314static const
315struct stv0900_car_loop_optim FE_STV0900_S2APSKCarLoopCut30[11] = {
316 /*Modcod 2MPon 2MPoff 5MPon 5MPoff 10MPon
317 10MPoff 20MPon 20MPoff 30MPon 30MPoff */
318 { STV0900_16APSK_23, 0x0A, 0x0A, 0x0A, 0x0A, 0x1A,
319 0x0A, 0x3A, 0x0A, 0x2A, 0x0A },
320 { STV0900_16APSK_34, 0x0A, 0x0A, 0x0A, 0x0A, 0x0B,
321 0x0A, 0x3B, 0x0A, 0x1B, 0x0A },
322 { STV0900_16APSK_45, 0x0A, 0x0A, 0x0A, 0x0A, 0x1B,
323 0x0A, 0x3B, 0x0A, 0x2B, 0x0A },
324 { STV0900_16APSK_56, 0x0A, 0x0A, 0x0A, 0x0A, 0x1B,
325 0x0A, 0x3B, 0x0A, 0x2B, 0x0A },
326 { STV0900_16APSK_89, 0x0A, 0x0A, 0x0A, 0x0A, 0x2B,
327 0x0A, 0x0C, 0x0A, 0x3B, 0x0A },
328 { STV0900_16APSK_910, 0x0A, 0x0A, 0x0A, 0x0A, 0x2B,
329 0x0A, 0x0C, 0x0A, 0x3B, 0x0A },
330 { STV0900_32APSK_34, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A,
331 0x0A, 0x0A, 0x0A, 0x0A, 0x0A },
332 { STV0900_32APSK_45, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A,
333 0x0A, 0x0A, 0x0A, 0x0A, 0x0A },
334 { STV0900_32APSK_56, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A,
335 0x0A, 0x0A, 0x0A, 0x0A, 0x0A },
336 { STV0900_32APSK_89, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A,
337 0x0A, 0x0A, 0x0A, 0x0A, 0x0A },
338 { STV0900_32APSK_910, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A,
339 0x0A, 0x0A, 0x0A, 0x0A, 0x0A }
340};
341
342static const
343struct stv0900_car_loop_optim FE_STV0900_S2LowQPCarLoopCut30[3] = {
344 /*Modcod 2MPon 2MPoff 5MPon 5MPoff 10MPon
345 10MPoff 20MPon 20MPoff 30MPon 30MPoff*/
346 { STV0900_QPSK_14, 0x0C, 0x3C, 0x0B, 0x3C, 0x2A,
347 0x2C, 0x2A, 0x1C, 0x3A, 0x3B },
348 { STV0900_QPSK_13, 0x0C, 0x3C, 0x0B, 0x3C, 0x2A,
349 0x2C, 0x3A, 0x0C, 0x3A, 0x2B },
350 { STV0900_QPSK_25, 0x1C, 0x3C, 0x1B, 0x3C, 0x3A,
351 0x1C, 0x3A, 0x3B, 0x3A, 0x2B }
352};
353
354static const struct stv0900_short_frames_car_loop_optim_vs_mod
355FE_STV0900_S2ShortCarLoopCut30[4] = {
356 /*Mod 2Mcut3.0 5Mcut3.0 10Mcut3.0 20Mcut3.0 30Mcut3.0*/
357 { STV0900_QPSK, 0x2C, 0x2B, 0x0B, 0x0B, 0x3A },
358 { STV0900_8PSK, 0x3B, 0x0B, 0x2A, 0x0A, 0x39 },
359 { STV0900_16APSK, 0x1B, 0x1B, 0x1B, 0x3A, 0x2A },
360 { STV0900_32APSK, 0x1B, 0x1B, 0x1B, 0x3A, 0x2A },
361
218}; 362};
219 363
220static const u16 STV0900_InitVal[182][2] = { 364static const u16 STV0900_InitVal[181][2] = {
221 { R0900_OUTCFG , 0x00 }, 365 { R0900_OUTCFG , 0x00 },
222 { R0900_MODECFG , 0xff },
223 { R0900_AGCRF1CFG , 0x11 }, 366 { R0900_AGCRF1CFG , 0x11 },
224 { R0900_AGCRF2CFG , 0x13 }, 367 { R0900_AGCRF2CFG , 0x13 },
225 { R0900_TSGENERAL1X , 0x14 }, 368 { R0900_TSGENERAL1X , 0x14 },
@@ -381,7 +524,7 @@ static const u16 STV0900_InitVal[182][2] = {
381 { R0900_GAINLLR_NF15 , 0x1A }, 524 { R0900_GAINLLR_NF15 , 0x1A },
382 { R0900_GAINLLR_NF16 , 0x1F }, 525 { R0900_GAINLLR_NF16 , 0x1F },
383 { R0900_GAINLLR_NF17 , 0x21 }, 526 { R0900_GAINLLR_NF17 , 0x21 },
384 { R0900_RCCFGH , 0x20 }, 527 { R0900_RCCFG2 , 0x20 },
385 { R0900_P1_FECM , 0x01 }, /*disable DSS modes*/ 528 { R0900_P1_FECM , 0x01 }, /*disable DSS modes*/
386 { R0900_P2_FECM , 0x01 }, /*disable DSS modes*/ 529 { R0900_P2_FECM , 0x01 }, /*disable DSS modes*/
387 { R0900_P1_PRVIT , 0x2F }, /*disable puncture rate 6/7*/ 530 { R0900_P1_PRVIT , 0x2F }, /*disable puncture rate 6/7*/
diff --git a/drivers/media/dvb/frontends/stv0900_priv.h b/drivers/media/dvb/frontends/stv0900_priv.h
index 5f4414f8da20..d8ba8a984abe 100644
--- a/drivers/media/dvb/frontends/stv0900_priv.h
+++ b/drivers/media/dvb/frontends/stv0900_priv.h
@@ -46,22 +46,6 @@
46#define FALSE (!TRUE) 46#define FALSE (!TRUE)
47#endif 47#endif
48 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
63extern int stvdebug;
64
65#define dprintk(args...) \ 49#define dprintk(args...) \
66 do { \ 50 do { \
67 if (stvdebug) \ 51 if (stvdebug) \
@@ -70,6 +54,8 @@ extern int stvdebug;
70 54
71#define STV0900_MAXLOOKUPSIZE 500 55#define STV0900_MAXLOOKUPSIZE 500
72#define STV0900_BLIND_SEARCH_AGC2_TH 700 56#define STV0900_BLIND_SEARCH_AGC2_TH 700
57#define STV0900_BLIND_SEARCH_AGC2_TH_CUT30 1400
58#define IQPOWER_THRESHOLD 30
73 59
74/* One point of the lookup table */ 60/* One point of the lookup table */
75struct stv000_lookpoint { 61struct stv000_lookpoint {
@@ -263,14 +249,14 @@ struct stv0900_init_params{
263 int tuner1_adc; 249 int tuner1_adc;
264 250
265 /* IQ from the tuner1 to the demod */ 251 /* IQ from the tuner1 to the demod */
266 enum stv0900_iq_inversion tun1_iq_inversion; 252 enum stv0900_iq_inversion tun1_iq_inv;
267 enum fe_stv0900_clock_type path2_ts_clock; 253 enum fe_stv0900_clock_type path2_ts_clock;
268 254
269 u8 tun2_maddress; 255 u8 tun2_maddress;
270 int tuner2_adc; 256 int tuner2_adc;
271 257
272 /* IQ from the tuner2 to the demod */ 258 /* IQ from the tuner2 to the demod */
273 enum stv0900_iq_inversion tun2_iq_inversion; 259 enum stv0900_iq_inversion tun2_iq_inv;
274 struct stv0900_reg *ts_config; 260 struct stv0900_reg *ts_config;
275}; 261};
276 262
@@ -300,7 +286,7 @@ struct stv0900_signal_info {
300 enum fe_stv0900_modcode modcode; 286 enum fe_stv0900_modcode modcode;
301 enum fe_stv0900_modulation modulation; 287 enum fe_stv0900_modulation modulation;
302 enum fe_stv0900_pilot pilot; 288 enum fe_stv0900_pilot pilot;
303 enum fe_stv0900_frame_length frame_length; 289 enum fe_stv0900_frame_length frame_len;
304 enum stv0900_iq_inversion spectrum; 290 enum stv0900_iq_inversion spectrum;
305 enum fe_stv0900_rolloff rolloff; 291 enum fe_stv0900_rolloff rolloff;
306 292
@@ -318,47 +304,25 @@ struct stv0900_internal{
318 /* Demodulator use for single demod or for dual demod) */ 304 /* Demodulator use for single demod or for dual demod) */
319 enum fe_stv0900_demod_mode demod_mode; 305 enum fe_stv0900_demod_mode demod_mode;
320 306
321 /*Demod 1*/ 307 /*Demods */
322 s32 tuner1_freq; 308 s32 freq[2];
323 s32 tuner1_bw; 309 s32 bw[2];
324 s32 dmd1_symbol_rate; 310 s32 symbol_rate[2];
325 s32 dmd1_srch_range; 311 s32 srch_range[2];
326 312
327 /* algorithm for search Blind, Cold or Warm*/ 313 /* algorithm for search Blind, Cold or Warm*/
328 enum fe_stv0900_search_algo dmd1_srch_algo; 314 enum fe_stv0900_search_algo srch_algo[2];
329 /* search standard: Auto, DVBS1/DSS only or DVBS2 only*/ 315 /* search standard: Auto, DVBS1/DSS only or DVBS2 only*/
330 enum fe_stv0900_search_standard dmd1_srch_standard; 316 enum fe_stv0900_search_standard srch_standard[2];
331 /* inversion search : auto, auto norma first, normal or inverted */ 317 /* inversion search : auto, auto norma first, normal or inverted */
332 enum fe_stv0900_search_iq dmd1_srch_iq_inv; 318 enum fe_stv0900_search_iq srch_iq_inv[2];
333 enum fe_stv0900_modcode dmd1_modcode; 319 enum fe_stv0900_modcode modcode[2];
334 enum fe_stv0900_modulation dmd1_modulation; 320 enum fe_stv0900_modulation modulation[2];
335 enum fe_stv0900_fec dmd1_fec; 321 enum fe_stv0900_fec fec[2];
336
337 struct stv0900_signal_info dmd1_rslts;
338 enum fe_stv0900_signal_type dmd1_state;
339 322
340 enum fe_stv0900_error dmd1_err; 323 struct stv0900_signal_info result[2];
324 enum fe_stv0900_error err[2];
341 325
342 /*Demod 2*/
343 s32 tuner2_freq;
344 s32 tuner2_bw;
345 s32 dmd2_symbol_rate;
346 s32 dmd2_srch_range;
347
348 enum fe_stv0900_search_algo dmd2_srch_algo;
349 enum fe_stv0900_search_standard dmd2_srch_stndrd;
350 /* inversion search : auto, auto normal first, normal or inverted */
351 enum fe_stv0900_search_iq dmd2_srch_iq_inv;
352 enum fe_stv0900_modcode dmd2_modcode;
353 enum fe_stv0900_modulation dmd2_modulation;
354 enum fe_stv0900_fec dmd2_fec;
355
356 /* results of the search*/
357 struct stv0900_signal_info dmd2_rslts;
358 /* current state of the search algorithm */
359 enum fe_stv0900_signal_type dmd2_state;
360
361 enum fe_stv0900_error dmd2_err;
362 326
363 struct i2c_adapter *i2c_adap; 327 struct i2c_adapter *i2c_adap;
364 u8 i2c_addr; 328 u8 i2c_addr;
@@ -379,6 +343,8 @@ struct stv0900_state {
379 int demod; 343 int demod;
380}; 344};
381 345
346extern int stvdebug;
347
382extern s32 ge2comp(s32 a, s32 width); 348extern s32 ge2comp(s32 a, s32 width);
383 349
384extern void stv0900_write_reg(struct stv0900_internal *i_params, 350extern void stv0900_write_reg(struct stv0900_internal *i_params,
@@ -418,13 +384,14 @@ extern u8 stv0900_get_optim_short_carr_loop(s32 srate,
418extern void stv0900_stop_all_s2_modcod(struct stv0900_internal *i_params, 384extern void stv0900_stop_all_s2_modcod(struct stv0900_internal *i_params,
419 enum fe_stv0900_demod_num demod); 385 enum fe_stv0900_demod_num demod);
420 386
421extern void stv0900_activate_s2_modcode(struct stv0900_internal *i_params, 387extern void stv0900_activate_s2_modcod(struct stv0900_internal *i_params,
422 enum fe_stv0900_demod_num demod); 388 enum fe_stv0900_demod_num demod);
423 389
424extern void stv0900_activate_s2_modcode_single(struct stv0900_internal *i_params, 390extern void stv0900_activate_s2_modcod_single(struct stv0900_internal *i_params,
425 enum fe_stv0900_demod_num demod); 391 enum fe_stv0900_demod_num demod);
426 392
427extern enum fe_stv0900_tracking_standard stv0900_get_standard(struct dvb_frontend *fe, 393extern enum
394fe_stv0900_tracking_standard stv0900_get_standard(struct dvb_frontend *fe,
428 enum fe_stv0900_demod_num demod); 395 enum fe_stv0900_demod_num demod);
429 396
430#endif 397#endif