aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tda9887.c
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2007-12-16 17:53:32 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:03:54 -0500
commit710401b837f8849dc9c28385eb5298746b811305 (patch)
tree25a556fa0f840a5d115abefac344181fd2caea00 /drivers/media/video/tda9887.c
parentf1c9a281005f714fdc57c830a23f2b6bd6e2b714 (diff)
V4L/DVB (6840): tuner: convert tda9887 to use TUNER_SET_CONFIG
Use TUNER_SET_CONFIG to set configuration in tda9887's private state structure, rather than storing tda9887-specific configuration within struct tuner. Update handling of TUNER_SET_CONFIG by tuner-core, to call &t->fe.ops.analog_demod_ops rather than &t->fe.ops.tuner_ops analog_demod_ops.set_config passes the request to tuner_ops.set_config, so this does not break other drivers. Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/tda9887.c')
-rw-r--r--drivers/media/video/tda9887.c47
1 files changed, 30 insertions, 17 deletions
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c
index f265c702cde1..7686f52cfcf9 100644
--- a/drivers/media/video/tda9887.c
+++ b/drivers/media/video/tda9887.c
@@ -38,6 +38,7 @@ struct tda9887_priv {
38 struct tuner_i2c_props i2c_props; 38 struct tuner_i2c_props i2c_props;
39 39
40 unsigned char data[4]; 40 unsigned char data[4];
41 unsigned int config;
41 42
42 struct tuner *t; 43 struct tuner *t;
43}; 44};
@@ -473,31 +474,31 @@ static int tda9887_set_insmod(struct dvb_frontend *fe)
473 return 0; 474 return 0;
474} 475}
475 476
476static int tda9887_set_config(struct dvb_frontend *fe) 477static int tda9887_do_config(struct dvb_frontend *fe)
477{ 478{
478 struct tda9887_priv *priv = fe->analog_demod_priv; 479 struct tda9887_priv *priv = fe->analog_demod_priv;
479 struct tuner *t = priv->t; 480 struct tuner *t = priv->t;
480 char *buf = priv->data; 481 char *buf = priv->data;
481 482
482 if (t->tda9887_config & TDA9887_PORT1_ACTIVE) 483 if (priv->config & TDA9887_PORT1_ACTIVE)
483 buf[1] &= ~cOutputPort1Inactive; 484 buf[1] &= ~cOutputPort1Inactive;
484 if (t->tda9887_config & TDA9887_PORT1_INACTIVE) 485 if (priv->config & TDA9887_PORT1_INACTIVE)
485 buf[1] |= cOutputPort1Inactive; 486 buf[1] |= cOutputPort1Inactive;
486 if (t->tda9887_config & TDA9887_PORT2_ACTIVE) 487 if (priv->config & TDA9887_PORT2_ACTIVE)
487 buf[1] &= ~cOutputPort2Inactive; 488 buf[1] &= ~cOutputPort2Inactive;
488 if (t->tda9887_config & TDA9887_PORT2_INACTIVE) 489 if (priv->config & TDA9887_PORT2_INACTIVE)
489 buf[1] |= cOutputPort2Inactive; 490 buf[1] |= cOutputPort2Inactive;
490 491
491 if (t->tda9887_config & TDA9887_QSS) 492 if (priv->config & TDA9887_QSS)
492 buf[1] |= cQSS; 493 buf[1] |= cQSS;
493 if (t->tda9887_config & TDA9887_INTERCARRIER) 494 if (priv->config & TDA9887_INTERCARRIER)
494 buf[1] &= ~cQSS; 495 buf[1] &= ~cQSS;
495 496
496 if (t->tda9887_config & TDA9887_AUTOMUTE) 497 if (priv->config & TDA9887_AUTOMUTE)
497 buf[1] |= cAutoMuteFmActive; 498 buf[1] |= cAutoMuteFmActive;
498 if (t->tda9887_config & TDA9887_DEEMPHASIS_MASK) { 499 if (priv->config & TDA9887_DEEMPHASIS_MASK) {
499 buf[2] &= ~0x60; 500 buf[2] &= ~0x60;
500 switch (t->tda9887_config & TDA9887_DEEMPHASIS_MASK) { 501 switch (priv->config & TDA9887_DEEMPHASIS_MASK) {
501 case TDA9887_DEEMPHASIS_NONE: 502 case TDA9887_DEEMPHASIS_NONE:
502 buf[2] |= cDeemphasisOFF; 503 buf[2] |= cDeemphasisOFF;
503 break; 504 break;
@@ -509,21 +510,22 @@ static int tda9887_set_config(struct dvb_frontend *fe)
509 break; 510 break;
510 } 511 }
511 } 512 }
512 if (t->tda9887_config & TDA9887_TOP_SET) { 513 if (priv->config & TDA9887_TOP_SET) {
513 buf[2] &= ~cTopMask; 514 buf[2] &= ~cTopMask;
514 buf[2] |= (t->tda9887_config >> 8) & cTopMask; 515 buf[2] |= (priv->config >> 8) & cTopMask;
515 } 516 }
516 if ((t->tda9887_config & TDA9887_INTERCARRIER_NTSC) && (t->std & V4L2_STD_NTSC)) 517 if ((priv->config & TDA9887_INTERCARRIER_NTSC) &&
518 (t->std & V4L2_STD_NTSC))
517 buf[1] &= ~cQSS; 519 buf[1] &= ~cQSS;
518 if (t->tda9887_config & TDA9887_GATING_18) 520 if (priv->config & TDA9887_GATING_18)
519 buf[3] &= ~cGating_36; 521 buf[3] &= ~cGating_36;
520 522
521 if (t->mode == V4L2_TUNER_RADIO) { 523 if (t->mode == V4L2_TUNER_RADIO) {
522 if (t->tda9887_config & TDA9887_RIF_41_3) { 524 if (priv->config & TDA9887_RIF_41_3) {
523 buf[3] &= ~cVideoIFMask; 525 buf[3] &= ~cVideoIFMask;
524 buf[3] |= cRadioIF_41_30; 526 buf[3] |= cRadioIF_41_30;
525 } 527 }
526 if (t->tda9887_config & TDA9887_GAIN_NORMAL) 528 if (priv->config & TDA9887_GAIN_NORMAL)
527 buf[3] &= ~cTunerGainLow; 529 buf[3] &= ~cTunerGainLow;
528 } 530 }
529 531
@@ -570,7 +572,7 @@ static void tda9887_configure(struct dvb_frontend *fe)
570 priv->data[1] |= cOutputPort1Inactive; 572 priv->data[1] |= cOutputPort1Inactive;
571 priv->data[1] |= cOutputPort2Inactive; 573 priv->data[1] |= cOutputPort2Inactive;
572 574
573 tda9887_set_config(fe); 575 tda9887_do_config(fe);
574 tda9887_set_insmod(fe); 576 tda9887_set_insmod(fe);
575 577
576 if (t->mode == T_STANDBY) { 578 if (t->mode == T_STANDBY) {
@@ -629,6 +631,16 @@ static void tda9887_set_params(struct dvb_frontend *fe,
629 tda9887_configure(fe); 631 tda9887_configure(fe);
630} 632}
631 633
634static int tda9887_set_config(struct dvb_frontend *fe, void *priv_cfg)
635{
636 struct tda9887_priv *priv = fe->analog_demod_priv;
637
638 priv->config = *(unsigned int *)priv_cfg;
639 tda9887_configure(fe);
640
641 return 0;
642}
643
632static void tda9887_release(struct dvb_frontend *fe) 644static void tda9887_release(struct dvb_frontend *fe)
633{ 645{
634 kfree(fe->analog_demod_priv); 646 kfree(fe->analog_demod_priv);
@@ -644,6 +656,7 @@ static struct analog_tuner_ops tda9887_tuner_ops = {
644 .tuner_status = tda9887_tuner_status, 656 .tuner_status = tda9887_tuner_status,
645 .get_afc = tda9887_get_afc, 657 .get_afc = tda9887_get_afc,
646 .release = tda9887_release, 658 .release = tda9887_release,
659 .set_config = tda9887_set_config,
647}; 660};
648 661
649int tda9887_attach(struct tuner *t) 662int tda9887_attach(struct tuner *t)