Commit c22bcb07 authored by Michael Krufky's avatar Michael Krufky Committed by Mauro Carvalho Chehab

V4L/DVB (5754): Mt20xx: store tuning operations in tuner_operations structure

Create static struct tuner_operations mt2050_tuner_ops and mt2032_tuner_ops
for mt20xx tuning function callback pointers
Signed-off-by: default avatarMichael Krufky <mkrufky@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 7a91a80a
...@@ -42,6 +42,14 @@ struct microtune_priv { ...@@ -42,6 +42,14 @@ struct microtune_priv {
unsigned int radio_if2; unsigned int radio_if2;
}; };
static void microtune_release(struct i2c_client *c)
{
struct tuner *t = i2c_get_clientdata(c);
kfree(t->priv);
t->priv = NULL;
}
// IsSpurInBand()? // IsSpurInBand()?
static int mt2032_spurcheck(struct i2c_client *c, static int mt2032_spurcheck(struct i2c_client *c,
int f1, int f2, int spectrum_from,int spectrum_to) 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,6 +316,12 @@ static void mt2032_set_radio_freq(struct i2c_client *c, unsigned int freq)
1085*1000*1000,if2,if2,if2); 1085*1000*1000,if2,if2,if2);
} }
static struct tuner_operations mt2032_tuner_ops = {
.set_tv_freq = mt2032_set_tv_freq,
.set_radio_freq = mt2032_set_radio_freq,
.release = microtune_release,
};
// Initalization as described in "MT203x Programming Procedures", Rev 1.2, Feb.2001 // Initalization as described in "MT203x Programming Procedures", Rev 1.2, Feb.2001
static int mt2032_init(struct i2c_client *c) static int mt2032_init(struct i2c_client *c)
{ {
...@@ -361,8 +375,8 @@ static int mt2032_init(struct i2c_client *c) ...@@ -361,8 +375,8 @@ static int mt2032_init(struct i2c_client *c)
} while (xok != 1 ); } while (xok != 1 );
priv->xogc=xogc; priv->xogc=xogc;
t->ops.set_tv_freq = mt2032_set_tv_freq; memcpy(&t->ops, &mt2032_tuner_ops, sizeof(struct tuner_operations));
t->ops.set_radio_freq = mt2032_set_radio_freq;
return(1); return(1);
} }
...@@ -471,6 +485,12 @@ static void mt2050_set_radio_freq(struct i2c_client *c, unsigned int freq) ...@@ -471,6 +485,12 @@ static void mt2050_set_radio_freq(struct i2c_client *c, unsigned int freq)
mt2050_set_antenna(c, radio_antenna); mt2050_set_antenna(c, radio_antenna);
} }
static struct tuner_operations mt2050_tuner_ops = {
.set_tv_freq = mt2050_set_tv_freq,
.set_radio_freq = mt2050_set_radio_freq,
.release = microtune_release,
};
static int mt2050_init(struct i2c_client *c) static int mt2050_init(struct i2c_client *c)
{ {
struct tuner *t = i2c_get_clientdata(c); struct tuner *t = i2c_get_clientdata(c);
...@@ -490,17 +510,10 @@ static int mt2050_init(struct i2c_client *c) ...@@ -490,17 +510,10 @@ static int mt2050_init(struct i2c_client *c)
i2c_master_recv(c,buf,1); i2c_master_recv(c,buf,1);
tuner_dbg("mt2050: sro is %x\n",buf[0]); tuner_dbg("mt2050: sro is %x\n",buf[0]);
t->ops.set_tv_freq = mt2050_set_tv_freq;
t->ops.set_radio_freq = mt2050_set_radio_freq;
return 0;
}
static void microtune_release(struct i2c_client *c) memcpy(&t->ops, &mt2050_tuner_ops, sizeof(struct tuner_operations));
{
struct tuner *t = i2c_get_clientdata(c);
kfree(t->priv); return 0;
t->priv = NULL;
} }
int microtune_init(struct i2c_client *c) int microtune_init(struct i2c_client *c)
...@@ -519,10 +532,7 @@ int microtune_init(struct i2c_client *c) ...@@ -519,10 +532,7 @@ int microtune_init(struct i2c_client *c)
priv->radio_if2 = 10700 * 1000; /* 10.7MHz - FM radio */ priv->radio_if2 = 10700 * 1000; /* 10.7MHz - FM radio */
memset(buf,0,sizeof(buf)); memset(buf,0,sizeof(buf));
t->ops.set_tv_freq = NULL;
t->ops.set_radio_freq = NULL;
t->ops.standby = NULL;
t->ops.release = microtune_release;
if (t->std & V4L2_STD_525_60) { if (t->std & V4L2_STD_525_60) {
tuner_dbg("pinnacle ntsc\n"); tuner_dbg("pinnacle ntsc\n");
priv->radio_if2 = 41300 * 1000; priv->radio_if2 = 41300 * 1000;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment