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

V4L/DVB (6438): tuner: move analog_demod_priv into struct dvb_frontend

Signed-off-by: default avatarMichael Krufky <mkrufky@linuxtv.org>
Reviewed-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent e2be32ac
...@@ -169,6 +169,7 @@ struct dvb_frontend { ...@@ -169,6 +169,7 @@ struct dvb_frontend {
void* tuner_priv; void* tuner_priv;
void* frontend_priv; void* frontend_priv;
void* sec_priv; void* sec_priv;
void* analog_demod_priv;
}; };
extern int dvb_register_frontend(struct dvb_adapter* dvb, extern int dvb_register_frontend(struct dvb_adapter* dvb,
......
...@@ -50,7 +50,7 @@ struct tda8290_priv { ...@@ -50,7 +50,7 @@ struct tda8290_priv {
static void tda8290_i2c_bridge(struct tuner *t, int close) static void tda8290_i2c_bridge(struct tuner *t, int close)
{ {
struct tda8290_priv *priv = t->priv; struct tda8290_priv *priv = t->fe.analog_demod_priv;
unsigned char enable[2] = { 0x21, 0xC0 }; unsigned char enable[2] = { 0x21, 0xC0 };
unsigned char disable[2] = { 0x21, 0x00 }; unsigned char disable[2] = { 0x21, 0x00 };
...@@ -68,7 +68,7 @@ static void tda8290_i2c_bridge(struct tuner *t, int close) ...@@ -68,7 +68,7 @@ static void tda8290_i2c_bridge(struct tuner *t, int close)
static void tda8295_i2c_bridge(struct tuner *t, int close) static void tda8295_i2c_bridge(struct tuner *t, int close)
{ {
struct tda8290_priv *priv = t->priv; struct tda8290_priv *priv = t->fe.analog_demod_priv;
unsigned char enable[2] = { 0x45, 0xc1 }; unsigned char enable[2] = { 0x45, 0xc1 };
unsigned char disable[2] = { 0x46, 0x00 }; unsigned char disable[2] = { 0x46, 0x00 };
...@@ -98,7 +98,7 @@ static void tda8295_i2c_bridge(struct tuner *t, int close) ...@@ -98,7 +98,7 @@ static void tda8295_i2c_bridge(struct tuner *t, int close)
static void set_audio(struct tuner *t) static void set_audio(struct tuner *t)
{ {
struct tda8290_priv *priv = t->priv; struct tda8290_priv *priv = t->fe.analog_demod_priv;
char* mode; char* mode;
priv->cfg.tda827x_lpsel = 0; priv->cfg.tda827x_lpsel = 0;
...@@ -145,7 +145,7 @@ static void set_audio(struct tuner *t) ...@@ -145,7 +145,7 @@ static void set_audio(struct tuner *t)
static void tda8290_set_freq(struct tuner *t, unsigned int freq) static void tda8290_set_freq(struct tuner *t, unsigned int freq)
{ {
struct tda8290_priv *priv = t->priv; struct tda8290_priv *priv = t->fe.analog_demod_priv;
unsigned char soft_reset[] = { 0x00, 0x00 }; unsigned char soft_reset[] = { 0x00, 0x00 };
unsigned char easy_mode[] = { 0x01, priv->tda8290_easy_mode }; unsigned char easy_mode[] = { 0x01, priv->tda8290_easy_mode };
unsigned char expert_mode[] = { 0x01, 0x80 }; unsigned char expert_mode[] = { 0x01, 0x80 };
...@@ -264,7 +264,7 @@ static void tda8290_set_freq(struct tuner *t, unsigned int freq) ...@@ -264,7 +264,7 @@ static void tda8290_set_freq(struct tuner *t, unsigned int freq)
static void tda8295_power(struct tuner *t, int enable) static void tda8295_power(struct tuner *t, int enable)
{ {
struct tda8290_priv *priv = t->priv; struct tda8290_priv *priv = t->fe.analog_demod_priv;
unsigned char buf[] = { 0x30, 0x00 }; /* clb_stdbt */ unsigned char buf[] = { 0x30, 0x00 }; /* clb_stdbt */
tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1); tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1);
...@@ -280,7 +280,7 @@ static void tda8295_power(struct tuner *t, int enable) ...@@ -280,7 +280,7 @@ static void tda8295_power(struct tuner *t, int enable)
static void tda8295_set_easy_mode(struct tuner *t, int enable) static void tda8295_set_easy_mode(struct tuner *t, int enable)
{ {
struct tda8290_priv *priv = t->priv; struct tda8290_priv *priv = t->fe.analog_demod_priv;
unsigned char buf[] = { 0x01, 0x00 }; unsigned char buf[] = { 0x01, 0x00 };
tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1); 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,7 +296,7 @@ static void tda8295_set_easy_mode(struct tuner *t, int enable)
static void tda8295_set_video_std(struct tuner *t) static void tda8295_set_video_std(struct tuner *t)
{ {
struct tda8290_priv *priv = t->priv; struct tda8290_priv *priv = t->fe.analog_demod_priv;
unsigned char buf[] = { 0x00, priv->tda8290_easy_mode }; unsigned char buf[] = { 0x00, priv->tda8290_easy_mode };
tuner_i2c_xfer_send(&priv->i2c_props, buf, 2); tuner_i2c_xfer_send(&priv->i2c_props, buf, 2);
...@@ -310,7 +310,7 @@ static void tda8295_set_video_std(struct tuner *t) ...@@ -310,7 +310,7 @@ static void tda8295_set_video_std(struct tuner *t)
static void tda8295_agc1_out(struct tuner *t, int enable) static void tda8295_agc1_out(struct tuner *t, int enable)
{ {
struct tda8290_priv *priv = t->priv; struct tda8290_priv *priv = t->fe.analog_demod_priv;
unsigned char buf[] = { 0x02, 0x00 }; /* DIV_FUNC */ unsigned char buf[] = { 0x02, 0x00 }; /* DIV_FUNC */
tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1); 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,7 +326,7 @@ static void tda8295_agc1_out(struct tuner *t, int enable)
static void tda8295_agc2_out(struct tuner *t, int enable) static void tda8295_agc2_out(struct tuner *t, int enable)
{ {
struct tda8290_priv *priv = t->priv; struct tda8290_priv *priv = t->fe.analog_demod_priv;
unsigned char set_gpio_cf[] = { 0x44, 0x00 }; unsigned char set_gpio_cf[] = { 0x44, 0x00 };
unsigned char set_gpio_val[] = { 0x46, 0x00 }; unsigned char set_gpio_val[] = { 0x46, 0x00 };
...@@ -347,7 +347,7 @@ static void tda8295_agc2_out(struct tuner *t, int enable) ...@@ -347,7 +347,7 @@ static void tda8295_agc2_out(struct tuner *t, int enable)
static int tda8295_has_signal(struct tuner *t) static int tda8295_has_signal(struct tuner *t)
{ {
struct tda8290_priv *priv = t->priv; struct tda8290_priv *priv = t->fe.analog_demod_priv;
unsigned char hvpll_stat = 0x26; unsigned char hvpll_stat = 0x26;
unsigned char ret; unsigned char ret;
...@@ -361,7 +361,7 @@ static int tda8295_has_signal(struct tuner *t) ...@@ -361,7 +361,7 @@ static int tda8295_has_signal(struct tuner *t)
static void tda8295_set_freq(struct tuner *t, unsigned int freq) static void tda8295_set_freq(struct tuner *t, unsigned int freq)
{ {
struct tda8290_priv *priv = t->priv; struct tda8290_priv *priv = t->fe.analog_demod_priv;
u16 ifc; u16 ifc;
unsigned char blanking_mode[] = { 0x1d, 0x00 }; unsigned char blanking_mode[] = { 0x1d, 0x00 };
...@@ -411,7 +411,7 @@ static void tda8295_set_freq(struct tuner *t, unsigned int freq) ...@@ -411,7 +411,7 @@ static void tda8295_set_freq(struct tuner *t, unsigned int freq)
static int tda8290_has_signal(struct tuner *t) static int tda8290_has_signal(struct tuner *t)
{ {
struct tda8290_priv *priv = t->priv; struct tda8290_priv *priv = t->fe.analog_demod_priv;
unsigned char i2c_get_afc[1] = { 0x1B }; unsigned char i2c_get_afc[1] = { 0x1B };
unsigned char afc = 0; unsigned char afc = 0;
...@@ -425,7 +425,7 @@ static int tda8290_has_signal(struct tuner *t) ...@@ -425,7 +425,7 @@ static int tda8290_has_signal(struct tuner *t)
static void tda8290_standby(struct tuner *t) static void tda8290_standby(struct tuner *t)
{ {
struct tda8290_priv *priv = t->priv; struct tda8290_priv *priv = t->fe.analog_demod_priv;
unsigned char cb1[] = { 0x30, 0xD0 }; unsigned char cb1[] = { 0x30, 0xD0 };
unsigned char tda8290_standby[] = { 0x00, 0x02 }; unsigned char tda8290_standby[] = { 0x00, 0x02 };
unsigned char tda8290_agc_tri[] = { 0x02, 0x20 }; unsigned char tda8290_agc_tri[] = { 0x02, 0x20 };
...@@ -449,7 +449,7 @@ static void tda8295_standby(struct tuner *t) ...@@ -449,7 +449,7 @@ static void tda8295_standby(struct tuner *t)
static void tda8290_init_if(struct tuner *t) static void tda8290_init_if(struct tuner *t)
{ {
struct tda8290_priv *priv = t->priv; struct tda8290_priv *priv = t->fe.analog_demod_priv;
unsigned char set_VS[] = { 0x30, 0x6F }; unsigned char set_VS[] = { 0x30, 0x6F };
unsigned char set_GP00_CF[] = { 0x20, 0x01 }; unsigned char set_GP00_CF[] = { 0x20, 0x01 };
...@@ -464,7 +464,7 @@ static void tda8290_init_if(struct tuner *t) ...@@ -464,7 +464,7 @@ static void tda8290_init_if(struct tuner *t)
static void tda8295_init_if(struct tuner *t) static void tda8295_init_if(struct tuner *t)
{ {
struct tda8290_priv *priv = t->priv; struct tda8290_priv *priv = t->fe.analog_demod_priv;
static unsigned char set_adc_ctl[] = { 0x33, 0x14 }; static unsigned char set_adc_ctl[] = { 0x33, 0x14 };
static unsigned char set_adc_ctl2[] = { 0x34, 0x00 }; static unsigned char set_adc_ctl2[] = { 0x34, 0x00 };
...@@ -493,7 +493,7 @@ static void tda8295_init_if(struct tuner *t) ...@@ -493,7 +493,7 @@ static void tda8295_init_if(struct tuner *t)
static void tda8290_init_tuner(struct tuner *t) static void tda8290_init_tuner(struct tuner *t)
{ {
struct tda8290_priv *priv = t->priv; struct tda8290_priv *priv = t->fe.analog_demod_priv;
unsigned char tda8275_init[] = { 0x00, 0x00, 0x00, 0x40, 0xdC, 0x04, 0xAf, unsigned char tda8275_init[] = { 0x00, 0x00, 0x00, 0x40, 0xdC, 0x04, 0xAf,
0x3F, 0x2A, 0x04, 0xFF, 0x00, 0x00, 0x40 }; 0x3F, 0x2A, 0x04, 0xFF, 0x00, 0x00, 0x40 };
unsigned char tda8275a_init[] = { 0x00, 0x00, 0x00, 0x00, 0xdC, 0x05, 0x8b, unsigned char tda8275a_init[] = { 0x00, 0x00, 0x00, 0x00, 0xdC, 0x05, 0x8b,
...@@ -515,8 +515,8 @@ static void tda829x_release(struct tuner *t) ...@@ -515,8 +515,8 @@ static void tda829x_release(struct tuner *t)
if (t->fe.ops.tuner_ops.release) if (t->fe.ops.tuner_ops.release)
t->fe.ops.tuner_ops.release(&t->fe); t->fe.ops.tuner_ops.release(&t->fe);
kfree(t->priv); kfree(t->fe.analog_demod_priv);
t->priv = NULL; t->fe.analog_demod_priv = NULL;
} }
static struct analog_tuner_ops tda8290_tuner_ops = { static struct analog_tuner_ops tda8290_tuner_ops = {
...@@ -546,7 +546,7 @@ int tda8290_attach(struct tuner *t) ...@@ -546,7 +546,7 @@ int tda8290_attach(struct tuner *t)
priv = kzalloc(sizeof(struct tda8290_priv), GFP_KERNEL); priv = kzalloc(sizeof(struct tda8290_priv), GFP_KERNEL);
if (priv == NULL) if (priv == NULL)
return -ENOMEM; return -ENOMEM;
t->priv = priv; t->fe.analog_demod_priv = priv;
priv->i2c_props.addr = t->i2c.addr; priv->i2c_props.addr = t->i2c.addr;
priv->i2c_props.adap = t->i2c.adapter; priv->i2c_props.adap = t->i2c.adapter;
...@@ -636,7 +636,7 @@ int tda8295_attach(struct tuner *t) ...@@ -636,7 +636,7 @@ int tda8295_attach(struct tuner *t)
priv = kzalloc(sizeof(struct tda8290_priv), GFP_KERNEL); priv = kzalloc(sizeof(struct tda8290_priv), GFP_KERNEL);
if (priv == NULL) if (priv == NULL)
return -ENOMEM; return -ENOMEM;
t->priv = priv; t->fe.analog_demod_priv = priv;
priv->i2c_props.addr = t->i2c.addr; priv->i2c_props.addr = t->i2c.addr;
priv->i2c_props.adap = t->i2c.adapter; priv->i2c_props.adap = t->i2c.adapter;
......
...@@ -512,7 +512,7 @@ static int tda9887_set_config(struct tuner *t, char *buf) ...@@ -512,7 +512,7 @@ static int tda9887_set_config(struct tuner *t, char *buf)
static int tda9887_status(struct tuner *t) static int tda9887_status(struct tuner *t)
{ {
struct tda9887_priv *priv = t->priv; struct tda9887_priv *priv = t->fe.analog_demod_priv;
unsigned char buf[1]; unsigned char buf[1];
int rc; int rc;
...@@ -525,7 +525,7 @@ static int tda9887_status(struct tuner *t) ...@@ -525,7 +525,7 @@ static int tda9887_status(struct tuner *t)
static void tda9887_configure(struct tuner *t) static void tda9887_configure(struct tuner *t)
{ {
struct tda9887_priv *priv = t->priv; struct tda9887_priv *priv = t->fe.analog_demod_priv;
int rc; int rc;
memset(priv->data,0,sizeof(priv->data)); memset(priv->data,0,sizeof(priv->data));
...@@ -572,13 +572,13 @@ static void tda9887_configure(struct tuner *t) ...@@ -572,13 +572,13 @@ static void tda9887_configure(struct tuner *t)
static void tda9887_tuner_status(struct tuner *t) static void tda9887_tuner_status(struct tuner *t)
{ {
struct tda9887_priv *priv = t->priv; struct tda9887_priv *priv = t->fe.analog_demod_priv;
tda9887_info("Data bytes: b=0x%02x c=0x%02x e=0x%02x\n", priv->data[1], priv->data[2], priv->data[3]); tda9887_info("Data bytes: b=0x%02x c=0x%02x e=0x%02x\n", priv->data[1], priv->data[2], priv->data[3]);
} }
static int tda9887_get_afc(struct tuner *t) static int tda9887_get_afc(struct tuner *t)
{ {
struct tda9887_priv *priv = t->priv; struct tda9887_priv *priv = t->fe.analog_demod_priv;
static int AFC_BITS_2_kHz[] = { static int AFC_BITS_2_kHz[] = {
-12500, -37500, -62500, -97500, -12500, -37500, -62500, -97500,
-112500, -137500, -162500, -187500, -112500, -137500, -162500, -187500,
...@@ -606,8 +606,8 @@ static void tda9887_set_freq(struct tuner *t, unsigned int freq) ...@@ -606,8 +606,8 @@ static void tda9887_set_freq(struct tuner *t, unsigned int freq)
static void tda9887_release(struct tuner *t) static void tda9887_release(struct tuner *t)
{ {
kfree(t->priv); kfree(t->fe.analog_demod_priv);
t->priv = NULL; t->fe.analog_demod_priv = NULL;
} }
static struct analog_tuner_ops tda9887_tuner_ops = { static struct analog_tuner_ops tda9887_tuner_ops = {
...@@ -626,7 +626,7 @@ int tda9887_tuner_init(struct tuner *t) ...@@ -626,7 +626,7 @@ int tda9887_tuner_init(struct tuner *t)
priv = kzalloc(sizeof(struct tda9887_priv), GFP_KERNEL); priv = kzalloc(sizeof(struct tda9887_priv), GFP_KERNEL);
if (priv == NULL) if (priv == NULL)
return -ENOMEM; return -ENOMEM;
t->priv = priv; t->fe.analog_demod_priv = priv;
priv->i2c_props.addr = t->i2c.addr; priv->i2c_props.addr = t->i2c.addr;
priv->i2c_props.adap = t->i2c.adapter; priv->i2c_props.adap = t->i2c.adapter;
......
...@@ -280,10 +280,6 @@ static void set_type(struct i2c_client *c, unsigned int type, ...@@ -280,10 +280,6 @@ static void set_type(struct i2c_client *c, unsigned int type,
/* discard private data, in case set_type() was previously called */ /* discard private data, in case set_type() was previously called */
if ((ops) && (ops->release)) if ((ops) && (ops->release))
ops->release(t); ops->release(t);
else {
kfree(t->priv);
t->priv = NULL;
}
switch (t->type) { switch (t->type) {
case TUNER_MT2032: case TUNER_MT2032:
...@@ -728,9 +724,7 @@ static int tuner_detach(struct i2c_client *client) ...@@ -728,9 +724,7 @@ static int tuner_detach(struct i2c_client *client)
if ((ops) && (ops->release)) if ((ops) && (ops->release))
ops->release(t); ops->release(t);
else {
kfree(t->priv);
}
kfree(t); kfree(t);
return 0; return 0;
} }
......
...@@ -57,7 +57,6 @@ struct tuner { ...@@ -57,7 +57,6 @@ struct tuner {
v4l2_std_id std; v4l2_std_id std;
int using_v4l2; int using_v4l2;
void *priv;
struct dvb_frontend fe; struct dvb_frontend fe;
......
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