From 7bff4b4d3ad2b9ff42b4087f409076035af1d165 Mon Sep 17 00:00:00 2001 From: Hartmut Hackmann Date: Tue, 22 Apr 2008 14:46:08 -0300 Subject: [PATCH] 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: Hartmut Hackmann Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/tda1004x.h | 1 - drivers/media/dvb/frontends/tda827x.c | 163 ++++++++++---------- drivers/media/dvb/frontends/tda827x.h | 4 +- drivers/media/video/saa7134/saa7134-cards.c | 13 +- drivers/media/video/saa7134/saa7134-core.c | 6 + drivers/media/video/saa7134/saa7134-dvb.c | 160 ++++++++----------- drivers/media/video/saa7134/saa7134-video.c | 7 +- drivers/media/video/tda8290.c | 9 +- drivers/media/video/tda8290.h | 2 +- drivers/media/video/tuner-core.c | 2 +- 10 files changed, 172 insertions(+), 195 deletions(-) diff --git a/drivers/media/dvb/frontends/tda1004x.h b/drivers/media/dvb/frontends/tda1004x.h index abae84350142..ebb2c5f5a261 100644 --- a/drivers/media/dvb/frontends/tda1004x.h +++ b/drivers/media/dvb/frontends/tda1004x.h @@ -94,7 +94,6 @@ struct tda1004x_config /* slave address and configuration of the tuner */ u8 tuner_address; - u8 tuner_config; u8 antenna_switch; /* if the board uses another I2c Bridge (tda8290), its address */ diff --git a/drivers/media/dvb/frontends/tda827x.c b/drivers/media/dvb/frontends/tda827x.c index 967ac8b28efd..d30d2c9094d9 100644 --- a/drivers/media/dvb/frontends/tda827x.c +++ b/drivers/media/dvb/frontends/tda827x.c @@ -142,7 +142,7 @@ static int tda827xo_set_params(struct dvb_frontend *fe, int i, tuner_freq, if_freq; u32 N; - dprintk("%s:\n", __FUNCTION__); + dprintk("%s:\n", __func__); switch (params->u.ofdm.bandwidth) { case BANDWIDTH_6_MHZ: if_freq = 4000000; @@ -186,7 +186,7 @@ static int tda827xo_set_params(struct dvb_frontend *fe, fe->ops.i2c_gate_ctrl(fe, 1); if (i2c_transfer(priv->i2c_adap, &msg, 1) != 1) { printk("%s: could not write to tuner at addr: 0x%02x\n", - __FUNCTION__, priv->i2c_addr << 1); + __func__, priv->i2c_addr << 1); return -EIO; } msleep(500); @@ -212,7 +212,7 @@ static int tda827xo_sleep(struct dvb_frontend *fe) struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0, .buf = buf, .len = sizeof(buf) }; - dprintk("%s:\n", __FUNCTION__); + dprintk("%s:\n", __func__); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); i2c_transfer(priv->i2c_adap, &msg, 1); @@ -389,6 +389,79 @@ static struct tda827xa_data tda827xa_analog[] = { { .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, struct dvb_frontend_parameters *params) { @@ -401,9 +474,9 @@ static int tda827xa_set_params(struct dvb_frontend *fe, int i, tuner_freq, if_freq; u32 N; - dprintk("%s:\n", __FUNCTION__); - if (priv->cfg && priv->cfg->lna_gain) - priv->cfg->lna_gain(fe, 1); + dprintk("%s:\n", __func__); + + tda827xa_lna_gain(fe, 1, NULL); msleep(20); switch (params->u.ofdm.bandwidth) { @@ -444,7 +517,7 @@ static int tda827xa_set_params(struct dvb_frontend *fe, fe->ops.i2c_gate_ctrl(fe, 1); if (i2c_transfer(priv->i2c_adap, &msg, 1) != 1) { printk("%s: could not write to tuner at addr: 0x%02x\n", - __FUNCTION__, priv->i2c_addr << 1); + __func__, priv->i2c_addr << 1); return -EIO; } buf[0] = 0x90; @@ -474,8 +547,7 @@ static int tda827xa_set_params(struct dvb_frontend *fe, buf[1] >>= 4; dprintk("tda8275a AGC2 gain is: %d\n", buf[1]); if ((buf[1]) < 2) { - if (priv->cfg && priv->cfg->lna_gain) - priv->cfg->lna_gain(fe, 0); + tda827xa_lna_gain(fe, 0, NULL); buf[0] = 0x60; buf[1] = 0x0c; if (fe->ops.i2c_gate_ctrl) @@ -523,73 +595,6 @@ static int tda827xa_set_params(struct dvb_frontend *fe, 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, struct analog_parameters *params) @@ -724,7 +729,7 @@ static int tda827x_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) static int tda827x_init(struct dvb_frontend *fe) { struct tda827x_priv *priv = fe->tuner_priv; - dprintk("%s:\n", __FUNCTION__); + dprintk("%s:\n", __func__); if (priv->cfg && priv->cfg->init) priv->cfg->init(fe); @@ -792,7 +797,7 @@ static int tda827x_probe_version(struct dvb_frontend *fe) fe->ops.i2c_gate_ctrl(fe, 1); if (i2c_transfer(priv->i2c_adap, &msg, 1) != 1) { printk("%s: could not read from tuner at addr: 0x%02x\n", - __FUNCTION__, msg.addr << 1); + __func__, msg.addr << 1); return -EIO; } if ((data & 0x3c) == 0) { @@ -816,7 +821,7 @@ struct dvb_frontend *tda827x_attach(struct dvb_frontend *fe, int addr, { struct tda827x_priv *priv = NULL; - dprintk("%s:\n", __FUNCTION__); + dprintk("%s:\n", __func__); priv = kzalloc(sizeof(struct tda827x_priv), GFP_KERNEL); if (priv == NULL) return NULL; diff --git a/drivers/media/dvb/frontends/tda827x.h b/drivers/media/dvb/frontends/tda827x.h index 92eb65b4012b..cd3032f985cd 100644 --- a/drivers/media/dvb/frontends/tda827x.h +++ b/drivers/media/dvb/frontends/tda827x.h @@ -30,12 +30,12 @@ struct tda827x_config { /* saa7134 - provided callbacks */ - void (*lna_gain) (struct dvb_frontend *fe, int high); int (*init) (struct dvb_frontend *fe); int (*sleep) (struct dvb_frontend *fe); /* interface to tda829x driver */ - unsigned int *config; + unsigned int config; + int switch_addr; int (*tuner_callback) (void *dev, int command, int arg); void (*agcf)(struct dvb_frontend *fe); diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 1b6c7d697f04..bab8498046c8 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -5260,12 +5260,13 @@ int saa7134_tuner_callback(void *priv, int command, int arg) { struct i2c_algo_bit_data *i2c_algo = priv; struct saa7134_dev *dev = i2c_algo->data; - - switch (dev->tuner_type) { - case TUNER_PHILIPS_TDA8290: - return saa7134_tda8290_callback(dev, command, arg); - case TUNER_XC2028: - return saa7134_xc2028_callback(dev, command, arg); + if (dev != NULL) { + switch (dev->tuner_type) { + case TUNER_PHILIPS_TDA8290: + return saa7134_tda8290_callback(dev, command, arg); + case TUNER_XC2028: + return saa7134_xc2028_callback(dev, command, arg); + } } return -EINVAL; } diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index ed96ce775a9b..599273894f34 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c @@ -864,6 +864,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, struct saa7134_dev *dev; struct saa7134_mpeg_ops *mops; int err; + int mask; dev = kzalloc(sizeof(*dev),GFP_KERNEL); if (NULL == dev) @@ -1061,6 +1062,11 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, if (TUNER_ABSENT != dev->tuner_type) 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; fail4: diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 8e55c7572b4b..f95f5f2fbf72 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c @@ -439,8 +439,6 @@ static struct tda1004x_config philips_europa_config = { .request_firmware = philips_tda1004x_request_firmware }; -/* ------------------------------------------------------------------ */ - static struct tda1004x_config medion_cardbus = { .demod_address = 0x08, .invert = 1, @@ -456,47 +454,6 @@ static struct tda1004x_config medion_cardbus = { * 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) { struct tda1004x_state *state = fe->demodulator_priv; @@ -519,8 +476,6 @@ static int tda8290_i2c_gate_ctrl( struct dvb_frontend* fe, int enable) return 0; } -/* ------------------------------------------------------------------ */ - static int philips_tda827x_tuner_init(struct dvb_frontend *fe) { struct saa7134_dev *dev = fe->dvb->priv; @@ -555,28 +510,57 @@ static int philips_tda827x_tuner_sleep(struct dvb_frontend *fe) return 0; } -static struct tda827x_config tda827x_cfg = { - .lna_gain = philips_tda827x_lna_gain, - .init = philips_tda827x_tuner_init, - .sleep = philips_tda827x_tuner_sleep -}; - -static void configure_tda827x_fe(struct saa7134_dev *dev, struct tda1004x_config *tda_conf) +static void configure_tda827x_fe(struct saa7134_dev *dev, struct tda1004x_config *cdec_conf, + struct tda827x_config *tuner_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 (tda_conf->i2c_gate) + if (cdec_conf->i2c_gate) dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl; - if (dvb_attach(tda827x_attach, dev->dvb.frontend, tda_conf->tuner_address, - &dev->i2c_adap,&tda827x_cfg) == NULL) { + if (dvb_attach(tda827x_attach, dev->dvb.frontend, cdec_conf->tuner_address, + &dev->i2c_adap, tuner_conf) == NULL) { 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 = { .demod_address = 0x08, .invert = 1, @@ -599,7 +583,6 @@ static struct tda1004x_config philips_tiger_config = { .if_freq = TDA10046_FREQ_045, .i2c_gate = 0x4b, .tuner_address = 0x61, - .tuner_config = 0, .antenna_switch= 1, .request_firmware = philips_tda1004x_request_firmware }; @@ -614,7 +597,6 @@ static struct tda1004x_config cinergy_ht_config = { .if_freq = TDA10046_FREQ_045, .i2c_gate = 0x4b, .tuner_address = 0x61, - .tuner_config = 0, .request_firmware = philips_tda1004x_request_firmware }; @@ -628,7 +610,6 @@ static struct tda1004x_config cinergy_ht_pci_config = { .if_freq = TDA10046_FREQ_045, .i2c_gate = 0x4b, .tuner_address = 0x60, - .tuner_config = 0, .request_firmware = philips_tda1004x_request_firmware }; @@ -642,7 +623,6 @@ static struct tda1004x_config philips_tiger_s_config = { .if_freq = TDA10046_FREQ_045, .i2c_gate = 0x4b, .tuner_address = 0x61, - .tuner_config = 2, .antenna_switch= 1, .request_firmware = philips_tda1004x_request_firmware }; @@ -657,7 +637,6 @@ static struct tda1004x_config pinnacle_pctv_310i_config = { .if_freq = TDA10046_FREQ_045, .i2c_gate = 0x4b, .tuner_address = 0x61, - .tuner_config = 1, .request_firmware = philips_tda1004x_request_firmware }; @@ -671,7 +650,6 @@ static struct tda1004x_config hauppauge_hvr_1110_config = { .if_freq = TDA10046_FREQ_045, .i2c_gate = 0x4b, .tuner_address = 0x61, - .tuner_config = 1, .request_firmware = philips_tda1004x_request_firmware }; @@ -685,7 +663,6 @@ static struct tda1004x_config asus_p7131_dual_config = { .if_freq = TDA10046_FREQ_045, .i2c_gate = 0x4b, .tuner_address = 0x61, - .tuner_config = 0, .antenna_switch= 2, .request_firmware = philips_tda1004x_request_firmware }; @@ -724,7 +701,6 @@ static struct tda1004x_config md8800_dvbt_config = { .if_freq = TDA10046_FREQ_045, .i2c_gate = 0x4b, .tuner_address = 0x60, - .tuner_config = 0, .request_firmware = philips_tda1004x_request_firmware }; @@ -738,7 +714,6 @@ static struct tda1004x_config asus_p7131_4871_config = { .if_freq = TDA10046_FREQ_045, .i2c_gate = 0x4b, .tuner_address = 0x61, - .tuner_config = 2, .antenna_switch= 2, .request_firmware = philips_tda1004x_request_firmware }; @@ -753,7 +728,6 @@ static struct tda1004x_config asus_p7131_hybrid_lna_config = { .if_freq = TDA10046_FREQ_045, .i2c_gate = 0x4b, .tuner_address = 0x61, - .tuner_config = 2, .antenna_switch= 2, .request_firmware = philips_tda1004x_request_firmware }; @@ -768,7 +742,6 @@ static struct tda1004x_config kworld_dvb_t_210_config = { .if_freq = TDA10046_FREQ_045, .i2c_gate = 0x4b, .tuner_address = 0x61, - .tuner_config = 2, .antenna_switch= 1, .request_firmware = philips_tda1004x_request_firmware }; @@ -783,7 +756,6 @@ static struct tda1004x_config avermedia_super_007_config = { .if_freq = TDA10046_FREQ_045, .i2c_gate = 0x4b, .tuner_address = 0x60, - .tuner_config = 0, .antenna_switch= 1, .request_firmware = philips_tda1004x_request_firmware }; @@ -798,7 +770,6 @@ static struct tda1004x_config twinhan_dtv_dvb_3056_config = { .if_freq = TDA10046_FREQ_045, .i2c_gate = 0x42, .tuner_address = 0x61, - .tuner_config = 2, .antenna_switch = 1, .request_firmware = philips_tda1004x_request_firmware }; @@ -826,9 +797,10 @@ static int ads_duo_tuner_sleep(struct dvb_frontend *fe) } static struct tda827x_config ads_duo_cfg = { - .lna_gain = philips_tda827x_lna_gain, + .tuner_callback = saa7134_tuner_callback, .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 = { @@ -981,7 +953,7 @@ static int dvb_init(struct saa7134_dev *dev) break; case SAA7134_BOARD_FLYDVBTDUO: case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS: - configure_tda827x_fe(dev, &tda827x_lifeview_config); + configure_tda827x_fe(dev, &tda827x_lifeview_config, &tda827x_cfg_0); break; case SAA7134_BOARD_PHILIPS_EUROPA: case SAA7134_BOARD_VIDEOMATE_DVBT_300: @@ -1006,27 +978,27 @@ static int dvb_init(struct saa7134_dev *dev) } break; 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; case SAA7134_BOARD_PHILIPS_TIGER: - configure_tda827x_fe(dev, &philips_tiger_config); + configure_tda827x_fe(dev, &philips_tiger_config, &tda827x_cfg_0); break; 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; 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; 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; case SAA7134_BOARD_FLYDVBT_LR301: - configure_tda827x_fe(dev, &tda827x_lifeview_config); + configure_tda827x_fe(dev, &tda827x_lifeview_config, &tda827x_cfg_0); break; case SAA7134_BOARD_FLYDVB_TRIO: if(! use_frontend) { /* terrestrial */ - configure_tda827x_fe(dev, &lifeview_trio_config); - } else { /* satellite */ + configure_tda827x_fe(dev, &lifeview_trio_config, &tda827x_cfg_0); + } else { /* satellite */ dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap); if (dev->dvb.frontend) { if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x63, @@ -1047,19 +1019,19 @@ static int dvb_init(struct saa7134_dev *dev) &dev->i2c_adap); if (dev->dvb.frontend) { if (dvb_attach(tda827x_attach,dev->dvb.frontend, - ads_tech_duo_config.tuner_address, - &dev->i2c_adap,&ads_duo_cfg) == NULL) { + ads_tech_duo_config.tuner_address, &dev->i2c_adap, + &ads_duo_cfg) == NULL) { wprintk("no tda827x tuner found at addr: %02x\n", ads_tech_duo_config.tuner_address); } } break; case SAA7134_BOARD_TEVION_DVBT_220RF: - configure_tda827x_fe(dev, &tevion_dvbt220rf_config); + configure_tda827x_fe(dev, &tevion_dvbt220rf_config, &tda827x_cfg_0); break; case SAA7134_BOARD_MEDION_MD8800_QUADRO: if (!use_frontend) { /* terrestrial */ - configure_tda827x_fe(dev, &md8800_dvbt_config); + configure_tda827x_fe(dev, &md8800_dvbt_config, &tda827x_cfg_0); } else { /* satellite */ dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap); @@ -1148,25 +1120,25 @@ static int dvb_init(struct saa7134_dev *dev) } break; case SAA7134_BOARD_CINERGY_HT_PCMCIA: - configure_tda827x_fe(dev, &cinergy_ht_config); + configure_tda827x_fe(dev, &cinergy_ht_config, &tda827x_cfg_0); break; 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; 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; 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; 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; 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; 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; case SAA7134_BOARD_PHILIPS_SNAKE: dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, @@ -1181,10 +1153,10 @@ static int dvb_init(struct saa7134_dev *dev) } break; case SAA7134_BOARD_CREATIX_CTX953: - configure_tda827x_fe(dev, &md8800_dvbt_config); + configure_tda827x_fe(dev, &md8800_dvbt_config, &tda827x_cfg_0); break; 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; case SAA7134_BOARD_AVERMEDIA_CARDBUS_506: dev->dvb.frontend = dvb_attach(mt352_attach, diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index ecc5243da57e..a0baf2d0ba7f 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c @@ -626,13 +626,8 @@ void saa7134_set_tvnorm_hw(struct saa7134_dev *dev) { saa7134_set_decoder(dev); - 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); + if (card_in(dev, dev->ctl_input).tv) saa7134_i2c_call_clients(dev, VIDIOC_S_STD, &dev->tvnorm->id); - } } static void set_h_prescale(struct saa7134_dev *dev, int task, int prescale) diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c index 6f2449ab46a0..89afb19c9468 100644 --- a/drivers/media/video/tda8290.c +++ b/drivers/media/video/tda8290.c @@ -172,7 +172,7 @@ static void tda8290_set_params(struct dvb_frontend *fe, set_audio(fe, params); 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, agc_out_on, 2); tuner_i2c_xfer_send(&priv->i2c_props, soft_reset, 2); @@ -442,8 +442,7 @@ static void tda8290_init_if(struct dvb_frontend *fe) unsigned char set_GP00_CF[] = { 0x20, 0x01 }; unsigned char set_GP01_CF[] = { 0x20, 0x0B }; - if ((priv->cfg.config) && - ((*priv->cfg.config == 1) || (*priv->cfg.config == 2))) + if ((priv->cfg.config == 1) || (priv->cfg.config == 2)) tuner_i2c_xfer_send(&priv->i2c_props, set_GP00_CF, 2); else tuner_i2c_xfer_send(&priv->i2c_props, set_GP01_CF, 2); @@ -588,8 +587,8 @@ static int tda829x_find_tuner(struct dvb_frontend *fe) else priv->ver |= TDA8275A; - tda827x_attach(fe, priv->tda827x_addr, - priv->i2c_props.adap, &priv->cfg); + tda827x_attach(fe, priv->tda827x_addr, priv->i2c_props.adap, &priv->cfg); + priv->cfg.switch_addr = priv->i2c_props.addr; } if (fe->ops.tuner_ops.init) fe->ops.tuner_ops.init(fe); diff --git a/drivers/media/video/tda8290.h b/drivers/media/video/tda8290.h index dc8ef310b7b2..9dd8b73eb8c6 100644 --- a/drivers/media/video/tda8290.h +++ b/drivers/media/video/tda8290.h @@ -21,7 +21,7 @@ #include "dvb_frontend.h" struct tda829x_config { - unsigned int *lna_cfg; + unsigned int lna_cfg; int (*tuner_callback) (void *dev, int command, int arg); unsigned int probe_tuner:1; diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 335a971298a3..4b936b809d78 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -320,7 +320,7 @@ static void tuner_i2c_address_check(struct tuner *t) static void attach_tda829x(struct tuner *t) { struct tda829x_config cfg = { - .lna_cfg = &t->config, + .lna_cfg = t->config, .tuner_callback = t->tuner_callback, }; tda829x_attach(&t->fe, t->i2c->adapter, t->i2c->addr, &cfg); -- 2.20.1