Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
[cascardo/linux.git] / drivers / media / common / tuners / tda8290.c
index 0ee79fd..064d14c 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <linux/i2c.h>
 #include <linux/delay.h>
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
 #include "tuner-i2c.h"
 #include "tda8290.h"
 #include "tda827x.h"
@@ -150,7 +150,7 @@ static void set_audio(struct dvb_frontend *fe,
        }
 }
 
-struct {
+static struct {
        unsigned char seq[2];
 } fm_mode[] = {
        { { 0x01, 0x81} },      /* Put device into expert mode */
@@ -207,7 +207,6 @@ static void tda8290_set_params(struct dvb_frontend *fe,
        msleep(1);
 
        if (params->mode == V4L2_TUNER_RADIO) {
-               int i;
                unsigned char deemphasis[]  = { 0x13, 1 };
 
                /* FIXME: allow using a different deemphasis */
@@ -567,8 +566,11 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)
        u8 data;
        struct i2c_msg msg = { .flags = I2C_M_RD, .buf = &data, .len = 1 };
 
-       if (NULL == analog_ops->i2c_gate_ctrl)
+       if (!analog_ops->i2c_gate_ctrl) {
+               printk(KERN_ERR "tda8290: no gate control were provided!\n");
+
                return -EINVAL;
+       }
 
        analog_ops->i2c_gate_ctrl(fe, 1);
 
@@ -616,11 +618,13 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)
 
        if (ret != 1) {
                tuner_warn("tuner access failed!\n");
+               analog_ops->i2c_gate_ctrl(fe, 0);
                return -EREMOTEIO;
        }
 
        if ((data == 0x83) || (data == 0x84)) {
                priv->ver |= TDA18271;
+               tda829x_tda18271_config.config = priv->cfg.config;
                dvb_attach(tda18271_attach, fe, priv->tda827x_addr,
                           priv->i2c_props.adap, &tda829x_tda18271_config);
        } else {
@@ -767,7 +771,8 @@ struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe,
        fe->ops.analog_ops.info.name = name;
 
        if (priv->ver & TDA8290) {
-               tda8290_init_tuner(fe);
+               if (priv->ver & (TDA8275 | TDA8275A))
+                       tda8290_init_tuner(fe);
                tda8290_init_if(fe);
        } else if (priv->ver & TDA8295)
                tda8295_init_if(fe);