Commit 7bff4b4d authored by Hartmut Hackmann's avatar Hartmut Hackmann Committed by Mauro Carvalho Chehab

V4L/DVB (7393): tda827x: fixed support of tuners with LNA

Tuner refactoring broke support of tuners with LNA configurations 1 and 2
for both, analog TV and DVB-T.
Additionally, this patch initializes the saa713x gpios defined by the gpiomask
at driver init to avoid undefined stated at dvb.
Signed-off-by: default avatarHartmut Hackmann <hartmut.hackmann@t-online.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 5823b3a6
...@@ -94,7 +94,6 @@ struct tda1004x_config ...@@ -94,7 +94,6 @@ struct tda1004x_config
/* slave address and configuration of the tuner */ /* slave address and configuration of the tuner */
u8 tuner_address; u8 tuner_address;
u8 tuner_config;
u8 antenna_switch; u8 antenna_switch;
/* if the board uses another I2c Bridge (tda8290), its address */ /* if the board uses another I2c Bridge (tda8290), its address */
......
...@@ -142,7 +142,7 @@ static int tda827xo_set_params(struct dvb_frontend *fe, ...@@ -142,7 +142,7 @@ static int tda827xo_set_params(struct dvb_frontend *fe,
int i, tuner_freq, if_freq; int i, tuner_freq, if_freq;
u32 N; u32 N;
dprintk("%s:\n", __FUNCTION__); dprintk("%s:\n", __func__);
switch (params->u.ofdm.bandwidth) { switch (params->u.ofdm.bandwidth) {
case BANDWIDTH_6_MHZ: case BANDWIDTH_6_MHZ:
if_freq = 4000000; if_freq = 4000000;
...@@ -186,7 +186,7 @@ static int tda827xo_set_params(struct dvb_frontend *fe, ...@@ -186,7 +186,7 @@ static int tda827xo_set_params(struct dvb_frontend *fe,
fe->ops.i2c_gate_ctrl(fe, 1); fe->ops.i2c_gate_ctrl(fe, 1);
if (i2c_transfer(priv->i2c_adap, &msg, 1) != 1) { if (i2c_transfer(priv->i2c_adap, &msg, 1) != 1) {
printk("%s: could not write to tuner at addr: 0x%02x\n", printk("%s: could not write to tuner at addr: 0x%02x\n",
__FUNCTION__, priv->i2c_addr << 1); __func__, priv->i2c_addr << 1);
return -EIO; return -EIO;
} }
msleep(500); msleep(500);
...@@ -212,7 +212,7 @@ static int tda827xo_sleep(struct dvb_frontend *fe) ...@@ -212,7 +212,7 @@ static int tda827xo_sleep(struct dvb_frontend *fe)
struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0, struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0,
.buf = buf, .len = sizeof(buf) }; .buf = buf, .len = sizeof(buf) };
dprintk("%s:\n", __FUNCTION__); dprintk("%s:\n", __func__);
if (fe->ops.i2c_gate_ctrl) if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1); fe->ops.i2c_gate_ctrl(fe, 1);
i2c_transfer(priv->i2c_adap, &msg, 1); i2c_transfer(priv->i2c_adap, &msg, 1);
...@@ -389,6 +389,79 @@ static struct tda827xa_data tda827xa_analog[] = { ...@@ -389,6 +389,79 @@ static struct tda827xa_data tda827xa_analog[] = {
{ .lomax = 0, .svco = 0, .spd = 0, .scr = 0, .sbs = 0, .gc3 = 0} { .lomax = 0, .svco = 0, .spd = 0, .scr = 0, .sbs = 0, .gc3 = 0}
}; };
static int tda827xa_sleep(struct dvb_frontend *fe)
{
struct tda827x_priv *priv = fe->tuner_priv;
static u8 buf[] = { 0x30, 0x90 };
struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0,
.buf = buf, .len = sizeof(buf) };
dprintk("%s:\n", __func__);
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
i2c_transfer(priv->i2c_adap, &msg, 1);
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 0);
if (priv->cfg && priv->cfg->sleep)
priv->cfg->sleep(fe);
return 0;
}
static void tda827xa_lna_gain(struct dvb_frontend *fe, int high,
struct analog_parameters *params)
{
struct tda827x_priv *priv = fe->tuner_priv;
unsigned char buf[] = {0x22, 0x01};
int arg;
int gp_func;
struct i2c_msg msg = { .addr = priv->cfg->switch_addr, .flags = 0,
.buf = buf, .len = sizeof(buf) };
if (NULL == priv->cfg) {
dprintk("tda827x_config not defined, cannot set LNA gain!\n");
return;
}
if (priv->cfg->config) {
if (high)
dprintk("setting LNA to high gain\n");
else
dprintk("setting LNA to low gain\n");
}
switch (priv->cfg->config) {
case 0: /* no LNA */
break;
case 1: /* switch is GPIO 0 of tda8290 */
case 2:
if (params == NULL) {
gp_func = 0;
arg = 0;
} else {
/* turn Vsync on */
gp_func = 1;
if (params->std & V4L2_STD_MN)
arg = 1;
else
arg = 0;
}
if (priv->cfg->tuner_callback)
priv->cfg->tuner_callback(priv->i2c_adap->algo_data,
gp_func, arg);
buf[1] = high ? 0 : 1;
if (priv->cfg->config == 2)
buf[1] = high ? 1 : 0;
i2c_transfer(priv->i2c_adap, &msg, 1);
break;
case 3: /* switch with GPIO of saa713x */
if (priv->cfg->tuner_callback)
priv->cfg->tuner_callback(priv->i2c_adap->algo_data, 0, high);
break;
}
}
static int tda827xa_set_params(struct dvb_frontend *fe, static int tda827xa_set_params(struct dvb_frontend *fe,
struct dvb_frontend_parameters *params) struct dvb_frontend_parameters *params)
{ {
...@@ -401,9 +474,9 @@ static int tda827xa_set_params(struct dvb_frontend *fe, ...@@ -401,9 +474,9 @@ static int tda827xa_set_params(struct dvb_frontend *fe,
int i, tuner_freq, if_freq; int i, tuner_freq, if_freq;
u32 N; u32 N;
dprintk("%s:\n", __FUNCTION__); dprintk("%s:\n", __func__);
if (priv->cfg && priv->cfg->lna_gain)
priv->cfg->lna_gain(fe, 1); tda827xa_lna_gain(fe, 1, NULL);
msleep(20); msleep(20);
switch (params->u.ofdm.bandwidth) { switch (params->u.ofdm.bandwidth) {
...@@ -444,7 +517,7 @@ static int tda827xa_set_params(struct dvb_frontend *fe, ...@@ -444,7 +517,7 @@ static int tda827xa_set_params(struct dvb_frontend *fe,
fe->ops.i2c_gate_ctrl(fe, 1); fe->ops.i2c_gate_ctrl(fe, 1);
if (i2c_transfer(priv->i2c_adap, &msg, 1) != 1) { if (i2c_transfer(priv->i2c_adap, &msg, 1) != 1) {
printk("%s: could not write to tuner at addr: 0x%02x\n", printk("%s: could not write to tuner at addr: 0x%02x\n",
__FUNCTION__, priv->i2c_addr << 1); __func__, priv->i2c_addr << 1);
return -EIO; return -EIO;
} }
buf[0] = 0x90; buf[0] = 0x90;
...@@ -474,8 +547,7 @@ static int tda827xa_set_params(struct dvb_frontend *fe, ...@@ -474,8 +547,7 @@ static int tda827xa_set_params(struct dvb_frontend *fe,
buf[1] >>= 4; buf[1] >>= 4;
dprintk("tda8275a AGC2 gain is: %d\n", buf[1]); dprintk("tda8275a AGC2 gain is: %d\n", buf[1]);
if ((buf[1]) < 2) { if ((buf[1]) < 2) {
if (priv->cfg && priv->cfg->lna_gain) tda827xa_lna_gain(fe, 0, NULL);
priv->cfg->lna_gain(fe, 0);
buf[0] = 0x60; buf[0] = 0x60;
buf[1] = 0x0c; buf[1] = 0x0c;
if (fe->ops.i2c_gate_ctrl) if (fe->ops.i2c_gate_ctrl)
...@@ -523,73 +595,6 @@ static int tda827xa_set_params(struct dvb_frontend *fe, ...@@ -523,73 +595,6 @@ static int tda827xa_set_params(struct dvb_frontend *fe,
return 0; return 0;
} }
static int tda827xa_sleep(struct dvb_frontend *fe)
{
struct tda827x_priv *priv = fe->tuner_priv;
static u8 buf[] = { 0x30, 0x90 };
struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0,
.buf = buf, .len = sizeof(buf) };
dprintk("%s:\n", __FUNCTION__);
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
i2c_transfer(priv->i2c_adap, &msg, 1);
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 0);
if (priv->cfg && priv->cfg->sleep)
priv->cfg->sleep(fe);
return 0;
}
/* ------------------------------------------------------------------ */
static void tda827xa_lna_gain(struct dvb_frontend *fe, int high,
struct analog_parameters *params)
{
struct tda827x_priv *priv = fe->tuner_priv;
unsigned char buf[] = {0x22, 0x01};
int arg;
struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0,
.buf = buf, .len = sizeof(buf) };
if (NULL == priv->cfg) {
dprintk("tda827x_config not defined, cannot set LNA gain!\n");
return;
}
if (priv->cfg->config) {
if (high)
dprintk("setting LNA to high gain\n");
else
dprintk("setting LNA to low gain\n");
}
switch (*priv->cfg->config) {
case 0: /* no LNA */
break;
case 1: /* switch is GPIO 0 of tda8290 */
case 2:
/* turn Vsync on */
if (params->std & V4L2_STD_MN)
arg = 1;
else
arg = 0;
if (priv->cfg->tuner_callback)
priv->cfg->tuner_callback(priv, 1, arg);
buf[1] = high ? 0 : 1;
if (*priv->cfg->config == 2)
buf[1] = high ? 1 : 0;
i2c_transfer(priv->i2c_adap, &msg, 1);
break;
case 3: /* switch with GPIO of saa713x */
if (priv->cfg->tuner_callback)
priv->cfg->tuner_callback(priv, 0, high);
break;
}
}
static int tda827xa_set_analog_params(struct dvb_frontend *fe, static int tda827xa_set_analog_params(struct dvb_frontend *fe,
struct analog_parameters *params) struct analog_parameters *params)
...@@ -724,7 +729,7 @@ static int tda827x_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) ...@@ -724,7 +729,7 @@ static int tda827x_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
static int tda827x_init(struct dvb_frontend *fe) static int tda827x_init(struct dvb_frontend *fe)
{ {
struct tda827x_priv *priv = fe->tuner_priv; struct tda827x_priv *priv = fe->tuner_priv;
dprintk("%s:\n", __FUNCTION__); dprintk("%s:\n", __func__);
if (priv->cfg && priv->cfg->init) if (priv->cfg && priv->cfg->init)
priv->cfg->init(fe); priv->cfg->init(fe);
...@@ -792,7 +797,7 @@ static int tda827x_probe_version(struct dvb_frontend *fe) ...@@ -792,7 +797,7 @@ static int tda827x_probe_version(struct dvb_frontend *fe)
fe->ops.i2c_gate_ctrl(fe, 1); fe->ops.i2c_gate_ctrl(fe, 1);
if (i2c_transfer(priv->i2c_adap, &msg, 1) != 1) { if (i2c_transfer(priv->i2c_adap, &msg, 1) != 1) {
printk("%s: could not read from tuner at addr: 0x%02x\n", printk("%s: could not read from tuner at addr: 0x%02x\n",
__FUNCTION__, msg.addr << 1); __func__, msg.addr << 1);
return -EIO; return -EIO;
} }
if ((data & 0x3c) == 0) { if ((data & 0x3c) == 0) {
...@@ -816,7 +821,7 @@ struct dvb_frontend *tda827x_attach(struct dvb_frontend *fe, int addr, ...@@ -816,7 +821,7 @@ struct dvb_frontend *tda827x_attach(struct dvb_frontend *fe, int addr,
{ {
struct tda827x_priv *priv = NULL; struct tda827x_priv *priv = NULL;
dprintk("%s:\n", __FUNCTION__); dprintk("%s:\n", __func__);
priv = kzalloc(sizeof(struct tda827x_priv), GFP_KERNEL); priv = kzalloc(sizeof(struct tda827x_priv), GFP_KERNEL);
if (priv == NULL) if (priv == NULL)
return NULL; return NULL;
......
...@@ -30,12 +30,12 @@ ...@@ -30,12 +30,12 @@
struct tda827x_config struct tda827x_config
{ {
/* saa7134 - provided callbacks */ /* saa7134 - provided callbacks */
void (*lna_gain) (struct dvb_frontend *fe, int high);
int (*init) (struct dvb_frontend *fe); int (*init) (struct dvb_frontend *fe);
int (*sleep) (struct dvb_frontend *fe); int (*sleep) (struct dvb_frontend *fe);
/* interface to tda829x driver */ /* interface to tda829x driver */
unsigned int *config; unsigned int config;
int switch_addr;
int (*tuner_callback) (void *dev, int command, int arg); int (*tuner_callback) (void *dev, int command, int arg);
void (*agcf)(struct dvb_frontend *fe); void (*agcf)(struct dvb_frontend *fe);
......
...@@ -5260,12 +5260,13 @@ int saa7134_tuner_callback(void *priv, int command, int arg) ...@@ -5260,12 +5260,13 @@ int saa7134_tuner_callback(void *priv, int command, int arg)
{ {
struct i2c_algo_bit_data *i2c_algo = priv; struct i2c_algo_bit_data *i2c_algo = priv;
struct saa7134_dev *dev = i2c_algo->data; struct saa7134_dev *dev = i2c_algo->data;
if (dev != NULL) {
switch (dev->tuner_type) { switch (dev->tuner_type) {
case TUNER_PHILIPS_TDA8290: case TUNER_PHILIPS_TDA8290:
return saa7134_tda8290_callback(dev, command, arg); return saa7134_tda8290_callback(dev, command, arg);
case TUNER_XC2028: case TUNER_XC2028:
return saa7134_xc2028_callback(dev, command, arg); return saa7134_xc2028_callback(dev, command, arg);
}
} }
return -EINVAL; return -EINVAL;
} }
......
...@@ -864,6 +864,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, ...@@ -864,6 +864,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
struct saa7134_dev *dev; struct saa7134_dev *dev;
struct saa7134_mpeg_ops *mops; struct saa7134_mpeg_ops *mops;
int err; int err;
int mask;
dev = kzalloc(sizeof(*dev),GFP_KERNEL); dev = kzalloc(sizeof(*dev),GFP_KERNEL);
if (NULL == dev) if (NULL == dev)
...@@ -1061,6 +1062,11 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, ...@@ -1061,6 +1062,11 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
if (TUNER_ABSENT != dev->tuner_type) if (TUNER_ABSENT != dev->tuner_type)
saa7134_i2c_call_clients(dev, TUNER_SET_STANDBY, NULL); saa7134_i2c_call_clients(dev, TUNER_SET_STANDBY, NULL);
if (card(dev).gpiomask != 0) {
mask = card(dev).gpiomask;
saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, mask, mask);
saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, 0);
}
return 0; return 0;
fail4: fail4:
......
...@@ -439,8 +439,6 @@ static struct tda1004x_config philips_europa_config = { ...@@ -439,8 +439,6 @@ static struct tda1004x_config philips_europa_config = {
.request_firmware = philips_tda1004x_request_firmware .request_firmware = philips_tda1004x_request_firmware
}; };
/* ------------------------------------------------------------------ */
static struct tda1004x_config medion_cardbus = { static struct tda1004x_config medion_cardbus = {
.demod_address = 0x08, .demod_address = 0x08,
.invert = 1, .invert = 1,
...@@ -456,47 +454,6 @@ static struct tda1004x_config medion_cardbus = { ...@@ -456,47 +454,6 @@ static struct tda1004x_config medion_cardbus = {
* tda 1004x based cards with philips silicon tuner * tda 1004x based cards with philips silicon tuner
*/ */
static void philips_tda827x_lna_gain(struct dvb_frontend *fe, int high)
{
struct saa7134_dev *dev = fe->dvb->priv;
struct tda1004x_state *state = fe->demodulator_priv;
u8 addr = state->config->i2c_gate;
u8 config = state->config->tuner_config;
u8 GP00_CF[] = {0x20, 0x01};
u8 GP00_LEV[] = {0x22, 0x00};
struct i2c_msg msg = {.addr = addr,.flags = 0,.buf = GP00_CF, .len = 2};
if (config) {
if (high) {
dprintk("setting LNA to high gain\n");
} else {
dprintk("setting LNA to low gain\n");
}
}
switch (config) {
case 0: /* no LNA */
break;
case 1: /* switch is GPIO 0 of tda8290 */
case 2:
/* turn Vsync off */
saa7134_set_gpio(dev, 22, 0);
GP00_LEV[1] = high ? 0 : 1;
if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) {
wprintk("could not access tda8290 at addr: 0x%02x\n",
addr << 1);
return;
}
msg.buf = GP00_LEV;
if (config == 2)
GP00_LEV[1] = high ? 1 : 0;
i2c_transfer(&dev->i2c_adap, &msg, 1);
break;
case 3: /* switch with GPIO of saa713x */
saa7134_set_gpio(dev, 22, high);
break;
}
}
static int tda8290_i2c_gate_ctrl( struct dvb_frontend* fe, int enable) static int tda8290_i2c_gate_ctrl( struct dvb_frontend* fe, int enable)
{ {
struct tda1004x_state *state = fe->demodulator_priv; struct tda1004x_state *state = fe->demodulator_priv;
...@@ -519,8 +476,6 @@ static int tda8290_i2c_gate_ctrl( struct dvb_frontend* fe, int enable) ...@@ -519,8 +476,6 @@ static int tda8290_i2c_gate_ctrl( struct dvb_frontend* fe, int enable)
return 0; return 0;
} }
/* ------------------------------------------------------------------ */
static int philips_tda827x_tuner_init(struct dvb_frontend *fe) static int philips_tda827x_tuner_init(struct dvb_frontend *fe)
{ {
struct saa7134_dev *dev = fe->dvb->priv; struct saa7134_dev *dev = fe->dvb->priv;
...@@ -555,28 +510,57 @@ static int philips_tda827x_tuner_sleep(struct dvb_frontend *fe) ...@@ -555,28 +510,57 @@ static int philips_tda827x_tuner_sleep(struct dvb_frontend *fe)
return 0; return 0;
} }
static struct tda827x_config tda827x_cfg = { static void configure_tda827x_fe(struct saa7134_dev *dev, struct tda1004x_config *cdec_conf,
.lna_gain = philips_tda827x_lna_gain, struct tda827x_config *tuner_conf)
.init = philips_tda827x_tuner_init,
.sleep = philips_tda827x_tuner_sleep
};
static void configure_tda827x_fe(struct saa7134_dev *dev, struct tda1004x_config *tda_conf)
{ {
dev->dvb.frontend = dvb_attach(tda10046_attach, tda_conf, &dev->i2c_adap); dev->dvb.frontend = dvb_attach(tda10046_attach, cdec_conf, &dev->i2c_adap);
if (dev->dvb.frontend) { if (dev->dvb.frontend) {
if (tda_conf->i2c_gate) if (cdec_conf->i2c_gate)
dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl; dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl;
if (dvb_attach(tda827x_attach, dev->dvb.frontend, tda_conf->tuner_address, if (dvb_attach(tda827x_attach, dev->dvb.frontend, cdec_conf->tuner_address,
&dev->i2c_adap,&tda827x_cfg) == NULL) { &dev->i2c_adap, tuner_conf) == NULL) {
wprintk("no tda827x tuner found at addr: %02x\n", wprintk("no tda827x tuner found at addr: %02x\n",
tda_conf->tuner_address); cdec_conf->tuner_address);
} }
} }
} }
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
static struct tda827x_config tda827x_cfg_0 = {
.tuner_callback = saa7134_tuner_callback,
.init = philips_tda827x_tuner_init,
.sleep = philips_tda827x_tuner_sleep,
.config = 0,
.switch_addr = 0
};
static struct tda827x_config tda827x_cfg_1 = {
.tuner_callback = saa7134_tuner_callback,
.init = philips_tda827x_tuner_init,
.sleep = philips_tda827x_tuner_sleep,
.config = 1,
.switch_addr = 0x4b
};
static struct tda827x_config tda827x_cfg_2 = {
.tuner_callback = saa7134_tuner_callback,
.init = philips_tda827x_tuner_init,
.sleep = philips_tda827x_tuner_sleep,
.config = 2,
.switch_addr = 0x4b
};
static struct tda827x_config tda827x_cfg_2_sw42 = {
.tuner_callback = saa7134_tuner_callback,
.init = philips_tda827x_tuner_init,
.sleep = philips_tda827x_tuner_sleep,
.config = 2,
.switch_addr = 0x42
};
/* ------------------------------------------------------------------ */
static struct tda1004x_config tda827x_lifeview_config = { static struct tda1004x_config tda827x_lifeview_config = {
.demod_address = 0x08, .demod_address = 0x08,
.invert = 1, .invert = 1,
...@@ -599,7 +583,6 @@ static struct tda1004x_config philips_tiger_config = { ...@@ -599,7 +583,6 @@ static struct tda1004x_config philips_tiger_config = {
.if_freq = TDA10046_FREQ_045, .if_freq = TDA10046_FREQ_045,
.i2c_gate = 0x4b, .i2c_gate = 0x4b,
.tuner_address = 0x61, .tuner_address = 0x61,
.tuner_config = 0,
.antenna_switch= 1, .antenna_switch= 1,
.request_firmware = philips_tda1004x_request_firmware .request_firmware = philips_tda1004x_request_firmware
}; };
...@@ -614,7 +597,6 @@ static struct tda1004x_config cinergy_ht_config = { ...@@ -614,7 +597,6 @@ static struct tda1004x_config cinergy_ht_config = {
.if_freq = TDA10046_FREQ_045, .if_freq = TDA10046_FREQ_045,
.i2c_gate = 0x4b, .i2c_gate = 0x4b,
.tuner_address = 0x61, .tuner_address = 0x61,
.tuner_config = 0,
.request_firmware = philips_tda1004x_request_firmware .request_firmware = philips_tda1004x_request_firmware
}; };
...@@ -628,7 +610,6 @@ static struct tda1004x_config cinergy_ht_pci_config = { ...@@ -628,7 +610,6 @@ static struct tda1004x_config cinergy_ht_pci_config = {
.if_freq = TDA10046_FREQ_045, .if_freq = TDA10046_FREQ_045,
.i2c_gate = 0x4b, .i2c_gate = 0x4b,
.tuner_address = 0x60, .tuner_address = 0x60,
.tuner_config = 0,
.request_firmware = philips_tda1004x_request_firmware .request_firmware = philips_tda1004x_request_firmware
}; };
...@@ -642,7 +623,6 @@ static struct tda1004x_config philips_tiger_s_config = { ...@@ -642,7 +623,6 @@ static struct tda1004x_config philips_tiger_s_config = {
.if_freq = TDA10046_FREQ_045, .if_freq = TDA10046_FREQ_045,
.i2c_gate = 0x4b, .i2c_gate = 0x4b,
.tuner_address = 0x61, .tuner_address = 0x61,
.tuner_config = 2,
.antenna_switch= 1, .antenna_switch= 1,
.request_firmware = philips_tda1004x_request_firmware .request_firmware = philips_tda1004x_request_firmware
}; };
...@@ -657,7 +637,6 @@ static struct tda1004x_config pinnacle_pctv_310i_config = { ...@@ -657,7 +637,6 @@ static struct tda1004x_config pinnacle_pctv_310i_config = {
.if_freq = TDA10046_FREQ_045, .if_freq = TDA10046_FREQ_045,
.i2c_gate = 0x4b, .i2c_gate = 0x4b,
.tuner_address = 0x61, .tuner_address = 0x61,
.tuner_config = 1,
.request_firmware = philips_tda1004x_request_firmware .request_firmware = philips_tda1004x_request_firmware
}; };
...@@ -671,7 +650,6 @@ static struct tda1004x_config hauppauge_hvr_1110_config = { ...@@ -671,7 +650,6 @@ static struct tda1004x_config hauppauge_hvr_1110_config = {
.if_freq = TDA10046_FREQ_045, .if_freq = TDA10046_FREQ_045,
.i2c_gate = 0x4b, .i2c_gate = 0x4b,
.tuner_address = 0x61, .tuner_address = 0x61,
.tuner_config = 1,
.request_firmware = philips_tda1004x_request_firmware .request_firmware = philips_tda1004x_request_firmware
}; };
...@@ -685,7 +663,6 @@ static struct tda1004x_config asus_p7131_dual_config = { ...@@ -685,7 +663,6 @@ static struct tda1004x_config asus_p7131_dual_config = {
.if_freq = TDA10046_FREQ_045, .if_freq = TDA10046_FREQ_045,
.i2c_gate = 0x4b, .i2c_gate = 0x4b,
.tuner_address = 0x61, .tuner_address = 0x61,
.tuner_config = 0,
.antenna_switch= 2, .antenna_switch= 2,
.request_firmware = philips_tda1004x_request_firmware .request_firmware = philips_tda1004x_request_firmware
}; };
...@@ -724,7 +701,6 @@ static struct tda1004x_config md8800_dvbt_config = { ...@@ -724,7 +701,6 @@ static struct tda1004x_config md8800_dvbt_config = {
.if_freq = TDA10046_FREQ_045, .if_freq = TDA10046_FREQ_045,
.i2c_gate = 0x4b, .i2c_gate = 0x4b,
.tuner_address = 0x60, .tuner_address = 0x60,
.tuner_config = 0,
.request_firmware = philips_tda1004x_request_firmware .request_firmware = philips_tda1004x_request_firmware
}; };
...@@ -738,7 +714,6 @@ static struct tda1004x_config asus_p7131_4871_config = { ...@@ -738,7 +714,6 @@ static struct tda1004x_config asus_p7131_4871_config = {
.if_freq = TDA10046_FREQ_045, .if_freq = TDA10046_FREQ_045,
.i2c_gate = 0x4b, .i2c_gate = 0x4b,
.tuner_address = 0x61, .tuner_address = 0x61,
.tuner_config = 2,
.antenna_switch= 2, .antenna_switch= 2,
.request_firmware = philips_tda1004x_request_firmware .request_firmware = philips_tda1004x_request_firmware
}; };
...@@ -753,7 +728,6 @@ static struct tda1004x_config asus_p7131_hybrid_lna_config = { ...@@ -753,7 +728,6 @@ static struct tda1004x_config asus_p7131_hybrid_lna_config = {
.if_freq = TDA10046_FREQ_045, .if_freq = TDA10046_FREQ_045,
.i2c_gate = 0x4b, .i2c_gate = 0x4b,
.tuner_address = 0x61, .tuner_address = 0x61,
.tuner_config = 2,
.antenna_switch= 2, .antenna_switch= 2,
.request_firmware = philips_tda1004x_request_firmware .request_firmware = philips_tda1004x_request_firmware
}; };
...@@ -768,7 +742,6 @@ static struct tda1004x_config kworld_dvb_t_210_config = { ...@@ -768,7 +742,6 @@ static struct tda1004x_config kworld_dvb_t_210_config = {
.if_freq = TDA10046_FREQ_045, .if_freq = TDA10046_FREQ_045,
.i2c_gate = 0x4b, .i2c_gate = 0x4b,
.tuner_address = 0x61, .tuner_address = 0x61,
.tuner_config = 2,
.antenna_switch= 1, .antenna_switch= 1,
.request_firmware = philips_tda1004x_request_firmware .request_firmware = philips_tda1004x_request_firmware
}; };
...@@ -783,7 +756,6 @@ static struct tda1004x_config avermedia_super_007_config = { ...@@ -783,7 +756,6 @@ static struct tda1004x_config avermedia_super_007_config = {
.if_freq = TDA10046_FREQ_045, .if_freq = TDA10046_FREQ_045,
.i2c_gate = 0x4b, .i2c_gate = 0x4b,
.tuner_address = 0x60, .tuner_address = 0x60,
.tuner_config = 0,
.antenna_switch= 1, .antenna_switch= 1,
.request_firmware = philips_tda1004x_request_firmware .request_firmware = philips_tda1004x_request_firmware
}; };
...@@ -798,7 +770,6 @@ static struct tda1004x_config twinhan_dtv_dvb_3056_config = { ...@@ -798,7 +770,6 @@ static struct tda1004x_config twinhan_dtv_dvb_3056_config = {
.if_freq = TDA10046_FREQ_045, .if_freq = TDA10046_FREQ_045,
.i2c_gate = 0x42, .i2c_gate = 0x42,
.tuner_address = 0x61, .tuner_address = 0x61,
.tuner_config = 2,
.antenna_switch = 1, .antenna_switch = 1,
.request_firmware = philips_tda1004x_request_firmware .request_firmware = philips_tda1004x_request_firmware
}; };
...@@ -826,9 +797,10 @@ static int ads_duo_tuner_sleep(struct dvb_frontend *fe) ...@@ -826,9 +797,10 @@ static int ads_duo_tuner_sleep(struct dvb_frontend *fe)
} }
static struct tda827x_config ads_duo_cfg = { static struct tda827x_config ads_duo_cfg = {
.lna_gain = philips_tda827x_lna_gain, .tuner_callback = saa7134_tuner_callback,
.init = ads_duo_tuner_init, .init = ads_duo_tuner_init,
.sleep = ads_duo_tuner_sleep .sleep = ads_duo_tuner_sleep,
.config = 0
}; };
static struct tda1004x_config ads_tech_duo_config = { static struct tda1004x_config ads_tech_duo_config = {
...@@ -981,7 +953,7 @@ static int dvb_init(struct saa7134_dev *dev) ...@@ -981,7 +953,7 @@ static int dvb_init(struct saa7134_dev *dev)
break; break;
case SAA7134_BOARD_FLYDVBTDUO: case SAA7134_BOARD_FLYDVBTDUO:
case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS: case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS:
configure_tda827x_fe(dev, &tda827x_lifeview_config); configure_tda827x_fe(dev, &tda827x_lifeview_config, &tda827x_cfg_0);
break; break;
case SAA7134_BOARD_PHILIPS_EUROPA: case SAA7134_BOARD_PHILIPS_EUROPA:
case SAA7134_BOARD_VIDEOMATE_DVBT_300: case SAA7134_BOARD_VIDEOMATE_DVBT_300:
...@@ -1006,27 +978,27 @@ static int dvb_init(struct saa7134_dev *dev) ...@@ -1006,27 +978,27 @@ static int dvb_init(struct saa7134_dev *dev)
} }
break; break;
case SAA7134_BOARD_KWORLD_DVBT_210: case SAA7134_BOARD_KWORLD_DVBT_210:
configure_tda827x_fe(dev, &kworld_dvb_t_210_config); configure_tda827x_fe(dev, &kworld_dvb_t_210_config, &tda827x_cfg_2);
break; break;
case SAA7134_BOARD_PHILIPS_TIGER: case SAA7134_BOARD_PHILIPS_TIGER:
configure_tda827x_fe(dev, &philips_tiger_config); configure_tda827x_fe(dev, &philips_tiger_config, &tda827x_cfg_0);
break; break;
case SAA7134_BOARD_PINNACLE_PCTV_310i: case SAA7134_BOARD_PINNACLE_PCTV_310i:
configure_tda827x_fe(dev, &pinnacle_pctv_310i_config); configure_tda827x_fe(dev, &pinnacle_pctv_310i_config, &tda827x_cfg_1);
break; break;
case SAA7134_BOARD_HAUPPAUGE_HVR1110: case SAA7134_BOARD_HAUPPAUGE_HVR1110:
configure_tda827x_fe(dev, &hauppauge_hvr_1110_config); configure_tda827x_fe(dev, &hauppauge_hvr_1110_config, &tda827x_cfg_1);
break; break;
case SAA7134_BOARD_ASUSTeK_P7131_DUAL: case SAA7134_BOARD_ASUSTeK_P7131_DUAL:
configure_tda827x_fe(dev, &asus_p7131_dual_config); configure_tda827x_fe(dev, &asus_p7131_dual_config, &tda827x_cfg_0);
break; break;
case SAA7134_BOARD_FLYDVBT_LR301: case SAA7134_BOARD_FLYDVBT_LR301:
configure_tda827x_fe(dev, &tda827x_lifeview_config); configure_tda827x_fe(dev, &tda827x_lifeview_config, &tda827x_cfg_0);
break; break;
case SAA7134_BOARD_FLYDVB_TRIO: case SAA7134_BOARD_FLYDVB_TRIO:
if(! use_frontend) { /* terrestrial */ if(! use_frontend) { /* terrestrial */
configure_tda827x_fe(dev, &lifeview_trio_config); configure_tda827x_fe(dev, &lifeview_trio_config, &tda827x_cfg_0);
} else { /* satellite */ } else { /* satellite */
dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap); dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap);
if (dev->dvb.frontend) { if (dev->dvb.frontend) {
if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x63, if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x63,
...@@ -1047,19 +1019,19 @@ static int dvb_init(struct saa7134_dev *dev) ...@@ -1047,19 +1019,19 @@ static int dvb_init(struct saa7134_dev *dev)
&dev->i2c_adap); &dev->i2c_adap);
if (dev->dvb.frontend) { if (dev->dvb.frontend) {
if (dvb_attach(tda827x_attach,dev->dvb.frontend, if (dvb_attach(tda827x_attach,dev->dvb.frontend,
ads_tech_duo_config.tuner_address, ads_tech_duo_config.tuner_address, &dev->i2c_adap,
&dev->i2c_adap,&ads_duo_cfg) == NULL) { &ads_duo_cfg) == NULL) {
wprintk("no tda827x tuner found at addr: %02x\n", wprintk("no tda827x tuner found at addr: %02x\n",
ads_tech_duo_config.tuner_address); ads_tech_duo_config.tuner_address);
} }
} }
break; break;
case SAA7134_BOARD_TEVION_DVBT_220RF: case SAA7134_BOARD_TEVION_DVBT_220RF:
configure_tda827x_fe(dev, &tevion_dvbt220rf_config); configure_tda827x_fe(dev, &tevion_dvbt220rf_config, &tda827x_cfg_0);
break; break;
case SAA7134_BOARD_MEDION_MD8800_QUADRO: case SAA7134_BOARD_MEDION_MD8800_QUADRO:
if (!use_frontend) { /* terrestrial */ if (!use_frontend) { /* terrestrial */
configure_tda827x_fe(dev, &md8800_dvbt_config); configure_tda827x_fe(dev, &md8800_dvbt_config, &tda827x_cfg_0);
} else { /* satellite */ } else { /* satellite */
dev->dvb.frontend = dvb_attach(tda10086_attach, dev->dvb.frontend = dvb_attach(tda10086_attach,
&flydvbs, &dev->i2c_adap); &flydvbs, &dev->i2c_adap);
...@@ -1148,25 +1120,25 @@ static int dvb_init(struct saa7134_dev *dev) ...@@ -1148,25 +1120,25 @@ static int dvb_init(struct saa7134_dev *dev)
} }
break; break;
case SAA7134_BOARD_CINERGY_HT_PCMCIA: case SAA7134_BOARD_CINERGY_HT_PCMCIA:
configure_tda827x_fe(dev, &cinergy_ht_config); configure_tda827x_fe(dev, &cinergy_ht_config, &tda827x_cfg_0);
break; break;
case SAA7134_BOARD_CINERGY_HT_PCI: case SAA7134_BOARD_CINERGY_HT_PCI:
configure_tda827x_fe(dev, &cinergy_ht_pci_config); configure_tda827x_fe(dev, &cinergy_ht_pci_config, &tda827x_cfg_0);
break; break;
case SAA7134_BOARD_PHILIPS_TIGER_S: case SAA7134_BOARD_PHILIPS_TIGER_S:
configure_tda827x_fe(dev, &philips_tiger_s_config); configure_tda827x_fe(dev, &philips_tiger_s_config, &tda827x_cfg_2);
break; break;
case SAA7134_BOARD_ASUS_P7131_4871: case SAA7134_BOARD_ASUS_P7131_4871:
configure_tda827x_fe(dev, &asus_p7131_4871_config); configure_tda827x_fe(dev, &asus_p7131_4871_config, &tda827x_cfg_2);
break; break;
case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA: case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA:
configure_tda827x_fe(dev, &asus_p7131_hybrid_lna_config); configure_tda827x_fe(dev, &asus_p7131_hybrid_lna_config, &tda827x_cfg_2);
break; break;
case SAA7134_BOARD_AVERMEDIA_SUPER_007: case SAA7134_BOARD_AVERMEDIA_SUPER_007:
configure_tda827x_fe(dev, &avermedia_super_007_config); configure_tda827x_fe(dev, &avermedia_super_007_config, &tda827x_cfg_0);
break; break;
case SAA7134_BOARD_TWINHAN_DTV_DVB_3056: case SAA7134_BOARD_TWINHAN_DTV_DVB_3056:
configure_tda827x_fe(dev, &twinhan_dtv_dvb_3056_config); configure_tda827x_fe(dev, &twinhan_dtv_dvb_3056_config, &tda827x_cfg_2_sw42);
break; break;
case SAA7134_BOARD_PHILIPS_SNAKE: case SAA7134_BOARD_PHILIPS_SNAKE:
dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs,
...@@ -1181,10 +1153,10 @@ static int dvb_init(struct saa7134_dev *dev) ...@@ -1181,10 +1153,10 @@ static int dvb_init(struct saa7134_dev *dev)
} }
break; break;
case SAA7134_BOARD_CREATIX_CTX953: case SAA7134_BOARD_CREATIX_CTX953:
configure_tda827x_fe(dev, &md8800_dvbt_config); configure_tda827x_fe(dev, &md8800_dvbt_config, &tda827x_cfg_0);
break; break;
case SAA7134_BOARD_MSI_TVANYWHERE_AD11: case SAA7134_BOARD_MSI_TVANYWHERE_AD11:
configure_tda827x_fe(dev, &philips_tiger_s_config); configure_tda827x_fe(dev, &philips_tiger_s_config, &tda827x_cfg_2);
break; break;
case SAA7134_BOARD_AVERMEDIA_CARDBUS_506: case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
dev->dvb.frontend = dvb_attach(mt352_attach, dev->dvb.frontend = dvb_attach(mt352_attach,
......
...@@ -626,13 +626,8 @@ void saa7134_set_tvnorm_hw(struct saa7134_dev *dev) ...@@ -626,13 +626,8 @@ void saa7134_set_tvnorm_hw(struct saa7134_dev *dev)
{ {
saa7134_set_decoder(dev); saa7134_set_decoder(dev);
if (card_in(dev, dev->ctl_input).tv) { if (card_in(dev, dev->ctl_input).tv)
if ((card(dev).tuner_type == TUNER_PHILIPS_TDA8290)
&& ((card(dev).tuner_config == 1)
|| (card(dev).tuner_config == 2)))
saa7134_set_gpio(dev, 22, 5);
saa7134_i2c_call_clients(dev, VIDIOC_S_STD, &dev->tvnorm->id); saa7134_i2c_call_clients(dev, VIDIOC_S_STD, &dev->tvnorm->id);
}
} }
static void set_h_prescale(struct saa7134_dev *dev, int task, int prescale) static void set_h_prescale(struct saa7134_dev *dev, int task, int prescale)
......
...@@ -172,7 +172,7 @@ static void tda8290_set_params(struct dvb_frontend *fe, ...@@ -172,7 +172,7 @@ static void tda8290_set_params(struct dvb_frontend *fe,
set_audio(fe, params); set_audio(fe, params);
if (priv->cfg.config) if (priv->cfg.config)
tuner_dbg("tda827xa config is 0x%02x\n", *priv->cfg.config); tuner_dbg("tda827xa config is 0x%02x\n", priv->cfg.config);
tuner_i2c_xfer_send(&priv->i2c_props, easy_mode, 2); tuner_i2c_xfer_send(&priv->i2c_props, easy_mode, 2);
tuner_i2c_xfer_send(&priv->i2c_props, agc_out_on, 2); tuner_i2c_xfer_send(&priv->i2c_props, agc_out_on, 2);
tuner_i2c_xfer_send(&priv->i2c_props, soft_reset, 2); tuner_i2c_xfer_send(&priv->i2c_props, soft_reset, 2);
...@@ -442,8 +442,7 @@ static void tda8290_init_if(struct dvb_frontend *fe) ...@@ -442,8 +442,7 @@ static void tda8290_init_if(struct dvb_frontend *fe)
unsigned char set_GP00_CF[] = { 0x20, 0x01 }; unsigned char set_GP00_CF[] = { 0x20, 0x01 };
unsigned char set_GP01_CF[] = { 0x20, 0x0B }; unsigned char set_GP01_CF[] = { 0x20, 0x0B };
if ((priv->cfg.config) && if ((priv->cfg.config == 1) || (priv->cfg.config == 2))
((*priv->cfg.config == 1) || (*priv->cfg.config == 2)))
tuner_i2c_xfer_send(&priv->i2c_props, set_GP00_CF, 2); tuner_i2c_xfer_send(&priv->i2c_props, set_GP00_CF, 2);
else else
tuner_i2c_xfer_send(&priv->i2c_props, set_GP01_CF, 2); tuner_i2c_xfer_send(&priv->i2c_props, set_GP01_CF, 2);
...@@ -588,8 +587,8 @@ static int tda829x_find_tuner(struct dvb_frontend *fe) ...@@ -588,8 +587,8 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)
else else
priv->ver |= TDA8275A; priv->ver |= TDA8275A;
tda827x_attach(fe, priv->tda827x_addr, tda827x_attach(fe, priv->tda827x_addr, priv->i2c_props.adap, &priv->cfg);
priv->i2c_props.adap, &priv->cfg); priv->cfg.switch_addr = priv->i2c_props.addr;
} }
if (fe->ops.tuner_ops.init) if (fe->ops.tuner_ops.init)
fe->ops.tuner_ops.init(fe); fe->ops.tuner_ops.init(fe);
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "dvb_frontend.h" #include "dvb_frontend.h"
struct tda829x_config { struct tda829x_config {
unsigned int *lna_cfg; unsigned int lna_cfg;
int (*tuner_callback) (void *dev, int command, int arg); int (*tuner_callback) (void *dev, int command, int arg);
unsigned int probe_tuner:1; unsigned int probe_tuner:1;
......
...@@ -320,7 +320,7 @@ static void tuner_i2c_address_check(struct tuner *t) ...@@ -320,7 +320,7 @@ static void tuner_i2c_address_check(struct tuner *t)
static void attach_tda829x(struct tuner *t) static void attach_tda829x(struct tuner *t)
{ {
struct tda829x_config cfg = { struct tda829x_config cfg = {
.lna_cfg = &t->config, .lna_cfg = t->config,
.tuner_callback = t->tuner_callback, .tuner_callback = t->tuner_callback,
}; };
tda829x_attach(&t->fe, t->i2c->adapter, t->i2c->addr, &cfg); tda829x_attach(&t->fe, t->i2c->adapter, t->i2c->addr, &cfg);
......
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