V4L/DVB (7383): tda18271: add attach-time parameter to limit i2c transfer size
authorMichael Krufky <mkrufky@linuxtv.org>
Tue, 22 Apr 2008 17:46:06 +0000 (14:46 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Thu, 24 Apr 2008 17:07:52 +0000 (14:07 -0300)
Add attach-time parameter, "small_i2c" to limit i2c transfer size to write
at most 16 registers at a time during initialization.

Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/dvb/frontends/tda18271-common.c
drivers/media/dvb/frontends/tda18271-fe.c
drivers/media/dvb/frontends/tda18271-priv.h
drivers/media/dvb/frontends/tda18271.h

index 39496463ccf3f39a54653e9e5b2bbe71724baedb..bbfc22a5f6dbaca149f6b440da2e0cf1e0d18777 100644 (file)
@@ -311,7 +311,12 @@ int tda18271_init_regs(struct dvb_frontend *fe)
        regs[R_EB22] = 0x48;
        regs[R_EB23] = 0xb0;
 
-       tda18271_write_regs(fe, 0x00, TDA18271_NUM_REGS);
+       if (priv->small_i2c) {
+               tda18271_write_regs(fe, 0x00, 0x10);
+               tda18271_write_regs(fe, 0x10, 0x10);
+               tda18271_write_regs(fe, 0x20, 0x07);
+       } else
+               tda18271_write_regs(fe, 0x00, TDA18271_NUM_REGS);
 
        /* setup agc1 gain */
        regs[R_EB17] = 0x00;
index b5d69a8108d96761d79d65184107c55f7c3531c5..bb0a65310b71ff06fe95a6a403d13a7ebff327af 100644 (file)
@@ -1081,6 +1081,9 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
 
                fe->tuner_priv = priv;
 
+               if (cfg)
+                       priv->small_i2c = cfg->small_i2c;
+
                if (tda18271_get_id(fe) < 0)
                        goto fail;
 
index 840b1803d171e3e02ef7b6386b2a13ce9e6fc3cd..ecb588e5f7d5519d71292b87396325e5dcbfa2ae 100644 (file)
@@ -110,6 +110,7 @@ struct tda18271_priv {
 
        unsigned int tm_rfcal;
        unsigned int cal_initialized:1;
+       unsigned int small_i2c:1;
 
        struct tda18271_map_layout *maps;
        struct tda18271_std_map std;
index 24b0e35a2ab3c7ae3b3134af19895ba4220407eb..e79441e22718a8ca966d50f35a7c80a9c31912cd 100644 (file)
@@ -58,6 +58,9 @@ struct tda18271_config {
 
        /* use i2c gate provided by analog or digital demod */
        enum tda18271_i2c_gate gate;
+
+       /* some i2c providers cant write all 39 registers at once */
+       unsigned int small_i2c:1;
 };
 
 #if defined(CONFIG_DVB_TDA18271) || (defined(CONFIG_DVB_TDA18271_MODULE) && defined(MODULE))