diff options
author | Hartmut Hackmann <hartmut.hackmann@t-online.de> | 2007-04-27 11:31:12 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-04-27 14:43:32 -0400 |
commit | 58ef4f924cf2824ae198b1fec3eea1e4059a021c (patch) | |
tree | dc10d767ffc30857a183dacbc4d50a6deacee442 /drivers/media/video/saa7134/saa7134-dvb.c | |
parent | de956c1e0f89413a3837b642d592e2dff3e3eb78 (diff) |
V4L/DVB (5314): Added support for tda827x tuners with preamlifiers
This patch contains
- new tuning code for the tda827xa silicon tuner.
- controls the preamplifier of some boards with this tuner.
- support for the Philips Tiger S hybrid DVB-T reference design.
- reworked the saa7134-dvb modulue to get rid of most of the
small board specific functions.
Signed-off-by: Hartmut Hackmann <hartmut.hackmann@t-online.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-dvb.c')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-dvb.c | 856 |
1 files changed, 439 insertions, 417 deletions
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 6d148a7601ac..61a68c67c4ad 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
@@ -54,7 +54,17 @@ static int use_frontend = 0; | |||
54 | module_param(use_frontend, int, 0644); | 54 | module_param(use_frontend, int, 0644); |
55 | MODULE_PARM_DESC(use_frontend,"for cards with multiple frontends (0: terrestrial, 1: satellite)"); | 55 | MODULE_PARM_DESC(use_frontend,"for cards with multiple frontends (0: terrestrial, 1: satellite)"); |
56 | 56 | ||
57 | /* ------------------------------------------------------------------ */ | 57 | static int debug = 0; |
58 | module_param(debug, int, 0644); | ||
59 | MODULE_PARM_DESC(debug, "Turn on/off module debugging (default:off)."); | ||
60 | |||
61 | #define dprintk(fmt, arg...) if (debug) \ | ||
62 | printk(KERN_DEBUG "%s/dvb: " fmt, dev->name , ## arg) | ||
63 | |||
64 | /* ------------------------------------------------------------------ | ||
65 | * mt352 based DVB-T cards | ||
66 | */ | ||
67 | |||
58 | static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on) | 68 | static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on) |
59 | { | 69 | { |
60 | u32 ok; | 70 | u32 ok; |
@@ -185,10 +195,35 @@ static struct mt352_config avermedia_777 = { | |||
185 | .demod_init = mt352_aver777_init, | 195 | .demod_init = mt352_aver777_init, |
186 | }; | 196 | }; |
187 | 197 | ||
188 | /* ------------------------------------------------------------------ */ | 198 | /* ================================================================== |
189 | static int philips_tda6651_pll_set(u8 addr, struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 199 | * tda1004x based DVB-T cards, helper functions |
200 | */ | ||
201 | |||
202 | static int philips_tda1004x_request_firmware(struct dvb_frontend *fe, | ||
203 | const struct firmware **fw, char *name) | ||
190 | { | 204 | { |
191 | struct saa7134_dev *dev = fe->dvb->priv; | 205 | struct saa7134_dev *dev = fe->dvb->priv; |
206 | return request_firmware(fw, name, &dev->pci->dev); | ||
207 | } | ||
208 | |||
209 | static void philips_tda1004x_set_board_name(struct dvb_frontend *fe, char *name) | ||
210 | { | ||
211 | size_t len; | ||
212 | |||
213 | len = sizeof(fe->ops.info.name); | ||
214 | strncpy(fe->ops.info.name, name, len); | ||
215 | fe->ops.info.name[len - 1] = 0; | ||
216 | } | ||
217 | |||
218 | /* ------------------------------------------------------------------ | ||
219 | * these tuners are tu1216, td1316(a) | ||
220 | */ | ||
221 | |||
222 | static int philips_tda6651_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | ||
223 | { | ||
224 | struct saa7134_dev *dev = fe->dvb->priv; | ||
225 | struct tda1004x_state *state = fe->demodulator_priv; | ||
226 | u8 addr = state->config->tuner_address; | ||
192 | u8 tuner_buf[4]; | 227 | u8 tuner_buf[4]; |
193 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tuner_buf,.len = | 228 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tuner_buf,.len = |
194 | sizeof(tuner_buf) }; | 229 | sizeof(tuner_buf) }; |
@@ -263,15 +298,19 @@ static int philips_tda6651_pll_set(u8 addr, struct dvb_frontend *fe, struct dvb_ | |||
263 | 298 | ||
264 | if (fe->ops.i2c_gate_ctrl) | 299 | if (fe->ops.i2c_gate_ctrl) |
265 | fe->ops.i2c_gate_ctrl(fe, 1); | 300 | fe->ops.i2c_gate_ctrl(fe, 1); |
266 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | 301 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) { |
302 | printk("%s/dvb: could not write to tuner at addr: 0x%02x\n",dev->name, addr << 1); | ||
267 | return -EIO; | 303 | return -EIO; |
304 | } | ||
268 | msleep(1); | 305 | msleep(1); |
269 | return 0; | 306 | return 0; |
270 | } | 307 | } |
271 | 308 | ||
272 | static int philips_tda6651_pll_init(u8 addr, struct dvb_frontend *fe) | 309 | static int philips_tu1216_init(struct dvb_frontend *fe) |
273 | { | 310 | { |
274 | struct saa7134_dev *dev = fe->dvb->priv; | 311 | struct saa7134_dev *dev = fe->dvb->priv; |
312 | struct tda1004x_state *state = fe->demodulator_priv; | ||
313 | u8 addr = state->config->tuner_address; | ||
275 | static u8 tu1216_init[] = { 0x0b, 0xf5, 0x85, 0xab }; | 314 | static u8 tu1216_init[] = { 0x0b, 0xf5, 0x85, 0xab }; |
276 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tu1216_init,.len = sizeof(tu1216_init) }; | 315 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tu1216_init,.len = sizeof(tu1216_init) }; |
277 | 316 | ||
@@ -287,46 +326,17 @@ static int philips_tda6651_pll_init(u8 addr, struct dvb_frontend *fe) | |||
287 | 326 | ||
288 | /* ------------------------------------------------------------------ */ | 327 | /* ------------------------------------------------------------------ */ |
289 | 328 | ||
290 | static int philips_tu1216_tuner_60_init(struct dvb_frontend *fe) | ||
291 | { | ||
292 | return philips_tda6651_pll_init(0x60, fe); | ||
293 | } | ||
294 | |||
295 | static int philips_tu1216_tuner_60_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | ||
296 | { | ||
297 | return philips_tda6651_pll_set(0x60, fe, params); | ||
298 | } | ||
299 | |||
300 | static int philips_tda1004x_request_firmware(struct dvb_frontend *fe, | ||
301 | const struct firmware **fw, char *name) | ||
302 | { | ||
303 | struct saa7134_dev *dev = fe->dvb->priv; | ||
304 | return request_firmware(fw, name, &dev->pci->dev); | ||
305 | } | ||
306 | |||
307 | static struct tda1004x_config philips_tu1216_60_config = { | 329 | static struct tda1004x_config philips_tu1216_60_config = { |
308 | |||
309 | .demod_address = 0x8, | 330 | .demod_address = 0x8, |
310 | .invert = 1, | 331 | .invert = 1, |
311 | .invert_oclk = 0, | 332 | .invert_oclk = 0, |
312 | .xtal_freq = TDA10046_XTAL_4M, | 333 | .xtal_freq = TDA10046_XTAL_4M, |
313 | .agc_config = TDA10046_AGC_DEFAULT, | 334 | .agc_config = TDA10046_AGC_DEFAULT, |
314 | .if_freq = TDA10046_FREQ_3617, | 335 | .if_freq = TDA10046_FREQ_3617, |
315 | .request_firmware = philips_tda1004x_request_firmware, | 336 | .tuner_address = 0x60, |
337 | .request_firmware = philips_tda1004x_request_firmware | ||
316 | }; | 338 | }; |
317 | 339 | ||
318 | /* ------------------------------------------------------------------ */ | ||
319 | |||
320 | static int philips_tu1216_tuner_61_init(struct dvb_frontend *fe) | ||
321 | { | ||
322 | return philips_tda6651_pll_init(0x61, fe); | ||
323 | } | ||
324 | |||
325 | static int philips_tu1216_tuner_61_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | ||
326 | { | ||
327 | return philips_tda6651_pll_set(0x61, fe, params); | ||
328 | } | ||
329 | |||
330 | static struct tda1004x_config philips_tu1216_61_config = { | 340 | static struct tda1004x_config philips_tu1216_61_config = { |
331 | 341 | ||
332 | .demod_address = 0x8, | 342 | .demod_address = 0x8, |
@@ -335,7 +345,8 @@ static struct tda1004x_config philips_tu1216_61_config = { | |||
335 | .xtal_freq = TDA10046_XTAL_4M, | 345 | .xtal_freq = TDA10046_XTAL_4M, |
336 | .agc_config = TDA10046_AGC_DEFAULT, | 346 | .agc_config = TDA10046_AGC_DEFAULT, |
337 | .if_freq = TDA10046_FREQ_3617, | 347 | .if_freq = TDA10046_FREQ_3617, |
338 | .request_firmware = philips_tda1004x_request_firmware, | 348 | .tuner_address = 0x61, |
349 | .request_firmware = philips_tda1004x_request_firmware | ||
339 | }; | 350 | }; |
340 | 351 | ||
341 | /* ------------------------------------------------------------------ */ | 352 | /* ------------------------------------------------------------------ */ |
@@ -343,24 +354,42 @@ static struct tda1004x_config philips_tu1216_61_config = { | |||
343 | static int philips_td1316_tuner_init(struct dvb_frontend *fe) | 354 | static int philips_td1316_tuner_init(struct dvb_frontend *fe) |
344 | { | 355 | { |
345 | struct saa7134_dev *dev = fe->dvb->priv; | 356 | struct saa7134_dev *dev = fe->dvb->priv; |
357 | struct tda1004x_state *state = fe->demodulator_priv; | ||
358 | u8 addr = state->config->tuner_address; | ||
346 | static u8 msg[] = { 0x0b, 0xf5, 0x86, 0xab }; | 359 | static u8 msg[] = { 0x0b, 0xf5, 0x86, 0xab }; |
347 | struct i2c_msg init_msg = {.addr = 0x61,.flags = 0,.buf = msg,.len = sizeof(msg) }; | 360 | struct i2c_msg init_msg = {.addr = addr,.flags = 0,.buf = msg,.len = sizeof(msg) }; |
348 | 361 | ||
349 | /* setup PLL configuration */ | 362 | /* setup PLL configuration */ |
350 | if (fe->ops.i2c_gate_ctrl) | 363 | if (fe->ops.i2c_gate_ctrl) |
351 | fe->ops.i2c_gate_ctrl(fe, 1); | 364 | fe->ops.i2c_gate_ctrl(fe, 1); |
352 | if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1) | 365 | if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1) |
353 | return -EIO; | 366 | return -EIO; |
354 | if (fe->ops.i2c_gate_ctrl) | ||
355 | fe->ops.i2c_gate_ctrl(fe, 0); | ||
356 | return 0; | 367 | return 0; |
357 | } | 368 | } |
358 | 369 | ||
359 | static int philips_td1316_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 370 | static int philips_td1316_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
360 | { | 371 | { |
361 | return philips_tda6651_pll_set(0x61, fe, params); | 372 | return philips_tda6651_pll_set(fe, params); |
373 | } | ||
374 | |||
375 | static int philips_td1316_tuner_sleep(struct dvb_frontend *fe) | ||
376 | { | ||
377 | struct saa7134_dev *dev = fe->dvb->priv; | ||
378 | struct tda1004x_state *state = fe->demodulator_priv; | ||
379 | u8 addr = state->config->tuner_address; | ||
380 | static u8 msg[] = { 0x0b, 0xdc, 0x86, 0xa4 }; | ||
381 | struct i2c_msg analog_msg = {.addr = addr,.flags = 0,.buf = msg,.len = sizeof(msg) }; | ||
382 | |||
383 | /* switch the tuner to analog mode */ | ||
384 | if (fe->ops.i2c_gate_ctrl) | ||
385 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
386 | if (i2c_transfer(&dev->i2c_adap, &analog_msg, 1) != 1) | ||
387 | return -EIO; | ||
388 | return 0; | ||
362 | } | 389 | } |
363 | 390 | ||
391 | /* ------------------------------------------------------------------ */ | ||
392 | |||
364 | static int philips_europa_tuner_init(struct dvb_frontend *fe) | 393 | static int philips_europa_tuner_init(struct dvb_frontend *fe) |
365 | { | 394 | { |
366 | struct saa7134_dev *dev = fe->dvb->priv; | 395 | struct saa7134_dev *dev = fe->dvb->priv; |
@@ -380,18 +409,14 @@ static int philips_europa_tuner_init(struct dvb_frontend *fe) | |||
380 | static int philips_europa_tuner_sleep(struct dvb_frontend *fe) | 409 | static int philips_europa_tuner_sleep(struct dvb_frontend *fe) |
381 | { | 410 | { |
382 | struct saa7134_dev *dev = fe->dvb->priv; | 411 | struct saa7134_dev *dev = fe->dvb->priv; |
383 | /* this message actually turns the tuner back to analog mode */ | ||
384 | static u8 msg[] = { 0x0b, 0xdc, 0x86, 0xa4 }; | ||
385 | struct i2c_msg analog_msg = {.addr = 0x61,.flags = 0,.buf = msg,.len = sizeof(msg) }; | ||
386 | 412 | ||
387 | i2c_transfer(&dev->i2c_adap, &analog_msg, 1); | 413 | static u8 msg[] = { 0x00, 0x14 }; |
388 | msleep(1); | 414 | struct i2c_msg analog_msg = {.addr = 0x43,.flags = 0,.buf = msg,.len = sizeof(msg) }; |
415 | |||
416 | if (philips_td1316_tuner_sleep(fe)) | ||
417 | return -EIO; | ||
389 | 418 | ||
390 | /* switch the board to analog mode */ | 419 | /* switch the board to analog mode */ |
391 | analog_msg.addr = 0x43; | ||
392 | analog_msg.len = 0x02; | ||
393 | msg[0] = 0x00; | ||
394 | msg[1] = 0x14; | ||
395 | if (fe->ops.i2c_gate_ctrl) | 420 | if (fe->ops.i2c_gate_ctrl) |
396 | fe->ops.i2c_gate_ctrl(fe, 1); | 421 | fe->ops.i2c_gate_ctrl(fe, 1); |
397 | i2c_transfer(&dev->i2c_adap, &analog_msg, 1); | 422 | i2c_transfer(&dev->i2c_adap, &analog_msg, 1); |
@@ -416,7 +441,8 @@ static struct tda1004x_config philips_europa_config = { | |||
416 | .xtal_freq = TDA10046_XTAL_4M, | 441 | .xtal_freq = TDA10046_XTAL_4M, |
417 | .agc_config = TDA10046_AGC_IFO_AUTO_POS, | 442 | .agc_config = TDA10046_AGC_IFO_AUTO_POS, |
418 | .if_freq = TDA10046_FREQ_052, | 443 | .if_freq = TDA10046_FREQ_052, |
419 | .request_firmware = philips_tda1004x_request_firmware, | 444 | .tuner_address = 0x61, |
445 | .request_firmware = philips_tda1004x_request_firmware | ||
420 | }; | 446 | }; |
421 | 447 | ||
422 | /* ------------------------------------------------------------------ */ | 448 | /* ------------------------------------------------------------------ */ |
@@ -424,9 +450,11 @@ static struct tda1004x_config philips_europa_config = { | |||
424 | static int philips_fmd1216_tuner_init(struct dvb_frontend *fe) | 450 | static int philips_fmd1216_tuner_init(struct dvb_frontend *fe) |
425 | { | 451 | { |
426 | struct saa7134_dev *dev = fe->dvb->priv; | 452 | struct saa7134_dev *dev = fe->dvb->priv; |
453 | struct tda1004x_state *state = fe->demodulator_priv; | ||
454 | u8 addr = state->config->tuner_address; | ||
427 | /* this message is to set up ATC and ALC */ | 455 | /* this message is to set up ATC and ALC */ |
428 | static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0xa0 }; | 456 | static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0xa0 }; |
429 | struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) }; | 457 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) }; |
430 | 458 | ||
431 | if (fe->ops.i2c_gate_ctrl) | 459 | if (fe->ops.i2c_gate_ctrl) |
432 | fe->ops.i2c_gate_ctrl(fe, 1); | 460 | fe->ops.i2c_gate_ctrl(fe, 1); |
@@ -440,9 +468,11 @@ static int philips_fmd1216_tuner_init(struct dvb_frontend *fe) | |||
440 | static int philips_fmd1216_tuner_sleep(struct dvb_frontend *fe) | 468 | static int philips_fmd1216_tuner_sleep(struct dvb_frontend *fe) |
441 | { | 469 | { |
442 | struct saa7134_dev *dev = fe->dvb->priv; | 470 | struct saa7134_dev *dev = fe->dvb->priv; |
471 | struct tda1004x_state *state = fe->demodulator_priv; | ||
472 | u8 addr = state->config->tuner_address; | ||
443 | /* this message actually turns the tuner back to analog mode */ | 473 | /* this message actually turns the tuner back to analog mode */ |
444 | static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0x60 }; | 474 | static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0x60 }; |
445 | struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) }; | 475 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) }; |
446 | 476 | ||
447 | if (fe->ops.i2c_gate_ctrl) | 477 | if (fe->ops.i2c_gate_ctrl) |
448 | fe->ops.i2c_gate_ctrl(fe, 1); | 478 | fe->ops.i2c_gate_ctrl(fe, 1); |
@@ -460,8 +490,10 @@ static int philips_fmd1216_tuner_sleep(struct dvb_frontend *fe) | |||
460 | static int philips_fmd1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 490 | static int philips_fmd1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
461 | { | 491 | { |
462 | struct saa7134_dev *dev = fe->dvb->priv; | 492 | struct saa7134_dev *dev = fe->dvb->priv; |
493 | struct tda1004x_state *state = fe->demodulator_priv; | ||
494 | u8 addr = state->config->tuner_address; | ||
463 | u8 tuner_buf[4]; | 495 | u8 tuner_buf[4]; |
464 | struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = tuner_buf,.len = | 496 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tuner_buf,.len = |
465 | sizeof(tuner_buf) }; | 497 | sizeof(tuner_buf) }; |
466 | int tuner_frequency = 0; | 498 | int tuner_frequency = 0; |
467 | int divider = 0; | 499 | int divider = 0; |
@@ -536,8 +568,10 @@ static int philips_fmd1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_ | |||
536 | 568 | ||
537 | if (fe->ops.i2c_gate_ctrl) | 569 | if (fe->ops.i2c_gate_ctrl) |
538 | fe->ops.i2c_gate_ctrl(fe, 1); | 570 | fe->ops.i2c_gate_ctrl(fe, 1); |
539 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | 571 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) { |
572 | printk("%s/dvb: could not write to tuner at addr: 0x%02x\n",dev->name, addr << 1); | ||
540 | return -EIO; | 573 | return -EIO; |
574 | } | ||
541 | return 0; | 575 | return 0; |
542 | } | 576 | } |
543 | 577 | ||
@@ -548,9 +582,76 @@ static struct tda1004x_config medion_cardbus = { | |||
548 | .xtal_freq = TDA10046_XTAL_16M, | 582 | .xtal_freq = TDA10046_XTAL_16M, |
549 | .agc_config = TDA10046_AGC_IFO_AUTO_NEG, | 583 | .agc_config = TDA10046_AGC_IFO_AUTO_NEG, |
550 | .if_freq = TDA10046_FREQ_3613, | 584 | .if_freq = TDA10046_FREQ_3613, |
551 | .request_firmware = philips_tda1004x_request_firmware, | 585 | .tuner_address = 0x61, |
586 | .request_firmware = philips_tda1004x_request_firmware | ||
552 | }; | 587 | }; |
553 | 588 | ||
589 | /* ------------------------------------------------------------------ | ||
590 | * tda 1004x based cards with philips silicon tuner | ||
591 | */ | ||
592 | |||
593 | static void philips_tda827x_lna_gain(struct dvb_frontend *fe, int high) | ||
594 | { | ||
595 | struct saa7134_dev *dev = fe->dvb->priv; | ||
596 | struct tda1004x_state *state = fe->demodulator_priv; | ||
597 | u8 addr = state->config->i2c_gate; | ||
598 | u8 config = state->config->tuner_config; | ||
599 | u8 GP00_CF[] = {0x20, 0x01}; | ||
600 | u8 GP00_LEV[] = {0x22, 0x00}; | ||
601 | |||
602 | struct i2c_msg msg = {.addr = addr,.flags = 0,.buf = GP00_CF, .len = 2}; | ||
603 | if (config) { | ||
604 | if (high) { | ||
605 | dprintk("setting LNA to high gain\n"); | ||
606 | } else { | ||
607 | dprintk("setting LNA to low gain\n"); | ||
608 | } | ||
609 | } | ||
610 | switch (config) { | ||
611 | case 0: /* no LNA */ | ||
612 | break; | ||
613 | case 1: /* switch is GPIO 0 of tda8290 */ | ||
614 | case 2: | ||
615 | /* turn Vsync off */ | ||
616 | saa7134_set_gpio(dev, 22, 0); | ||
617 | GP00_LEV[1] = high ? 0 : 1; | ||
618 | if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) { | ||
619 | printk("%s/dvb: could not access tda8290 at addr: 0x%02x\n",dev->name, addr << 1); | ||
620 | return; | ||
621 | } | ||
622 | msg.buf = GP00_LEV; | ||
623 | if (config == 2) | ||
624 | GP00_LEV[1] = high ? 1 : 0; | ||
625 | i2c_transfer(&dev->i2c_adap, &msg, 1); | ||
626 | break; | ||
627 | case 3: /* switch with GPIO of saa713x */ | ||
628 | saa7134_set_gpio(dev, 22, high); | ||
629 | break; | ||
630 | } | ||
631 | } | ||
632 | |||
633 | static int tda8290_i2c_gate_ctrl( struct dvb_frontend* fe, int enable) | ||
634 | { | ||
635 | struct saa7134_dev *dev = fe->dvb->priv; | ||
636 | struct tda1004x_state *state = fe->demodulator_priv; | ||
637 | |||
638 | u8 addr = state->config->i2c_gate; | ||
639 | static u8 tda8290_close[] = { 0x21, 0xc0}; | ||
640 | static u8 tda8290_open[] = { 0x21, 0x80}; | ||
641 | struct i2c_msg tda8290_msg = {.addr = addr,.flags = 0, .len = 2}; | ||
642 | if (enable) { | ||
643 | tda8290_msg.buf = tda8290_close; | ||
644 | } else { | ||
645 | tda8290_msg.buf = tda8290_open; | ||
646 | } | ||
647 | if (i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1) != 1) { | ||
648 | printk("%s/dvb: could not access tda8290 I2C gate\n",dev->name); | ||
649 | return -EIO; | ||
650 | } | ||
651 | msleep(20); | ||
652 | return 0; | ||
653 | } | ||
654 | |||
554 | /* ------------------------------------------------------------------ */ | 655 | /* ------------------------------------------------------------------ */ |
555 | 656 | ||
556 | struct tda827x_data { | 657 | struct tda827x_data { |
@@ -595,17 +696,14 @@ static struct tda827x_data tda827x_dvbt[] = { | |||
595 | { .lomax = 0, .spd = 0, .bs = 0, .bp = 0, .cp = 0, .gc3 = 0, .div1p5 = 0} | 696 | { .lomax = 0, .spd = 0, .bs = 0, .bp = 0, .cp = 0, .gc3 = 0, .div1p5 = 0} |
596 | }; | 697 | }; |
597 | 698 | ||
598 | static int philips_tda827x_tuner_init(struct dvb_frontend *fe) | 699 | static int philips_tda827xo_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
599 | { | ||
600 | return 0; | ||
601 | } | ||
602 | |||
603 | static int philips_tda827x_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | ||
604 | { | 700 | { |
605 | struct saa7134_dev *dev = fe->dvb->priv; | 701 | struct saa7134_dev *dev = fe->dvb->priv; |
702 | struct tda1004x_state *state = fe->demodulator_priv; | ||
703 | u8 addr = state->config->tuner_address; | ||
606 | u8 tuner_buf[14]; | 704 | u8 tuner_buf[14]; |
607 | 705 | ||
608 | struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tuner_buf, | 706 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tuner_buf, |
609 | .len = sizeof(tuner_buf) }; | 707 | .len = sizeof(tuner_buf) }; |
610 | int i, tuner_freq, if_freq; | 708 | int i, tuner_freq, if_freq; |
611 | u32 N; | 709 | u32 N; |
@@ -649,9 +747,10 @@ static int philips_tda827x_tuner_set_params(struct dvb_frontend *fe, struct dvb_ | |||
649 | tuner_msg.len = 14; | 747 | tuner_msg.len = 14; |
650 | if (fe->ops.i2c_gate_ctrl) | 748 | if (fe->ops.i2c_gate_ctrl) |
651 | fe->ops.i2c_gate_ctrl(fe, 1); | 749 | fe->ops.i2c_gate_ctrl(fe, 1); |
652 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | 750 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) { |
751 | printk("%s/dvb: could not write to tuner at addr: 0x%02x\n",dev->name, addr << 1); | ||
653 | return -EIO; | 752 | return -EIO; |
654 | 753 | } | |
655 | msleep(500); | 754 | msleep(500); |
656 | /* correct CP value */ | 755 | /* correct CP value */ |
657 | tuner_buf[0] = 0x30; | 756 | tuner_buf[0] = 0x30; |
@@ -664,11 +763,13 @@ static int philips_tda827x_tuner_set_params(struct dvb_frontend *fe, struct dvb_ | |||
664 | return 0; | 763 | return 0; |
665 | } | 764 | } |
666 | 765 | ||
667 | static int philips_tda827x_tuner_sleep(struct dvb_frontend *fe) | 766 | static int philips_tda827xo_tuner_sleep(struct dvb_frontend *fe) |
668 | { | 767 | { |
669 | struct saa7134_dev *dev = fe->dvb->priv; | 768 | struct saa7134_dev *dev = fe->dvb->priv; |
769 | struct tda1004x_state *state = fe->demodulator_priv; | ||
770 | u8 addr = state->config->tuner_address; | ||
670 | static u8 tda827x_sleep[] = { 0x30, 0xd0}; | 771 | static u8 tda827x_sleep[] = { 0x30, 0xd0}; |
671 | struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tda827x_sleep, | 772 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tda827x_sleep, |
672 | .len = sizeof(tda827x_sleep) }; | 773 | .len = sizeof(tda827x_sleep) }; |
673 | if (fe->ops.i2c_gate_ctrl) | 774 | if (fe->ops.i2c_gate_ctrl) |
674 | fe->ops.i2c_gate_ctrl(fe, 1); | 775 | fe->ops.i2c_gate_ctrl(fe, 1); |
@@ -676,17 +777,6 @@ static int philips_tda827x_tuner_sleep(struct dvb_frontend *fe) | |||
676 | return 0; | 777 | return 0; |
677 | } | 778 | } |
678 | 779 | ||
679 | static struct tda1004x_config tda827x_lifeview_config = { | ||
680 | .demod_address = 0x08, | ||
681 | .invert = 1, | ||
682 | .invert_oclk = 0, | ||
683 | .xtal_freq = TDA10046_XTAL_16M, | ||
684 | .agc_config = TDA10046_AGC_TDA827X, | ||
685 | .gpio_config = TDA10046_GP11_I, | ||
686 | .if_freq = TDA10046_FREQ_045, | ||
687 | .request_firmware = philips_tda1004x_request_firmware, | ||
688 | }; | ||
689 | |||
690 | /* ------------------------------------------------------------------ */ | 780 | /* ------------------------------------------------------------------ */ |
691 | 781 | ||
692 | struct tda827xa_data { | 782 | struct tda827xa_data { |
@@ -727,17 +817,20 @@ static struct tda827xa_data tda827xa_dvbt[] = { | |||
727 | { .lomax = 911000000, .svco = 3, .spd = 0, .scr = 2, .sbs = 4, .gc3 = 0}, | 817 | { .lomax = 911000000, .svco = 3, .spd = 0, .scr = 2, .sbs = 4, .gc3 = 0}, |
728 | { .lomax = 0, .svco = 0, .spd = 0, .scr = 0, .sbs = 0, .gc3 = 0}}; | 818 | { .lomax = 0, .svco = 0, .spd = 0, .scr = 0, .sbs = 0, .gc3 = 0}}; |
729 | 819 | ||
730 | 820 | static int philips_tda827xa_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | |
731 | static int philips_tda827xa_pll_set(u8 addr, struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | ||
732 | { | 821 | { |
733 | struct saa7134_dev *dev = fe->dvb->priv; | 822 | struct saa7134_dev *dev = fe->dvb->priv; |
734 | u8 tuner_buf[14]; | 823 | struct tda1004x_state *state = fe->demodulator_priv; |
735 | unsigned char reg2[2]; | 824 | u8 addr = state->config->tuner_address; |
825 | u8 tuner_buf[10]; | ||
736 | 826 | ||
737 | struct i2c_msg msg = {.addr = addr,.flags = 0,.buf = tuner_buf}; | 827 | struct i2c_msg msg = {.addr = addr,.flags = 0,.buf = tuner_buf}; |
738 | int i, tuner_freq, if_freq; | 828 | int i, tuner_freq, if_freq; |
739 | u32 N; | 829 | u32 N; |
740 | 830 | ||
831 | philips_tda827x_lna_gain( fe, 1); | ||
832 | msleep(20); | ||
833 | |||
741 | switch (params->u.ofdm.bandwidth) { | 834 | switch (params->u.ofdm.bandwidth) { |
742 | case BANDWIDTH_6_MHZ: | 835 | case BANDWIDTH_6_MHZ: |
743 | if_freq = 4000000; | 836 | if_freq = 4000000; |
@@ -767,45 +860,82 @@ static int philips_tda827xa_pll_set(u8 addr, struct dvb_frontend *fe, struct dvb | |||
767 | tuner_buf[5] = (tda827xa_dvbt[i].spd << 5) + (tda827xa_dvbt[i].svco << 3) + | 860 | tuner_buf[5] = (tda827xa_dvbt[i].spd << 5) + (tda827xa_dvbt[i].svco << 3) + |
768 | tda827xa_dvbt[i].sbs; | 861 | tda827xa_dvbt[i].sbs; |
769 | tuner_buf[6] = 0x4b + (tda827xa_dvbt[i].gc3 << 4); | 862 | tuner_buf[6] = 0x4b + (tda827xa_dvbt[i].gc3 << 4); |
770 | tuner_buf[7] = 0x0c; | 863 | tuner_buf[7] = 0x1c; |
771 | tuner_buf[8] = 0x06; | 864 | tuner_buf[8] = 0x06; |
772 | tuner_buf[9] = 0x24; | 865 | tuner_buf[9] = 0x24; |
773 | tuner_buf[10] = 0xff; | 866 | tuner_buf[10] = 0x00; |
774 | tuner_buf[11] = 0x60; | 867 | msg.len = 11; |
775 | tuner_buf[12] = 0x00; | ||
776 | tuner_buf[13] = 0x39; // lpsel | ||
777 | msg.len = 14; | ||
778 | if (fe->ops.i2c_gate_ctrl) | 868 | if (fe->ops.i2c_gate_ctrl) |
779 | fe->ops.i2c_gate_ctrl(fe, 1); | 869 | fe->ops.i2c_gate_ctrl(fe, 1); |
780 | if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) | 870 | if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) { |
871 | printk("%s/dvb: could not write to tuner at addr: 0x%02x\n",dev->name, addr << 1); | ||
781 | return -EIO; | 872 | return -EIO; |
873 | } | ||
874 | tuner_buf[0] = 0x90; | ||
875 | tuner_buf[1] = 0xff; | ||
876 | tuner_buf[2] = 0x60; | ||
877 | tuner_buf[3] = 0x00; | ||
878 | tuner_buf[4] = 0x59; // lpsel, for 6MHz + 2 | ||
879 | msg.len = 5; | ||
880 | if (fe->ops.i2c_gate_ctrl) | ||
881 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
882 | i2c_transfer(&dev->i2c_adap, &msg, 1); | ||
782 | 883 | ||
783 | msg.buf= reg2; | 884 | tuner_buf[0] = 0xa0; |
885 | tuner_buf[1] = 0x40; | ||
784 | msg.len = 2; | 886 | msg.len = 2; |
785 | reg2[0] = 0x60; | ||
786 | reg2[1] = 0x3c; | ||
787 | if (fe->ops.i2c_gate_ctrl) | 887 | if (fe->ops.i2c_gate_ctrl) |
788 | fe->ops.i2c_gate_ctrl(fe, 1); | 888 | fe->ops.i2c_gate_ctrl(fe, 1); |
789 | i2c_transfer(&dev->i2c_adap, &msg, 1); | 889 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
790 | 890 | ||
791 | reg2[0] = 0xa0; | 891 | msleep(11); |
792 | reg2[1] = 0x40; | 892 | msg.flags = I2C_M_RD; |
893 | if (fe->ops.i2c_gate_ctrl) | ||
894 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
895 | i2c_transfer(&dev->i2c_adap, &msg, 1); | ||
896 | msg.flags = 0; | ||
897 | |||
898 | tuner_buf[1] >>= 4; | ||
899 | dprintk("tda8275a AGC2 gain is: %d\n", tuner_buf[1]); | ||
900 | if ((tuner_buf[1]) < 2) { | ||
901 | philips_tda827x_lna_gain(fe, 0); | ||
902 | tuner_buf[0] = 0x60; | ||
903 | tuner_buf[1] = 0x0c; | ||
904 | if (fe->ops.i2c_gate_ctrl) | ||
905 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
906 | i2c_transfer(&dev->i2c_adap, &msg, 1); | ||
907 | } | ||
908 | |||
909 | tuner_buf[0] = 0xc0; | ||
910 | tuner_buf[1] = 0x99; // lpsel, for 6MHz + 2 | ||
911 | if (fe->ops.i2c_gate_ctrl) | ||
912 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
913 | i2c_transfer(&dev->i2c_adap, &msg, 1); | ||
914 | |||
915 | tuner_buf[0] = 0x60; | ||
916 | tuner_buf[1] = 0x3c; | ||
793 | if (fe->ops.i2c_gate_ctrl) | 917 | if (fe->ops.i2c_gate_ctrl) |
794 | fe->ops.i2c_gate_ctrl(fe, 1); | 918 | fe->ops.i2c_gate_ctrl(fe, 1); |
795 | i2c_transfer(&dev->i2c_adap, &msg, 1); | 919 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
796 | 920 | ||
797 | msleep(2); | ||
798 | /* correct CP value */ | 921 | /* correct CP value */ |
799 | reg2[0] = 0x30; | 922 | tuner_buf[0] = 0x30; |
800 | reg2[1] = 0x10 + tda827xa_dvbt[i].scr; | 923 | tuner_buf[1] = 0x10 + tda827xa_dvbt[i].scr; |
801 | msg.len = 2; | 924 | if (fe->ops.i2c_gate_ctrl) |
925 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
926 | i2c_transfer(&dev->i2c_adap, &msg, 1); | ||
927 | |||
928 | msleep(163); | ||
929 | tuner_buf[0] = 0xc0; | ||
930 | tuner_buf[1] = 0x39; // lpsel, for 6MHz + 2 | ||
802 | if (fe->ops.i2c_gate_ctrl) | 931 | if (fe->ops.i2c_gate_ctrl) |
803 | fe->ops.i2c_gate_ctrl(fe, 1); | 932 | fe->ops.i2c_gate_ctrl(fe, 1); |
804 | i2c_transfer(&dev->i2c_adap, &msg, 1); | 933 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
805 | 934 | ||
806 | msleep(550); | 935 | msleep(3); |
807 | reg2[0] = 0x50; | 936 | /* freeze AGC1 */ |
808 | reg2[1] = 0x4f + (tda827xa_dvbt[i].gc3 << 4); | 937 | tuner_buf[0] = 0x50; |
938 | tuner_buf[1] = 0x4f + (tda827xa_dvbt[i].gc3 << 4); | ||
809 | if (fe->ops.i2c_gate_ctrl) | 939 | if (fe->ops.i2c_gate_ctrl) |
810 | fe->ops.i2c_gate_ctrl(fe, 1); | 940 | fe->ops.i2c_gate_ctrl(fe, 1); |
811 | i2c_transfer(&dev->i2c_adap, &msg, 1); | 941 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
@@ -814,9 +944,11 @@ static int philips_tda827xa_pll_set(u8 addr, struct dvb_frontend *fe, struct dvb | |||
814 | 944 | ||
815 | } | 945 | } |
816 | 946 | ||
817 | static int philips_tda827xa_tuner_sleep(u8 addr, struct dvb_frontend *fe) | 947 | static int philips_tda827xa_tuner_sleep(struct dvb_frontend *fe) |
818 | { | 948 | { |
819 | struct saa7134_dev *dev = fe->dvb->priv; | 949 | struct saa7134_dev *dev = fe->dvb->priv; |
950 | struct tda1004x_state *state = fe->demodulator_priv; | ||
951 | u8 addr = state->config->tuner_address; | ||
820 | static u8 tda827xa_sleep[] = { 0x30, 0x90}; | 952 | static u8 tda827xa_sleep[] = { 0x30, 0x90}; |
821 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tda827xa_sleep, | 953 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tda827xa_sleep, |
822 | .len = sizeof(tda827xa_sleep) }; | 954 | .len = sizeof(tda827xa_sleep) }; |
@@ -828,60 +960,98 @@ static int philips_tda827xa_tuner_sleep(u8 addr, struct dvb_frontend *fe) | |||
828 | return 0; | 960 | return 0; |
829 | } | 961 | } |
830 | 962 | ||
831 | /* ------------------------------------------------------------------ */ | 963 | /* ------------------------------------------------------------------ |
964 | * upper layer: distinguish the silicon tuner versions | ||
965 | */ | ||
832 | 966 | ||
833 | static int tda8290_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) | 967 | static int philips_tda827x_tuner_init(struct dvb_frontend *fe) |
834 | { | 968 | { |
835 | struct saa7134_dev *dev = fe->dvb->priv; | 969 | struct saa7134_dev *dev = fe->dvb->priv; |
836 | static u8 tda8290_close[] = { 0x21, 0xc0}; | 970 | struct tda1004x_state *state = fe->demodulator_priv; |
837 | static u8 tda8290_open[] = { 0x21, 0x80}; | 971 | u8 addr = state->config->tuner_address; |
838 | struct i2c_msg tda8290_msg = {.addr = 0x4b,.flags = 0, .len = 2}; | 972 | u8 data; |
839 | if (enable) { | 973 | struct i2c_msg tuner_msg = {.addr = addr,.flags = I2C_M_RD,.buf = &data, .len = 1}; |
840 | tda8290_msg.buf = tda8290_close; | 974 | state->conf_probed = 0; |
975 | if (fe->ops.i2c_gate_ctrl) | ||
976 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
977 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) { | ||
978 | printk("%s/dvb: could not read from tuner at addr: 0x%02x\n",dev->name, addr << 1); | ||
979 | return -EIO; | ||
980 | } | ||
981 | if ((data & 0x3c) == 0) { | ||
982 | dprintk("tda827x tuner found\n"); | ||
983 | state->conf_probed = 1; | ||
841 | } else { | 984 | } else { |
842 | tda8290_msg.buf = tda8290_open; | 985 | dprintk("tda827xa tuner found\n"); |
986 | state->conf_probed = 2; | ||
987 | } | ||
988 | switch (state->config->antenna_switch) { | ||
989 | case 0: break; | ||
990 | case 1: dprintk("setting GPIO21 to 0 (TV antenna?)\n"); | ||
991 | saa7134_set_gpio(dev, 21, 0); | ||
992 | break; | ||
993 | case 2: dprintk("setting GPIO21 to 1 (Radio antenna?)\n"); | ||
994 | saa7134_set_gpio(dev, 21, 1); | ||
995 | break; | ||
843 | } | 996 | } |
844 | if (i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1) != 1) | ||
845 | return -EIO; | ||
846 | msleep(20); | ||
847 | return 0; | 997 | return 0; |
848 | } | 998 | } |
849 | 999 | ||
850 | /* ------------------------------------------------------------------ */ | 1000 | static int philips_tda827x_tuner_sleep(struct dvb_frontend *fe) |
851 | |||
852 | static int philips_tiger_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | ||
853 | { | 1001 | { |
854 | int ret; | 1002 | struct saa7134_dev *dev = fe->dvb->priv; |
855 | 1003 | struct tda1004x_state *state = fe->demodulator_priv; | |
856 | ret = philips_tda827xa_pll_set(0x61, fe, params); | 1004 | switch (state->conf_probed) { |
857 | if (ret != 0) | 1005 | case 1: philips_tda827xo_tuner_sleep(fe); |
858 | return ret; | 1006 | break; |
1007 | case 2: philips_tda827xa_tuner_sleep(fe); | ||
1008 | break; | ||
1009 | default: dprintk("Huh? unknown tda827x version!\n"); | ||
1010 | return -EIO; | ||
1011 | } | ||
1012 | switch (state->config->antenna_switch) { | ||
1013 | case 0: break; | ||
1014 | case 1: dprintk("setting GPIO21 to 1 (Radio antenna?)\n"); | ||
1015 | saa7134_set_gpio(dev, 21, 1); | ||
1016 | break; | ||
1017 | case 2: dprintk("setting GPIO21 to 0 (TV antenna?)\n"); | ||
1018 | saa7134_set_gpio(dev, 21, 0); | ||
1019 | break; | ||
1020 | } | ||
859 | return 0; | 1021 | return 0; |
860 | } | 1022 | } |
861 | 1023 | ||
862 | static int philips_tiger_tuner_init(struct dvb_frontend *fe) | 1024 | static int philips_tda827x_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
863 | { | 1025 | { |
864 | struct saa7134_dev *dev = fe->dvb->priv; | 1026 | struct saa7134_dev *dev = fe->dvb->priv; |
865 | static u8 data[] = { 0x3c, 0x33, 0x6a}; | 1027 | struct tda1004x_state *state = fe->demodulator_priv; |
866 | struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; | 1028 | switch (state->conf_probed) { |
867 | 1029 | case 1: philips_tda827xo_pll_set(fe, params); | |
868 | if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) | 1030 | break; |
1031 | case 2: philips_tda827xa_pll_set(fe, params); | ||
1032 | break; | ||
1033 | default: dprintk("Huh? unknown tda827x version!\n"); | ||
869 | return -EIO; | 1034 | return -EIO; |
1035 | } | ||
870 | return 0; | 1036 | return 0; |
871 | } | 1037 | } |
872 | 1038 | ||
873 | static int philips_tiger_tuner_sleep(struct dvb_frontend *fe) | 1039 | static void configure_tda827x_fe(struct saa7134_dev *dev, struct tda1004x_config *tda_conf, |
1040 | char *board_name) | ||
874 | { | 1041 | { |
875 | struct saa7134_dev *dev = fe->dvb->priv; | 1042 | dev->dvb.frontend = dvb_attach(tda10046_attach, tda_conf, &dev->i2c_adap); |
876 | static u8 data[] = { 0x3c, 0x33, 0x68}; | 1043 | if (dev->dvb.frontend) { |
877 | struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; | 1044 | if (tda_conf->i2c_gate) |
878 | 1045 | dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl; | |
879 | i2c_transfer(&dev->i2c_adap, &msg, 1); | 1046 | dev->dvb.frontend->ops.tuner_ops.init = philips_tda827x_tuner_init; |
880 | philips_tda827xa_tuner_sleep( 0x61, fe); | 1047 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_tda827x_tuner_sleep; |
881 | return 0; | 1048 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tda827x_pll_set; |
1049 | } | ||
1050 | philips_tda1004x_set_board_name(dev->dvb.frontend, board_name); | ||
882 | } | 1051 | } |
883 | 1052 | ||
884 | static struct tda1004x_config philips_tiger_config = { | 1053 | /* ------------------------------------------------------------------ */ |
1054 | static struct tda1004x_config tda827x_lifeview_config = { | ||
885 | .demod_address = 0x08, | 1055 | .demod_address = 0x08, |
886 | .invert = 1, | 1056 | .invert = 1, |
887 | .invert_oclk = 0, | 1057 | .invert_oclk = 0, |
@@ -889,31 +1059,24 @@ static struct tda1004x_config philips_tiger_config = { | |||
889 | .agc_config = TDA10046_AGC_TDA827X, | 1059 | .agc_config = TDA10046_AGC_TDA827X, |
890 | .gpio_config = TDA10046_GP11_I, | 1060 | .gpio_config = TDA10046_GP11_I, |
891 | .if_freq = TDA10046_FREQ_045, | 1061 | .if_freq = TDA10046_FREQ_045, |
892 | .request_firmware = philips_tda1004x_request_firmware, | 1062 | .tuner_address = 0x60, |
1063 | .request_firmware = philips_tda1004x_request_firmware | ||
893 | }; | 1064 | }; |
894 | /* ------------------------------------------------------------------ */ | ||
895 | |||
896 | static int cinergy_ht_tuner_init(struct dvb_frontend *fe) | ||
897 | { | ||
898 | struct saa7134_dev *dev = fe->dvb->priv; | ||
899 | static u8 data[] = { 0x3c, 0x33, 0x62}; | ||
900 | struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; | ||
901 | |||
902 | if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) | ||
903 | return -EIO; | ||
904 | return 0; | ||
905 | } | ||
906 | |||
907 | static int cinergy_ht_tuner_sleep(struct dvb_frontend *fe) | ||
908 | { | ||
909 | struct saa7134_dev *dev = fe->dvb->priv; | ||
910 | static u8 data[] = { 0x3c, 0x33, 0x60}; | ||
911 | struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; | ||
912 | 1065 | ||
913 | i2c_transfer(&dev->i2c_adap, &msg, 1); | 1066 | static struct tda1004x_config philips_tiger_config = { |
914 | philips_tda827xa_tuner_sleep( 0x61, fe); | 1067 | .demod_address = 0x08, |
915 | return 0; | 1068 | .invert = 1, |
916 | } | 1069 | .invert_oclk = 0, |
1070 | .xtal_freq = TDA10046_XTAL_16M, | ||
1071 | .agc_config = TDA10046_AGC_TDA827X, | ||
1072 | .gpio_config = TDA10046_GP11_I, | ||
1073 | .if_freq = TDA10046_FREQ_045, | ||
1074 | .i2c_gate = 0x4b, | ||
1075 | .tuner_address = 0x61, | ||
1076 | .tuner_config = 0, | ||
1077 | .antenna_switch= 1, | ||
1078 | .request_firmware = philips_tda1004x_request_firmware | ||
1079 | }; | ||
917 | 1080 | ||
918 | static struct tda1004x_config cinergy_ht_config = { | 1081 | static struct tda1004x_config cinergy_ht_config = { |
919 | .demod_address = 0x08, | 1082 | .demod_address = 0x08, |
@@ -923,10 +1086,40 @@ static struct tda1004x_config cinergy_ht_config = { | |||
923 | .agc_config = TDA10046_AGC_TDA827X, | 1086 | .agc_config = TDA10046_AGC_TDA827X, |
924 | .gpio_config = TDA10046_GP01_I, | 1087 | .gpio_config = TDA10046_GP01_I, |
925 | .if_freq = TDA10046_FREQ_045, | 1088 | .if_freq = TDA10046_FREQ_045, |
926 | .request_firmware = philips_tda1004x_request_firmware, | 1089 | .i2c_gate = 0x4b, |
1090 | .tuner_address = 0x61, | ||
1091 | .tuner_config = 0, | ||
1092 | .request_firmware = philips_tda1004x_request_firmware | ||
927 | }; | 1093 | }; |
928 | 1094 | ||
929 | /* ------------------------------------------------------------------ */ | 1095 | static struct tda1004x_config cinergy_ht_pci_config = { |
1096 | .demod_address = 0x08, | ||
1097 | .invert = 1, | ||
1098 | .invert_oclk = 0, | ||
1099 | .xtal_freq = TDA10046_XTAL_16M, | ||
1100 | .agc_config = TDA10046_AGC_TDA827X, | ||
1101 | .gpio_config = TDA10046_GP01_I, | ||
1102 | .if_freq = TDA10046_FREQ_045, | ||
1103 | .i2c_gate = 0x4b, | ||
1104 | .tuner_address = 0x60, | ||
1105 | .tuner_config = 0, | ||
1106 | .request_firmware = philips_tda1004x_request_firmware | ||
1107 | }; | ||
1108 | |||
1109 | static struct tda1004x_config philips_tiger_s_config = { | ||
1110 | .demod_address = 0x08, | ||
1111 | .invert = 1, | ||
1112 | .invert_oclk = 0, | ||
1113 | .xtal_freq = TDA10046_XTAL_16M, | ||
1114 | .agc_config = TDA10046_AGC_TDA827X, | ||
1115 | .gpio_config = TDA10046_GP01_I, | ||
1116 | .if_freq = TDA10046_FREQ_045, | ||
1117 | .i2c_gate = 0x4b, | ||
1118 | .tuner_address = 0x61, | ||
1119 | .tuner_config = 2, | ||
1120 | .antenna_switch= 1, | ||
1121 | .request_firmware = philips_tda1004x_request_firmware | ||
1122 | }; | ||
930 | 1123 | ||
931 | static struct tda1004x_config pinnacle_pctv_310i_config = { | 1124 | static struct tda1004x_config pinnacle_pctv_310i_config = { |
932 | .demod_address = 0x08, | 1125 | .demod_address = 0x08, |
@@ -936,11 +1129,12 @@ static struct tda1004x_config pinnacle_pctv_310i_config = { | |||
936 | .agc_config = TDA10046_AGC_TDA827X, | 1129 | .agc_config = TDA10046_AGC_TDA827X, |
937 | .gpio_config = TDA10046_GP11_I, | 1130 | .gpio_config = TDA10046_GP11_I, |
938 | .if_freq = TDA10046_FREQ_045, | 1131 | .if_freq = TDA10046_FREQ_045, |
939 | .request_firmware = philips_tda1004x_request_firmware, | 1132 | .i2c_gate = 0x4b, |
1133 | .tuner_address = 0x61, | ||
1134 | .tuner_config = 1, | ||
1135 | .request_firmware = philips_tda1004x_request_firmware | ||
940 | }; | 1136 | }; |
941 | 1137 | ||
942 | /* ------------------------------------------------------------------ */ | ||
943 | |||
944 | static struct tda1004x_config hauppauge_hvr_1110_config = { | 1138 | static struct tda1004x_config hauppauge_hvr_1110_config = { |
945 | .demod_address = 0x08, | 1139 | .demod_address = 0x08, |
946 | .invert = 1, | 1140 | .invert = 1, |
@@ -949,11 +1143,11 @@ static struct tda1004x_config hauppauge_hvr_1110_config = { | |||
949 | .agc_config = TDA10046_AGC_TDA827X, | 1143 | .agc_config = TDA10046_AGC_TDA827X, |
950 | .gpio_config = TDA10046_GP11_I, | 1144 | .gpio_config = TDA10046_GP11_I, |
951 | .if_freq = TDA10046_FREQ_045, | 1145 | .if_freq = TDA10046_FREQ_045, |
952 | .request_firmware = philips_tda1004x_request_firmware, | 1146 | .i2c_gate = 0x4b, |
1147 | .tuner_address = 0x61, | ||
1148 | .request_firmware = philips_tda1004x_request_firmware | ||
953 | }; | 1149 | }; |
954 | 1150 | ||
955 | /* ------------------------------------------------------------------ */ | ||
956 | |||
957 | static struct tda1004x_config asus_p7131_dual_config = { | 1151 | static struct tda1004x_config asus_p7131_dual_config = { |
958 | .demod_address = 0x08, | 1152 | .demod_address = 0x08, |
959 | .invert = 1, | 1153 | .invert = 1, |
@@ -962,51 +1156,13 @@ static struct tda1004x_config asus_p7131_dual_config = { | |||
962 | .agc_config = TDA10046_AGC_TDA827X, | 1156 | .agc_config = TDA10046_AGC_TDA827X, |
963 | .gpio_config = TDA10046_GP11_I, | 1157 | .gpio_config = TDA10046_GP11_I, |
964 | .if_freq = TDA10046_FREQ_045, | 1158 | .if_freq = TDA10046_FREQ_045, |
965 | .request_firmware = philips_tda1004x_request_firmware, | 1159 | .i2c_gate = 0x4b, |
1160 | .tuner_address = 0x61, | ||
1161 | .tuner_config = 0, | ||
1162 | .antenna_switch= 2, | ||
1163 | .request_firmware = philips_tda1004x_request_firmware | ||
966 | }; | 1164 | }; |
967 | 1165 | ||
968 | static int asus_p7131_dual_tuner_init(struct dvb_frontend *fe) | ||
969 | { | ||
970 | struct saa7134_dev *dev = fe->dvb->priv; | ||
971 | static u8 data[] = { 0x3c, 0x33, 0x6a}; | ||
972 | struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; | ||
973 | |||
974 | if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) | ||
975 | return -EIO; | ||
976 | /* make sure the DVB-T antenna input is set */ | ||
977 | saa_setl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x0200000); | ||
978 | return 0; | ||
979 | } | ||
980 | |||
981 | static int asus_p7131_dual_tuner_sleep(struct dvb_frontend *fe) | ||
982 | { | ||
983 | struct saa7134_dev *dev = fe->dvb->priv; | ||
984 | static u8 data[] = { 0x3c, 0x33, 0x68}; | ||
985 | struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; | ||
986 | |||
987 | i2c_transfer(&dev->i2c_adap, &msg, 1); | ||
988 | philips_tda827xa_tuner_sleep( 0x61, fe); | ||
989 | /* reset antenna inputs for analog usage */ | ||
990 | saa_clearl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x0200000); | ||
991 | return 0; | ||
992 | } | ||
993 | |||
994 | /* ------------------------------------------------------------------ */ | ||
995 | |||
996 | static int lifeview_trio_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | ||
997 | { | ||
998 | int ret; | ||
999 | |||
1000 | ret = philips_tda827xa_pll_set(0x60, fe, params); | ||
1001 | return ret; | ||
1002 | } | ||
1003 | |||
1004 | static int lifeview_trio_tuner_sleep(struct dvb_frontend *fe) | ||
1005 | { | ||
1006 | philips_tda827xa_tuner_sleep(0x60, fe); | ||
1007 | return 0; | ||
1008 | } | ||
1009 | |||
1010 | static struct tda1004x_config lifeview_trio_config = { | 1166 | static struct tda1004x_config lifeview_trio_config = { |
1011 | .demod_address = 0x09, | 1167 | .demod_address = 0x09, |
1012 | .invert = 1, | 1168 | .invert = 1, |
@@ -1015,125 +1171,82 @@ static struct tda1004x_config lifeview_trio_config = { | |||
1015 | .agc_config = TDA10046_AGC_TDA827X, | 1171 | .agc_config = TDA10046_AGC_TDA827X, |
1016 | .gpio_config = TDA10046_GP00_I, | 1172 | .gpio_config = TDA10046_GP00_I, |
1017 | .if_freq = TDA10046_FREQ_045, | 1173 | .if_freq = TDA10046_FREQ_045, |
1018 | .request_firmware = philips_tda1004x_request_firmware, | 1174 | .tuner_address = 0x60, |
1175 | .request_firmware = philips_tda1004x_request_firmware | ||
1019 | }; | 1176 | }; |
1020 | 1177 | ||
1021 | /* ------------------------------------------------------------------ */ | 1178 | static struct tda1004x_config tevion_dvbt220rf_config = { |
1022 | |||
1023 | static int ads_duo_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | ||
1024 | { | ||
1025 | int ret; | ||
1026 | |||
1027 | ret = philips_tda827xa_pll_set(0x61, fe, params); | ||
1028 | return ret; | ||
1029 | } | ||
1030 | |||
1031 | static int ads_duo_tuner_init(struct dvb_frontend *fe) | ||
1032 | { | ||
1033 | struct saa7134_dev *dev = fe->dvb->priv; | ||
1034 | /* route TDA8275a AGC input to the channel decoder */ | ||
1035 | saa_writeb(SAA7134_GPIO_GPSTATUS2, 0x60); | ||
1036 | return 0; | ||
1037 | } | ||
1038 | |||
1039 | static int ads_duo_tuner_sleep(struct dvb_frontend *fe) | ||
1040 | { | ||
1041 | struct saa7134_dev *dev = fe->dvb->priv; | ||
1042 | /* route TDA8275a AGC input to the analog IF chip*/ | ||
1043 | saa_writeb(SAA7134_GPIO_GPSTATUS2, 0x20); | ||
1044 | philips_tda827xa_tuner_sleep( 0x61, fe); | ||
1045 | return 0; | ||
1046 | } | ||
1047 | |||
1048 | static struct tda1004x_config ads_tech_duo_config = { | ||
1049 | .demod_address = 0x08, | 1179 | .demod_address = 0x08, |
1050 | .invert = 1, | 1180 | .invert = 1, |
1051 | .invert_oclk = 0, | 1181 | .invert_oclk = 0, |
1052 | .xtal_freq = TDA10046_XTAL_16M, | 1182 | .xtal_freq = TDA10046_XTAL_16M, |
1053 | .agc_config = TDA10046_AGC_TDA827X, | 1183 | .agc_config = TDA10046_AGC_TDA827X, |
1054 | .gpio_config = TDA10046_GP00_I, | 1184 | .gpio_config = TDA10046_GP11_I, |
1055 | .if_freq = TDA10046_FREQ_045, | 1185 | .if_freq = TDA10046_FREQ_045, |
1056 | .request_firmware = philips_tda1004x_request_firmware, | 1186 | .tuner_address = 0x60, |
1187 | .request_firmware = philips_tda1004x_request_firmware | ||
1057 | }; | 1188 | }; |
1058 | 1189 | ||
1059 | /* ------------------------------------------------------------------ */ | 1190 | static struct tda1004x_config md8800_dvbt_config = { |
1060 | |||
1061 | static int tevion_dvb220rf_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | ||
1062 | { | ||
1063 | int ret; | ||
1064 | ret = philips_tda827xa_pll_set(0x60, fe, params); | ||
1065 | return ret; | ||
1066 | } | ||
1067 | |||
1068 | static int tevion_dvb220rf_tuner_sleep(struct dvb_frontend *fe) | ||
1069 | { | ||
1070 | philips_tda827xa_tuner_sleep( 0x61, fe); | ||
1071 | return 0; | ||
1072 | } | ||
1073 | |||
1074 | static struct tda1004x_config tevion_dvbt220rf_config = { | ||
1075 | .demod_address = 0x08, | 1191 | .demod_address = 0x08, |
1076 | .invert = 1, | 1192 | .invert = 1, |
1077 | .invert_oclk = 0, | 1193 | .invert_oclk = 0, |
1078 | .xtal_freq = TDA10046_XTAL_16M, | 1194 | .xtal_freq = TDA10046_XTAL_16M, |
1079 | .agc_config = TDA10046_AGC_TDA827X, | 1195 | .agc_config = TDA10046_AGC_TDA827X, |
1080 | .gpio_config = TDA10046_GP11_I, | 1196 | .gpio_config = TDA10046_GP01_I, |
1081 | .if_freq = TDA10046_FREQ_045, | 1197 | .if_freq = TDA10046_FREQ_045, |
1082 | .request_firmware = philips_tda1004x_request_firmware, | 1198 | .i2c_gate = 0x4b, |
1199 | .tuner_address = 0x60, | ||
1200 | .tuner_config = 0, | ||
1201 | .request_firmware = philips_tda1004x_request_firmware | ||
1083 | }; | 1202 | }; |
1084 | 1203 | ||
1085 | /* ------------------------------------------------------------------ */ | 1204 | /* ------------------------------------------------------------------ |
1205 | * special case: this card uses saa713x GPIO22 for the mode switch | ||
1206 | */ | ||
1086 | 1207 | ||
1087 | static int md8800_dvbt_analog_mode(struct dvb_frontend *fe) | 1208 | static int ads_duo_tuner_init(struct dvb_frontend *fe) |
1088 | { | 1209 | { |
1089 | struct saa7134_dev *dev = fe->dvb->priv; | 1210 | struct saa7134_dev *dev = fe->dvb->priv; |
1090 | static u8 data[] = { 0x3c, 0x33, 0x68}; | 1211 | philips_tda827x_tuner_init(fe); |
1091 | struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; | 1212 | /* route TDA8275a AGC input to the channel decoder */ |
1092 | 1213 | saa_setl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x0400000); | |
1093 | i2c_transfer(&dev->i2c_adap, &msg, 1); | ||
1094 | philips_tda827xa_tuner_sleep( 0x61, fe); | ||
1095 | return 0; | 1214 | return 0; |
1096 | } | 1215 | } |
1097 | 1216 | ||
1098 | static int md8800_dvbt_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 1217 | static int ads_duo_tuner_sleep(struct dvb_frontend *fe) |
1099 | { | 1218 | { |
1100 | int ret; | ||
1101 | struct saa7134_dev *dev = fe->dvb->priv; | 1219 | struct saa7134_dev *dev = fe->dvb->priv; |
1102 | static u8 tda8290_close[] = { 0x21, 0xc0}; | 1220 | /* route TDA8275a AGC input to the analog IF chip*/ |
1103 | static u8 tda8290_open[] = { 0x21, 0x80}; | 1221 | saa_clearl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x0400000); |
1104 | struct i2c_msg tda8290_msg = {.addr = 0x4b,.flags = 0, .len = 2}; | 1222 | philips_tda827x_tuner_sleep(fe); |
1105 | /* close tda8290 i2c bridge */ | 1223 | return 0; |
1106 | tda8290_msg.buf = tda8290_close; | ||
1107 | ret = i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1); | ||
1108 | if (ret != 1) | ||
1109 | return -EIO; | ||
1110 | msleep(20); | ||
1111 | ret = philips_tda827xa_pll_set(0x60, fe, params); | ||
1112 | if (ret != 0) | ||
1113 | return ret; | ||
1114 | /* open tda8290 i2c bridge */ | ||
1115 | tda8290_msg.buf = tda8290_open; | ||
1116 | i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1); | ||
1117 | return ret; | ||
1118 | } | 1224 | } |
1119 | 1225 | ||
1120 | static struct tda1004x_config md8800_dvbt_config = { | 1226 | static struct tda1004x_config ads_tech_duo_config = { |
1121 | .demod_address = 0x08, | 1227 | .demod_address = 0x08, |
1122 | .invert = 1, | 1228 | .invert = 1, |
1123 | .invert_oclk = 0, | 1229 | .invert_oclk = 0, |
1124 | .xtal_freq = TDA10046_XTAL_16M, | 1230 | .xtal_freq = TDA10046_XTAL_16M, |
1125 | .agc_config = TDA10046_AGC_TDA827X, | 1231 | .agc_config = TDA10046_AGC_TDA827X, |
1126 | .gpio_config = TDA10046_GP11_I, | 1232 | .gpio_config = TDA10046_GP00_I, |
1127 | .if_freq = TDA10046_FREQ_045, | 1233 | .if_freq = TDA10046_FREQ_045, |
1128 | .request_firmware = philips_tda1004x_request_firmware, | 1234 | .tuner_address = 0x61, |
1235 | .request_firmware = philips_tda1004x_request_firmware | ||
1129 | }; | 1236 | }; |
1130 | 1237 | ||
1238 | /* ================================================================== | ||
1239 | * tda10086 based DVB-S cards, helper functions | ||
1240 | */ | ||
1241 | |||
1131 | static struct tda10086_config flydvbs = { | 1242 | static struct tda10086_config flydvbs = { |
1132 | .demod_address = 0x0e, | 1243 | .demod_address = 0x0e, |
1133 | .invert = 0, | 1244 | .invert = 0, |
1134 | }; | 1245 | }; |
1135 | 1246 | ||
1136 | /* ------------------------------------------------------------------ */ | 1247 | /* ================================================================== |
1248 | * nxt200x based ATSC cards, helper functions | ||
1249 | */ | ||
1137 | 1250 | ||
1138 | static struct nxt200x_config avertvhda180 = { | 1251 | static struct nxt200x_config avertvhda180 = { |
1139 | .demod_address = 0x0a, | 1252 | .demod_address = 0x0a, |
@@ -1153,10 +1266,13 @@ static struct nxt200x_config kworldatsc110 = { | |||
1153 | .set_pll_input = nxt200x_set_pll_input, | 1266 | .set_pll_input = nxt200x_set_pll_input, |
1154 | }; | 1267 | }; |
1155 | 1268 | ||
1156 | /* ------------------------------------------------------------------ */ | 1269 | /* ================================================================== |
1270 | * Core code | ||
1271 | */ | ||
1157 | 1272 | ||
1158 | static int dvb_init(struct saa7134_dev *dev) | 1273 | static int dvb_init(struct saa7134_dev *dev) |
1159 | { | 1274 | { |
1275 | char *board_name; | ||
1160 | /* init struct videobuf_dvb */ | 1276 | /* init struct videobuf_dvb */ |
1161 | dev->ts.nr_bufs = 32; | 1277 | dev->ts.nr_bufs = 32; |
1162 | dev->ts.nr_packets = 32*4; | 1278 | dev->ts.nr_packets = 32*4; |
@@ -1194,6 +1310,7 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1194 | dev->dvb.frontend->ops.tuner_ops.init = philips_fmd1216_tuner_init; | 1310 | dev->dvb.frontend->ops.tuner_ops.init = philips_fmd1216_tuner_init; |
1195 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_fmd1216_tuner_sleep; | 1311 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_fmd1216_tuner_sleep; |
1196 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_fmd1216_tuner_set_params; | 1312 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_fmd1216_tuner_set_params; |
1313 | philips_tda1004x_set_board_name(dev->dvb.frontend, "DVB-T Medion MD7134"); | ||
1197 | } | 1314 | } |
1198 | break; | 1315 | break; |
1199 | case SAA7134_BOARD_PHILIPS_TOUGH: | 1316 | case SAA7134_BOARD_PHILIPS_TOUGH: |
@@ -1201,42 +1318,16 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1201 | &philips_tu1216_60_config, | 1318 | &philips_tu1216_60_config, |
1202 | &dev->i2c_adap); | 1319 | &dev->i2c_adap); |
1203 | if (dev->dvb.frontend) { | 1320 | if (dev->dvb.frontend) { |
1204 | dev->dvb.frontend->ops.tuner_ops.init = philips_tu1216_tuner_60_init; | 1321 | dev->dvb.frontend->ops.tuner_ops.init = philips_tu1216_init; |
1205 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tu1216_tuner_60_set_params; | 1322 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tda6651_pll_set; |
1323 | philips_tda1004x_set_board_name(dev->dvb.frontend, "DVB-T Philips TOUGH"); | ||
1206 | } | 1324 | } |
1207 | break; | 1325 | break; |
1208 | case SAA7134_BOARD_FLYDVBTDUO: | 1326 | case SAA7134_BOARD_FLYDVBTDUO: |
1209 | dev->dvb.frontend = dvb_attach(tda10046_attach, | ||
1210 | &tda827x_lifeview_config, | ||
1211 | &dev->i2c_adap); | ||
1212 | if (dev->dvb.frontend) { | ||
1213 | dev->dvb.frontend->ops.tuner_ops.init = philips_tda827x_tuner_init; | ||
1214 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_tda827x_tuner_sleep; | ||
1215 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tda827x_tuner_set_params; | ||
1216 | } | ||
1217 | break; | ||
1218 | case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS: | 1327 | case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS: |
1219 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1328 | configure_tda827x_fe(dev, &tda827x_lifeview_config, "DVB-T Lifeview FlyDVB Duo"); |
1220 | &tda827x_lifeview_config, | ||
1221 | &dev->i2c_adap); | ||
1222 | if (dev->dvb.frontend) { | ||
1223 | dev->dvb.frontend->ops.tuner_ops.init = philips_tda827x_tuner_init; | ||
1224 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_tda827x_tuner_sleep; | ||
1225 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tda827x_tuner_set_params; | ||
1226 | } | ||
1227 | break; | 1329 | break; |
1228 | case SAA7134_BOARD_PHILIPS_EUROPA: | 1330 | case SAA7134_BOARD_PHILIPS_EUROPA: |
1229 | dev->dvb.frontend = dvb_attach(tda10046_attach, | ||
1230 | &philips_europa_config, | ||
1231 | &dev->i2c_adap); | ||
1232 | if (dev->dvb.frontend) { | ||
1233 | dev->original_demod_sleep = dev->dvb.frontend->ops.sleep; | ||
1234 | dev->dvb.frontend->ops.sleep = philips_europa_demod_sleep; | ||
1235 | dev->dvb.frontend->ops.tuner_ops.init = philips_europa_tuner_init; | ||
1236 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_europa_tuner_sleep; | ||
1237 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params; | ||
1238 | } | ||
1239 | break; | ||
1240 | case SAA7134_BOARD_VIDEOMATE_DVBT_300: | 1331 | case SAA7134_BOARD_VIDEOMATE_DVBT_300: |
1241 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1332 | dev->dvb.frontend = dvb_attach(tda10046_attach, |
1242 | &philips_europa_config, | 1333 | &philips_europa_config, |
@@ -1247,6 +1338,11 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1247 | dev->dvb.frontend->ops.tuner_ops.init = philips_europa_tuner_init; | 1338 | dev->dvb.frontend->ops.tuner_ops.init = philips_europa_tuner_init; |
1248 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_europa_tuner_sleep; | 1339 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_europa_tuner_sleep; |
1249 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params; | 1340 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params; |
1341 | if (dev->board == SAA7134_BOARD_VIDEOMATE_DVBT_300) | ||
1342 | board_name = "DVB-T Compro VideoMate 300"; | ||
1343 | else | ||
1344 | board_name = "DVB-T Philips Europa"; | ||
1345 | philips_tda1004x_set_board_name(dev->dvb.frontend, board_name); | ||
1250 | } | 1346 | } |
1251 | break; | 1347 | break; |
1252 | case SAA7134_BOARD_VIDEOMATE_DVBT_200: | 1348 | case SAA7134_BOARD_VIDEOMATE_DVBT_200: |
@@ -1254,74 +1350,29 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1254 | &philips_tu1216_61_config, | 1350 | &philips_tu1216_61_config, |
1255 | &dev->i2c_adap); | 1351 | &dev->i2c_adap); |
1256 | if (dev->dvb.frontend) { | 1352 | if (dev->dvb.frontend) { |
1257 | dev->dvb.frontend->ops.tuner_ops.init = philips_tu1216_tuner_61_init; | 1353 | dev->dvb.frontend->ops.tuner_ops.init = philips_tu1216_init; |
1258 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tu1216_tuner_61_set_params; | 1354 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tda6651_pll_set; |
1355 | philips_tda1004x_set_board_name(dev->dvb.frontend, "DVB-T Compro VideoMate 200"); | ||
1259 | } | 1356 | } |
1260 | break; | 1357 | break; |
1261 | case SAA7134_BOARD_PHILIPS_TIGER: | 1358 | case SAA7134_BOARD_PHILIPS_TIGER: |
1262 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1359 | configure_tda827x_fe(dev, &philips_tiger_config, "DVB-T Philips Tiger"); |
1263 | &philips_tiger_config, | ||
1264 | &dev->i2c_adap); | ||
1265 | if (dev->dvb.frontend) { | ||
1266 | dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl; | ||
1267 | dev->dvb.frontend->ops.tuner_ops.init = philips_tiger_tuner_init; | ||
1268 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_tiger_tuner_sleep; | ||
1269 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tiger_tuner_set_params; | ||
1270 | } | ||
1271 | break; | 1360 | break; |
1272 | case SAA7134_BOARD_PINNACLE_PCTV_310i: | 1361 | case SAA7134_BOARD_PINNACLE_PCTV_310i: |
1273 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1362 | configure_tda827x_fe(dev, &pinnacle_pctv_310i_config, "DVB-T Pinnacle PCTV 310i"); |
1274 | &pinnacle_pctv_310i_config, | ||
1275 | &dev->i2c_adap); | ||
1276 | if (dev->dvb.frontend) { | ||
1277 | dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl; | ||
1278 | dev->dvb.frontend->ops.tuner_ops.init = philips_tiger_tuner_init; | ||
1279 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_tiger_tuner_sleep; | ||
1280 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tiger_tuner_set_params; | ||
1281 | } | ||
1282 | break; | 1363 | break; |
1283 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: | 1364 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: |
1284 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1365 | configure_tda827x_fe(dev, &hauppauge_hvr_1110_config, "DVB-T Hauppauge HVR 1110"); |
1285 | &hauppauge_hvr_1110_config, | ||
1286 | &dev->i2c_adap); | ||
1287 | if (dev->dvb.frontend) { | ||
1288 | dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl; | ||
1289 | dev->dvb.frontend->ops.tuner_ops.init = philips_tiger_tuner_init; | ||
1290 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_tiger_tuner_sleep; | ||
1291 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tiger_tuner_set_params; | ||
1292 | } | ||
1293 | break; | 1366 | break; |
1294 | case SAA7134_BOARD_ASUSTeK_P7131_DUAL: | 1367 | case SAA7134_BOARD_ASUSTeK_P7131_DUAL: |
1295 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1368 | configure_tda827x_fe(dev, &asus_p7131_dual_config, "DVB-T Asus P7137 Dual"); |
1296 | &asus_p7131_dual_config, | ||
1297 | &dev->i2c_adap); | ||
1298 | if (dev->dvb.frontend) { | ||
1299 | dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl; | ||
1300 | dev->dvb.frontend->ops.tuner_ops.init = asus_p7131_dual_tuner_init; | ||
1301 | dev->dvb.frontend->ops.tuner_ops.sleep = asus_p7131_dual_tuner_sleep; | ||
1302 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tiger_tuner_set_params; | ||
1303 | } | ||
1304 | break; | 1369 | break; |
1305 | case SAA7134_BOARD_FLYDVBT_LR301: | 1370 | case SAA7134_BOARD_FLYDVBT_LR301: |
1306 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1371 | configure_tda827x_fe(dev, &tda827x_lifeview_config, "DVB-T Lifeview FlyDVBT LR301"); |
1307 | &tda827x_lifeview_config, | ||
1308 | &dev->i2c_adap); | ||
1309 | if (dev->dvb.frontend) { | ||
1310 | dev->dvb.frontend->ops.tuner_ops.init = philips_tda827x_tuner_init; | ||
1311 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_tda827x_tuner_sleep; | ||
1312 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tda827x_tuner_set_params; | ||
1313 | } | ||
1314 | break; | 1372 | break; |
1315 | case SAA7134_BOARD_FLYDVB_TRIO: | 1373 | case SAA7134_BOARD_FLYDVB_TRIO: |
1316 | if(! use_frontend) { //terrestrial | 1374 | if(! use_frontend) { //terrestrial |
1317 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1375 | configure_tda827x_fe(dev, &lifeview_trio_config, NULL); |
1318 | &lifeview_trio_config, | ||
1319 | &dev->i2c_adap); | ||
1320 | if (dev->dvb.frontend) { | ||
1321 | dev->dvb.frontend->ops.tuner_ops.sleep = lifeview_trio_tuner_sleep; | ||
1322 | dev->dvb.frontend->ops.tuner_ops.set_params = | ||
1323 | lifeview_trio_tuner_set_params; | ||
1324 | } | ||
1325 | } else { //satellite | 1376 | } else { //satellite |
1326 | dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap); | 1377 | dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap); |
1327 | if (dev->dvb.frontend) { | 1378 | if (dev->dvb.frontend) { |
@@ -1337,42 +1388,26 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1337 | } | 1388 | } |
1338 | break; | 1389 | break; |
1339 | case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331: | 1390 | case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331: |
1391 | case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS: | ||
1340 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1392 | dev->dvb.frontend = dvb_attach(tda10046_attach, |
1341 | &ads_tech_duo_config, | 1393 | &ads_tech_duo_config, |
1342 | &dev->i2c_adap); | 1394 | &dev->i2c_adap); |
1343 | if (dev->dvb.frontend) { | 1395 | if (dev->dvb.frontend) { |
1344 | dev->dvb.frontend->ops.tuner_ops.init = ads_duo_tuner_init; | 1396 | dev->dvb.frontend->ops.tuner_ops.init = ads_duo_tuner_init; |
1345 | dev->dvb.frontend->ops.tuner_ops.sleep = ads_duo_tuner_sleep; | 1397 | dev->dvb.frontend->ops.tuner_ops.sleep = ads_duo_tuner_sleep; |
1346 | dev->dvb.frontend->ops.tuner_ops.set_params = ads_duo_tuner_set_params; | 1398 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tda827x_pll_set; |
1399 | if (dev->board == SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331) | ||
1400 | board_name = "DVB-T ADS DUO Cardbus PTV331"; | ||
1401 | else | ||
1402 | board_name = "DVB-T Lifeview FlyDVT Cardbus"; | ||
1403 | philips_tda1004x_set_board_name(dev->dvb.frontend, board_name); | ||
1347 | } | 1404 | } |
1348 | break; | 1405 | break; |
1349 | case SAA7134_BOARD_TEVION_DVBT_220RF: | 1406 | case SAA7134_BOARD_TEVION_DVBT_220RF: |
1350 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1407 | configure_tda827x_fe(dev, &tevion_dvbt220rf_config, "DVB-T Tevion 220RF"); |
1351 | &tevion_dvbt220rf_config, | ||
1352 | &dev->i2c_adap); | ||
1353 | if (dev->dvb.frontend) { | ||
1354 | dev->dvb.frontend->ops.tuner_ops.sleep = tevion_dvb220rf_tuner_sleep; | ||
1355 | dev->dvb.frontend->ops.tuner_ops.set_params = tevion_dvb220rf_tuner_set_params; | ||
1356 | } | ||
1357 | break; | ||
1358 | case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS: | ||
1359 | dev->dvb.frontend = dvb_attach(tda10046_attach, | ||
1360 | &ads_tech_duo_config, | ||
1361 | &dev->i2c_adap); | ||
1362 | if (dev->dvb.frontend) { | ||
1363 | dev->dvb.frontend->ops.tuner_ops.init = ads_duo_tuner_init; | ||
1364 | dev->dvb.frontend->ops.tuner_ops.sleep = ads_duo_tuner_sleep; | ||
1365 | dev->dvb.frontend->ops.tuner_ops.set_params = ads_duo_tuner_set_params; | ||
1366 | } | ||
1367 | break; | 1408 | break; |
1368 | case SAA7134_BOARD_MEDION_MD8800_QUADRO: | 1409 | case SAA7134_BOARD_MEDION_MD8800_QUADRO: |
1369 | dev->dvb.frontend = tda10046_attach(&md8800_dvbt_config, | 1410 | configure_tda827x_fe(dev, &md8800_dvbt_config, "DVB-T Medion MD8800"); |
1370 | &dev->i2c_adap); | ||
1371 | if (dev->dvb.frontend) { | ||
1372 | dev->dvb.frontend->ops.tuner_ops.init = philips_tiger_tuner_init; | ||
1373 | dev->dvb.frontend->ops.tuner_ops.sleep = md8800_dvbt_analog_mode; | ||
1374 | dev->dvb.frontend->ops.tuner_ops.set_params = md8800_dvbt_pll_set; | ||
1375 | } | ||
1376 | break; | 1411 | break; |
1377 | case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: | 1412 | case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: |
1378 | dev->dvb.frontend = dvb_attach(nxt200x_attach, &avertvhda180, | 1413 | dev->dvb.frontend = dvb_attach(nxt200x_attach, &avertvhda180, |
@@ -1413,6 +1448,7 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1413 | dev->dvb.frontend->ops.tuner_ops.init = philips_fmd1216_tuner_init; | 1448 | dev->dvb.frontend->ops.tuner_ops.init = philips_fmd1216_tuner_init; |
1414 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_fmd1216_tuner_sleep; | 1449 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_fmd1216_tuner_sleep; |
1415 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_fmd1216_tuner_set_params; | 1450 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_fmd1216_tuner_set_params; |
1451 | philips_tda1004x_set_board_name(dev->dvb.frontend, "DVBT Asus Europa 2 Hybrid"); | ||
1416 | } | 1452 | } |
1417 | break; | 1453 | break; |
1418 | case SAA7134_BOARD_VIDEOMATE_DVBT_200A: | 1454 | case SAA7134_BOARD_VIDEOMATE_DVBT_200A: |
@@ -1422,31 +1458,17 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1422 | if (dev->dvb.frontend) { | 1458 | if (dev->dvb.frontend) { |
1423 | dev->dvb.frontend->ops.tuner_ops.init = philips_td1316_tuner_init; | 1459 | dev->dvb.frontend->ops.tuner_ops.init = philips_td1316_tuner_init; |
1424 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params; | 1460 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params; |
1461 | philips_tda1004x_set_board_name(dev->dvb.frontend, "DVBT Compro Videomate 200a"); | ||
1425 | } | 1462 | } |
1426 | break; | 1463 | break; |
1427 | case SAA7134_BOARD_CINERGY_HT_PCMCIA: | 1464 | case SAA7134_BOARD_CINERGY_HT_PCMCIA: |
1428 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1465 | configure_tda827x_fe(dev, &cinergy_ht_config, "DVB-T Terratec Cinergy HT Cardbus"); |
1429 | &cinergy_ht_config, | ||
1430 | &dev->i2c_adap); | ||
1431 | if (dev->dvb.frontend) { | ||
1432 | dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl; | ||
1433 | dev->dvb.frontend->ops.tuner_ops.init = cinergy_ht_tuner_init; | ||
1434 | dev->dvb.frontend->ops.tuner_ops.sleep = cinergy_ht_tuner_sleep; | ||
1435 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tiger_tuner_set_params; | ||
1436 | |||
1437 | } | ||
1438 | break; | 1466 | break; |
1439 | case SAA7134_BOARD_CINERGY_HT_PCI: | 1467 | case SAA7134_BOARD_CINERGY_HT_PCI: |
1440 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 1468 | configure_tda827x_fe(dev, &cinergy_ht_pci_config, "DVB-T Terratec Cinergy HT PCI"); |
1441 | &cinergy_ht_config, | 1469 | break; |
1442 | &dev->i2c_adap); | 1470 | case SAA7134_BOARD_PHILIPS_TIGER_S: |
1443 | if (dev->dvb.frontend) { | 1471 | configure_tda827x_fe(dev, &philips_tiger_s_config, "DVB-T Philips Tiger S"); |
1444 | dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl; | ||
1445 | dev->dvb.frontend->ops.tuner_ops.init = cinergy_ht_tuner_init; | ||
1446 | dev->dvb.frontend->ops.tuner_ops.sleep = cinergy_ht_tuner_sleep; | ||
1447 | dev->dvb.frontend->ops.tuner_ops.set_params = md8800_dvbt_pll_set; | ||
1448 | |||
1449 | } | ||
1450 | break; | 1472 | break; |
1451 | default: | 1473 | default: |
1452 | printk("%s: Huh? unknown DVB card?\n",dev->name); | 1474 | printk("%s: Huh? unknown DVB card?\n",dev->name); |