aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/mt20xx.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/drivers/media/video/mt20xx.c b/drivers/media/video/mt20xx.c
index 846c6233fa3d..8a838bdb01b6 100644
--- a/drivers/media/video/mt20xx.c
+++ b/drivers/media/video/mt20xx.c
@@ -42,6 +42,14 @@ struct microtune_priv {
42 unsigned int radio_if2; 42 unsigned int radio_if2;
43}; 43};
44 44
45static void microtune_release(struct i2c_client *c)
46{
47 struct tuner *t = i2c_get_clientdata(c);
48
49 kfree(t->priv);
50 t->priv = NULL;
51}
52
45// IsSpurInBand()? 53// IsSpurInBand()?
46static int mt2032_spurcheck(struct i2c_client *c, 54static int mt2032_spurcheck(struct i2c_client *c,
47 int f1, int f2, int spectrum_from,int spectrum_to) 55 int f1, int f2, int spectrum_from,int spectrum_to)
@@ -308,6 +316,12 @@ static void mt2032_set_radio_freq(struct i2c_client *c, unsigned int freq)
308 1085*1000*1000,if2,if2,if2); 316 1085*1000*1000,if2,if2,if2);
309} 317}
310 318
319static struct tuner_operations mt2032_tuner_ops = {
320 .set_tv_freq = mt2032_set_tv_freq,
321 .set_radio_freq = mt2032_set_radio_freq,
322 .release = microtune_release,
323};
324
311// Initalization as described in "MT203x Programming Procedures", Rev 1.2, Feb.2001 325// Initalization as described in "MT203x Programming Procedures", Rev 1.2, Feb.2001
312static int mt2032_init(struct i2c_client *c) 326static int mt2032_init(struct i2c_client *c)
313{ 327{
@@ -361,8 +375,8 @@ static int mt2032_init(struct i2c_client *c)
361 } while (xok != 1 ); 375 } while (xok != 1 );
362 priv->xogc=xogc; 376 priv->xogc=xogc;
363 377
364 t->ops.set_tv_freq = mt2032_set_tv_freq; 378 memcpy(&t->ops, &mt2032_tuner_ops, sizeof(struct tuner_operations));
365 t->ops.set_radio_freq = mt2032_set_radio_freq; 379
366 return(1); 380 return(1);
367} 381}
368 382
@@ -471,6 +485,12 @@ static void mt2050_set_radio_freq(struct i2c_client *c, unsigned int freq)
471 mt2050_set_antenna(c, radio_antenna); 485 mt2050_set_antenna(c, radio_antenna);
472} 486}
473 487
488static struct tuner_operations mt2050_tuner_ops = {
489 .set_tv_freq = mt2050_set_tv_freq,
490 .set_radio_freq = mt2050_set_radio_freq,
491 .release = microtune_release,
492};
493
474static int mt2050_init(struct i2c_client *c) 494static int mt2050_init(struct i2c_client *c)
475{ 495{
476 struct tuner *t = i2c_get_clientdata(c); 496 struct tuner *t = i2c_get_clientdata(c);
@@ -490,17 +510,10 @@ static int mt2050_init(struct i2c_client *c)
490 i2c_master_recv(c,buf,1); 510 i2c_master_recv(c,buf,1);
491 511
492 tuner_dbg("mt2050: sro is %x\n",buf[0]); 512 tuner_dbg("mt2050: sro is %x\n",buf[0]);
493 t->ops.set_tv_freq = mt2050_set_tv_freq;
494 t->ops.set_radio_freq = mt2050_set_radio_freq;
495 return 0;
496}
497 513
498static void microtune_release(struct i2c_client *c) 514 memcpy(&t->ops, &mt2050_tuner_ops, sizeof(struct tuner_operations));
499{
500 struct tuner *t = i2c_get_clientdata(c);
501 515
502 kfree(t->priv); 516 return 0;
503 t->priv = NULL;
504} 517}
505 518
506int microtune_init(struct i2c_client *c) 519int microtune_init(struct i2c_client *c)
@@ -519,10 +532,7 @@ int microtune_init(struct i2c_client *c)
519 priv->radio_if2 = 10700 * 1000; /* 10.7MHz - FM radio */ 532 priv->radio_if2 = 10700 * 1000; /* 10.7MHz - FM radio */
520 533
521 memset(buf,0,sizeof(buf)); 534 memset(buf,0,sizeof(buf));
522 t->ops.set_tv_freq = NULL; 535
523 t->ops.set_radio_freq = NULL;
524 t->ops.standby = NULL;
525 t->ops.release = microtune_release;
526 if (t->std & V4L2_STD_525_60) { 536 if (t->std & V4L2_STD_525_60) {
527 tuner_dbg("pinnacle ntsc\n"); 537 tuner_dbg("pinnacle ntsc\n");
528 priv->radio_if2 = 41300 * 1000; 538 priv->radio_if2 = 41300 * 1000;