Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e435f95ce6468f0240f050e14c9eac93e2fe7e71
Commit:     e435f95ce6468f0240f050e14c9eac93e2fe7e71
Parent:     7206abbc2d19b6846b879fb266672b40da9961cb
Author:     Michael Krufky <[EMAIL PROTECTED]>
AuthorDate: Sun Dec 9 22:23:30 2007 -0300
Committer:  Mauro Carvalho Chehab <[EMAIL PROTECTED]>
CommitDate: Fri Jan 25 19:03:32 2008 -0200

    V4L/DVB (6801): tda18271: pass i2c gate configuration into tda18271_attach()
    
    If we pass TDA18271_GATE_DIGITAL into tda18271_attach(), it will always try 
to
    use the digital demodulator's i2c gate.
    
    If we pass TDA18271_GATE_ANALOG into tda18271_attach(), it will always try 
to
    use the analog demodulator's i2c gate.
    
    If we pass TDA18271_GATE_AUTO into tda18271_attach(), it will try to use the
    analog demodulator's i2c gate when tuning in analog mode, and it will try to
    use the digital demodulator's i2c gate when tuning in digital mode.
    
    Signed-off-by: Michael Krufky <[EMAIL PROTECTED]>
    Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
---
 drivers/media/dvb/frontends/tda18271-fe.c |   34 +++++++++++++++++++++++++---
 drivers/media/dvb/frontends/tda18271.h    |   12 ++++++++-
 drivers/media/video/tda8290.c             |    3 +-
 3 files changed, 42 insertions(+), 7 deletions(-)

diff --git a/drivers/media/dvb/frontends/tda18271-fe.c 
b/drivers/media/dvb/frontends/tda18271-fe.c
index dbf0f61..28c63fd 100644
--- a/drivers/media/dvb/frontends/tda18271-fe.c
+++ b/drivers/media/dvb/frontends/tda18271-fe.c
@@ -40,7 +40,9 @@ struct tda18271_priv {
        u8 i2c_addr;
        struct i2c_adapter *i2c_adap;
        unsigned char tda18271_regs[TDA18271_NUM_REGS];
+
        enum tda18271_mode mode;
+       enum tda18271_i2c_gate gate;
 
        u32 frequency;
        u32 bandwidth;
@@ -50,17 +52,39 @@ static int tda18271_i2c_gate_ctrl(struct dvb_frontend *fe, 
int enable)
 {
        struct tda18271_priv *priv = fe->tuner_priv;
        struct analog_tuner_ops *ops = fe->ops.analog_demod_ops;
+       enum tda18271_i2c_gate gate;
        int ret = 0;
 
-       switch (priv->mode) {
-       case TDA18271_ANALOG:
+       switch (priv->gate) {
+       case TDA18271_GATE_DIGITAL:
+       case TDA18271_GATE_ANALOG:
+               gate = priv->gate;
+               break;
+       case TDA18271_GATE_AUTO:
+       default:
+               switch (priv->mode) {
+               case TDA18271_DIGITAL:
+                       gate = TDA18271_GATE_DIGITAL;
+                       break;
+               case TDA18271_ANALOG:
+               default:
+                       gate = TDA18271_GATE_ANALOG;
+                       break;
+               }
+       }
+
+       switch (gate) {
+       case TDA18271_GATE_ANALOG:
                if (ops && ops->i2c_gate_ctrl)
                        ret = ops->i2c_gate_ctrl(fe, enable);
                break;
-       case TDA18271_DIGITAL:
+       case TDA18271_GATE_DIGITAL:
                if (fe->ops.i2c_gate_ctrl)
                        ret = fe->ops.i2c_gate_ctrl(fe, enable);
                break;
+       default:
+               ret = -EINVAL;
+               break;
        }
 
        return ret;
@@ -713,7 +737,8 @@ static struct dvb_tuner_ops tda18271_tuner_ops = {
 };
 
 struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
-                                    struct i2c_adapter *i2c)
+                                    struct i2c_adapter *i2c,
+                                    enum tda18271_i2c_gate gate)
 {
        struct tda18271_priv *priv = NULL;
 
@@ -724,6 +749,7 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend 
*fe, u8 addr,
 
        priv->i2c_addr = addr;
        priv->i2c_adap = i2c;
+       priv->gate = gate;
 
        memcpy(&fe->ops.tuner_ops, &tda18271_tuner_ops,
               sizeof(struct dvb_tuner_ops));
diff --git a/drivers/media/dvb/frontends/tda18271.h 
b/drivers/media/dvb/frontends/tda18271.h
index a8a19a7..d840033 100644
--- a/drivers/media/dvb/frontends/tda18271.h
+++ b/drivers/media/dvb/frontends/tda18271.h
@@ -24,13 +24,21 @@
 #include <linux/i2c.h>
 #include "dvb_frontend.h"
 
+enum tda18271_i2c_gate {
+       TDA18271_GATE_AUTO = 0,
+       TDA18271_GATE_ANALOG,
+       TDA18271_GATE_DIGITAL,
+};
+
 #if defined(CONFIG_DVB_TDA18271) || (defined(CONFIG_DVB_TDA18271_MODULE) && 
defined(MODULE))
 extern struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
-                                           struct i2c_adapter *i2c);
+                                           struct i2c_adapter *i2c,
+                                           enum tda18271_i2c_gate gate);
 #else
 static inline struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe,
                                                   u8 addr,
-                                                  struct i2c_adapter *i2c)
+                                                  struct i2c_adapter *i2c,
+                                                  enum tda18271_i2c_gate gate);
 {
        printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
        return NULL;
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c
index 403f96f..a451d94 100644
--- a/drivers/media/video/tda8290.c
+++ b/drivers/media/video/tda8290.c
@@ -574,7 +574,8 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)
        if (data == 0x83) {
                priv->ver |= TDA18271;
                tda18271_attach(fe, priv->tda827x_addr,
-                               priv->i2c_props.adap);
+                               priv->i2c_props.adap,
+                               TDA18271_GATE_ANALOG);
        } else {
                if ((data & 0x3c) == 0)
                        priv->ver |= TDA8275;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to