diff options
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/saa7134/saa6752hs.c | 4 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-dvb.c | 420 |
2 files changed, 389 insertions, 35 deletions
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c index e6d0a18833d6..79d05ea1b69b 100644 --- a/drivers/media/video/saa7134/saa6752hs.c +++ b/drivers/media/video/saa7134/saa6752hs.c | |||
@@ -155,10 +155,6 @@ static struct v4l2_mpeg_compression param_defaults = | |||
155 | .target = 256, | 155 | .target = 256, |
156 | }, | 156 | }, |
157 | 157 | ||
158 | #if 0 | ||
159 | /* FIXME: size? via S_FMT? */ | ||
160 | .video_format = MPEG_VIDEO_FORMAT_D1, | ||
161 | #endif | ||
162 | }; | 158 | }; |
163 | 159 | ||
164 | /* ---------------------------------------------------------------------- */ | 160 | /* ---------------------------------------------------------------------- */ |
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index aa8e2cf62d55..3959a571486f 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
@@ -1,8 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-dvb.c,v 1.13 2005/06/12 04:19:19 mchehab Exp $ | 2 | * $Id: saa7134-dvb.c,v 1.18 2005/07/04 16:05:50 mkrufky Exp $ |
3 | * | 3 | * |
4 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] | 4 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] |
5 | * | 5 | * |
6 | * Extended 3 / 2005 by Hartmut Hackmann to support various | ||
7 | * cards with the tda10046 DVB-T channel decoder | ||
8 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License as published by |
8 | * the Free Software Foundation; either version 2 of the License, or | 11 | * the Free Software Foundation; either version 2 of the License, or |
@@ -30,20 +33,25 @@ | |||
30 | #include "saa7134-reg.h" | 33 | #include "saa7134-reg.h" |
31 | #include "saa7134.h" | 34 | #include "saa7134.h" |
32 | 35 | ||
33 | #include "dvb-pll.h" | 36 | #if CONFIG_DVB_MT352 |
34 | #include "mt352.h" | 37 | # include "mt352.h" |
35 | #include "mt352_priv.h" /* FIXME */ | 38 | # include "mt352_priv.h" /* FIXME */ |
36 | #include "tda1004x.h" | 39 | #endif |
40 | #if CONFIG_DVB_TDA1004X | ||
41 | # include "tda1004x.h" | ||
42 | #endif | ||
37 | 43 | ||
38 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); | 44 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); |
39 | MODULE_LICENSE("GPL"); | 45 | MODULE_LICENSE("GPL"); |
40 | 46 | ||
41 | static unsigned int antenna_pwr = 0; | 47 | static unsigned int antenna_pwr = 0; |
48 | |||
42 | module_param(antenna_pwr, int, 0444); | 49 | module_param(antenna_pwr, int, 0444); |
43 | MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)"); | 50 | MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)"); |
44 | 51 | ||
45 | /* ------------------------------------------------------------------ */ | 52 | /* ------------------------------------------------------------------ */ |
46 | 53 | ||
54 | #if CONFIG_DVB_MT352 | ||
47 | static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on) | 55 | static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on) |
48 | { | 56 | { |
49 | u32 ok; | 57 | u32 ok; |
@@ -138,48 +146,387 @@ static struct mt352_config pinnacle_300i = { | |||
138 | .demod_init = mt352_pinnacle_init, | 146 | .demod_init = mt352_pinnacle_init, |
139 | .pll_set = mt352_pinnacle_pll_set, | 147 | .pll_set = mt352_pinnacle_pll_set, |
140 | }; | 148 | }; |
149 | #endif | ||
141 | 150 | ||
142 | /* ------------------------------------------------------------------ */ | 151 | /* ------------------------------------------------------------------ */ |
143 | 152 | ||
144 | static int medion_cardbus_init(struct dvb_frontend* fe) | 153 | #if CONFIG_DVB_TDA1004X |
154 | static int philips_tu1216_pll_init(struct dvb_frontend *fe) | ||
145 | { | 155 | { |
146 | /* anything to do here ??? */ | 156 | struct saa7134_dev *dev = fe->dvb->priv; |
157 | static u8 tu1216_init[] = { 0x0b, 0xf5, 0x85, 0xab }; | ||
158 | struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tu1216_init,.len = sizeof(tu1216_init) }; | ||
159 | |||
160 | /* setup PLL configuration */ | ||
161 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | ||
162 | return -EIO; | ||
163 | msleep(1); | ||
164 | |||
147 | return 0; | 165 | return 0; |
148 | } | 166 | } |
149 | 167 | ||
150 | static int medion_cardbus_pll_set(struct dvb_frontend* fe, | 168 | static int philips_tu1216_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
151 | struct dvb_frontend_parameters* params) | ||
152 | { | 169 | { |
153 | struct saa7134_dev *dev = fe->dvb->priv; | 170 | struct saa7134_dev *dev = fe->dvb->priv; |
154 | struct v4l2_frequency f; | 171 | u8 tuner_buf[4]; |
172 | struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tuner_buf,.len = | ||
173 | sizeof(tuner_buf) }; | ||
174 | int tuner_frequency = 0; | ||
175 | u8 band, cp, filter; | ||
176 | |||
177 | /* determine charge pump */ | ||
178 | tuner_frequency = params->frequency + 36166000; | ||
179 | if (tuner_frequency < 87000000) | ||
180 | return -EINVAL; | ||
181 | else if (tuner_frequency < 130000000) | ||
182 | cp = 3; | ||
183 | else if (tuner_frequency < 160000000) | ||
184 | cp = 5; | ||
185 | else if (tuner_frequency < 200000000) | ||
186 | cp = 6; | ||
187 | else if (tuner_frequency < 290000000) | ||
188 | cp = 3; | ||
189 | else if (tuner_frequency < 420000000) | ||
190 | cp = 5; | ||
191 | else if (tuner_frequency < 480000000) | ||
192 | cp = 6; | ||
193 | else if (tuner_frequency < 620000000) | ||
194 | cp = 3; | ||
195 | else if (tuner_frequency < 830000000) | ||
196 | cp = 5; | ||
197 | else if (tuner_frequency < 895000000) | ||
198 | cp = 7; | ||
199 | else | ||
200 | return -EINVAL; | ||
201 | |||
202 | /* determine band */ | ||
203 | if (params->frequency < 49000000) | ||
204 | return -EINVAL; | ||
205 | else if (params->frequency < 161000000) | ||
206 | band = 1; | ||
207 | else if (params->frequency < 444000000) | ||
208 | band = 2; | ||
209 | else if (params->frequency < 861000000) | ||
210 | band = 4; | ||
211 | else | ||
212 | return -EINVAL; | ||
213 | |||
214 | /* setup PLL filter */ | ||
215 | switch (params->u.ofdm.bandwidth) { | ||
216 | case BANDWIDTH_6_MHZ: | ||
217 | filter = 0; | ||
218 | break; | ||
219 | |||
220 | case BANDWIDTH_7_MHZ: | ||
221 | filter = 0; | ||
222 | break; | ||
223 | |||
224 | case BANDWIDTH_8_MHZ: | ||
225 | filter = 1; | ||
226 | break; | ||
155 | 227 | ||
156 | /* | 228 | default: |
157 | * this instructs tuner.o to set the frequency, the call will | 229 | return -EINVAL; |
158 | * end up in tuner_command(), VIDIOC_S_FREQUENCY switch. | 230 | } |
159 | * tda9887.o will see that as well. | 231 | |
232 | /* calculate divisor | ||
233 | * ((36166000+((1000000/6)/2)) + Finput)/(1000000/6) | ||
160 | */ | 234 | */ |
161 | f.tuner = 0; | 235 | tuner_frequency = (((params->frequency / 1000) * 6) + 217496) / 1000; |
162 | f.type = V4L2_TUNER_DIGITAL_TV; | 236 | |
163 | f.frequency = params->frequency / 1000 * 16 / 1000; | 237 | /* setup tuner buffer */ |
164 | saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,&f); | 238 | tuner_buf[0] = (tuner_frequency >> 8) & 0x7f; |
239 | tuner_buf[1] = tuner_frequency & 0xff; | ||
240 | tuner_buf[2] = 0xca; | ||
241 | tuner_buf[3] = (cp << 5) | (filter << 3) | band; | ||
242 | |||
243 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | ||
244 | return -EIO; | ||
245 | |||
246 | msleep(1); | ||
165 | return 0; | 247 | return 0; |
166 | } | 248 | } |
167 | 249 | ||
168 | static int fe_request_firmware(struct dvb_frontend* fe, | 250 | static int philips_tu1216_request_firmware(struct dvb_frontend *fe, |
169 | const struct firmware **fw, char* name) | 251 | const struct firmware **fw, char *name) |
170 | { | 252 | { |
171 | struct saa7134_dev *dev = fe->dvb->priv; | 253 | struct saa7134_dev *dev = fe->dvb->priv; |
172 | return request_firmware(fw, name, &dev->pci->dev); | 254 | return request_firmware(fw, name, &dev->pci->dev); |
173 | } | 255 | } |
174 | 256 | ||
257 | static struct tda1004x_config philips_tu1216_config = { | ||
258 | |||
259 | .demod_address = 0x8, | ||
260 | .invert = 1, | ||
261 | .invert_oclk = 1, | ||
262 | .xtal_freq = TDA10046_XTAL_4M, | ||
263 | .agc_config = TDA10046_AGC_DEFAULT, | ||
264 | .if_freq = TDA10046_FREQ_3617, | ||
265 | .pll_init = philips_tu1216_pll_init, | ||
266 | .pll_set = philips_tu1216_pll_set, | ||
267 | .pll_sleep = NULL, | ||
268 | .request_firmware = philips_tu1216_request_firmware, | ||
269 | }; | ||
270 | |||
271 | /* ------------------------------------------------------------------ */ | ||
272 | |||
273 | |||
274 | static int philips_fmd1216_pll_init(struct dvb_frontend *fe) | ||
275 | { | ||
276 | struct saa7134_dev *dev = fe->dvb->priv; | ||
277 | /* this message is to set up ATC and ALC */ | ||
278 | static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0xa0 }; | ||
279 | struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) }; | ||
280 | |||
281 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | ||
282 | return -EIO; | ||
283 | msleep(1); | ||
284 | |||
285 | return 0; | ||
286 | } | ||
287 | |||
288 | static void philips_fmd1216_analog(struct dvb_frontend *fe) | ||
289 | { | ||
290 | struct saa7134_dev *dev = fe->dvb->priv; | ||
291 | /* this message actually turns the tuner back to analog mode */ | ||
292 | static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0x60 }; | ||
293 | struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) }; | ||
294 | |||
295 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); | ||
296 | msleep(1); | ||
297 | fmd1216_init[2] = 0x86; | ||
298 | fmd1216_init[3] = 0x54; | ||
299 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); | ||
300 | msleep(1); | ||
301 | } | ||
302 | |||
303 | static int philips_fmd1216_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | ||
304 | { | ||
305 | struct saa7134_dev *dev = fe->dvb->priv; | ||
306 | u8 tuner_buf[4]; | ||
307 | struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = tuner_buf,.len = | ||
308 | sizeof(tuner_buf) }; | ||
309 | int tuner_frequency = 0; | ||
310 | int divider = 0; | ||
311 | u8 band, mode, cp; | ||
312 | |||
313 | /* determine charge pump */ | ||
314 | tuner_frequency = params->frequency + 36130000; | ||
315 | if (tuner_frequency < 87000000) | ||
316 | return -EINVAL; | ||
317 | /* low band */ | ||
318 | else if (tuner_frequency < 180000000) { | ||
319 | band = 1; | ||
320 | mode = 7; | ||
321 | cp = 0; | ||
322 | } else if (tuner_frequency < 195000000) { | ||
323 | band = 1; | ||
324 | mode = 6; | ||
325 | cp = 1; | ||
326 | /* mid band */ | ||
327 | } else if (tuner_frequency < 366000000) { | ||
328 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { | ||
329 | band = 10; | ||
330 | } else { | ||
331 | band = 2; | ||
332 | } | ||
333 | mode = 7; | ||
334 | cp = 0; | ||
335 | } else if (tuner_frequency < 478000000) { | ||
336 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { | ||
337 | band = 10; | ||
338 | } else { | ||
339 | band = 2; | ||
340 | } | ||
341 | mode = 6; | ||
342 | cp = 1; | ||
343 | /* high band */ | ||
344 | } else if (tuner_frequency < 662000000) { | ||
345 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { | ||
346 | band = 12; | ||
347 | } else { | ||
348 | band = 4; | ||
349 | } | ||
350 | mode = 7; | ||
351 | cp = 0; | ||
352 | } else if (tuner_frequency < 840000000) { | ||
353 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { | ||
354 | band = 12; | ||
355 | } else { | ||
356 | band = 4; | ||
357 | } | ||
358 | mode = 6; | ||
359 | cp = 1; | ||
360 | } else { | ||
361 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { | ||
362 | band = 12; | ||
363 | } else { | ||
364 | band = 4; | ||
365 | } | ||
366 | mode = 7; | ||
367 | cp = 1; | ||
368 | |||
369 | } | ||
370 | /* calculate divisor */ | ||
371 | /* ((36166000 + Finput) / 166666) rounded! */ | ||
372 | divider = (tuner_frequency + 83333) / 166667; | ||
373 | |||
374 | /* setup tuner buffer */ | ||
375 | tuner_buf[0] = (divider >> 8) & 0x7f; | ||
376 | tuner_buf[1] = divider & 0xff; | ||
377 | tuner_buf[2] = 0x80 | (cp << 6) | (mode << 3) | 4; | ||
378 | tuner_buf[3] = 0x40 | band; | ||
379 | |||
380 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | ||
381 | return -EIO; | ||
382 | return 0; | ||
383 | } | ||
384 | |||
385 | |||
175 | static struct tda1004x_config medion_cardbus = { | 386 | static struct tda1004x_config medion_cardbus = { |
176 | .demod_address = 0x08, /* not sure this is correct */ | 387 | .demod_address = 0x08, |
177 | .invert = 0, | 388 | .invert = 1, |
178 | .invert_oclk = 0, | 389 | .invert_oclk = 0, |
179 | .pll_init = medion_cardbus_init, | 390 | .xtal_freq = TDA10046_XTAL_16M, |
180 | .pll_set = medion_cardbus_pll_set, | 391 | .agc_config = TDA10046_AGC_IFO_AUTO_NEG, |
181 | .request_firmware = fe_request_firmware, | 392 | .if_freq = TDA10046_FREQ_3613, |
393 | .pll_init = philips_fmd1216_pll_init, | ||
394 | .pll_set = philips_fmd1216_pll_set, | ||
395 | .pll_sleep = philips_fmd1216_analog, | ||
396 | .request_firmware = NULL, | ||
397 | }; | ||
398 | |||
399 | /* ------------------------------------------------------------------ */ | ||
400 | |||
401 | struct tda827x_data { | ||
402 | u32 lomax; | ||
403 | u8 spd; | ||
404 | u8 bs; | ||
405 | u8 bp; | ||
406 | u8 cp; | ||
407 | u8 gc3; | ||
408 | u8 div1p5; | ||
409 | }; | ||
410 | |||
411 | static struct tda827x_data tda827x_dvbt[] = { | ||
412 | { .lomax = 62000000, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 1}, | ||
413 | { .lomax = 66000000, .spd = 3, .bs = 3, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 1}, | ||
414 | { .lomax = 76000000, .spd = 3, .bs = 1, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 0}, | ||
415 | { .lomax = 84000000, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 0}, | ||
416 | { .lomax = 93000000, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
417 | { .lomax = 98000000, .spd = 3, .bs = 3, .bp = 0, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
418 | { .lomax = 109000000, .spd = 3, .bs = 3, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
419 | { .lomax = 123000000, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 1}, | ||
420 | { .lomax = 133000000, .spd = 2, .bs = 3, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 1}, | ||
421 | { .lomax = 151000000, .spd = 2, .bs = 1, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
422 | { .lomax = 154000000, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
423 | { .lomax = 181000000, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 0, .div1p5 = 0}, | ||
424 | { .lomax = 185000000, .spd = 2, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
425 | { .lomax = 217000000, .spd = 2, .bs = 3, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
426 | { .lomax = 244000000, .spd = 1, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 1}, | ||
427 | { .lomax = 265000000, .spd = 1, .bs = 3, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 1}, | ||
428 | { .lomax = 302000000, .spd = 1, .bs = 1, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
429 | { .lomax = 324000000, .spd = 1, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
430 | { .lomax = 370000000, .spd = 1, .bs = 2, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
431 | { .lomax = 454000000, .spd = 1, .bs = 3, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
432 | { .lomax = 493000000, .spd = 0, .bs = 2, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 1}, | ||
433 | { .lomax = 530000000, .spd = 0, .bs = 3, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 1}, | ||
434 | { .lomax = 554000000, .spd = 0, .bs = 1, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
435 | { .lomax = 604000000, .spd = 0, .bs = 1, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0}, | ||
436 | { .lomax = 696000000, .spd = 0, .bs = 2, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0}, | ||
437 | { .lomax = 740000000, .spd = 0, .bs = 2, .bp = 4, .cp = 1, .gc3 = 0, .div1p5 = 0}, | ||
438 | { .lomax = 820000000, .spd = 0, .bs = 3, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0}, | ||
439 | { .lomax = 865000000, .spd = 0, .bs = 3, .bp = 4, .cp = 1, .gc3 = 0, .div1p5 = 0}, | ||
440 | { .lomax = 0, .spd = 0, .bs = 0, .bp = 0, .cp = 0, .gc3 = 0, .div1p5 = 0} | ||
441 | }; | ||
442 | |||
443 | static int philips_tda827x_pll_init(struct dvb_frontend *fe) | ||
444 | { | ||
445 | return 0; | ||
446 | } | ||
447 | |||
448 | static int philips_tda827x_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | ||
449 | { | ||
450 | struct saa7134_dev *dev = fe->dvb->priv; | ||
451 | u8 tuner_buf[14]; | ||
452 | |||
453 | struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tuner_buf, | ||
454 | .len = sizeof(tuner_buf) }; | ||
455 | int i, tuner_freq, if_freq; | ||
456 | u32 N; | ||
457 | switch (params->u.ofdm.bandwidth) { | ||
458 | case BANDWIDTH_6_MHZ: | ||
459 | if_freq = 4000000; | ||
460 | break; | ||
461 | case BANDWIDTH_7_MHZ: | ||
462 | if_freq = 4500000; | ||
463 | break; | ||
464 | default: /* 8 MHz or Auto */ | ||
465 | if_freq = 5000000; | ||
466 | break; | ||
467 | } | ||
468 | tuner_freq = params->frequency + if_freq; | ||
469 | |||
470 | i = 0; | ||
471 | while (tda827x_dvbt[i].lomax < tuner_freq) { | ||
472 | if(tda827x_dvbt[i + 1].lomax == 0) | ||
473 | break; | ||
474 | i++; | ||
475 | } | ||
476 | |||
477 | N = ((tuner_freq + 125000) / 250000) << (tda827x_dvbt[i].spd + 2); | ||
478 | tuner_buf[0] = 0; | ||
479 | tuner_buf[1] = (N>>8) | 0x40; | ||
480 | tuner_buf[2] = N & 0xff; | ||
481 | tuner_buf[3] = 0; | ||
482 | tuner_buf[4] = 0x52; | ||
483 | tuner_buf[5] = (tda827x_dvbt[i].spd << 6) + (tda827x_dvbt[i].div1p5 << 5) + | ||
484 | (tda827x_dvbt[i].bs << 3) + tda827x_dvbt[i].bp; | ||
485 | tuner_buf[6] = (tda827x_dvbt[i].gc3 << 4) + 0x8f; | ||
486 | tuner_buf[7] = 0xbf; | ||
487 | tuner_buf[8] = 0x2a; | ||
488 | tuner_buf[9] = 0x05; | ||
489 | tuner_buf[10] = 0xff; | ||
490 | tuner_buf[11] = 0x00; | ||
491 | tuner_buf[12] = 0x00; | ||
492 | tuner_buf[13] = 0x40; | ||
493 | |||
494 | tuner_msg.len = 14; | ||
495 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | ||
496 | return -EIO; | ||
497 | |||
498 | msleep(500); | ||
499 | /* correct CP value */ | ||
500 | tuner_buf[0] = 0x30; | ||
501 | tuner_buf[1] = 0x50 + tda827x_dvbt[i].cp; | ||
502 | tuner_msg.len = 2; | ||
503 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); | ||
504 | |||
505 | return 0; | ||
506 | } | ||
507 | |||
508 | static void philips_tda827x_pll_sleep(struct dvb_frontend *fe) | ||
509 | { | ||
510 | struct saa7134_dev *dev = fe->dvb->priv; | ||
511 | static u8 tda827x_sleep[] = { 0x30, 0xd0}; | ||
512 | struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tda827x_sleep, | ||
513 | .len = sizeof(tda827x_sleep) }; | ||
514 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); | ||
515 | } | ||
516 | |||
517 | static struct tda1004x_config tda827x_lifeview_config = { | ||
518 | .demod_address = 0x08, | ||
519 | .invert = 1, | ||
520 | .invert_oclk = 0, | ||
521 | .xtal_freq = TDA10046_XTAL_16M, | ||
522 | .agc_config = TDA10046_AGC_TDA827X, | ||
523 | .if_freq = TDA10046_FREQ_045, | ||
524 | .pll_init = philips_tda827x_pll_init, | ||
525 | .pll_set = philips_tda827x_pll_set, | ||
526 | .pll_sleep = philips_tda827x_pll_sleep, | ||
527 | .request_firmware = NULL, | ||
182 | }; | 528 | }; |
529 | #endif | ||
183 | 530 | ||
184 | /* ------------------------------------------------------------------ */ | 531 | /* ------------------------------------------------------------------ */ |
185 | 532 | ||
@@ -197,18 +544,31 @@ static int dvb_init(struct saa7134_dev *dev) | |||
197 | dev); | 544 | dev); |
198 | 545 | ||
199 | switch (dev->board) { | 546 | switch (dev->board) { |
547 | #if CONFIG_DVB_MT352 | ||
200 | case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: | 548 | case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: |
201 | printk("%s: pinnacle 300i dvb setup\n",dev->name); | 549 | printk("%s: pinnacle 300i dvb setup\n",dev->name); |
202 | dev->dvb.frontend = mt352_attach(&pinnacle_300i, | 550 | dev->dvb.frontend = mt352_attach(&pinnacle_300i, |
203 | &dev->i2c_adap); | 551 | &dev->i2c_adap); |
204 | break; | 552 | break; |
553 | #endif | ||
554 | #if CONFIG_DVB_TDA1004X | ||
205 | case SAA7134_BOARD_MD7134: | 555 | case SAA7134_BOARD_MD7134: |
206 | dev->dvb.frontend = tda10046_attach(&medion_cardbus, | 556 | dev->dvb.frontend = tda10046_attach(&medion_cardbus, |
207 | &dev->i2c_adap); | 557 | &dev->i2c_adap); |
208 | if (NULL == dev->dvb.frontend) | ||
209 | printk("%s: Hmm, looks like this is the old MD7134 " | ||
210 | "version without DVB-T support\n",dev->name); | ||
211 | break; | 558 | break; |
559 | case SAA7134_BOARD_PHILIPS_TOUGH: | ||
560 | dev->dvb.frontend = tda10046_attach(&philips_tu1216_config, | ||
561 | &dev->i2c_adap); | ||
562 | break; | ||
563 | case SAA7134_BOARD_FLYDVBTDUO: | ||
564 | dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, | ||
565 | &dev->i2c_adap); | ||
566 | break; | ||
567 | case SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS: | ||
568 | dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, | ||
569 | &dev->i2c_adap); | ||
570 | break; | ||
571 | #endif | ||
212 | default: | 572 | default: |
213 | printk("%s: Huh? unknown DVB card?\n",dev->name); | 573 | printk("%s: Huh? unknown DVB card?\n",dev->name); |
214 | break; | 574 | break; |
@@ -227,8 +587,6 @@ static int dvb_fini(struct saa7134_dev *dev) | |||
227 | { | 587 | { |
228 | static int on = TDA9887_PRESENT | TDA9887_PORT2_INACTIVE; | 588 | static int on = TDA9887_PRESENT | TDA9887_PORT2_INACTIVE; |
229 | 589 | ||
230 | printk("%s: %s\n",dev->name,__FUNCTION__); | ||
231 | |||
232 | switch (dev->board) { | 590 | switch (dev->board) { |
233 | case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: | 591 | case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: |
234 | /* otherwise we don't detect the tuner on next insmod */ | 592 | /* otherwise we don't detect the tuner on next insmod */ |