aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2007-05-05 11:15:57 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-07-18 13:23:14 -0400
commit4abe9f9d94e60303c30b1a9bbbc8e6532f6138cb (patch)
treec71ff23ff82c19edadddca9aed2b00b43bf6f18a
parent77d675047062d514acdc1bbe9f84658b39f99abe (diff)
V4L/DVB (5633): Tuv1236d: move rf input switching code into dvb-pll
This patch removes duplicate code from cx88-dvb and saa7134-dvb that handles rf input switching for the TUV1236d tuner. The functionality is added to dvb-pll, where all the other code that handles the TUV1236d is kept. Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/dvb/frontends/dvb-pll.c14
-rw-r--r--drivers/media/dvb/frontends/nxt200x.c22
-rw-r--r--drivers/media/dvb/frontends/nxt200x.h3
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c10
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c10
5 files changed, 21 insertions, 38 deletions
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c
index 0e3195f9575..1363cc8c906 100644
--- a/drivers/media/dvb/frontends/dvb-pll.c
+++ b/drivers/media/dvb/frontends/dvb-pll.c
@@ -343,11 +343,25 @@ EXPORT_SYMBOL(dvb_pll_tdhu2);
343/* Philips TUV1236D 343/* Philips TUV1236D
344 * used in ATI HDTV Wonder 344 * used in ATI HDTV Wonder
345 */ 345 */
346static void tuv1236d_rf(u8 *buf, const struct dvb_frontend_parameters *params)
347{
348 switch (params->u.vsb.modulation) {
349 case QAM_64:
350 case QAM_256:
351 buf[3] |= 0x08;
352 break;
353 case VSB_8:
354 default:
355 buf[3] &= ~0x08;
356 }
357}
358
346struct dvb_pll_desc dvb_pll_tuv1236d = { 359struct dvb_pll_desc dvb_pll_tuv1236d = {
347 .name = "Philips TUV1236D", 360 .name = "Philips TUV1236D",
348 .min = 54000000, 361 .min = 54000000,
349 .max = 864000000, 362 .max = 864000000,
350 .iffreq= 44000000, 363 .iffreq= 44000000,
364 .set = tuv1236d_rf,
351 .count = 3, 365 .count = 3,
352 .entries = { 366 .entries = {
353 { 157250000, 62500, 0xc6, 0x41 }, 367 { 157250000, 62500, 0xc6, 0x41 },
diff --git a/drivers/media/dvb/frontends/nxt200x.c b/drivers/media/dvb/frontends/nxt200x.c
index b809f83d956..b96f8e846fd 100644
--- a/drivers/media/dvb/frontends/nxt200x.c
+++ b/drivers/media/dvb/frontends/nxt200x.c
@@ -546,11 +546,6 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe,
546 nxt200x_writebytes(state, 0x17, buf, 1); 546 nxt200x_writebytes(state, 0x17, buf, 1);
547 } 547 }
548 548
549 /* get tuning information */
550 if (fe->ops.tuner_ops.calc_regs) {
551 fe->ops.tuner_ops.calc_regs(fe, p, buf, 5);
552 }
553
554 /* set additional params */ 549 /* set additional params */
555 switch (p->u.vsb.modulation) { 550 switch (p->u.vsb.modulation) {
556 case QAM_64: 551 case QAM_64:
@@ -559,27 +554,24 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe,
559 /* This is just a guess since I am unable to test it */ 554 /* This is just a guess since I am unable to test it */
560 if (state->config->set_ts_params) 555 if (state->config->set_ts_params)
561 state->config->set_ts_params(fe, 1); 556 state->config->set_ts_params(fe, 1);
562
563 /* set input */
564 if (state->config->set_pll_input)
565 state->config->set_pll_input(buf+1, 1);
566 break; 557 break;
567 case VSB_8: 558 case VSB_8:
568 /* Set non-punctured clock for VSB */ 559 /* Set non-punctured clock for VSB */
569 if (state->config->set_ts_params) 560 if (state->config->set_ts_params)
570 state->config->set_ts_params(fe, 0); 561 state->config->set_ts_params(fe, 0);
571
572 /* set input */
573 if (state->config->set_pll_input)
574 state->config->set_pll_input(buf+1, 0);
575 break; 562 break;
576 default: 563 default:
577 return -EINVAL; 564 return -EINVAL;
578 break; 565 break;
579 } 566 }
580 567
581 /* write frequency information */ 568 if (fe->ops.tuner_ops.calc_regs) {
582 nxt200x_writetuner(state, buf); 569 /* get tuning information */
570 fe->ops.tuner_ops.calc_regs(fe, p, buf, 5);
571
572 /* write frequency information */
573 nxt200x_writetuner(state, buf);
574 }
583 575
584 /* reset the agc now that tuning has been completed */ 576 /* reset the agc now that tuning has been completed */
585 nxt200x_agc_reset(state); 577 nxt200x_agc_reset(state);
diff --git a/drivers/media/dvb/frontends/nxt200x.h b/drivers/media/dvb/frontends/nxt200x.h
index 28bc5591b31..bb0ef58d797 100644
--- a/drivers/media/dvb/frontends/nxt200x.h
+++ b/drivers/media/dvb/frontends/nxt200x.h
@@ -38,9 +38,6 @@ struct nxt200x_config
38 /* the demodulator's i2c address */ 38 /* the demodulator's i2c address */
39 u8 demod_address; 39 u8 demod_address;
40 40
41 /* used to set pll input */
42 int (*set_pll_input)(u8* buf, int input);
43
44 /* need to set device param for start_dma */ 41 /* need to set device param for start_dma */
45 int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured); 42 int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured);
46}; 43};
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index 770ea64369e..420c25f53bc 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -366,18 +366,8 @@ static int nxt200x_set_ts_param(struct dvb_frontend* fe, int is_punctured)
366 return 0; 366 return 0;
367} 367}
368 368
369static int nxt200x_set_pll_input(u8* buf, int input)
370{
371 if (input)
372 buf[3] |= 0x08;
373 else
374 buf[3] &= ~0x08;
375 return 0;
376}
377
378static struct nxt200x_config ati_hdtvwonder = { 369static struct nxt200x_config ati_hdtvwonder = {
379 .demod_address = 0x0a, 370 .demod_address = 0x0a,
380 .set_pll_input = nxt200x_set_pll_input,
381 .set_ts_params = nxt200x_set_ts_param, 371 .set_ts_params = nxt200x_set_ts_param,
382}; 372};
383 373
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index d6dd6d55b59..1f50a481de2 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -956,18 +956,8 @@ static struct nxt200x_config avertvhda180 = {
956 .demod_address = 0x0a, 956 .demod_address = 0x0a,
957}; 957};
958 958
959static int nxt200x_set_pll_input(u8 *buf, int input)
960{
961 if (input)
962 buf[3] |= 0x08;
963 else
964 buf[3] &= ~0x08;
965 return 0;
966}
967
968static struct nxt200x_config kworldatsc110 = { 959static struct nxt200x_config kworldatsc110 = {
969 .demod_address = 0x0a, 960 .demod_address = 0x0a,
970 .set_pll_input = nxt200x_set_pll_input,
971}; 961};
972 962
973/* ================================================================== 963/* ==================================================================