aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2007-12-16 18:05:00 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:03:55 -0500
commit91c9d4a16710b047781248a38e7000ce9de324af (patch)
tree585258b2f5a533acb67aa0092a7430351175e881
parent710401b837f8849dc9c28385eb5298746b811305 (diff)
V4L/DVB (6841): tda9887: maintain private state independent of struct tuner
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/tda9887.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c
index 7686f52cfcf9..95d974298fe9 100644
--- a/drivers/media/video/tda9887.c
+++ b/drivers/media/video/tda9887.c
@@ -39,8 +39,9 @@ struct tda9887_priv {
39 39
40 unsigned char data[4]; 40 unsigned char data[4];
41 unsigned int config; 41 unsigned int config;
42 42 unsigned int mode;
43 struct tuner *t; 43 unsigned int audmode;
44 v4l2_std_id std;
44}; 45};
45 46
46/* ---------------------------------------------------------------------- */ 47/* ---------------------------------------------------------------------- */
@@ -402,19 +403,18 @@ static void dump_write_message(struct dvb_frontend *fe, unsigned char *buf)
402static int tda9887_set_tvnorm(struct dvb_frontend *fe) 403static int tda9887_set_tvnorm(struct dvb_frontend *fe)
403{ 404{
404 struct tda9887_priv *priv = fe->analog_demod_priv; 405 struct tda9887_priv *priv = fe->analog_demod_priv;
405 struct tuner *t = priv->t;
406 struct tvnorm *norm = NULL; 406 struct tvnorm *norm = NULL;
407 char *buf = priv->data; 407 char *buf = priv->data;
408 int i; 408 int i;
409 409
410 if (t->mode == V4L2_TUNER_RADIO) { 410 if (priv->mode == V4L2_TUNER_RADIO) {
411 if (t->audmode == V4L2_TUNER_MODE_MONO) 411 if (priv->audmode == V4L2_TUNER_MODE_MONO)
412 norm = &radio_mono; 412 norm = &radio_mono;
413 else 413 else
414 norm = &radio_stereo; 414 norm = &radio_stereo;
415 } else { 415 } else {
416 for (i = 0; i < ARRAY_SIZE(tvnorms); i++) { 416 for (i = 0; i < ARRAY_SIZE(tvnorms); i++) {
417 if (tvnorms[i].std & t->std) { 417 if (tvnorms[i].std & priv->std) {
418 norm = tvnorms+i; 418 norm = tvnorms+i;
419 break; 419 break;
420 } 420 }
@@ -477,7 +477,6 @@ static int tda9887_set_insmod(struct dvb_frontend *fe)
477static int tda9887_do_config(struct dvb_frontend *fe) 477static int tda9887_do_config(struct dvb_frontend *fe)
478{ 478{
479 struct tda9887_priv *priv = fe->analog_demod_priv; 479 struct tda9887_priv *priv = fe->analog_demod_priv;
480 struct tuner *t = priv->t;
481 char *buf = priv->data; 480 char *buf = priv->data;
482 481
483 if (priv->config & TDA9887_PORT1_ACTIVE) 482 if (priv->config & TDA9887_PORT1_ACTIVE)
@@ -515,12 +514,12 @@ static int tda9887_do_config(struct dvb_frontend *fe)
515 buf[2] |= (priv->config >> 8) & cTopMask; 514 buf[2] |= (priv->config >> 8) & cTopMask;
516 } 515 }
517 if ((priv->config & TDA9887_INTERCARRIER_NTSC) && 516 if ((priv->config & TDA9887_INTERCARRIER_NTSC) &&
518 (t->std & V4L2_STD_NTSC)) 517 (priv->std & V4L2_STD_NTSC))
519 buf[1] &= ~cQSS; 518 buf[1] &= ~cQSS;
520 if (priv->config & TDA9887_GATING_18) 519 if (priv->config & TDA9887_GATING_18)
521 buf[3] &= ~cGating_36; 520 buf[3] &= ~cGating_36;
522 521
523 if (t->mode == V4L2_TUNER_RADIO) { 522 if (priv->mode == V4L2_TUNER_RADIO) {
524 if (priv->config & TDA9887_RIF_41_3) { 523 if (priv->config & TDA9887_RIF_41_3) {
525 buf[3] &= ~cVideoIFMask; 524 buf[3] &= ~cVideoIFMask;
526 buf[3] |= cRadioIF_41_30; 525 buf[3] |= cRadioIF_41_30;
@@ -550,7 +549,6 @@ static int tda9887_status(struct dvb_frontend *fe)
550static void tda9887_configure(struct dvb_frontend *fe) 549static void tda9887_configure(struct dvb_frontend *fe)
551{ 550{
552 struct tda9887_priv *priv = fe->analog_demod_priv; 551 struct tda9887_priv *priv = fe->analog_demod_priv;
553 struct tuner *t = priv->t;
554 int rc; 552 int rc;
555 553
556 memset(priv->data,0,sizeof(priv->data)); 554 memset(priv->data,0,sizeof(priv->data));
@@ -575,9 +573,8 @@ static void tda9887_configure(struct dvb_frontend *fe)
575 tda9887_do_config(fe); 573 tda9887_do_config(fe);
576 tda9887_set_insmod(fe); 574 tda9887_set_insmod(fe);
577 575
578 if (t->mode == T_STANDBY) { 576 if (priv->mode == T_STANDBY)
579 priv->data[1] |= cForcedMuteAudioON; 577 priv->data[1] |= cForcedMuteAudioON;
580 }
581 578
582 tda9887_dbg("writing: b=0x%02x c=0x%02x e=0x%02x\n", 579 tda9887_dbg("writing: b=0x%02x c=0x%02x e=0x%02x\n",
583 priv->data[1],priv->data[2],priv->data[3]); 580 priv->data[1],priv->data[2],priv->data[3]);
@@ -622,12 +619,21 @@ static int tda9887_get_afc(struct dvb_frontend *fe)
622 619
623static void tda9887_standby(struct dvb_frontend *fe) 620static void tda9887_standby(struct dvb_frontend *fe)
624{ 621{
622 struct tda9887_priv *priv = fe->analog_demod_priv;
623
624 priv->mode = T_STANDBY;
625
625 tda9887_configure(fe); 626 tda9887_configure(fe);
626} 627}
627 628
628static void tda9887_set_params(struct dvb_frontend *fe, 629static void tda9887_set_params(struct dvb_frontend *fe,
629 struct analog_parameters *params) 630 struct analog_parameters *params)
630{ 631{
632 struct tda9887_priv *priv = fe->analog_demod_priv;
633
634 priv->mode = params->mode;
635 priv->audmode = params->audmode;
636 priv->std = params->std;
631 tda9887_configure(fe); 637 tda9887_configure(fe);
632} 638}
633 639
@@ -670,7 +676,6 @@ int tda9887_attach(struct tuner *t)
670 676
671 priv->i2c_props.addr = t->i2c->addr; 677 priv->i2c_props.addr = t->i2c->addr;
672 priv->i2c_props.adap = t->i2c->adapter; 678 priv->i2c_props.adap = t->i2c->adapter;
673 priv->t = t;
674 679
675 strlcpy(t->i2c->name, "tda9887", sizeof(t->i2c->name)); 680 strlcpy(t->i2c->name, "tda9887", sizeof(t->i2c->name));
676 681