aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/frontends')
-rw-r--r--drivers/media/dvb/frontends/Makefile2
-rw-r--r--drivers/media/dvb/frontends/cx22702.c1
-rw-r--r--drivers/media/dvb/frontends/cx24123.c2
-rw-r--r--drivers/media/dvb/frontends/dvb-pll.c256
-rw-r--r--drivers/media/dvb/frontends/dvb-pll.h73
-rw-r--r--drivers/media/dvb/frontends/nxt200x.c23
-rw-r--r--drivers/media/dvb/frontends/nxt200x.h3
-rw-r--r--drivers/media/dvb/frontends/or51132.c1
-rw-r--r--drivers/media/dvb/frontends/or51211.c31
-rw-r--r--drivers/media/dvb/frontends/stv0299.c2
-rw-r--r--drivers/media/dvb/frontends/tda10023.c2
11 files changed, 200 insertions, 196 deletions
diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile
index 27f386585d43..156b062e02c4 100644
--- a/drivers/media/dvb/frontends/Makefile
+++ b/drivers/media/dvb/frontends/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the kernel DVB frontend device drivers. 2# Makefile for the kernel DVB frontend device drivers.
3# 3#
4 4
5EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ 5EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/
6 6
7obj-$(CONFIG_DVB_PLL) += dvb-pll.o 7obj-$(CONFIG_DVB_PLL) += dvb-pll.o
8obj-$(CONFIG_DVB_STV0299) += stv0299.o 8obj-$(CONFIG_DVB_STV0299) += stv0299.o
diff --git a/drivers/media/dvb/frontends/cx22702.c b/drivers/media/dvb/frontends/cx22702.c
index 335219ebce2d..1dc164d5488c 100644
--- a/drivers/media/dvb/frontends/cx22702.c
+++ b/drivers/media/dvb/frontends/cx22702.c
@@ -32,7 +32,6 @@
32#include <linux/slab.h> 32#include <linux/slab.h>
33#include <linux/delay.h> 33#include <linux/delay.h>
34#include "dvb_frontend.h" 34#include "dvb_frontend.h"
35#include "dvb-pll.h"
36#include "cx22702.h" 35#include "cx22702.h"
37 36
38 37
diff --git a/drivers/media/dvb/frontends/cx24123.c b/drivers/media/dvb/frontends/cx24123.c
index 732e94aaa364..0834c0677fef 100644
--- a/drivers/media/dvb/frontends/cx24123.c
+++ b/drivers/media/dvb/frontends/cx24123.c
@@ -917,7 +917,7 @@ static int cx24123_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone)
917static int cx24123_tune(struct dvb_frontend* fe, 917static int cx24123_tune(struct dvb_frontend* fe,
918 struct dvb_frontend_parameters* params, 918 struct dvb_frontend_parameters* params,
919 unsigned int mode_flags, 919 unsigned int mode_flags,
920 int *delay, 920 unsigned int *delay,
921 fe_status_t *status) 921 fe_status_t *status)
922{ 922{
923 int retval = 0; 923 int retval = 0;
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c
index 5f96ffda91ad..0c0b94767bc1 100644
--- a/drivers/media/dvb/frontends/dvb-pll.c
+++ b/drivers/media/dvb/frontends/dvb-pll.c
@@ -24,6 +24,23 @@
24 24
25#include "dvb-pll.h" 25#include "dvb-pll.h"
26 26
27struct dvb_pll_desc {
28 char *name;
29 u32 min;
30 u32 max;
31 u32 iffreq;
32 void (*set)(u8 *buf, const struct dvb_frontend_parameters *params);
33 u8 *initdata;
34 u8 *sleepdata;
35 int count;
36 struct {
37 u32 limit;
38 u32 stepsize;
39 u8 config;
40 u8 cb;
41 } entries[12];
42};
43
27/* ----------------------------------------------------------- */ 44/* ----------------------------------------------------------- */
28/* descriptions */ 45/* descriptions */
29 46
@@ -38,7 +55,13 @@
38 0x50 = AGC Take over point = 103 dBuV */ 55 0x50 = AGC Take over point = 103 dBuV */
39static u8 tua603x_agc103[] = { 2, 0x80|0x40|0x18|0x06|0x01, 0x00|0x50 }; 56static u8 tua603x_agc103[] = { 2, 0x80|0x40|0x18|0x06|0x01, 0x00|0x50 };
40 57
41struct dvb_pll_desc dvb_pll_thomson_dtt7579 = { 58/* 0x04 = 166.67 kHz divider
59
60 0x80 = AGC Time constant 50ms Iagc = 9 uA
61 0x20 = AGC Take over point = 112 dBuV */
62static u8 tua603x_agc112[] = { 2, 0x80|0x40|0x18|0x04|0x01, 0x80|0x20 };
63
64static struct dvb_pll_desc dvb_pll_thomson_dtt7579 = {
42 .name = "Thomson dtt7579", 65 .name = "Thomson dtt7579",
43 .min = 177000000, 66 .min = 177000000,
44 .max = 858000000, 67 .max = 858000000,
@@ -52,9 +75,8 @@ struct dvb_pll_desc dvb_pll_thomson_dtt7579 = {
52 { 999999999, 166667, 0xf4, 0x08 }, 75 { 999999999, 166667, 0xf4, 0x08 },
53 }, 76 },
54}; 77};
55EXPORT_SYMBOL(dvb_pll_thomson_dtt7579);
56 78
57struct dvb_pll_desc dvb_pll_thomson_dtt7610 = { 79static struct dvb_pll_desc dvb_pll_thomson_dtt7610 = {
58 .name = "Thomson dtt7610", 80 .name = "Thomson dtt7610",
59 .min = 44000000, 81 .min = 44000000,
60 .max = 958000000, 82 .max = 958000000,
@@ -66,19 +88,19 @@ struct dvb_pll_desc dvb_pll_thomson_dtt7610 = {
66 { 999999999, 62500, 0x8e, 0x3c }, 88 { 999999999, 62500, 0x8e, 0x3c },
67 }, 89 },
68}; 90};
69EXPORT_SYMBOL(dvb_pll_thomson_dtt7610);
70 91
71static void thomson_dtt759x_bw(u8 *buf, u32 freq, int bandwidth) 92static void thomson_dtt759x_bw(u8 *buf,
93 const struct dvb_frontend_parameters *params)
72{ 94{
73 if (BANDWIDTH_7_MHZ == bandwidth) 95 if (BANDWIDTH_7_MHZ == params->u.ofdm.bandwidth)
74 buf[3] |= 0x10; 96 buf[3] |= 0x10;
75} 97}
76 98
77struct dvb_pll_desc dvb_pll_thomson_dtt759x = { 99static struct dvb_pll_desc dvb_pll_thomson_dtt759x = {
78 .name = "Thomson dtt759x", 100 .name = "Thomson dtt759x",
79 .min = 177000000, 101 .min = 177000000,
80 .max = 896000000, 102 .max = 896000000,
81 .setbw = thomson_dtt759x_bw, 103 .set = thomson_dtt759x_bw,
82 .iffreq= 36166667, 104 .iffreq= 36166667,
83 .sleepdata = (u8[]){ 2, 0x84, 0x03 }, 105 .sleepdata = (u8[]){ 2, 0x84, 0x03 },
84 .count = 5, 106 .count = 5,
@@ -90,9 +112,8 @@ struct dvb_pll_desc dvb_pll_thomson_dtt759x = {
90 { 999999999, 166667, 0xfc, 0x08 }, 112 { 999999999, 166667, 0xfc, 0x08 },
91 }, 113 },
92}; 114};
93EXPORT_SYMBOL(dvb_pll_thomson_dtt759x);
94 115
95struct dvb_pll_desc dvb_pll_lg_z201 = { 116static struct dvb_pll_desc dvb_pll_lg_z201 = {
96 .name = "LG z201", 117 .name = "LG z201",
97 .min = 174000000, 118 .min = 174000000,
98 .max = 862000000, 119 .max = 862000000,
@@ -107,9 +128,8 @@ struct dvb_pll_desc dvb_pll_lg_z201 = {
107 { 999999999, 166667, 0xfc, 0x04 }, 128 { 999999999, 166667, 0xfc, 0x04 },
108 }, 129 },
109}; 130};
110EXPORT_SYMBOL(dvb_pll_lg_z201);
111 131
112struct dvb_pll_desc dvb_pll_microtune_4042 = { 132static struct dvb_pll_desc dvb_pll_microtune_4042 = {
113 .name = "Microtune 4042 FI5", 133 .name = "Microtune 4042 FI5",
114 .min = 57000000, 134 .min = 57000000,
115 .max = 858000000, 135 .max = 858000000,
@@ -121,9 +141,8 @@ struct dvb_pll_desc dvb_pll_microtune_4042 = {
121 { 999999999, 62500, 0x8e, 0x31 }, 141 { 999999999, 62500, 0x8e, 0x31 },
122 }, 142 },
123}; 143};
124EXPORT_SYMBOL(dvb_pll_microtune_4042);
125 144
126struct dvb_pll_desc dvb_pll_thomson_dtt761x = { 145static struct dvb_pll_desc dvb_pll_thomson_dtt761x = {
127 /* DTT 7611 7611A 7612 7613 7613A 7614 7615 7615A */ 146 /* DTT 7611 7611A 7612 7613 7613A 7614 7615 7615A */
128 .name = "Thomson dtt761x", 147 .name = "Thomson dtt761x",
129 .min = 57000000, 148 .min = 57000000,
@@ -137,9 +156,8 @@ struct dvb_pll_desc dvb_pll_thomson_dtt761x = {
137 { 999999999, 62500, 0x8e, 0x3c }, 156 { 999999999, 62500, 0x8e, 0x3c },
138 }, 157 },
139}; 158};
140EXPORT_SYMBOL(dvb_pll_thomson_dtt761x);
141 159
142struct dvb_pll_desc dvb_pll_unknown_1 = { 160static struct dvb_pll_desc dvb_pll_unknown_1 = {
143 .name = "unknown 1", /* used by dntv live dvb-t */ 161 .name = "unknown 1", /* used by dntv live dvb-t */
144 .min = 174000000, 162 .min = 174000000,
145 .max = 862000000, 163 .max = 862000000,
@@ -157,12 +175,11 @@ struct dvb_pll_desc dvb_pll_unknown_1 = {
157 { 999999999, 166667, 0xfc, 0x08 }, 175 { 999999999, 166667, 0xfc, 0x08 },
158 }, 176 },
159}; 177};
160EXPORT_SYMBOL(dvb_pll_unknown_1);
161 178
162/* Infineon TUA6010XS 179/* Infineon TUA6010XS
163 * used in Thomson Cable Tuner 180 * used in Thomson Cable Tuner
164 */ 181 */
165struct dvb_pll_desc dvb_pll_tua6010xs = { 182static struct dvb_pll_desc dvb_pll_tua6010xs = {
166 .name = "Infineon TUA6010XS", 183 .name = "Infineon TUA6010XS",
167 .min = 44250000, 184 .min = 44250000,
168 .max = 858000000, 185 .max = 858000000,
@@ -174,10 +191,9 @@ struct dvb_pll_desc dvb_pll_tua6010xs = {
174 { 999999999, 62500, 0x8e, 0x85 }, 191 { 999999999, 62500, 0x8e, 0x85 },
175 }, 192 },
176}; 193};
177EXPORT_SYMBOL(dvb_pll_tua6010xs);
178 194
179/* Panasonic env57h1xd5 (some Philips PLL ?) */ 195/* Panasonic env57h1xd5 (some Philips PLL ?) */
180struct dvb_pll_desc dvb_pll_env57h1xd5 = { 196static struct dvb_pll_desc dvb_pll_env57h1xd5 = {
181 .name = "Panasonic ENV57H1XD5", 197 .name = "Panasonic ENV57H1XD5",
182 .min = 44250000, 198 .min = 44250000,
183 .max = 858000000, 199 .max = 858000000,
@@ -190,23 +206,23 @@ struct dvb_pll_desc dvb_pll_env57h1xd5 = {
190 { 999999999, 166667, 0xc2, 0xa4 }, 206 { 999999999, 166667, 0xc2, 0xa4 },
191 }, 207 },
192}; 208};
193EXPORT_SYMBOL(dvb_pll_env57h1xd5);
194 209
195/* Philips TDA6650/TDA6651 210/* Philips TDA6650/TDA6651
196 * used in Panasonic ENV77H11D5 211 * used in Panasonic ENV77H11D5
197 */ 212 */
198static void tda665x_bw(u8 *buf, u32 freq, int bandwidth) 213static void tda665x_bw(u8 *buf, const struct dvb_frontend_parameters *params)
199{ 214{
200 if (bandwidth == BANDWIDTH_8_MHZ) 215 if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ)
201 buf[3] |= 0x08; 216 buf[3] |= 0x08;
202} 217}
203 218
204struct dvb_pll_desc dvb_pll_tda665x = { 219static struct dvb_pll_desc dvb_pll_tda665x = {
205 .name = "Philips TDA6650/TDA6651", 220 .name = "Philips TDA6650/TDA6651",
206 .min = 44250000, 221 .min = 44250000,
207 .max = 858000000, 222 .max = 858000000,
208 .setbw = tda665x_bw, 223 .set = tda665x_bw,
209 .iffreq= 36166667, 224 .iffreq= 36166667,
225 .initdata = (u8[]){ 4, 0x0b, 0xf5, 0x85, 0xab },
210 .count = 12, 226 .count = 12,
211 .entries = { 227 .entries = {
212 { 93834000, 166667, 0xca, 0x61 /* 011 0 0 0 01 */ }, 228 { 93834000, 166667, 0xca, 0x61 /* 011 0 0 0 01 */ },
@@ -223,36 +239,34 @@ struct dvb_pll_desc dvb_pll_tda665x = {
223 { 861000000, 166667, 0xca, 0xe4 /* 111 0 0 1 00 */ }, 239 { 861000000, 166667, 0xca, 0xe4 /* 111 0 0 1 00 */ },
224 } 240 }
225}; 241};
226EXPORT_SYMBOL(dvb_pll_tda665x);
227 242
228/* Infineon TUA6034 243/* Infineon TUA6034
229 * used in LG TDTP E102P 244 * used in LG TDTP E102P
230 */ 245 */
231static void tua6034_bw(u8 *buf, u32 freq, int bandwidth) 246static void tua6034_bw(u8 *buf, const struct dvb_frontend_parameters *params)
232{ 247{
233 if (BANDWIDTH_7_MHZ != bandwidth) 248 if (BANDWIDTH_7_MHZ != params->u.ofdm.bandwidth)
234 buf[3] |= 0x08; 249 buf[3] |= 0x08;
235} 250}
236 251
237struct dvb_pll_desc dvb_pll_tua6034 = { 252static struct dvb_pll_desc dvb_pll_tua6034 = {
238 .name = "Infineon TUA6034", 253 .name = "Infineon TUA6034",
239 .min = 44250000, 254 .min = 44250000,
240 .max = 858000000, 255 .max = 858000000,
241 .iffreq= 36166667, 256 .iffreq= 36166667,
242 .count = 3, 257 .count = 3,
243 .setbw = tua6034_bw, 258 .set = tua6034_bw,
244 .entries = { 259 .entries = {
245 { 174500000, 62500, 0xce, 0x01 }, 260 { 174500000, 62500, 0xce, 0x01 },
246 { 230000000, 62500, 0xce, 0x02 }, 261 { 230000000, 62500, 0xce, 0x02 },
247 { 999999999, 62500, 0xce, 0x04 }, 262 { 999999999, 62500, 0xce, 0x04 },
248 }, 263 },
249}; 264};
250EXPORT_SYMBOL(dvb_pll_tua6034);
251 265
252/* Infineon TUA6034 266/* Infineon TUA6034
253 * used in LG TDVS-H061F, LG TDVS-H062F and LG TDVS-H064F 267 * used in LG TDVS-H061F, LG TDVS-H062F and LG TDVS-H064F
254 */ 268 */
255struct dvb_pll_desc dvb_pll_lg_tdvs_h06xf = { 269static struct dvb_pll_desc dvb_pll_lg_tdvs_h06xf = {
256 .name = "LG TDVS-H06xF", 270 .name = "LG TDVS-H06xF",
257 .min = 54000000, 271 .min = 54000000,
258 .max = 863000000, 272 .max = 863000000,
@@ -265,23 +279,25 @@ struct dvb_pll_desc dvb_pll_lg_tdvs_h06xf = {
265 { 999999999, 62500, 0xce, 0x04 }, 279 { 999999999, 62500, 0xce, 0x04 },
266 }, 280 },
267}; 281};
268EXPORT_SYMBOL(dvb_pll_lg_tdvs_h06xf);
269 282
270/* Philips FMD1216ME 283/* Philips FMD1216ME
271 * used in Medion Hybrid PCMCIA card and USB Box 284 * used in Medion Hybrid PCMCIA card and USB Box
272 */ 285 */
273static void fmd1216me_bw(u8 *buf, u32 freq, int bandwidth) 286static void fmd1216me_bw(u8 *buf, const struct dvb_frontend_parameters *params)
274{ 287{
275 if (bandwidth == BANDWIDTH_8_MHZ && freq >= 158870000) 288 if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ &&
289 params->frequency >= 158870000)
276 buf[3] |= 0x08; 290 buf[3] |= 0x08;
277} 291}
278 292
279struct dvb_pll_desc dvb_pll_fmd1216me = { 293static struct dvb_pll_desc dvb_pll_fmd1216me = {
280 .name = "Philips FMD1216ME", 294 .name = "Philips FMD1216ME",
281 .min = 50870000, 295 .min = 50870000,
282 .max = 858000000, 296 .max = 858000000,
283 .iffreq= 36125000, 297 .iffreq= 36125000,
284 .setbw = fmd1216me_bw, 298 .set = fmd1216me_bw,
299 .initdata = tua603x_agc112,
300 .sleepdata = (u8[]){ 4, 0x9c, 0x60, 0x85, 0x54 },
285 .count = 7, 301 .count = 7,
286 .entries = { 302 .entries = {
287 { 143870000, 166667, 0xbc, 0x41 }, 303 { 143870000, 166667, 0xbc, 0x41 },
@@ -293,23 +309,22 @@ struct dvb_pll_desc dvb_pll_fmd1216me = {
293 { 999999999, 166667, 0xfc, 0x44 }, 309 { 999999999, 166667, 0xfc, 0x44 },
294 } 310 }
295}; 311};
296EXPORT_SYMBOL(dvb_pll_fmd1216me);
297 312
298/* ALPS TDED4 313/* ALPS TDED4
299 * used in Nebula-Cards and USB boxes 314 * used in Nebula-Cards and USB boxes
300 */ 315 */
301static void tded4_bw(u8 *buf, u32 freq, int bandwidth) 316static void tded4_bw(u8 *buf, const struct dvb_frontend_parameters *params)
302{ 317{
303 if (bandwidth == BANDWIDTH_8_MHZ) 318 if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ)
304 buf[3] |= 0x04; 319 buf[3] |= 0x04;
305} 320}
306 321
307struct dvb_pll_desc dvb_pll_tded4 = { 322static struct dvb_pll_desc dvb_pll_tded4 = {
308 .name = "ALPS TDED4", 323 .name = "ALPS TDED4",
309 .min = 47000000, 324 .min = 47000000,
310 .max = 863000000, 325 .max = 863000000,
311 .iffreq= 36166667, 326 .iffreq= 36166667,
312 .setbw = tded4_bw, 327 .set = tded4_bw,
313 .count = 4, 328 .count = 4,
314 .entries = { 329 .entries = {
315 { 153000000, 166667, 0x85, 0x01 }, 330 { 153000000, 166667, 0x85, 0x01 },
@@ -318,12 +333,11 @@ struct dvb_pll_desc dvb_pll_tded4 = {
318 { 999999999, 166667, 0x85, 0x88 }, 333 { 999999999, 166667, 0x85, 0x88 },
319 } 334 }
320}; 335};
321EXPORT_SYMBOL(dvb_pll_tded4);
322 336
323/* ALPS TDHU2 337/* ALPS TDHU2
324 * used in AverTVHD MCE A180 338 * used in AverTVHD MCE A180
325 */ 339 */
326struct dvb_pll_desc dvb_pll_tdhu2 = { 340static struct dvb_pll_desc dvb_pll_tdhu2 = {
327 .name = "ALPS TDHU2", 341 .name = "ALPS TDHU2",
328 .min = 54000000, 342 .min = 54000000,
329 .max = 864000000, 343 .max = 864000000,
@@ -336,16 +350,29 @@ struct dvb_pll_desc dvb_pll_tdhu2 = {
336 { 999999999, 62500, 0x85, 0x88 }, 350 { 999999999, 62500, 0x85, 0x88 },
337 } 351 }
338}; 352};
339EXPORT_SYMBOL(dvb_pll_tdhu2);
340 353
341/* Philips TUV1236D 354/* Philips TUV1236D
342 * used in ATI HDTV Wonder 355 * used in ATI HDTV Wonder
343 */ 356 */
344struct dvb_pll_desc dvb_pll_tuv1236d = { 357static void tuv1236d_rf(u8 *buf, const struct dvb_frontend_parameters *params)
358{
359 switch (params->u.vsb.modulation) {
360 case QAM_64:
361 case QAM_256:
362 buf[3] |= 0x08;
363 break;
364 case VSB_8:
365 default:
366 buf[3] &= ~0x08;
367 }
368}
369
370static struct dvb_pll_desc dvb_pll_tuv1236d = {
345 .name = "Philips TUV1236D", 371 .name = "Philips TUV1236D",
346 .min = 54000000, 372 .min = 54000000,
347 .max = 864000000, 373 .max = 864000000,
348 .iffreq= 44000000, 374 .iffreq= 44000000,
375 .set = tuv1236d_rf,
349 .count = 3, 376 .count = 3,
350 .entries = { 377 .entries = {
351 { 157250000, 62500, 0xc6, 0x41 }, 378 { 157250000, 62500, 0xc6, 0x41 },
@@ -353,12 +380,11 @@ struct dvb_pll_desc dvb_pll_tuv1236d = {
353 { 999999999, 62500, 0xc6, 0x44 }, 380 { 999999999, 62500, 0xc6, 0x44 },
354 }, 381 },
355}; 382};
356EXPORT_SYMBOL(dvb_pll_tuv1236d);
357 383
358/* Samsung TBMV30111IN / TBMV30712IN1 384/* Samsung TBMV30111IN / TBMV30712IN1
359 * used in Air2PC ATSC - 2nd generation (nxt2002) 385 * used in Air2PC ATSC - 2nd generation (nxt2002)
360 */ 386 */
361struct dvb_pll_desc dvb_pll_samsung_tbmv = { 387static struct dvb_pll_desc dvb_pll_samsung_tbmv = {
362 .name = "Samsung TBMV30111IN / TBMV30712IN1", 388 .name = "Samsung TBMV30111IN / TBMV30712IN1",
363 .min = 54000000, 389 .min = 54000000,
364 .max = 860000000, 390 .max = 860000000,
@@ -373,12 +399,11 @@ struct dvb_pll_desc dvb_pll_samsung_tbmv = {
373 { 999999999, 166667, 0xfc, 0x02 }, 399 { 999999999, 166667, 0xfc, 0x02 },
374 } 400 }
375}; 401};
376EXPORT_SYMBOL(dvb_pll_samsung_tbmv);
377 402
378/* 403/*
379 * Philips SD1878 Tuner. 404 * Philips SD1878 Tuner.
380 */ 405 */
381struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261 = { 406static struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261 = {
382 .name = "Philips SD1878", 407 .name = "Philips SD1878",
383 .min = 950000, 408 .min = 950000,
384 .max = 2150000, 409 .max = 2150000,
@@ -391,19 +416,18 @@ struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261 = {
391 { 2150000, 500, 0xc4, 0xc0}, 416 { 2150000, 500, 0xc4, 0xc0},
392 }, 417 },
393}; 418};
394EXPORT_SYMBOL(dvb_pll_philips_sd1878_tda8261);
395 419
396/* 420/*
397 * Philips TD1316 Tuner. 421 * Philips TD1316 Tuner.
398 */ 422 */
399static void td1316_bw(u8 *buf, u32 freq, int bandwidth) 423static void td1316_bw(u8 *buf, const struct dvb_frontend_parameters *params)
400{ 424{
401 u8 band; 425 u8 band;
402 426
403 /* determine band */ 427 /* determine band */
404 if (freq < 161000000) 428 if (params->frequency < 161000000)
405 band = 1; 429 band = 1;
406 else if (freq < 444000000) 430 else if (params->frequency < 444000000)
407 band = 2; 431 band = 2;
408 else 432 else
409 band = 4; 433 band = 4;
@@ -411,16 +435,16 @@ static void td1316_bw(u8 *buf, u32 freq, int bandwidth)
411 buf[3] |= band; 435 buf[3] |= band;
412 436
413 /* setup PLL filter */ 437 /* setup PLL filter */
414 if (bandwidth == BANDWIDTH_8_MHZ) 438 if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ)
415 buf[3] |= 1 << 3; 439 buf[3] |= 1 << 3;
416} 440}
417 441
418struct dvb_pll_desc dvb_pll_philips_td1316 = { 442static struct dvb_pll_desc dvb_pll_philips_td1316 = {
419 .name = "Philips TD1316", 443 .name = "Philips TD1316",
420 .min = 87000000, 444 .min = 87000000,
421 .max = 895000000, 445 .max = 895000000,
422 .iffreq= 36166667, 446 .iffreq= 36166667,
423 .setbw = td1316_bw, 447 .set = td1316_bw,
424 .count = 9, 448 .count = 9,
425 .entries = { 449 .entries = {
426 { 93834000, 166667, 0xca, 0x60}, 450 { 93834000, 166667, 0xca, 0x60},
@@ -434,10 +458,9 @@ struct dvb_pll_desc dvb_pll_philips_td1316 = {
434 { 858834000, 166667, 0xca, 0xe0}, 458 { 858834000, 166667, 0xca, 0xe0},
435 }, 459 },
436}; 460};
437EXPORT_SYMBOL(dvb_pll_philips_td1316);
438 461
439/* FE6600 used on DViCO Hybrid */ 462/* FE6600 used on DViCO Hybrid */
440struct dvb_pll_desc dvb_pll_thomson_fe6600 = { 463static struct dvb_pll_desc dvb_pll_thomson_fe6600 = {
441 .name = "Thomson FE6600", 464 .name = "Thomson FE6600",
442 .min = 44250000, 465 .min = 44250000,
443 .max = 858000000, 466 .max = 858000000,
@@ -450,19 +473,19 @@ struct dvb_pll_desc dvb_pll_thomson_fe6600 = {
450 { 999999999, 166667, 0xf4, 0x18 }, 473 { 999999999, 166667, 0xf4, 0x18 },
451 } 474 }
452}; 475};
453EXPORT_SYMBOL(dvb_pll_thomson_fe6600); 476
454static void opera1_bw(u8 *buf, u32 freq, int bandwidth) 477static void opera1_bw(u8 *buf, const struct dvb_frontend_parameters *params)
455{ 478{
456 if (bandwidth == BANDWIDTH_8_MHZ) 479 if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ)
457 buf[2] |= 0x08; 480 buf[2] |= 0x08;
458} 481}
459 482
460struct dvb_pll_desc dvb_pll_opera1 = { 483static struct dvb_pll_desc dvb_pll_opera1 = {
461 .name = "Opera Tuner", 484 .name = "Opera Tuner",
462 .min = 900000, 485 .min = 900000,
463 .max = 2250000, 486 .max = 2250000,
464 .iffreq= 0, 487 .iffreq= 0,
465 .setbw = opera1_bw, 488 .set = opera1_bw,
466 .count = 8, 489 .count = 8,
467 .entries = { 490 .entries = {
468 { 1064000, 500, 0xe5, 0xc6 }, 491 { 1064000, 500, 0xe5, 0xc6 },
@@ -475,7 +498,54 @@ struct dvb_pll_desc dvb_pll_opera1 = {
475 { 2250000, 500, 0xe5, 0xc4 }, 498 { 2250000, 500, 0xe5, 0xc4 },
476 } 499 }
477}; 500};
478EXPORT_SYMBOL(dvb_pll_opera1); 501
502/* Philips FCV1236D
503 */
504struct dvb_pll_desc dvb_pll_fcv1236d = {
505/* Bit_0: RF Input select
506 * Bit_1: 0=digital, 1=analog
507 */
508 .name = "Philips FCV1236D",
509 .min = 53000000,
510 .max = 803000000,
511 .iffreq= 44000000,
512 .count = 3,
513 .entries = {
514 { 159000000, 62500, 0x8e, 0xa0 },
515 { 453000000, 62500, 0x8e, 0x90 },
516 { 999999999, 62500, 0x8e, 0x30 },
517 },
518};
519
520/* ----------------------------------------------------------- */
521
522static struct dvb_pll_desc *pll_list[] = {
523 [DVB_PLL_UNDEFINED] = NULL,
524 [DVB_PLL_THOMSON_DTT7579] = &dvb_pll_thomson_dtt7579,
525 [DVB_PLL_THOMSON_DTT759X] = &dvb_pll_thomson_dtt759x,
526 [DVB_PLL_THOMSON_DTT7610] = &dvb_pll_thomson_dtt7610,
527 [DVB_PLL_LG_Z201] = &dvb_pll_lg_z201,
528 [DVB_PLL_MICROTUNE_4042] = &dvb_pll_microtune_4042,
529 [DVB_PLL_THOMSON_DTT761X] = &dvb_pll_thomson_dtt761x,
530 [DVB_PLL_UNKNOWN_1] = &dvb_pll_unknown_1,
531 [DVB_PLL_TUA6010XS] = &dvb_pll_tua6010xs,
532 [DVB_PLL_ENV57H1XD5] = &dvb_pll_env57h1xd5,
533 [DVB_PLL_TUA6034] = &dvb_pll_tua6034,
534 [DVB_PLL_LG_TDVS_H06XF] = &dvb_pll_lg_tdvs_h06xf,
535 [DVB_PLL_TDA665X] = &dvb_pll_tda665x,
536 [DVB_PLL_FMD1216ME] = &dvb_pll_fmd1216me,
537 [DVB_PLL_TDED4] = &dvb_pll_tded4,
538 [DVB_PLL_TUV1236D] = &dvb_pll_tuv1236d,
539 [DVB_PLL_TDHU2] = &dvb_pll_tdhu2,
540 [DVB_PLL_SAMSUNG_TBMV] = &dvb_pll_samsung_tbmv,
541 [DVB_PLL_PHILIPS_SD1878_TDA8261] = &dvb_pll_philips_sd1878_tda8261,
542 [DVB_PLL_PHILIPS_TD1316] = &dvb_pll_philips_td1316,
543 [DVB_PLL_THOMSON_FE6600] = &dvb_pll_thomson_fe6600,
544 [DVB_PLL_OPERA1] = &dvb_pll_opera1,
545 [DVB_PLL_FCV1236D] = &dvb_pll_fcv1236d,
546};
547
548/* ----------------------------------------------------------- */
479 549
480struct dvb_pll_priv { 550struct dvb_pll_priv {
481 /* i2c details */ 551 /* i2c details */
@@ -497,35 +567,37 @@ static int debug = 0;
497module_param(debug, int, 0644); 567module_param(debug, int, 0644);
498MODULE_PARM_DESC(debug, "enable verbose debug messages"); 568MODULE_PARM_DESC(debug, "enable verbose debug messages");
499 569
500int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, 570static int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf,
501 u32 freq, int bandwidth) 571 const struct dvb_frontend_parameters *params)
502{ 572{
503 u32 div; 573 u32 div;
504 int i; 574 int i;
505 575
506 if (freq != 0 && (freq < desc->min || freq > desc->max)) 576 if (params->frequency != 0 && (params->frequency < desc->min ||
507 return -EINVAL; 577 params->frequency > desc->max))
578 return -EINVAL;
508 579
509 for (i = 0; i < desc->count; i++) { 580 for (i = 0; i < desc->count; i++) {
510 if (freq > desc->entries[i].limit) 581 if (params->frequency > desc->entries[i].limit)
511 continue; 582 continue;
512 break; 583 break;
513 } 584 }
585
514 if (debug) 586 if (debug)
515 printk("pll: %s: freq=%d bw=%d | i=%d/%d\n", 587 printk("pll: %s: freq=%d | i=%d/%d\n", desc->name,
516 desc->name, freq, bandwidth, i, desc->count); 588 params->frequency, i, desc->count);
517 if (i == desc->count) 589 if (i == desc->count)
518 return -EINVAL; 590 return -EINVAL;
519 591
520 div = (freq + desc->iffreq + desc->entries[i].stepsize/2) / 592 div = (params->frequency + desc->iffreq +
521 desc->entries[i].stepsize; 593 desc->entries[i].stepsize/2) / desc->entries[i].stepsize;
522 buf[0] = div >> 8; 594 buf[0] = div >> 8;
523 buf[1] = div & 0xff; 595 buf[1] = div & 0xff;
524 buf[2] = desc->entries[i].config; 596 buf[2] = desc->entries[i].config;
525 buf[3] = desc->entries[i].cb; 597 buf[3] = desc->entries[i].cb;
526 598
527 if (desc->setbw) 599 if (desc->set)
528 desc->setbw(buf, freq, bandwidth); 600 desc->set(buf, params);
529 601
530 if (debug) 602 if (debug)
531 printk("pll: %s: div=%d | buf=0x%02x,0x%02x,0x%02x,0x%02x\n", 603 printk("pll: %s: div=%d | buf=0x%02x,0x%02x,0x%02x,0x%02x\n",
@@ -534,7 +606,6 @@ int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf,
534 // calculate the frequency we set it to 606 // calculate the frequency we set it to
535 return (div * desc->entries[i].stepsize) - desc->iffreq; 607 return (div * desc->entries[i].stepsize) - desc->iffreq;
536} 608}
537EXPORT_SYMBOL(dvb_pll_configure);
538 609
539static int dvb_pll_release(struct dvb_frontend *fe) 610static int dvb_pll_release(struct dvb_frontend *fe)
540{ 611{
@@ -578,18 +649,12 @@ static int dvb_pll_set_params(struct dvb_frontend *fe,
578 { .addr = priv->pll_i2c_address, .flags = 0, 649 { .addr = priv->pll_i2c_address, .flags = 0,
579 .buf = buf, .len = sizeof(buf) }; 650 .buf = buf, .len = sizeof(buf) };
580 int result; 651 int result;
581 u32 bandwidth = 0, frequency = 0; 652 u32 frequency = 0;
582 653
583 if (priv->i2c == NULL) 654 if (priv->i2c == NULL)
584 return -EINVAL; 655 return -EINVAL;
585 656
586 // DVBT bandwidth only just now 657 if ((result = dvb_pll_configure(priv->pll_desc, buf, params)) < 0)
587 if (fe->ops.info.type == FE_OFDM) {
588 bandwidth = params->u.ofdm.bandwidth;
589 }
590
591 if ((result = dvb_pll_configure(priv->pll_desc, buf,
592 params->frequency, bandwidth)) < 0)
593 return result; 658 return result;
594 else 659 else
595 frequency = result; 660 frequency = result;
@@ -601,7 +666,7 @@ static int dvb_pll_set_params(struct dvb_frontend *fe,
601 } 666 }
602 667
603 priv->frequency = frequency; 668 priv->frequency = frequency;
604 priv->bandwidth = bandwidth; 669 priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0;
605 670
606 return 0; 671 return 0;
607} 672}
@@ -612,18 +677,12 @@ static int dvb_pll_calc_regs(struct dvb_frontend *fe,
612{ 677{
613 struct dvb_pll_priv *priv = fe->tuner_priv; 678 struct dvb_pll_priv *priv = fe->tuner_priv;
614 int result; 679 int result;
615 u32 bandwidth = 0, frequency = 0; 680 u32 frequency = 0;
616 681
617 if (buf_len < 5) 682 if (buf_len < 5)
618 return -EINVAL; 683 return -EINVAL;
619 684
620 // DVBT bandwidth only just now 685 if ((result = dvb_pll_configure(priv->pll_desc, buf+1, params)) < 0)
621 if (fe->ops.info.type == FE_OFDM) {
622 bandwidth = params->u.ofdm.bandwidth;
623 }
624
625 if ((result = dvb_pll_configure(priv->pll_desc, buf+1,
626 params->frequency, bandwidth)) < 0)
627 return result; 686 return result;
628 else 687 else
629 frequency = result; 688 frequency = result;
@@ -631,7 +690,7 @@ static int dvb_pll_calc_regs(struct dvb_frontend *fe,
631 buf[0] = priv->pll_i2c_address; 690 buf[0] = priv->pll_i2c_address;
632 691
633 priv->frequency = frequency; 692 priv->frequency = frequency;
634 priv->bandwidth = bandwidth; 693 priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0;
635 694
636 return 5; 695 return 5;
637} 696}
@@ -687,13 +746,18 @@ static struct dvb_tuner_ops dvb_pll_tuner_ops = {
687 746
688struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, 747struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr,
689 struct i2c_adapter *i2c, 748 struct i2c_adapter *i2c,
690 struct dvb_pll_desc *desc) 749 unsigned int pll_desc_id)
691{ 750{
692 u8 b1 [] = { 0 }; 751 u8 b1 [] = { 0 };
693 struct i2c_msg msg = { .addr = pll_addr, .flags = I2C_M_RD, 752 struct i2c_msg msg = { .addr = pll_addr, .flags = I2C_M_RD,
694 .buf = b1, .len = 1 }; 753 .buf = b1, .len = 1 };
695 struct dvb_pll_priv *priv = NULL; 754 struct dvb_pll_priv *priv = NULL;
696 int ret; 755 int ret;
756 struct dvb_pll_desc *desc;
757
758 BUG_ON(pll_desc_id < 1 || pll_desc_id >= ARRAY_SIZE(pll_list));
759
760 desc = pll_list[pll_desc_id];
697 761
698 if (i2c != NULL) { 762 if (i2c != NULL) {
699 if (fe->ops.i2c_gate_ctrl) 763 if (fe->ops.i2c_gate_ctrl)
diff --git a/drivers/media/dvb/frontends/dvb-pll.h b/drivers/media/dvb/frontends/dvb-pll.h
index 5209f46f0893..e93a8104052b 100644
--- a/drivers/media/dvb/frontends/dvb-pll.h
+++ b/drivers/media/dvb/frontends/dvb-pll.h
@@ -8,50 +8,29 @@
8#include <linux/i2c.h> 8#include <linux/i2c.h>
9#include "dvb_frontend.h" 9#include "dvb_frontend.h"
10 10
11struct dvb_pll_desc { 11#define DVB_PLL_UNDEFINED 0
12 char *name; 12#define DVB_PLL_THOMSON_DTT7579 1
13 u32 min; 13#define DVB_PLL_THOMSON_DTT759X 2
14 u32 max; 14#define DVB_PLL_THOMSON_DTT7610 3
15 u32 iffreq; 15#define DVB_PLL_LG_Z201 4
16 void (*setbw)(u8 *buf, u32 freq, int bandwidth); 16#define DVB_PLL_MICROTUNE_4042 5
17 u8 *initdata; 17#define DVB_PLL_THOMSON_DTT761X 6
18 u8 *sleepdata; 18#define DVB_PLL_UNKNOWN_1 7
19 int count; 19#define DVB_PLL_TUA6010XS 8
20 struct { 20#define DVB_PLL_ENV57H1XD5 9
21 u32 limit; 21#define DVB_PLL_TUA6034 10
22 u32 stepsize; 22#define DVB_PLL_LG_TDVS_H06XF 11
23 u8 config; 23#define DVB_PLL_TDA665X 12
24 u8 cb; 24#define DVB_PLL_FMD1216ME 13
25 } entries[12]; 25#define DVB_PLL_TDED4 14
26}; 26#define DVB_PLL_TUV1236D 15
27 27#define DVB_PLL_TDHU2 16
28extern struct dvb_pll_desc dvb_pll_thomson_dtt7579; 28#define DVB_PLL_SAMSUNG_TBMV 17
29extern struct dvb_pll_desc dvb_pll_thomson_dtt759x; 29#define DVB_PLL_PHILIPS_SD1878_TDA8261 18
30extern struct dvb_pll_desc dvb_pll_thomson_dtt7610; 30#define DVB_PLL_PHILIPS_TD1316 19
31extern struct dvb_pll_desc dvb_pll_lg_z201; 31#define DVB_PLL_THOMSON_FE6600 20
32extern struct dvb_pll_desc dvb_pll_microtune_4042; 32#define DVB_PLL_OPERA1 21
33extern struct dvb_pll_desc dvb_pll_thomson_dtt761x; 33#define DVB_PLL_FCV1236D 22
34extern struct dvb_pll_desc dvb_pll_unknown_1;
35
36extern struct dvb_pll_desc dvb_pll_tua6010xs;
37extern struct dvb_pll_desc dvb_pll_env57h1xd5;
38extern struct dvb_pll_desc dvb_pll_tua6034;
39extern struct dvb_pll_desc dvb_pll_lg_tdvs_h06xf;
40extern struct dvb_pll_desc dvb_pll_tda665x;
41extern struct dvb_pll_desc dvb_pll_fmd1216me;
42extern struct dvb_pll_desc dvb_pll_tded4;
43
44extern struct dvb_pll_desc dvb_pll_tuv1236d;
45extern struct dvb_pll_desc dvb_pll_tdhu2;
46extern struct dvb_pll_desc dvb_pll_samsung_tbmv;
47extern struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261;
48extern struct dvb_pll_desc dvb_pll_philips_td1316;
49
50extern struct dvb_pll_desc dvb_pll_thomson_fe6600;
51extern struct dvb_pll_desc dvb_pll_opera1;
52
53extern int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf,
54 u32 freq, int bandwidth);
55 34
56/** 35/**
57 * Attach a dvb-pll to the supplied frontend structure. 36 * Attach a dvb-pll to the supplied frontend structure.
@@ -59,19 +38,19 @@ extern int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf,
59 * @param fe Frontend to attach to. 38 * @param fe Frontend to attach to.
60 * @param pll_addr i2c address of the PLL (if used). 39 * @param pll_addr i2c address of the PLL (if used).
61 * @param i2c i2c adapter to use (set to NULL if not used). 40 * @param i2c i2c adapter to use (set to NULL if not used).
62 * @param desc dvb_pll_desc to use. 41 * @param pll_desc_id dvb_pll_desc to use.
63 * @return Frontend pointer on success, NULL on failure 42 * @return Frontend pointer on success, NULL on failure
64 */ 43 */
65#if defined(CONFIG_DVB_PLL) || (defined(CONFIG_DVB_PLL_MODULE) && defined(MODULE)) 44#if defined(CONFIG_DVB_PLL) || (defined(CONFIG_DVB_PLL_MODULE) && defined(MODULE))
66extern struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, 45extern struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe,
67 int pll_addr, 46 int pll_addr,
68 struct i2c_adapter *i2c, 47 struct i2c_adapter *i2c,
69 struct dvb_pll_desc *desc); 48 unsigned int pll_desc_id);
70#else 49#else
71static inline struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, 50static inline struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe,
72 int pll_addr, 51 int pll_addr,
73 struct i2c_adapter *i2c, 52 struct i2c_adapter *i2c,
74 struct dvb_pll_desc *desc) 53 unsigned int pll_desc_id)
75{ 54{
76 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); 55 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
77 return NULL; 56 return NULL;
diff --git a/drivers/media/dvb/frontends/nxt200x.c b/drivers/media/dvb/frontends/nxt200x.c
index b809f83d9563..ddc84899cf86 100644
--- a/drivers/media/dvb/frontends/nxt200x.c
+++ b/drivers/media/dvb/frontends/nxt200x.c
@@ -49,7 +49,6 @@
49#include <linux/string.h> 49#include <linux/string.h>
50 50
51#include "dvb_frontend.h" 51#include "dvb_frontend.h"
52#include "dvb-pll.h"
53#include "nxt200x.h" 52#include "nxt200x.h"
54 53
55struct nxt200x_state { 54struct nxt200x_state {
@@ -546,11 +545,6 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe,
546 nxt200x_writebytes(state, 0x17, buf, 1); 545 nxt200x_writebytes(state, 0x17, buf, 1);
547 } 546 }
548 547
549 /* get tuning information */
550 if (fe->ops.tuner_ops.calc_regs) {
551 fe->ops.tuner_ops.calc_regs(fe, p, buf, 5);
552 }
553
554 /* set additional params */ 548 /* set additional params */
555 switch (p->u.vsb.modulation) { 549 switch (p->u.vsb.modulation) {
556 case QAM_64: 550 case QAM_64:
@@ -559,27 +553,24 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe,
559 /* This is just a guess since I am unable to test it */ 553 /* This is just a guess since I am unable to test it */
560 if (state->config->set_ts_params) 554 if (state->config->set_ts_params)
561 state->config->set_ts_params(fe, 1); 555 state->config->set_ts_params(fe, 1);
562
563 /* set input */
564 if (state->config->set_pll_input)
565 state->config->set_pll_input(buf+1, 1);
566 break; 556 break;
567 case VSB_8: 557 case VSB_8:
568 /* Set non-punctured clock for VSB */ 558 /* Set non-punctured clock for VSB */
569 if (state->config->set_ts_params) 559 if (state->config->set_ts_params)
570 state->config->set_ts_params(fe, 0); 560 state->config->set_ts_params(fe, 0);
571
572 /* set input */
573 if (state->config->set_pll_input)
574 state->config->set_pll_input(buf+1, 0);
575 break; 561 break;
576 default: 562 default:
577 return -EINVAL; 563 return -EINVAL;
578 break; 564 break;
579 } 565 }
580 566
581 /* write frequency information */ 567 if (fe->ops.tuner_ops.calc_regs) {
582 nxt200x_writetuner(state, buf); 568 /* get tuning information */
569 fe->ops.tuner_ops.calc_regs(fe, p, buf, 5);
570
571 /* write frequency information */
572 nxt200x_writetuner(state, buf);
573 }
583 574
584 /* reset the agc now that tuning has been completed */ 575 /* reset the agc now that tuning has been completed */
585 nxt200x_agc_reset(state); 576 nxt200x_agc_reset(state);
diff --git a/drivers/media/dvb/frontends/nxt200x.h b/drivers/media/dvb/frontends/nxt200x.h
index 28bc5591b319..bb0ef58d7972 100644
--- a/drivers/media/dvb/frontends/nxt200x.h
+++ b/drivers/media/dvb/frontends/nxt200x.h
@@ -38,9 +38,6 @@ struct nxt200x_config
38 /* the demodulator's i2c address */ 38 /* the demodulator's i2c address */
39 u8 demod_address; 39 u8 demod_address;
40 40
41 /* used to set pll input */
42 int (*set_pll_input)(u8* buf, int input);
43
44 /* need to set device param for start_dma */ 41 /* need to set device param for start_dma */
45 int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured); 42 int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured);
46}; 43};
diff --git a/drivers/media/dvb/frontends/or51132.c b/drivers/media/dvb/frontends/or51132.c
index 4e0aca7c67aa..3cc8b444b8f2 100644
--- a/drivers/media/dvb/frontends/or51132.c
+++ b/drivers/media/dvb/frontends/or51132.c
@@ -45,7 +45,6 @@
45 45
46#include "dvb_math.h" 46#include "dvb_math.h"
47#include "dvb_frontend.h" 47#include "dvb_frontend.h"
48#include "dvb-pll.h"
49#include "or51132.h" 48#include "or51132.h"
50 49
51static int debug; 50static int debug;
diff --git a/drivers/media/dvb/frontends/or51211.c b/drivers/media/dvb/frontends/or51211.c
index 048d7cfe12d3..f46d5a46683a 100644
--- a/drivers/media/dvb/frontends/or51211.c
+++ b/drivers/media/dvb/frontends/or51211.c
@@ -223,38 +223,13 @@ static int or51211_set_parameters(struct dvb_frontend* fe,
223 struct dvb_frontend_parameters *param) 223 struct dvb_frontend_parameters *param)
224{ 224{
225 struct or51211_state* state = fe->demodulator_priv; 225 struct or51211_state* state = fe->demodulator_priv;
226 u32 freq = 0;
227 u16 tunerfreq = 0;
228 u8 buf[4];
229 226
230 /* Change only if we are actually changing the channel */ 227 /* Change only if we are actually changing the channel */
231 if (state->current_frequency != param->frequency) { 228 if (state->current_frequency != param->frequency) {
232 freq = 44000 + (param->frequency/1000); 229 if (fe->ops.tuner_ops.set_params) {
233 tunerfreq = freq * 16/1000; 230 fe->ops.tuner_ops.set_params(fe, param);
234 231 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
235 dprintk("set_parameters frequency = %d (tunerfreq = %d)\n",
236 param->frequency,tunerfreq);
237
238 buf[0] = (tunerfreq >> 8) & 0x7F;
239 buf[1] = (tunerfreq & 0xFF);
240 buf[2] = 0x8E;
241
242 if (param->frequency < 157250000) {
243 buf[3] = 0xA0;
244 dprintk("set_parameters VHF low range\n");
245 } else if (param->frequency < 454000000) {
246 buf[3] = 0x90;
247 dprintk("set_parameters VHF high range\n");
248 } else {
249 buf[3] = 0x30;
250 dprintk("set_parameters UHF range\n");
251 } 232 }
252 dprintk("set_parameters tuner bytes: 0x%02x 0x%02x "
253 "0x%02x 0x%02x\n",buf[0],buf[1],buf[2],buf[3]);
254
255 if (i2c_writebytes(state,0xC2>>1,buf,4))
256 printk(KERN_WARNING "or51211:set_parameters error "
257 "writing to tuner\n");
258 233
259 /* Set to ATSC mode */ 234 /* Set to ATSC mode */
260 or51211_setmode(fe,0); 235 or51211_setmode(fe,0);
diff --git a/drivers/media/dvb/frontends/stv0299.c b/drivers/media/dvb/frontends/stv0299.c
index 18768d2f6d40..6c607302c1b6 100644
--- a/drivers/media/dvb/frontends/stv0299.c
+++ b/drivers/media/dvb/frontends/stv0299.c
@@ -249,7 +249,7 @@ static int stv0299_get_symbolrate (struct stv0299_state* state)
249 dprintk ("%s\n", __FUNCTION__); 249 dprintk ("%s\n", __FUNCTION__);
250 250
251 stv0299_readregs (state, 0x1f, sfr, 3); 251 stv0299_readregs (state, 0x1f, sfr, 3);
252 stv0299_readregs (state, 0x1a, &rtf, 1); 252 stv0299_readregs (state, 0x1a, (u8 *)&rtf, 1);
253 253
254 srate = (sfr[0] << 8) | sfr[1]; 254 srate = (sfr[0] << 8) | sfr[1];
255 srate *= Mclk; 255 srate *= Mclk;
diff --git a/drivers/media/dvb/frontends/tda10023.c b/drivers/media/dvb/frontends/tda10023.c
index da796e784be3..4bb06f97938b 100644
--- a/drivers/media/dvb/frontends/tda10023.c
+++ b/drivers/media/dvb/frontends/tda10023.c
@@ -478,7 +478,7 @@ struct dvb_frontend* tda10023_attach(const struct tda1002x_config* config,
478 state->i2c = i2c; 478 state->i2c = i2c;
479 memcpy(&state->frontend.ops, &tda10023_ops, sizeof(struct dvb_frontend_ops)); 479 memcpy(&state->frontend.ops, &tda10023_ops, sizeof(struct dvb_frontend_ops));
480 state->pwm = pwm; 480 state->pwm = pwm;
481 for (i=0; i < sizeof(tda10023_inittab)/sizeof(*tda10023_inittab);i+=3) { 481 for (i=0; i < ARRAY_SIZE(tda10023_inittab);i+=3) {
482 if (tda10023_inittab[i] == 0x00) { 482 if (tda10023_inittab[i] == 0x00) {
483 state->reg0 = tda10023_inittab[i+2]; 483 state->reg0 = tda10023_inittab[i+2];
484 break; 484 break;