]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
[media] tda10071: make sure both tuner and demod i2c addresses are specified
authorMichael Krufky <mkrufky@linuxtv.org>
Sun, 16 Dec 2012 22:37:11 +0000 (19:37 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 21 Dec 2012 16:36:54 +0000 (14:36 -0200)
display an error message if either tuner_i2c_addr or demod_i2c_addr
are not specified in the tda10071_config structure

Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb-frontends/tda10071.c
drivers/media/dvb-frontends/tda10071.h
drivers/media/pci/cx23885/cx23885-dvb.c
drivers/media/usb/em28xx/em28xx-dvb.c

index 710362916f83c4f5f67f96496f809c415c65abb0..02f9234a540029e09ee105e89c064855330c7268 100644 (file)
@@ -30,7 +30,7 @@ static int tda10071_wr_regs(struct tda10071_priv *priv, u8 reg, u8 *val,
        u8 buf[len+1];
        struct i2c_msg msg[1] = {
                {
-                       .addr = priv->cfg.i2c_address,
+                       .addr = priv->cfg.demod_i2c_addr,
                        .flags = 0,
                        .len = sizeof(buf),
                        .buf = buf,
@@ -59,12 +59,12 @@ static int tda10071_rd_regs(struct tda10071_priv *priv, u8 reg, u8 *val,
        u8 buf[len];
        struct i2c_msg msg[2] = {
                {
-                       .addr = priv->cfg.i2c_address,
+                       .addr = priv->cfg.demod_i2c_addr,
                        .flags = 0,
                        .len = 1,
                        .buf = &reg,
                }, {
-                       .addr = priv->cfg.i2c_address,
+                       .addr = priv->cfg.demod_i2c_addr,
                        .flags = I2C_M_RD,
                        .len = sizeof(buf),
                        .buf = buf,
@@ -1202,6 +1202,18 @@ struct dvb_frontend *tda10071_attach(const struct tda10071_config *config,
                goto error;
        }
 
+       /* make sure demod i2c address is specified */
+       if (!config->demod_i2c_addr) {
+               dev_dbg(&i2c->dev, "%s: invalid demod i2c address!\n", __func__);
+               goto error;
+       }
+
+       /* make sure tuner i2c address is specified */
+       if (!config->tuner_i2c_addr) {
+               dev_dbg(&i2c->dev, "%s: invalid tuner i2c address!\n", __func__);
+               goto error;
+       }
+
        /* setup the priv */
        priv->i2c = i2c;
        memcpy(&priv->cfg, config, sizeof(struct tda10071_config));
index a20d5c41e0481fe16b6be6782ca50dc80c6d5c52..bff1c38df8026e98390fb21d74503635008ff807 100644 (file)
@@ -28,10 +28,10 @@ struct tda10071_config {
         * Default: none, must set
         * Values: 0x55,
         */
-       u8 i2c_address;
+       u8 demod_i2c_addr;
 
        /* Tuner I2C address.
-        * Default: 0x14
+        * Default: none, must set
         * Values: 0x14, 0x54, ...
         */
        u8 tuner_i2c_addr;
index cf84c534f005fa3483d8e6575f7b07fcb0b66253..a1aae563373928daa406d875c256236edbc4aa95 100644 (file)
@@ -662,7 +662,7 @@ static struct mt2063_config terratec_mt2063_config[] = {
 };
 
 static const struct tda10071_config hauppauge_tda10071_config = {
-       .i2c_address = 0x05,
+       .demod_i2c_addr = 0x05,
        .tuner_i2c_addr = 0x54,
        .i2c_wr_max = 64,
        .ts_mode = TDA10071_TS_SERIAL,
index 63f2e7070c005d8ed05af171bd1d80c6006295f4..e8008810b60c3ce116c42b499b6506c321c70416 100644 (file)
@@ -714,7 +714,8 @@ static struct tda18271_config em28xx_cxd2820r_tda18271_config = {
 };
 
 static const struct tda10071_config em28xx_tda10071_config = {
-       .i2c_address = 0x55, /* (0xaa >> 1) */
+       .demod_i2c_addr = 0x55, /* (0xaa >> 1) */
+       .tuner_i2c_addr = 0x14,
        .i2c_wr_max = 64,
        .ts_mode = TDA10071_TS_SERIAL,
        .spec_inv = 0,