Merge branch 'omap-gpmc-fixes-for-v3.10' of git://github.com/jonhunter/linux into...
[firefly-linux-kernel-4.4.55.git] / drivers / media / tuners / tda8290.c
index a2b7a9fbd34496ec6256e98a85f9cc9899b37f8f..ab4106c17b4cf8f8987ac0743c2a2117486e50a2 100644 (file)
@@ -54,6 +54,7 @@ struct tda8290_priv {
 #define TDA18271 16
 
        struct tda827x_config cfg;
+       struct tda18271_std_map *tda18271_std_map;
 };
 
 /*---------------------------------------------------------------------*/
@@ -390,7 +391,7 @@ static void tda8295_agc2_out(struct dvb_frontend *fe, int enable)
        tuner_i2c_xfer_send(&priv->i2c_props, set_gpio_val, 2);
 }
 
-static int tda8295_has_signal(struct dvb_frontend *fe)
+static int tda8295_has_signal(struct dvb_frontend *fe, u16 *signal)
 {
        struct tda8290_priv *priv = fe->analog_demod_priv;
 
@@ -398,7 +399,8 @@ static int tda8295_has_signal(struct dvb_frontend *fe)
        unsigned char ret;
 
        tuner_i2c_xfer_send_recv(&priv->i2c_props, &hvpll_stat, 1, &ret, 1);
-       return (ret & 0x01) ? 65535 : 0;
+       *signal = (ret & 0x01) ? 65535 : 0;
+       return 0;
 }
 
 /*---------------------------------------------------------------------*/
@@ -407,7 +409,7 @@ static void tda8295_set_params(struct dvb_frontend *fe,
                               struct analog_parameters *params)
 {
        struct tda8290_priv *priv = fe->analog_demod_priv;
-
+       u16 signal = 0;
        unsigned char blanking_mode[]     = { 0x1d, 0x00 };
 
        set_audio(fe, params);
@@ -435,7 +437,8 @@ static void tda8295_set_params(struct dvb_frontend *fe,
        if (priv->cfg.agcf)
                priv->cfg.agcf(fe);
 
-       if (tda8295_has_signal(fe))
+       tda8295_has_signal(fe, &signal);
+       if (signal)
                tuner_dbg("tda8295 is locked\n");
        else
                tuner_dbg("tda8295 not locked, no signal?\n");
@@ -446,7 +449,7 @@ static void tda8295_set_params(struct dvb_frontend *fe,
 
 /*---------------------------------------------------------------------*/
 
-static int tda8290_has_signal(struct dvb_frontend *fe)
+static int tda8290_has_signal(struct dvb_frontend *fe, u16 *signal)
 {
        struct tda8290_priv *priv = fe->analog_demod_priv;
 
@@ -455,7 +458,8 @@ static int tda8290_has_signal(struct dvb_frontend *fe)
 
        tuner_i2c_xfer_send_recv(&priv->i2c_props,
                                 i2c_get_afc, ARRAY_SIZE(i2c_get_afc), &afc, 1);
-       return (afc & 0x80)? 65535:0;
+       *signal = (afc & 0x80) ? 65535 : 0;
+       return 0;
 }
 
 /*---------------------------------------------------------------------*/
@@ -495,7 +499,8 @@ 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 == 1) || (priv->cfg.config == 2))
+       if ((priv->cfg.config == TDA8290_LNA_GP0_HIGH_ON) ||
+           (priv->cfg.config == TDA8290_LNA_GP0_HIGH_OFF))
                tuner_i2c_xfer_send(&priv->i2c_props, set_GP00_CF, 2);
        else
                tuner_i2c_xfer_send(&priv->i2c_props, set_GP01_CF, 2);
@@ -635,6 +640,7 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)
        if ((data == 0x83) || (data == 0x84)) {
                priv->ver |= TDA18271;
                tda829x_tda18271_config.config = priv->cfg.config;
+               tda829x_tda18271_config.std_map = priv->tda18271_std_map;
                dvb_attach(tda18271_attach, fe, priv->tda827x_addr,
                           priv->i2c_props.adap, &tda829x_tda18271_config);
        } else {
@@ -746,8 +752,10 @@ struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe,
        priv->i2c_props.addr     = i2c_addr;
        priv->i2c_props.adap     = i2c_adap;
        priv->i2c_props.name     = "tda829x";
-       if (cfg)
-               priv->cfg.config         = cfg->lna_cfg;
+       if (cfg) {
+               priv->cfg.config = cfg->lna_cfg;
+               priv->tda18271_std_map = cfg->tda18271_std_map;
+       }
 
        if (tda8290_probe(&priv->i2c_props) == 0) {
                priv->ver = TDA8290;