aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.h1
-rw-r--r--drivers/media/video/tda8290.c40
-rw-r--r--drivers/media/video/tda9887.c14
-rw-r--r--drivers/media/video/tuner-core.c8
-rw-r--r--drivers/media/video/tuner-driver.h1
5 files changed, 29 insertions, 35 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.h b/drivers/media/dvb/dvb-core/dvb_frontend.h
index 0dd0c6728979..f93c5db36667 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.h
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.h
@@ -169,6 +169,7 @@ struct dvb_frontend {
169 void* tuner_priv; 169 void* tuner_priv;
170 void* frontend_priv; 170 void* frontend_priv;
171 void* sec_priv; 171 void* sec_priv;
172 void* analog_demod_priv;
172}; 173};
173 174
174extern int dvb_register_frontend(struct dvb_adapter* dvb, 175extern int dvb_register_frontend(struct dvb_adapter* dvb,
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c
index da5e5a8169fa..e001c397ccfc 100644
--- a/drivers/media/video/tda8290.c
+++ b/drivers/media/video/tda8290.c
@@ -50,7 +50,7 @@ struct tda8290_priv {
50 50
51static void tda8290_i2c_bridge(struct tuner *t, int close) 51static void tda8290_i2c_bridge(struct tuner *t, int close)
52{ 52{
53 struct tda8290_priv *priv = t->priv; 53 struct tda8290_priv *priv = t->fe.analog_demod_priv;
54 54
55 unsigned char enable[2] = { 0x21, 0xC0 }; 55 unsigned char enable[2] = { 0x21, 0xC0 };
56 unsigned char disable[2] = { 0x21, 0x00 }; 56 unsigned char disable[2] = { 0x21, 0x00 };
@@ -68,7 +68,7 @@ static void tda8290_i2c_bridge(struct tuner *t, int close)
68 68
69static void tda8295_i2c_bridge(struct tuner *t, int close) 69static void tda8295_i2c_bridge(struct tuner *t, int close)
70{ 70{
71 struct tda8290_priv *priv = t->priv; 71 struct tda8290_priv *priv = t->fe.analog_demod_priv;
72 72
73 unsigned char enable[2] = { 0x45, 0xc1 }; 73 unsigned char enable[2] = { 0x45, 0xc1 };
74 unsigned char disable[2] = { 0x46, 0x00 }; 74 unsigned char disable[2] = { 0x46, 0x00 };
@@ -98,7 +98,7 @@ static void tda8295_i2c_bridge(struct tuner *t, int close)
98 98
99static void set_audio(struct tuner *t) 99static void set_audio(struct tuner *t)
100{ 100{
101 struct tda8290_priv *priv = t->priv; 101 struct tda8290_priv *priv = t->fe.analog_demod_priv;
102 char* mode; 102 char* mode;
103 103
104 priv->cfg.tda827x_lpsel = 0; 104 priv->cfg.tda827x_lpsel = 0;
@@ -145,7 +145,7 @@ static void set_audio(struct tuner *t)
145 145
146static void tda8290_set_freq(struct tuner *t, unsigned int freq) 146static void tda8290_set_freq(struct tuner *t, unsigned int freq)
147{ 147{
148 struct tda8290_priv *priv = t->priv; 148 struct tda8290_priv *priv = t->fe.analog_demod_priv;
149 unsigned char soft_reset[] = { 0x00, 0x00 }; 149 unsigned char soft_reset[] = { 0x00, 0x00 };
150 unsigned char easy_mode[] = { 0x01, priv->tda8290_easy_mode }; 150 unsigned char easy_mode[] = { 0x01, priv->tda8290_easy_mode };
151 unsigned char expert_mode[] = { 0x01, 0x80 }; 151 unsigned char expert_mode[] = { 0x01, 0x80 };
@@ -264,7 +264,7 @@ static void tda8290_set_freq(struct tuner *t, unsigned int freq)
264 264
265static void tda8295_power(struct tuner *t, int enable) 265static void tda8295_power(struct tuner *t, int enable)
266{ 266{
267 struct tda8290_priv *priv = t->priv; 267 struct tda8290_priv *priv = t->fe.analog_demod_priv;
268 unsigned char buf[] = { 0x30, 0x00 }; /* clb_stdbt */ 268 unsigned char buf[] = { 0x30, 0x00 }; /* clb_stdbt */
269 269
270 tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1); 270 tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1);
@@ -280,7 +280,7 @@ static void tda8295_power(struct tuner *t, int enable)
280 280
281static void tda8295_set_easy_mode(struct tuner *t, int enable) 281static void tda8295_set_easy_mode(struct tuner *t, int enable)
282{ 282{
283 struct tda8290_priv *priv = t->priv; 283 struct tda8290_priv *priv = t->fe.analog_demod_priv;
284 unsigned char buf[] = { 0x01, 0x00 }; 284 unsigned char buf[] = { 0x01, 0x00 };
285 285
286 tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1); 286 tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1);
@@ -296,7 +296,7 @@ static void tda8295_set_easy_mode(struct tuner *t, int enable)
296 296
297static void tda8295_set_video_std(struct tuner *t) 297static void tda8295_set_video_std(struct tuner *t)
298{ 298{
299 struct tda8290_priv *priv = t->priv; 299 struct tda8290_priv *priv = t->fe.analog_demod_priv;
300 unsigned char buf[] = { 0x00, priv->tda8290_easy_mode }; 300 unsigned char buf[] = { 0x00, priv->tda8290_easy_mode };
301 301
302 tuner_i2c_xfer_send(&priv->i2c_props, buf, 2); 302 tuner_i2c_xfer_send(&priv->i2c_props, buf, 2);
@@ -310,7 +310,7 @@ static void tda8295_set_video_std(struct tuner *t)
310 310
311static void tda8295_agc1_out(struct tuner *t, int enable) 311static void tda8295_agc1_out(struct tuner *t, int enable)
312{ 312{
313 struct tda8290_priv *priv = t->priv; 313 struct tda8290_priv *priv = t->fe.analog_demod_priv;
314 unsigned char buf[] = { 0x02, 0x00 }; /* DIV_FUNC */ 314 unsigned char buf[] = { 0x02, 0x00 }; /* DIV_FUNC */
315 315
316 tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1); 316 tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1);
@@ -326,7 +326,7 @@ static void tda8295_agc1_out(struct tuner *t, int enable)
326 326
327static void tda8295_agc2_out(struct tuner *t, int enable) 327static void tda8295_agc2_out(struct tuner *t, int enable)
328{ 328{
329 struct tda8290_priv *priv = t->priv; 329 struct tda8290_priv *priv = t->fe.analog_demod_priv;
330 unsigned char set_gpio_cf[] = { 0x44, 0x00 }; 330 unsigned char set_gpio_cf[] = { 0x44, 0x00 };
331 unsigned char set_gpio_val[] = { 0x46, 0x00 }; 331 unsigned char set_gpio_val[] = { 0x46, 0x00 };
332 332
@@ -347,7 +347,7 @@ static void tda8295_agc2_out(struct tuner *t, int enable)
347 347
348static int tda8295_has_signal(struct tuner *t) 348static int tda8295_has_signal(struct tuner *t)
349{ 349{
350 struct tda8290_priv *priv = t->priv; 350 struct tda8290_priv *priv = t->fe.analog_demod_priv;
351 351
352 unsigned char hvpll_stat = 0x26; 352 unsigned char hvpll_stat = 0x26;
353 unsigned char ret; 353 unsigned char ret;
@@ -361,7 +361,7 @@ static int tda8295_has_signal(struct tuner *t)
361 361
362static void tda8295_set_freq(struct tuner *t, unsigned int freq) 362static void tda8295_set_freq(struct tuner *t, unsigned int freq)
363{ 363{
364 struct tda8290_priv *priv = t->priv; 364 struct tda8290_priv *priv = t->fe.analog_demod_priv;
365 u16 ifc; 365 u16 ifc;
366 366
367 unsigned char blanking_mode[] = { 0x1d, 0x00 }; 367 unsigned char blanking_mode[] = { 0x1d, 0x00 };
@@ -411,7 +411,7 @@ static void tda8295_set_freq(struct tuner *t, unsigned int freq)
411 411
412static int tda8290_has_signal(struct tuner *t) 412static int tda8290_has_signal(struct tuner *t)
413{ 413{
414 struct tda8290_priv *priv = t->priv; 414 struct tda8290_priv *priv = t->fe.analog_demod_priv;
415 415
416 unsigned char i2c_get_afc[1] = { 0x1B }; 416 unsigned char i2c_get_afc[1] = { 0x1B };
417 unsigned char afc = 0; 417 unsigned char afc = 0;
@@ -425,7 +425,7 @@ static int tda8290_has_signal(struct tuner *t)
425 425
426static void tda8290_standby(struct tuner *t) 426static void tda8290_standby(struct tuner *t)
427{ 427{
428 struct tda8290_priv *priv = t->priv; 428 struct tda8290_priv *priv = t->fe.analog_demod_priv;
429 unsigned char cb1[] = { 0x30, 0xD0 }; 429 unsigned char cb1[] = { 0x30, 0xD0 };
430 unsigned char tda8290_standby[] = { 0x00, 0x02 }; 430 unsigned char tda8290_standby[] = { 0x00, 0x02 };
431 unsigned char tda8290_agc_tri[] = { 0x02, 0x20 }; 431 unsigned char tda8290_agc_tri[] = { 0x02, 0x20 };
@@ -449,7 +449,7 @@ static void tda8295_standby(struct tuner *t)
449 449
450static void tda8290_init_if(struct tuner *t) 450static void tda8290_init_if(struct tuner *t)
451{ 451{
452 struct tda8290_priv *priv = t->priv; 452 struct tda8290_priv *priv = t->fe.analog_demod_priv;
453 453
454 unsigned char set_VS[] = { 0x30, 0x6F }; 454 unsigned char set_VS[] = { 0x30, 0x6F };
455 unsigned char set_GP00_CF[] = { 0x20, 0x01 }; 455 unsigned char set_GP00_CF[] = { 0x20, 0x01 };
@@ -464,7 +464,7 @@ static void tda8290_init_if(struct tuner *t)
464 464
465static void tda8295_init_if(struct tuner *t) 465static void tda8295_init_if(struct tuner *t)
466{ 466{
467 struct tda8290_priv *priv = t->priv; 467 struct tda8290_priv *priv = t->fe.analog_demod_priv;
468 468
469 static unsigned char set_adc_ctl[] = { 0x33, 0x14 }; 469 static unsigned char set_adc_ctl[] = { 0x33, 0x14 };
470 static unsigned char set_adc_ctl2[] = { 0x34, 0x00 }; 470 static unsigned char set_adc_ctl2[] = { 0x34, 0x00 };
@@ -493,7 +493,7 @@ static void tda8295_init_if(struct tuner *t)
493 493
494static void tda8290_init_tuner(struct tuner *t) 494static void tda8290_init_tuner(struct tuner *t)
495{ 495{
496 struct tda8290_priv *priv = t->priv; 496 struct tda8290_priv *priv = t->fe.analog_demod_priv;
497 unsigned char tda8275_init[] = { 0x00, 0x00, 0x00, 0x40, 0xdC, 0x04, 0xAf, 497 unsigned char tda8275_init[] = { 0x00, 0x00, 0x00, 0x40, 0xdC, 0x04, 0xAf,
498 0x3F, 0x2A, 0x04, 0xFF, 0x00, 0x00, 0x40 }; 498 0x3F, 0x2A, 0x04, 0xFF, 0x00, 0x00, 0x40 };
499 unsigned char tda8275a_init[] = { 0x00, 0x00, 0x00, 0x00, 0xdC, 0x05, 0x8b, 499 unsigned char tda8275a_init[] = { 0x00, 0x00, 0x00, 0x00, 0xdC, 0x05, 0x8b,
@@ -515,8 +515,8 @@ static void tda829x_release(struct tuner *t)
515 if (t->fe.ops.tuner_ops.release) 515 if (t->fe.ops.tuner_ops.release)
516 t->fe.ops.tuner_ops.release(&t->fe); 516 t->fe.ops.tuner_ops.release(&t->fe);
517 517
518 kfree(t->priv); 518 kfree(t->fe.analog_demod_priv);
519 t->priv = NULL; 519 t->fe.analog_demod_priv = NULL;
520} 520}
521 521
522static struct analog_tuner_ops tda8290_tuner_ops = { 522static struct analog_tuner_ops tda8290_tuner_ops = {
@@ -546,7 +546,7 @@ int tda8290_attach(struct tuner *t)
546 priv = kzalloc(sizeof(struct tda8290_priv), GFP_KERNEL); 546 priv = kzalloc(sizeof(struct tda8290_priv), GFP_KERNEL);
547 if (priv == NULL) 547 if (priv == NULL)
548 return -ENOMEM; 548 return -ENOMEM;
549 t->priv = priv; 549 t->fe.analog_demod_priv = priv;
550 550
551 priv->i2c_props.addr = t->i2c.addr; 551 priv->i2c_props.addr = t->i2c.addr;
552 priv->i2c_props.adap = t->i2c.adapter; 552 priv->i2c_props.adap = t->i2c.adapter;
@@ -636,7 +636,7 @@ int tda8295_attach(struct tuner *t)
636 priv = kzalloc(sizeof(struct tda8290_priv), GFP_KERNEL); 636 priv = kzalloc(sizeof(struct tda8290_priv), GFP_KERNEL);
637 if (priv == NULL) 637 if (priv == NULL)
638 return -ENOMEM; 638 return -ENOMEM;
639 t->priv = priv; 639 t->fe.analog_demod_priv = priv;
640 640
641 priv->i2c_props.addr = t->i2c.addr; 641 priv->i2c_props.addr = t->i2c.addr;
642 priv->i2c_props.adap = t->i2c.adapter; 642 priv->i2c_props.adap = t->i2c.adapter;
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c
index d9bfa812ffe8..68b22da7e25b 100644
--- a/drivers/media/video/tda9887.c
+++ b/drivers/media/video/tda9887.c
@@ -512,7 +512,7 @@ static int tda9887_set_config(struct tuner *t, char *buf)
512 512
513static int tda9887_status(struct tuner *t) 513static int tda9887_status(struct tuner *t)
514{ 514{
515 struct tda9887_priv *priv = t->priv; 515 struct tda9887_priv *priv = t->fe.analog_demod_priv;
516 unsigned char buf[1]; 516 unsigned char buf[1];
517 int rc; 517 int rc;
518 518
@@ -525,7 +525,7 @@ static int tda9887_status(struct tuner *t)
525 525
526static void tda9887_configure(struct tuner *t) 526static void tda9887_configure(struct tuner *t)
527{ 527{
528 struct tda9887_priv *priv = t->priv; 528 struct tda9887_priv *priv = t->fe.analog_demod_priv;
529 int rc; 529 int rc;
530 530
531 memset(priv->data,0,sizeof(priv->data)); 531 memset(priv->data,0,sizeof(priv->data));
@@ -572,13 +572,13 @@ static void tda9887_configure(struct tuner *t)
572 572
573static void tda9887_tuner_status(struct tuner *t) 573static void tda9887_tuner_status(struct tuner *t)
574{ 574{
575 struct tda9887_priv *priv = t->priv; 575 struct tda9887_priv *priv = t->fe.analog_demod_priv;
576 tda9887_info("Data bytes: b=0x%02x c=0x%02x e=0x%02x\n", priv->data[1], priv->data[2], priv->data[3]); 576 tda9887_info("Data bytes: b=0x%02x c=0x%02x e=0x%02x\n", priv->data[1], priv->data[2], priv->data[3]);
577} 577}
578 578
579static int tda9887_get_afc(struct tuner *t) 579static int tda9887_get_afc(struct tuner *t)
580{ 580{
581 struct tda9887_priv *priv = t->priv; 581 struct tda9887_priv *priv = t->fe.analog_demod_priv;
582 static int AFC_BITS_2_kHz[] = { 582 static int AFC_BITS_2_kHz[] = {
583 -12500, -37500, -62500, -97500, 583 -12500, -37500, -62500, -97500,
584 -112500, -137500, -162500, -187500, 584 -112500, -137500, -162500, -187500,
@@ -606,8 +606,8 @@ static void tda9887_set_freq(struct tuner *t, unsigned int freq)
606 606
607static void tda9887_release(struct tuner *t) 607static void tda9887_release(struct tuner *t)
608{ 608{
609 kfree(t->priv); 609 kfree(t->fe.analog_demod_priv);
610 t->priv = NULL; 610 t->fe.analog_demod_priv = NULL;
611} 611}
612 612
613static struct analog_tuner_ops tda9887_tuner_ops = { 613static struct analog_tuner_ops tda9887_tuner_ops = {
@@ -626,7 +626,7 @@ int tda9887_tuner_init(struct tuner *t)
626 priv = kzalloc(sizeof(struct tda9887_priv), GFP_KERNEL); 626 priv = kzalloc(sizeof(struct tda9887_priv), GFP_KERNEL);
627 if (priv == NULL) 627 if (priv == NULL)
628 return -ENOMEM; 628 return -ENOMEM;
629 t->priv = priv; 629 t->fe.analog_demod_priv = priv;
630 630
631 priv->i2c_props.addr = t->i2c.addr; 631 priv->i2c_props.addr = t->i2c.addr;
632 priv->i2c_props.adap = t->i2c.adapter; 632 priv->i2c_props.adap = t->i2c.adapter;
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 9de66769b623..9903b3f25300 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -280,10 +280,6 @@ static void set_type(struct i2c_client *c, unsigned int type,
280 /* discard private data, in case set_type() was previously called */ 280 /* discard private data, in case set_type() was previously called */
281 if ((ops) && (ops->release)) 281 if ((ops) && (ops->release))
282 ops->release(t); 282 ops->release(t);
283 else {
284 kfree(t->priv);
285 t->priv = NULL;
286 }
287 283
288 switch (t->type) { 284 switch (t->type) {
289 case TUNER_MT2032: 285 case TUNER_MT2032:
@@ -728,9 +724,7 @@ static int tuner_detach(struct i2c_client *client)
728 724
729 if ((ops) && (ops->release)) 725 if ((ops) && (ops->release))
730 ops->release(t); 726 ops->release(t);
731 else { 727
732 kfree(t->priv);
733 }
734 kfree(t); 728 kfree(t);
735 return 0; 729 return 0;
736} 730}
diff --git a/drivers/media/video/tuner-driver.h b/drivers/media/video/tuner-driver.h
index f2a9c29f1f09..fffacb378fd0 100644
--- a/drivers/media/video/tuner-driver.h
+++ b/drivers/media/video/tuner-driver.h
@@ -57,7 +57,6 @@ struct tuner {
57 v4l2_std_id std; 57 v4l2_std_id std;
58 58
59 int using_v4l2; 59 int using_v4l2;
60 void *priv;
61 60
62 struct dvb_frontend fe; 61 struct dvb_frontend fe;
63 62